diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2012-04-11 22:42:15 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-04-11 22:42:15 -0400 |
commit | eae5de76090e18f7a4c2f654cfd94307fc2dbdd8 (patch) | |
tree | 13fa378e397407199b28a9f1cf493b1c4b9ae9ab /clients | |
parent | ee4b4cb933ca85090e5ffbbea0640be76a451e18 (diff) |
Follow wayland change to serial numbers
Diffstat (limited to 'clients')
-rw-r--r-- | clients/desktop-shell.c | 17 | ||||
-rw-r--r-- | clients/dnd.c | 13 | ||||
-rw-r--r-- | clients/flower.c | 3 | ||||
-rw-r--r-- | clients/simple-touch.c | 19 | ||||
-rw-r--r-- | clients/window.c | 96 | ||||
-rw-r--r-- | clients/window.h | 11 |
6 files changed, 89 insertions, 70 deletions
diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c index 7477ac1..df4494e 100644 --- a/clients/desktop-shell.c +++ b/clients/desktop-shell.c @@ -50,8 +50,7 @@ struct desktop { struct surface { void (*configure)(void *data, struct desktop_shell *desktop_shell, - uint32_t time, uint32_t edges, - struct window *window, + uint32_t edges, struct window *window, int32_t width, int32_t height); }; @@ -234,7 +233,7 @@ panel_redraw_handler(struct widget *widget, void *data) static int panel_launcher_enter_handler(struct widget *widget, struct input *input, - uint32_t time, int32_t x, int32_t y, void *data) + int32_t x, int32_t y, void *data) { struct panel_launcher *launcher = data; @@ -300,8 +299,7 @@ panel_resize_handler(struct widget *widget, static void panel_configure(void *data, struct desktop_shell *desktop_shell, - uint32_t time, uint32_t edges, - struct window *window, + uint32_t edges, struct window *window, int32_t width, int32_t height) { struct surface *surface = window_get_user_data(window); @@ -424,8 +422,7 @@ background_draw(struct widget *widget, void *data) static void background_configure(void *data, struct desktop_shell *desktop_shell, - uint32_t time, uint32_t edges, - struct window *window, + uint32_t edges, struct window *window, int32_t width, int32_t height) { struct background *background = @@ -506,7 +503,7 @@ unlock_dialog_keyboard_focus_handler(struct window *window, static int unlock_dialog_widget_enter_handler(struct widget *widget, - struct input *input, uint32_t time, + struct input *input, int32_t x, int32_t y, void *data) { struct unlock_dialog *dialog = data; @@ -585,14 +582,14 @@ unlock_dialog_finish(struct task *task, uint32_t events) static void desktop_shell_configure(void *data, struct desktop_shell *desktop_shell, - uint32_t time, uint32_t edges, + uint32_t edges, struct wl_shell_surface *shell_surface, int32_t width, int32_t height) { struct window *window = wl_shell_surface_get_user_data(shell_surface); struct surface *s = window_get_user_data(window); - s->configure(data, desktop_shell, time, edges, window, width, height); + s->configure(data, desktop_shell, edges, window, width, height); } static void diff --git a/clients/dnd.c b/clients/dnd.c index 8e67dc4..c540eb4 100644 --- a/clients/dnd.c +++ b/clients/dnd.c @@ -372,6 +372,7 @@ dnd_button_handler(struct widget *widget, struct wl_compositor *compositor; struct wl_buffer *buffer; unsigned int i; + uint32_t serial; widget_get_allocation(dnd->widget, &allocation); input_get_position(input, &x, &y); @@ -397,6 +398,7 @@ dnd_button_handler(struct widget *widget, display = window_get_display(dnd->window); compositor = display_get_compositor(display); + serial = display_get_serial(display); dnd_drag->drag_surface = wl_compositor_create_surface(compositor); @@ -413,7 +415,7 @@ dnd_button_handler(struct widget *widget, dnd_drag->data_source, window_get_wl_surface(dnd->window), dnd_drag->drag_surface, - time); + serial); input_set_pointer_image(input, time, POINTER_DRAGGING); @@ -446,8 +448,7 @@ lookup_cursor(struct dnd *dnd, int x, int y) static int dnd_enter_handler(struct widget *widget, - struct input *input, uint32_t time, - int32_t x, int32_t y, void *data) + struct input *input, int32_t x, int32_t y, void *data) { return lookup_cursor(data, x, y); } @@ -462,15 +463,15 @@ dnd_motion_handler(struct widget *widget, static void dnd_data_handler(struct window *window, - struct input *input, uint32_t time, + struct input *input, int32_t x, int32_t y, const char **types, void *data) { struct dnd *dnd = data; if (!dnd_get_item(dnd, x, y)) { - input_accept(input, time, types[0]); + input_accept(input, types[0]); } else { - input_accept(input, time, NULL); + input_accept(input, NULL); } } diff --git a/clients/flower.c b/clients/flower.c index 7a34616..2d13f9e 100644 --- a/clients/flower.c +++ b/clients/flower.c @@ -149,7 +149,8 @@ button_handler(struct widget *widget, switch (button) { case BTN_LEFT: if (state) - window_move(flower->window, input, time); + window_move(flower->window, input, + display_get_serial(flower->display)); break; case BTN_MIDDLE: if (state) diff --git a/clients/simple-touch.c b/clients/simple-touch.c index c3ee877..b8d9156 100644 --- a/clients/simple-touch.c +++ b/clients/simple-touch.c @@ -110,7 +110,8 @@ input_device_handle_motion(void *data, struct wl_input_device *input_device, static void input_device_handle_button(void *data, struct wl_input_device *input_device, - uint32_t time, uint32_t button, uint32_t state) + uint32_t serial, uint32_t time, + uint32_t button, uint32_t state) { } @@ -122,14 +123,15 @@ input_device_handle_axis(void *data, struct wl_input_device *input_device, static void input_device_handle_key(void *data, struct wl_input_device *input_device, - uint32_t time, uint32_t key, uint32_t state) + uint32_t serial, uint32_t time, + uint32_t key, uint32_t state) { } static void input_device_handle_pointer_enter(void *data, struct wl_input_device *input_device, - uint32_t time, struct wl_surface *surface, + uint32_t serial, struct wl_surface *surface, int32_t sx, int32_t sy) { } @@ -137,14 +139,14 @@ input_device_handle_pointer_enter(void *data, static void input_device_handle_pointer_leave(void *data, struct wl_input_device *input_device, - uint32_t time, struct wl_surface *surface) + uint32_t serial, struct wl_surface *surface) { } static void input_device_handle_keyboard_enter(void *data, struct wl_input_device *input_device, - uint32_t time, + uint32_t serial, struct wl_surface *surface, struct wl_array *keys) { @@ -153,7 +155,7 @@ input_device_handle_keyboard_enter(void *data, static void input_device_handle_keyboard_leave(void *data, struct wl_input_device *input_device, - uint32_t time, + uint32_t serial, struct wl_surface *surface) { } @@ -193,7 +195,8 @@ touch_paint(struct touch *touch, int32_t x, int32_t y, int32_t id) static void input_device_handle_touch_down(void *data, struct wl_input_device *wl_input_device, - uint32_t time, struct wl_surface *surface, + uint32_t serial, uint32_t time, + struct wl_surface *surface, int32_t id, int32_t x, int32_t y) { struct touch *touch = data; @@ -204,7 +207,7 @@ input_device_handle_touch_down(void *data, static void input_device_handle_touch_up(void *data, struct wl_input_device *wl_input_device, - uint32_t time, int32_t id) + uint32_t serial, uint32_t time, int32_t id) { } diff --git a/clients/window.c b/clients/window.c index c7a0582..62f9926 100644 --- a/clients/window.c +++ b/clients/window.c @@ -74,6 +74,7 @@ struct display { EGLConfig argb_config; EGLContext argb_ctx; cairo_device_t *argb_device; + uint32_t serial; int display_fd; uint32_t mask; @@ -172,6 +173,7 @@ struct input { struct window *keyboard_focus; int current_pointer_image; uint32_t modifiers; + uint32_t pointer_enter_serial; int32_t sx, sy; struct wl_list link; @@ -1170,8 +1172,7 @@ window_show_frame_menu(struct window *window, static int frame_enter_handler(struct widget *widget, - struct input *input, uint32_t time, - int32_t x, int32_t y, void *data) + struct input *input, int32_t x, int32_t y, void *data) { return frame_get_pointer_image_for_location(data, input); } @@ -1203,10 +1204,10 @@ frame_button_handler(struct widget *widget, if (!window->shell_surface) break; input_set_pointer_image(input, time, POINTER_DRAGGING); - input_ungrab(input, time); + input_ungrab(input); wl_shell_surface_move(window->shell_surface, input_get_input_device(input), - time); + display->serial); break; case WINDOW_RESIZING_TOP: case WINDOW_RESIZING_BOTTOM: @@ -1218,7 +1219,7 @@ frame_button_handler(struct widget *widget, case WINDOW_RESIZING_BOTTOM_RIGHT: if (!window->shell_surface) break; - input_ungrab(input, time); + input_ungrab(input); if (!display->dpy) { /* If we're using shm, allocate a big @@ -1233,7 +1234,7 @@ frame_button_handler(struct widget *widget, wl_shell_surface_resize(window->shell_surface, input_get_input_device(input), - time, location); + display->serial, location); break; } } else if (button == BTN_RIGHT && state == 1) { @@ -1276,7 +1277,7 @@ frame_destroy(struct frame *frame) static void input_set_focus_widget(struct input *input, struct widget *focus, - uint32_t time, int32_t x, int32_t y) + int32_t x, int32_t y) { struct widget *old, *widget; int pointer = POINTER_LEFT_PTR; @@ -1299,12 +1300,12 @@ input_set_focus_widget(struct input *input, struct widget *focus, if (input->grab) widget = input->grab; if (widget->enter_handler) - pointer = widget->enter_handler(focus, input, time, - x, y, + pointer = widget->enter_handler(focus, input, x, y, widget->user_data); input->focus_widget = focus; - input_set_pointer_image(input, time, pointer); + input_set_pointer_image(input, input->pointer_enter_serial, + pointer); } } @@ -1322,7 +1323,7 @@ input_handle_motion(void *data, struct wl_input_device *input_device, if (!(input->grab && input->grab_button)) { widget = widget_find_widget(window->widget, sx, sy); - input_set_focus_widget(input, widget, time, sx, sy); + input_set_focus_widget(input, widget, sx, sy); } if (input->grab) @@ -1345,7 +1346,7 @@ input_grab(struct input *input, struct widget *widget, uint32_t button) } void -input_ungrab(struct input *input, uint32_t time) +input_ungrab(struct input *input) { struct widget *widget; @@ -1353,19 +1354,19 @@ input_ungrab(struct input *input, uint32_t time) if (input->pointer_focus) { widget = widget_find_widget(input->pointer_focus->widget, input->sx, input->sy); - input_set_focus_widget(input, widget, - time, input->sx, input->sy); + input_set_focus_widget(input, widget, input->sx, input->sy); } } static void input_handle_button(void *data, - struct wl_input_device *input_device, + struct wl_input_device *input_device, uint32_t serial, uint32_t time, uint32_t button, uint32_t state) { struct input *input = data; struct widget *widget; + input->display->serial = serial; if (input->focus_widget && input->grab == NULL && state) input_grab(input, input->focus_widget, button); @@ -1377,7 +1378,7 @@ input_handle_button(void *data, input->grab->user_data); if (input->grab && input->grab_button == button && !state) - input_ungrab(input, time); + input_ungrab(input); } static void @@ -1389,13 +1390,14 @@ input_handle_axis(void *data, static void input_handle_key(void *data, struct wl_input_device *input_device, - uint32_t time, uint32_t key, uint32_t state) + uint32_t serial, uint32_t time, uint32_t key, uint32_t state) { struct input *input = data; struct window *window = input->keyboard_focus; struct display *d = input->display; uint32_t code, sym, level; + input->display->serial = serial; code = key + 8; if (!window || window->keyboard_device != input) return; @@ -1423,14 +1425,14 @@ input_handle_key(void *data, struct wl_input_device *input_device, } static void -input_remove_pointer_focus(struct input *input, uint32_t time) +input_remove_pointer_focus(struct input *input) { struct window *window = input->pointer_focus; if (!window) return; - input_set_focus_widget(input, NULL, 0, 0, 0); + input_set_focus_widget(input, NULL, 0, 0); input->pointer_focus = NULL; input->current_pointer_image = POINTER_UNSET; @@ -1439,13 +1441,15 @@ input_remove_pointer_focus(struct input *input, uint32_t time) static void input_handle_pointer_enter(void *data, struct wl_input_device *input_device, - uint32_t time, struct wl_surface *surface, + uint32_t serial, struct wl_surface *surface, int32_t sx, int32_t sy) { struct input *input = data; struct window *window; struct widget *widget; + input->display->serial = serial; + input->pointer_enter_serial = serial; input->pointer_focus = wl_surface_get_user_data(surface); window = input->pointer_focus; @@ -1461,17 +1465,18 @@ input_handle_pointer_enter(void *data, input->sy = sy; widget = widget_find_widget(window->widget, sx, sy); - input_set_focus_widget(input, widget, time, sx, sy); + input_set_focus_widget(input, widget, sx, sy); } static void input_handle_pointer_leave(void *data, struct wl_input_device *input_device, - uint32_t time, struct wl_surface *surface) + uint32_t serial, struct wl_surface *surface) { struct input *input = data; - input_remove_pointer_focus(input, time); + input->display->serial = serial; + input_remove_pointer_focus(input); } static void @@ -1493,7 +1498,7 @@ input_remove_keyboard_focus(struct input *input) static void input_handle_keyboard_enter(void *data, struct wl_input_device *input_device, - uint32_t time, + uint32_t serial, struct wl_surface *surface, struct wl_array *keys) { @@ -1502,6 +1507,7 @@ input_handle_keyboard_enter(void *data, struct display *d = input->display; uint32_t *k, *end; + input->display->serial = serial; input->keyboard_focus = wl_surface_get_user_data(surface); end = keys->data + keys->size; @@ -1520,18 +1526,20 @@ input_handle_keyboard_enter(void *data, static void input_handle_keyboard_leave(void *data, struct wl_input_device *input_device, - uint32_t time, + uint32_t serial, struct wl_surface *surface) { struct input *input = data; + input->display->serial = serial; input_remove_keyboard_focus(input); } static void input_handle_touch_down(void *data, struct wl_input_device *wl_input_device, - uint32_t time, struct wl_surface *surface, + uint32_t serial, uint32_t time, + struct wl_surface *surface, int32_t id, int32_t x, int32_t y) { } @@ -1539,7 +1547,7 @@ input_handle_touch_down(void *data, static void input_handle_touch_up(void *data, struct wl_input_device *wl_input_device, - uint32_t time, int32_t id) + uint32_t serial, uint32_t time, int32_t id) { } @@ -1668,13 +1676,14 @@ data_device_data_offer(void *data, static void data_device_enter(void *data, struct wl_data_device *data_device, - uint32_t time, struct wl_surface *surface, + uint32_t serial, struct wl_surface *surface, int32_t x, int32_t y, struct wl_data_offer *offer) { struct input *input = data; struct window *window; char **p; + input->pointer_enter_serial = serial; input->drag_offer = wl_data_offer_get_user_data(offer); window = wl_surface_get_user_data(surface); input->pointer_focus = window; @@ -1684,7 +1693,7 @@ data_device_enter(void *data, struct wl_data_device *data_device, window = input->pointer_focus; if (window->data_handler) - window->data_handler(window, input, time, x, y, + window->data_handler(window, input, x, y, input->drag_offer->types.data, window->user_data); } @@ -1709,7 +1718,7 @@ data_device_motion(void *data, struct wl_data_device *data_device, input->sy = y; if (window->data_handler) - window->data_handler(window, input, time, x, y, + window->data_handler(window, input, x, y, input->drag_offer->types.data, window->user_data); } @@ -1788,9 +1797,10 @@ input_set_selection(struct input *input, } void -input_accept(struct input *input, uint32_t time, const char *type) +input_accept(struct input *input, const char *type) { - wl_data_offer_accept(input->drag_offer->offer, time, type); + wl_data_offer_accept(input->drag_offer->offer, + input->pointer_enter_serial, type); } static void @@ -1873,13 +1883,13 @@ input_receive_selection_data_to_fd(struct input *input, } void -window_move(struct window *window, struct input *input, uint32_t time) +window_move(struct window *window, struct input *input, uint32_t serial) { if (!window->shell_surface) return; wl_shell_surface_move(window->shell_surface, - input->input_device, time); + input->input_device, serial); } static void @@ -1938,8 +1948,7 @@ widget_schedule_resize(struct widget *widget, int32_t width, int32_t height) static void handle_configure(void *data, struct wl_shell_surface *shell_surface, - uint32_t time, uint32_t edges, - int32_t width, int32_t height) + uint32_t edges, int32_t width, int32_t height) { struct window *window = data; @@ -1970,7 +1979,7 @@ handle_popup_done(void *data, struct wl_shell_surface *shell_surface) * time. */ menu->func(window->parent, menu->current, window->parent->user_data); - input_ungrab(menu->input, 0); + input_ungrab(menu->input); menu_destroy(menu); } @@ -2272,8 +2281,7 @@ menu_motion_handler(struct widget *widget, static int menu_enter_handler(struct widget *widget, - struct input *input, uint32_t time, - int32_t x, int32_t y, void *data) + struct input *input, int32_t x, int32_t y, void *data) { struct menu *menu = data; @@ -2305,7 +2313,7 @@ menu_button_handler(struct widget *widget, * click-motion-click. */ menu->func(menu->window->parent, menu->current, menu->window->parent->user_data); - input_ungrab(input, time); + input_ungrab(input); menu_destroy(menu); } } @@ -2552,7 +2560,7 @@ static void input_destroy(struct input *input) { input_remove_keyboard_focus(input); - input_remove_pointer_focus(input, 0); + input_remove_pointer_focus(input); if (input->drag_offer) data_offer_destroy(input->drag_offer); @@ -2911,6 +2919,12 @@ display_get_compositor(struct display *display) return display->compositor; } +uint32_t +display_get_serial(struct display *display) +{ + return display->serial; +} + EGLDisplay display_get_egl_display(struct display *d) { diff --git a/clients/window.h b/clients/window.h index 628c4ae..a2a7880 100644 --- a/clients/window.h +++ b/clients/window.h @@ -70,6 +70,9 @@ display_get_shell(struct display *display); struct output * display_get_output(struct display *display); +uint32_t +display_get_serial(struct display *display); + typedef void (*display_output_handler_t)(struct output *output, void *data); /* @@ -161,7 +164,7 @@ typedef void (*window_keyboard_focus_handler_t)(struct window *window, struct input *device, void *data); typedef void (*window_data_handler_t)(struct window *window, - struct input *input, uint32_t time, + struct input *input, int32_t x, int32_t y, const char **types, void *data); @@ -178,7 +181,7 @@ typedef void (*widget_resize_handler_t)(struct widget *widget, typedef void (*widget_redraw_handler_t)(struct widget *widget, void *data); typedef int (*widget_enter_handler_t)(struct widget *widget, - struct input *input, uint32_t time, + struct input *input, int32_t x, int32_t y, void *data); typedef void (*widget_leave_handler_t)(struct widget *widget, struct input *input, void *data); @@ -362,7 +365,7 @@ void input_grab(struct input *input, struct widget *widget, uint32_t button); void -input_ungrab(struct input *input, uint32_t time); +input_ungrab(struct input *input); struct widget * input_get_focus_widget(struct input *input); @@ -378,7 +381,7 @@ input_set_selection(struct input *input, struct wl_data_source *source, uint32_t time); void -input_accept(struct input *input, uint32_t time, const char *type); +input_accept(struct input *input, const char *type); void |