window: Return pointer type from widget enter handler

This commit is contained in:
Kristian Høgsberg
2012-01-09 11:22:32 -05:00
parent 5388080949
commit bb901fac90
4 changed files with 26 additions and 9 deletions
+6 -2
View File
@@ -229,11 +229,13 @@ panel_redraw_handler(struct window *window, void *data)
window_flush(window); window_flush(window);
} }
static void static int
panel_launcher_enter_handler(struct widget *widget, struct input *input, panel_launcher_enter_handler(struct widget *widget, struct input *input,
uint32_t time, int32_t x, int32_t y, void *data) uint32_t time, int32_t x, int32_t y, void *data)
{ {
widget_schedule_redraw(widget); widget_schedule_redraw(widget);
return POINTER_LEFT_PTR;
} }
static void static void
@@ -454,12 +456,14 @@ unlock_dialog_keyboard_focus_handler(struct window *window,
window_schedule_redraw(window); window_schedule_redraw(window);
} }
static void static int
unlock_dialog_widget_enter_handler(struct widget *widget, unlock_dialog_widget_enter_handler(struct widget *widget,
struct input *input, uint32_t time, struct input *input, uint32_t time,
int32_t x, int32_t y, void *data) int32_t x, int32_t y, void *data)
{ {
widget_schedule_redraw(widget); widget_schedule_redraw(widget);
return POINTER_LEFT_PTR;
} }
static void static void
+5 -1
View File
@@ -432,11 +432,15 @@ lookup_cursor(struct dnd *dnd, int x, int y)
return POINTER_LEFT_PTR; return POINTER_LEFT_PTR;
} }
static void static int
dnd_enter_handler(struct widget *widget, dnd_enter_handler(struct widget *widget,
struct input *input, uint32_t time, struct input *input, uint32_t time,
int32_t x, int32_t y, void *data) int32_t x, int32_t y, void *data)
{ {
struct window *window = data;
struct dnd *dnd = window_get_user_data(window);
return lookup_cursor(dnd, x, y);
} }
static int static int
+9 -3
View File
@@ -1267,6 +1267,7 @@ window_set_focus_widget(struct window *window, struct widget *focus,
struct input *input, uint32_t time, int32_t x, int32_t y) struct input *input, uint32_t time, int32_t x, int32_t y)
{ {
struct widget *old; struct widget *old;
int pointer = POINTER_LEFT_PTR;
if (focus == window->focus_widget) if (focus == window->focus_widget)
return; return;
@@ -1280,9 +1281,12 @@ window_set_focus_widget(struct window *window, struct widget *focus,
if (focus) { if (focus) {
if (focus->enter_handler) if (focus->enter_handler)
focus->enter_handler(focus, input, time, pointer = focus->enter_handler(focus, input, time,
x, y, focus->user_data); x, y, focus->user_data);
window->focus_widget = focus; window->focus_widget = focus;
pointer = input_get_pointer_image_for_location(input, pointer);
input_set_pointer_image(input, time, pointer);
} }
} }
@@ -2221,7 +2225,7 @@ menu_motion_handler(struct widget *widget,
return menu_set_item(menu, y); return menu_set_item(menu, y);
} }
static void static int
menu_enter_handler(struct widget *widget, menu_enter_handler(struct widget *widget,
struct input *input, uint32_t time, struct input *input, uint32_t time,
int32_t x, int32_t y, void *data) int32_t x, int32_t y, void *data)
@@ -2230,6 +2234,8 @@ menu_enter_handler(struct widget *widget,
struct menu *menu = window_get_user_data(window); struct menu *menu = window_get_user_data(window);
menu_set_item(menu, y); menu_set_item(menu, y);
return POINTER_LEFT_PTR;
} }
static void static void
+6 -3
View File
@@ -180,9 +180,9 @@ typedef void (*window_drop_handler_t)(struct window *window,
typedef void (*window_close_handler_t)(struct window *window, void *data); typedef void (*window_close_handler_t)(struct window *window, void *data);
typedef void (*widget_enter_handler_t)(struct widget *widget, typedef int (*widget_enter_handler_t)(struct widget *widget,
struct input *input, uint32_t time, struct input *input, uint32_t time,
int32_t x, int32_t y, void *data); int32_t x, int32_t y, void *data);
typedef void (*widget_leave_handler_t)(struct widget *widget, typedef void (*widget_leave_handler_t)(struct widget *widget,
struct input *input, void *data); struct input *input, void *data);
typedef int (*widget_motion_handler_t)(struct widget *widget, typedef int (*widget_motion_handler_t)(struct widget *widget,
@@ -191,6 +191,9 @@ typedef int (*widget_motion_handler_t)(struct widget *widget,
typedef void (*widget_button_handler_t)(struct widget *widget, typedef void (*widget_button_handler_t)(struct widget *widget,
struct input *input, uint32_t time, struct input *input, uint32_t time,
int button, int state, void *data); int button, int state, void *data);
typedef void (*widget_resize_handler_t)(struct widget *widget,
int32_t width, int32_t height,
void *data);
struct window * struct window *
window_create(struct display *display, int32_t width, int32_t height); window_create(struct display *display, int32_t width, int32_t height);