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

View File

@ -229,11 +229,13 @@ panel_redraw_handler(struct window *window, void *data)
window_flush(window);
}
static void
static int
panel_launcher_enter_handler(struct widget *widget, struct input *input,
uint32_t time, int32_t x, int32_t y, void *data)
{
widget_schedule_redraw(widget);
return POINTER_LEFT_PTR;
}
static void
@ -454,12 +456,14 @@ unlock_dialog_keyboard_focus_handler(struct window *window,
window_schedule_redraw(window);
}
static void
static int
unlock_dialog_widget_enter_handler(struct widget *widget,
struct input *input, uint32_t time,
int32_t x, int32_t y, void *data)
{
widget_schedule_redraw(widget);
return POINTER_LEFT_PTR;
}
static void

View File

@ -432,11 +432,15 @@ lookup_cursor(struct dnd *dnd, int x, int y)
return POINTER_LEFT_PTR;
}
static void
static int
dnd_enter_handler(struct widget *widget,
struct input *input, uint32_t time,
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

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 widget *old;
int pointer = POINTER_LEFT_PTR;
if (focus == window->focus_widget)
return;
@ -1280,9 +1281,12 @@ window_set_focus_widget(struct window *window, struct widget *focus,
if (focus) {
if (focus->enter_handler)
focus->enter_handler(focus, input, time,
x, y, focus->user_data);
pointer = focus->enter_handler(focus, input, time,
x, y, focus->user_data);
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);
}
static void
static int
menu_enter_handler(struct widget *widget,
struct input *input, uint32_t time,
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);
menu_set_item(menu, y);
return POINTER_LEFT_PTR;
}
static void

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 (*widget_enter_handler_t)(struct widget *widget,
struct input *input, uint32_t time,
int32_t x, int32_t y, void *data);
typedef int (*widget_enter_handler_t)(struct widget *widget,
struct input *input, uint32_t time,
int32_t x, int32_t y, void *data);
typedef void (*widget_leave_handler_t)(struct widget *widget,
struct input *input, void *data);
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,
struct input *input, uint32_t time,
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 *
window_create(struct display *display, int32_t width, int32_t height);