window: Convert a few clients to use widget motion handler
This commit is contained in:
parent
04e98344cf
commit
5f190ef96a
@ -440,12 +440,11 @@ dnd_enter_handler(struct widget *widget,
|
||||
}
|
||||
|
||||
static int
|
||||
dnd_motion_handler(struct window *window,
|
||||
dnd_motion_handler(struct widget *widget,
|
||||
struct input *input, uint32_t time,
|
||||
int32_t x, int32_t y,
|
||||
int32_t sx, int32_t sy, void *data)
|
||||
int32_t x, int32_t y, void *data)
|
||||
{
|
||||
return lookup_cursor(data, sx, sy);
|
||||
return lookup_cursor(data, x, y);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -536,12 +535,12 @@ dnd_create(struct display *display)
|
||||
window_set_keyboard_focus_handler(dnd->window,
|
||||
keyboard_focus_handler);
|
||||
window_set_button_handler(dnd->window, dnd_button_handler);
|
||||
window_set_motion_handler(dnd->window, dnd_motion_handler);
|
||||
window_set_data_handler(dnd->window, dnd_data_handler);
|
||||
window_set_drop_handler(dnd->window, dnd_drop_handler);
|
||||
|
||||
dnd->widget = window_add_widget(dnd->window, dnd);
|
||||
widget_set_enter_handler(dnd->widget, dnd_enter_handler);
|
||||
widget_set_motion_handler(dnd->widget, dnd_motion_handler);
|
||||
|
||||
width = 4 * (item_width + item_padding) + item_padding;
|
||||
height = 4 * (item_height + item_padding) + item_padding;
|
||||
|
@ -197,15 +197,6 @@ lockscreen_draw(struct tablet_shell *shell)
|
||||
window_flush(shell->lockscreen);
|
||||
}
|
||||
|
||||
static int
|
||||
lockscreen_motion_handler(struct window *window,
|
||||
struct input *input, uint32_t time,
|
||||
int32_t x, int32_t y,
|
||||
int32_t sx, int32_t sy, void *data)
|
||||
{
|
||||
return POINTER_LEFT_PTR;
|
||||
}
|
||||
|
||||
static void
|
||||
lockscreen_button_handler(struct window *window,
|
||||
struct input *input, uint32_t time,
|
||||
@ -230,8 +221,6 @@ show_lockscreen(void *data, struct tablet_shell *tablet_shell)
|
||||
window_set_custom(shell->lockscreen);
|
||||
window_set_button_handler(shell->lockscreen,
|
||||
lockscreen_button_handler);
|
||||
window_set_motion_handler(shell->lockscreen,
|
||||
lockscreen_motion_handler);
|
||||
|
||||
|
||||
tablet_shell_set_lockscreen(shell->tablet_shell,
|
||||
|
@ -356,6 +356,7 @@ enum escape_state {
|
||||
|
||||
struct terminal {
|
||||
struct window *window;
|
||||
struct widget *widget;
|
||||
struct display *display;
|
||||
union utf8_char *data;
|
||||
struct task io_task;
|
||||
@ -2248,10 +2249,9 @@ button_handler(struct window *window,
|
||||
}
|
||||
|
||||
static int
|
||||
motion_handler(struct window *window,
|
||||
motion_handler(struct widget *widget,
|
||||
struct input *input, uint32_t time,
|
||||
int32_t x, int32_t y,
|
||||
int32_t sx, int32_t sy, void *data)
|
||||
int32_t x, int32_t y, void *data)
|
||||
{
|
||||
struct terminal *terminal = data;
|
||||
|
||||
@ -2259,7 +2259,7 @@ motion_handler(struct window *window,
|
||||
input_get_position(input,
|
||||
&terminal->selection_end_x,
|
||||
&terminal->selection_end_y);
|
||||
window_schedule_redraw(window);
|
||||
widget_schedule_redraw(widget);
|
||||
}
|
||||
|
||||
return POINTER_IBEAM;
|
||||
@ -2299,7 +2299,9 @@ terminal_create(struct display *display, int fullscreen)
|
||||
window_set_keyboard_focus_handler(terminal->window,
|
||||
keyboard_focus_handler);
|
||||
window_set_button_handler(terminal->window, button_handler);
|
||||
window_set_motion_handler(terminal->window, motion_handler);
|
||||
|
||||
terminal->widget = window_add_widget(terminal->window, terminal);
|
||||
widget_set_motion_handler(terminal->widget, motion_handler);
|
||||
|
||||
surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 0, 0);
|
||||
cr = cairo_create(surface);
|
||||
|
@ -2212,14 +2212,13 @@ menu_set_item(struct widget *widget, struct menu *menu, int sy)
|
||||
}
|
||||
|
||||
static int
|
||||
menu_motion_handler(struct window *window,
|
||||
menu_motion_handler(struct widget *widget,
|
||||
struct input *input, uint32_t time,
|
||||
int32_t x, int32_t y,
|
||||
int32_t sx, int32_t sy, void *data)
|
||||
int32_t x, int32_t y, void *data)
|
||||
{
|
||||
struct menu *menu = data;
|
||||
|
||||
return menu_set_item(menu->widget, menu, sy);
|
||||
return menu_set_item(menu->widget, menu, y);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2330,7 +2329,6 @@ window_create_menu(struct display *display,
|
||||
window->parent->shell_surface,
|
||||
window->x, window->y, 0);
|
||||
|
||||
window_set_motion_handler(window, menu_motion_handler);
|
||||
window_set_button_handler(window, menu_button_handler);
|
||||
window_set_redraw_handler(window, menu_redraw_handler);
|
||||
window_set_user_data(window, menu);
|
||||
@ -2338,6 +2336,7 @@ window_create_menu(struct display *display,
|
||||
menu->widget = window_add_widget(window, menu);
|
||||
widget_set_enter_handler(menu->widget, menu_enter_handler);
|
||||
widget_set_leave_handler(menu->widget, menu_leave_handler);
|
||||
widget_set_motion_handler(menu->widget, menu_motion_handler);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user