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/flower.c b/clients/flower.c
index dac52d5..21c38bf 100644
--- a/clients/flower.c
+++ b/clients/flower.c
@@ -129,13 +129,6 @@
cairo_surface_destroy(surface);
}
-static int
-motion_handler(struct widget *widget, struct input *input,
- uint32_t time, float x, float y, void *data)
-{
- return CURSOR_HAND1;
-}
-
static void
button_handler(struct widget *widget,
struct input *input, uint32_t time,
@@ -184,8 +177,8 @@
widget_set_resize_handler(flower.widget, resize_handler);
widget_set_redraw_handler(flower.widget, redraw_handler);
- widget_set_motion_handler(flower.widget, motion_handler);
widget_set_button_handler(flower.widget, button_handler);
+ widget_set_default_cursor(flower.widget, CURSOR_HAND1);
window_schedule_resize(flower.window, flower.width, flower.height);