window: Add a widget default cursor convenience helper
In a few cases, we set a motion handler just to be able to set a fixed
cursor. This adds a default cursor helper that can be used in those cases.
In case of the 'transformed' test case, we also avoid a brief flicker
of the pointer cursor, which is set on enter when the move grab is lifted.
diff --git a/clients/transformed.c b/clients/transformed.c
index be840d9..af77e18 100644
--- a/clients/transformed.c
+++ b/clients/transformed.c
@@ -185,13 +185,6 @@
window_schedule_redraw(window);
}
-static int
-motion_handler(struct widget *widget, struct input *input,
- uint32_t time, float x, float y, void *data)
-{
- return CURSOR_BLANK;
-}
-
static void
button_handler(struct widget *widget,
struct input *input, uint32_t time,
@@ -237,9 +230,9 @@
window_set_title(transformed.window, "Transformed");
widget_set_transparent(transformed.widget, 0);
+ widget_set_default_cursor(transformed.widget, CURSOR_BLANK);
widget_set_redraw_handler(transformed.widget, redraw_handler);
- widget_set_motion_handler(transformed.widget, motion_handler);
widget_set_button_handler(transformed.widget, button_handler);
window_set_fullscreen_handler(transformed.window, fullscreen_handler);