From eae5de76090e18f7a4c2f654cfd94307fc2dbdd8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 11 Apr 2012 22:42:15 -0400 Subject: [PATCH] Follow wayland change to serial numbers --- clients/desktop-shell.c | 17 +++---- clients/dnd.c | 13 +++--- clients/flower.c | 3 +- clients/simple-touch.c | 19 ++++---- clients/window.c | 96 +++++++++++++++++++++----------------- clients/window.h | 11 +++-- protocol/desktop-shell.xml | 1 - src/compositor-drm.c | 12 ++--- src/compositor-wayland.c | 17 ++++--- src/compositor-x11.c | 13 ++---- src/compositor.c | 75 +++++++++++++++--------------- src/compositor.h | 6 +-- src/evdev.c | 6 +-- src/screenshooter.c | 2 +- src/shell.c | 112 ++++++++++++++++++++++----------------------- src/tablet-shell.c | 15 +++--- src/util.c | 16 ++++--- src/xserver-launcher.c | 8 ++-- 18 files changed, 218 insertions(+), 224 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 diff --git a/protocol/desktop-shell.xml b/protocol/desktop-shell.xml index c40cf17..836b127 100644 --- a/protocol/desktop-shell.xml +++ b/protocol/desktop-shell.xml @@ -20,7 +20,6 @@ - diff --git a/src/compositor-drm.c b/src/compositor-drm.c index 8bbf867..d2a6b34 100644 --- a/src/compositor-drm.c +++ b/src/compositor-drm.c @@ -917,8 +917,7 @@ drm_subpixel_to_wayland(int drm_value) static void output_handle_scanout_buffer_destroy(struct wl_listener *listener, - struct wl_resource *resource, - uint32_t time) + struct wl_resource *resource) { struct drm_output *output = container_of(listener, struct drm_output, @@ -932,8 +931,7 @@ output_handle_scanout_buffer_destroy(struct wl_listener *listener, static void output_handle_pending_scanout_buffer_destroy(struct wl_listener *listener, - struct wl_resource *resource, - uint32_t time) + struct wl_resource *resource) { struct drm_output *output = container_of(listener, struct drm_output, @@ -946,8 +944,7 @@ output_handle_pending_scanout_buffer_destroy(struct wl_listener *listener, static void sprite_handle_buffer_destroy(struct wl_listener *listener, - struct wl_resource *resource, - uint32_t time) + struct wl_resource *resource) { struct drm_sprite *sprite = container_of(listener, struct drm_sprite, @@ -958,8 +955,7 @@ sprite_handle_buffer_destroy(struct wl_listener *listener, static void sprite_handle_pending_buffer_destroy(struct wl_listener *listener, - struct wl_resource *resource, - uint32_t time) + struct wl_resource *resource) { struct drm_sprite *sprite = container_of(listener, struct drm_sprite, diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c index 5eafbd8..7a9ebde 100644 --- a/src/compositor-wayland.c +++ b/src/compositor-wayland.c @@ -530,8 +530,8 @@ input_handle_motion(void *data, struct wl_input_device *input_device, static void input_handle_button(void *data, - struct wl_input_device *input_device, - uint32_t time, uint32_t button, uint32_t state) + struct wl_input_device *input_device, + uint32_t serial, uint32_t time, uint32_t button, uint32_t state) { struct wayland_input *input = data; struct wayland_compositor *c = input->compositor; @@ -541,7 +541,7 @@ input_handle_button(void *data, static void input_handle_axis(void *data, struct wl_input_device *input_device, - uint32_t time, uint32_t axis, int32_t value) + uint32_t time, uint32_t axis, int32_t value) { struct wayland_input *input = data; struct wayland_compositor *c = input->compositor; @@ -551,7 +551,7 @@ input_handle_axis(void *data, struct wl_input_device *input_device, 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 wayland_input *input = data; struct wayland_compositor *c = input->compositor; @@ -570,8 +570,7 @@ input_handle_pointer_enter(void *data, struct wayland_compositor *c = input->compositor; output = wl_surface_get_user_data(surface); - notify_pointer_focus(c->base.input_device, - time, &output->base, sx, sy); + notify_pointer_focus(c->base.input_device, &output->base, sx, sy); wl_input_device_attach(input->input_device, time, NULL, 0, 0); } @@ -583,7 +582,7 @@ input_handle_pointer_leave(void *data, struct wayland_input *input = data; struct wayland_compositor *c = input->compositor; - notify_pointer_focus(c->base.input_device, time, NULL, 0, 0); + notify_pointer_focus(c->base.input_device, NULL, 0, 0); } static void @@ -596,7 +595,7 @@ input_handle_keyboard_enter(void *data, struct wayland_input *input = data; struct wayland_compositor *c = input->compositor; - notify_keyboard_focus(c->base.input_device, time, keys); + notify_keyboard_focus(c->base.input_device, keys); } static void @@ -608,7 +607,7 @@ input_handle_keyboard_leave(void *data, struct wayland_input *input = data; struct wayland_compositor *c = input->compositor; - notify_keyboard_focus(c->base.input_device, time, NULL); + notify_keyboard_focus(c->base.input_device, NULL); } static const struct wl_input_device_listener input_device_listener = { diff --git a/src/compositor-x11.c b/src/compositor-x11.c index 122e38a..9822c2c 100644 --- a/src/compositor-x11.c +++ b/src/compositor-x11.c @@ -613,9 +613,7 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data) } output = x11_compositor_find_output(c, focus_in->event); - notify_keyboard_focus(c->base.input_device, - weston_compositor_get_time(), - &c->keys); + notify_keyboard_focus(c->base.input_device, &c->keys); free(prev); prev = NULL; @@ -664,7 +662,6 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data) break; output = x11_compositor_find_output(c, enter_notify->event); notify_pointer_focus(c->base.input_device, - weston_compositor_get_time(), &output->base, output->base.x + enter_notify->event_x, output->base.y + enter_notify->event_y); @@ -675,9 +672,7 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data) if (enter_notify->state >= Button1Mask) break; output = x11_compositor_find_output(c, enter_notify->event); - notify_pointer_focus(c->base.input_device, - weston_compositor_get_time(), - NULL, + notify_pointer_focus(c->base.input_device, NULL, output->base.x + enter_notify->event_x, output->base.y + enter_notify->event_y); break; @@ -702,9 +697,7 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data) if (focus_in->mode == XCB_NOTIFY_MODE_WHILE_GRABBED || focus_in->mode == XCB_NOTIFY_MODE_UNGRAB) break; - notify_keyboard_focus(c->base.input_device, - weston_compositor_get_time(), - NULL); + notify_keyboard_focus(c->base.input_device, NULL); break; default: diff --git a/src/compositor.c b/src/compositor.c index a71b7df..8341016 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -166,7 +166,7 @@ weston_client_launch(struct weston_compositor *compositor, static void surface_handle_buffer_destroy(struct wl_listener *listener, - struct wl_resource *resource, uint32_t time) + struct wl_resource *resource) { struct weston_surface *es = container_of(listener, struct weston_surface, @@ -548,11 +548,11 @@ weston_surface_is_mapped(struct weston_surface *surface) WL_EXPORT uint32_t weston_compositor_get_time(void) { - struct timeval tv; + struct timeval tv; - gettimeofday(&tv, NULL); + gettimeofday(&tv, NULL); - return tv.tv_sec * 1000 + tv.tv_usec / 1000; + return tv.tv_sec * 1000 + tv.tv_usec / 1000; } static struct weston_surface * @@ -572,7 +572,7 @@ weston_compositor_pick_surface(struct weston_compositor *compositor, } static void -weston_device_repick(struct wl_input_device *device, uint32_t time) +weston_device_repick(struct wl_input_device *device) { struct weston_input_device *wd = (struct weston_input_device *) device; const struct wl_pointer_grab_interface *interface; @@ -585,7 +585,7 @@ weston_device_repick(struct wl_input_device *device, uint32_t time) if (&surface->surface != device->current) { interface = device->pointer_grab->interface; - interface->focus(device->pointer_grab, time, &surface->surface, + interface->focus(device->pointer_grab, &surface->surface, device->current_x, device->current_y); device->current = &surface->surface; } @@ -600,14 +600,12 @@ WL_EXPORT void weston_compositor_repick(struct weston_compositor *compositor) { struct weston_input_device *device; - uint32_t time; if (!compositor->focus) return; - time = weston_compositor_get_time(); wl_list_for_each(device, &compositor->input_device_list, link) - weston_device_repick(&device->input_device, time); + weston_device_repick(&device->input_device); } static void @@ -621,11 +619,9 @@ weston_surface_unmap(struct weston_surface *surface) wl_list_remove(&surface->layer_link); if (device->keyboard_focus == &surface->surface) - wl_input_device_set_keyboard_focus(device, NULL, - weston_compositor_get_time()); + wl_input_device_set_keyboard_focus(device, NULL); if (device->pointer_focus == &surface->surface) - wl_input_device_set_pointer_focus(device, NULL, 0, 0, - weston_compositor_get_time()); + wl_input_device_set_pointer_focus(device, NULL, 0, 0); weston_compositor_schedule_repaint(surface->compositor); } @@ -998,7 +994,7 @@ weston_output_repaint(struct weston_output *output, int msecs) wl_list_for_each_safe(cb, cnext, &output->frame_callback_list, link) { wl_callback_send_done(&cb->resource, msecs); - wl_resource_destroy(&cb->resource, 0); + wl_resource_destroy(&cb->resource); } wl_list_for_each_safe(animation, next, &ec->animation_list, link) @@ -1113,7 +1109,7 @@ weston_compositor_fade(struct weston_compositor *compositor, float tint) static void surface_destroy(struct wl_client *client, struct wl_resource *resource) { - wl_resource_destroy(resource, weston_compositor_get_time()); + wl_resource_destroy(resource); } WL_EXPORT void @@ -1322,7 +1318,7 @@ destroy_region(struct wl_resource *resource) static void region_destroy(struct wl_client *client, struct wl_resource *resource) { - wl_resource_destroy(resource, weston_compositor_get_time()); + wl_resource_destroy(resource); } static void @@ -1500,7 +1496,7 @@ notify_motion(struct wl_input_device *device, uint32_t time, int x, int y) pixman_region32_contains_point(&output->region, x, y, NULL)) weston_output_update_zoom(output, x, y); - weston_device_repick(device, time); + weston_device_repick(device); interface = device->pointer_grab->interface; interface->motion(device->pointer_grab, time, device->pointer_grab->x, device->pointer_grab->y); @@ -1516,10 +1512,10 @@ notify_motion(struct wl_input_device *device, uint32_t time, int x, int y) WL_EXPORT void weston_surface_activate(struct weston_surface *surface, - struct weston_input_device *device, uint32_t time) + struct weston_input_device *device) { wl_input_device_set_keyboard_focus(&device->input_device, - &surface->surface, time); + &surface->surface); wl_data_device_set_keyboard_focus(&device->input_device); } @@ -1548,6 +1544,9 @@ notify_button(struct wl_input_device *device, device->pointer_grab->interface->button(device->pointer_grab, time, button, state); + if (device->button_count == 1) + device->grab_serial = + wl_display_get_serial(compositor->wl_display); } WL_EXPORT void @@ -1641,8 +1640,7 @@ notify_key(struct wl_input_device *device, WL_EXPORT void notify_pointer_focus(struct wl_input_device *device, - uint32_t time, struct weston_output *output, - int32_t x, int32_t y) + struct weston_output *output, int32_t x, int32_t y) { struct weston_input_device *wd = (struct weston_input_device *) device; struct weston_compositor *compositor = wd->compositor; @@ -1663,7 +1661,7 @@ notify_pointer_focus(struct wl_input_device *device, static void destroy_device_saved_kbd_focus(struct wl_listener *listener, - struct wl_resource *resource, uint32_t time) + struct wl_resource *resource) { struct weston_input_device *wd; @@ -1674,8 +1672,7 @@ destroy_device_saved_kbd_focus(struct wl_listener *listener, } WL_EXPORT void -notify_keyboard_focus(struct wl_input_device *device, - uint32_t time, struct wl_array *keys) +notify_keyboard_focus(struct wl_input_device *device, struct wl_array *keys) { struct weston_input_device *wd = (struct weston_input_device *) device; @@ -1696,7 +1693,7 @@ notify_keyboard_focus(struct wl_input_device *device, if (surface) { wl_list_remove(&wd->saved_kbd_focus_listener.link); wl_input_device_set_keyboard_focus(&wd->input_device, - surface, time); + surface); wd->saved_kbd_focus = NULL; } } else { @@ -1715,12 +1712,11 @@ notify_keyboard_focus(struct wl_input_device *device, &wd->saved_kbd_focus_listener.link); } - wl_input_device_set_keyboard_focus(&wd->input_device, - NULL, time); + wl_input_device_set_keyboard_focus(&wd->input_device, NULL); /* FIXME: We really need keyboard grab cancel here to * let the grab shut down properly. As it is we leak * the grab data. */ - wl_input_device_end_keyboard_grab(&wd->input_device, time); + wl_input_device_end_keyboard_grab(&wd->input_device); } } @@ -1743,7 +1739,7 @@ find_resource_for_surface(struct wl_list *list, struct wl_surface *surface) static void lose_touch_focus_resource(struct wl_listener *listener, - struct wl_resource *resource, uint32_t time) + struct wl_resource *resource) { struct weston_input_device *device = container_of(listener, struct weston_input_device, @@ -1754,7 +1750,7 @@ lose_touch_focus_resource(struct wl_listener *listener, static void lose_touch_focus(struct wl_listener *listener, - struct wl_resource *resource, uint32_t time) + struct wl_resource *resource) { struct weston_input_device *device = container_of(listener, struct weston_input_device, @@ -1765,7 +1761,7 @@ lose_touch_focus(struct wl_listener *listener, static void touch_set_focus(struct weston_input_device *device, - struct wl_surface *surface, uint32_t time) + struct wl_surface *surface) { struct wl_input_device *input_device = &device->input_device; struct wl_resource *resource; @@ -1818,6 +1814,7 @@ notify_touch(struct wl_input_device *device, uint32_t time, int touch_id, struct weston_compositor *ec = wd->compositor; struct weston_surface *es; int32_t sx, sy; + uint32_t serial = 0; switch (touch_type) { case WL_INPUT_DEVICE_TOUCH_DOWN: @@ -1830,7 +1827,7 @@ notify_touch(struct wl_input_device *device, uint32_t time, int touch_id, * until all touch points are up again. */ if (wd->num_tp == 1) { es = weston_compositor_pick_surface(ec, x, y, &sx, &sy); - touch_set_focus(wd, &es->surface, time); + touch_set_focus(wd, &es->surface); } else if (wd->touch_focus) { es = (struct weston_surface *) wd->touch_focus; weston_surface_from_global(es, x, y, &sx, &sy); @@ -1838,7 +1835,7 @@ notify_touch(struct wl_input_device *device, uint32_t time, int touch_id, if (wd->touch_focus_resource && wd->touch_focus) wl_input_device_send_touch_down(wd->touch_focus_resource, - time, &wd->touch_focus->resource, + serial, time, &wd->touch_focus->resource, touch_id, sx, sy); break; case WL_INPUT_DEVICE_TOUCH_MOTION: @@ -1857,9 +1854,9 @@ notify_touch(struct wl_input_device *device, uint32_t time, int touch_id, if (wd->touch_focus_resource) wl_input_device_send_touch_up(wd->touch_focus_resource, - time, touch_id); + serial, time, touch_id); if (wd->num_tp == 0) - touch_set_focus(wd, NULL, time); + touch_set_focus(wd, NULL); break; } } @@ -1867,14 +1864,14 @@ notify_touch(struct wl_input_device *device, uint32_t time, int touch_id, static void input_device_attach(struct wl_client *client, struct wl_resource *resource, - uint32_t time, + uint32_t serial, struct wl_resource *buffer_resource, int32_t x, int32_t y) { struct weston_input_device *device = resource->data; struct weston_compositor *compositor = device->compositor; struct wl_buffer *buffer = NULL; - if (time < device->input_device.pointer_focus_time) + if (serial < device->input_device.pointer_focus_serial) return; if (device->input_device.pointer_focus == NULL) return; @@ -1913,7 +1910,7 @@ static const struct wl_input_device_interface input_device_interface = { static void handle_drag_surface_destroy(struct wl_listener *listener, - struct wl_resource *resource, uint32_t time) + struct wl_resource *resource) { struct weston_input_device *device; @@ -1944,7 +1941,7 @@ bind_input_device(struct wl_client *client, static void device_handle_new_drag_icon(struct wl_listener *listener, - struct wl_resource *resource, uint32_t time) + struct wl_resource *resource) { struct weston_input_device *device; diff --git a/src/compositor.h b/src/compositor.h index 9022313..01e8d53 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -366,7 +366,7 @@ weston_spring_done(struct weston_spring *spring); void weston_surface_activate(struct weston_surface *surface, - struct weston_input_device *device, uint32_t time); + struct weston_input_device *device); void weston_surface_draw(struct weston_surface *es, struct weston_output *output, pixman_region32_t *damage); @@ -386,13 +386,11 @@ notify_key(struct wl_input_device *device, void notify_pointer_focus(struct wl_input_device *device, - uint32_t time, struct weston_output *output, int32_t x, int32_t y); void -notify_keyboard_focus(struct wl_input_device *device, - uint32_t time, struct wl_array *keys); +notify_keyboard_focus(struct wl_input_device *device, struct wl_array *keys); void notify_touch(struct wl_input_device *device, uint32_t time, int touch_id, diff --git a/src/evdev.c b/src/evdev.c index 9cb13cc..c65b82f 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -590,8 +590,7 @@ evdev_notify_keyboard_focus(struct evdev_input *input) } } - notify_keyboard_focus(&input->base.input_device, - weston_compositor_get_time(), &keys); + notify_keyboard_focus(&input->base.input_device, &keys); wl_array_release(&keys); } @@ -758,8 +757,7 @@ evdev_remove_devices(struct weston_input_device *input_base) wl_list_for_each_safe(device, next, &input->devices_list, link) device_removed(device); - notify_keyboard_focus(&input->base.input_device, - weston_compositor_get_time(), NULL); + notify_keyboard_focus(&input->base.input_device, NULL); } void diff --git a/src/screenshooter.c b/src/screenshooter.c index 1df413f..414bcea 100644 --- a/src/screenshooter.c +++ b/src/screenshooter.c @@ -94,7 +94,7 @@ bind_shooter(struct wl_client *client, if (client != shooter->client) { wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, "screenshooter failed: permission denied"); - wl_resource_destroy(resource, 0); + wl_resource_destroy(resource); } } diff --git a/src/shell.c b/src/shell.c index 17ae1f4..70a8e62 100644 --- a/src/shell.c +++ b/src/shell.c @@ -152,7 +152,7 @@ struct rotate_grab { static void destroy_shell_grab_shsurf(struct wl_listener *listener, - struct wl_resource *resource, uint32_t time) + struct wl_resource *resource) { struct shell_grab *grab; @@ -213,7 +213,7 @@ shell_configuration(struct wl_shell *shell) } static void -noop_grab_focus(struct wl_pointer_grab *grab, uint32_t time, +noop_grab_focus(struct wl_pointer_grab *grab, struct wl_surface *surface, int32_t x, int32_t y) { grab->focus = NULL; @@ -249,7 +249,7 @@ move_grab_button(struct wl_pointer_grab *grab, if (device->button_count == 0 && state == 0) { shell_grab_finish(shell_grab); - wl_input_device_end_pointer_grab(device, time); + wl_input_device_end_pointer_grab(device); free(grab); } } @@ -262,7 +262,7 @@ static const struct wl_pointer_grab_interface move_grab_interface = { static int weston_surface_move(struct weston_surface *es, - struct weston_input_device *wd, uint32_t time) + struct weston_input_device *wd) { struct weston_move_grab *move; struct shell_surface *shsurf = get_shell_surface(es); @@ -280,26 +280,26 @@ weston_surface_move(struct weston_surface *es, move->dy = es->geometry.y - wd->input_device.grab_y; wl_input_device_start_pointer_grab(&wd->input_device, - &move->base.grab, time); + &move->base.grab); - wl_input_device_set_pointer_focus(&wd->input_device, NULL, time, 0, 0); + wl_input_device_set_pointer_focus(&wd->input_device, NULL, 0, 0); return 0; } static void shell_surface_move(struct wl_client *client, struct wl_resource *resource, - struct wl_resource *input_resource, uint32_t time) + struct wl_resource *input_resource, uint32_t serial) { struct weston_input_device *wd = input_resource->data; struct shell_surface *shsurf = resource->data; if (wd->input_device.button_count == 0 || - wd->input_device.grab_time != time || + wd->input_device.grab_serial != serial || wd->input_device.pointer_focus != &shsurf->surface->surface) return; - if (weston_surface_move(shsurf->surface, wd, time) < 0) + if (weston_surface_move(shsurf->surface, wd) < 0) wl_resource_post_no_memory(resource); } @@ -345,7 +345,7 @@ resize_grab_motion(struct wl_pointer_grab *grab, } wl_shell_surface_send_configure(&resize->base.shsurf->resource, - time, resize->edges, width, height); + resize->edges, width, height); } static void @@ -357,7 +357,7 @@ resize_grab_button(struct wl_pointer_grab *grab, if (device->button_count == 0 && state == 0) { shell_grab_finish(&resize->base); - wl_input_device_end_pointer_grab(device, time); + wl_input_device_end_pointer_grab(device); free(grab); } } @@ -370,8 +370,7 @@ static const struct wl_pointer_grab_interface resize_grab_interface = { static int weston_surface_resize(struct shell_surface *shsurf, - struct weston_input_device *wd, - uint32_t time, uint32_t edges) + struct weston_input_device *wd, uint32_t edges) { struct weston_resize_grab *resize; @@ -393,16 +392,16 @@ weston_surface_resize(struct shell_surface *shsurf, resize->height = shsurf->surface->geometry.height; wl_input_device_start_pointer_grab(&wd->input_device, - &resize->base.grab, time); + &resize->base.grab); - wl_input_device_set_pointer_focus(&wd->input_device, NULL, time, 0, 0); + wl_input_device_set_pointer_focus(&wd->input_device, NULL, 0, 0); return 0; } static void shell_surface_resize(struct wl_client *client, struct wl_resource *resource, - struct wl_resource *input_resource, uint32_t time, + struct wl_resource *input_resource, uint32_t serial, uint32_t edges) { struct weston_input_device *wd = input_resource->data; @@ -412,11 +411,11 @@ shell_surface_resize(struct wl_client *client, struct wl_resource *resource, return; if (wd->input_device.button_count == 0 || - wd->input_device.grab_time != time || + wd->input_device.grab_serial != serial || wd->input_device.pointer_focus != &shsurf->surface->surface) return; - if (weston_surface_resize(shsurf, wd, time, edges) < 0) + if (weston_surface_resize(shsurf, wd, edges) < 0) wl_resource_post_no_memory(resource); } @@ -568,8 +567,7 @@ shell_surface_set_maximized(struct wl_client *client, panel_height = get_output_panel_height(wlshell, es->output); edges = WL_SHELL_SURFACE_RESIZE_TOP|WL_SHELL_SURFACE_RESIZE_LEFT; - wl_shell_surface_send_configure(&shsurf->resource, - weston_compositor_get_time(), edges, + wl_shell_surface_send_configure(&shsurf->resource, edges, es->output->current->width, es->output->current->height - panel_height); @@ -702,14 +700,13 @@ shell_surface_set_fullscreen(struct wl_client *client, if (weston_surface_is_mapped(es)) shsurf->force_configure = 1; - wl_shell_surface_send_configure(&shsurf->resource, - weston_compositor_get_time(), 0, + wl_shell_surface_send_configure(&shsurf->resource, 0, shsurf->output->current->width, shsurf->output->current->height); } static void -popup_grab_focus(struct wl_pointer_grab *grab, uint32_t time, +popup_grab_focus(struct wl_pointer_grab *grab, struct wl_surface *surface, int32_t x, int32_t y) { struct wl_input_device *device = grab->input_device; @@ -718,10 +715,10 @@ popup_grab_focus(struct wl_pointer_grab *grab, uint32_t time, struct wl_client *client = priv->surface->surface.resource.client; if (surface && surface->resource.client == client) { - wl_input_device_set_pointer_focus(device, surface, time, x, y); + wl_input_device_set_pointer_focus(device, surface, x, y); grab->focus = surface; } else { - wl_input_device_set_pointer_focus(device, NULL, time, 0, 0); + wl_input_device_set_pointer_focus(device, NULL, 0, 0); grab->focus = NULL; } } @@ -744,15 +741,20 @@ popup_grab_button(struct wl_pointer_grab *grab, struct wl_resource *resource; struct shell_surface *shsurf = container_of(grab, struct shell_surface, popup.grab); + struct wl_display *display; + uint32_t serial; resource = grab->input_device->pointer_focus_resource; if (resource) { - wl_input_device_send_button(resource, time, button, state); + display = wl_client_get_display(resource->client); + serial = wl_display_get_serial(display); + wl_input_device_send_button(resource, serial, + time, button, state); } else if (state == 0 && (shsurf->popup.initial_up || time - shsurf->popup.time > 500)) { wl_shell_surface_send_popup_done(&shsurf->resource); - wl_input_device_end_pointer_grab(grab->input_device, time); + wl_input_device_end_pointer_grab(grab->input_device); shsurf->popup.grab.input_device = NULL; } @@ -767,7 +769,7 @@ static const struct wl_pointer_grab_interface popup_grab_interface = { }; static void -shell_map_popup(struct shell_surface *shsurf, uint32_t time) +shell_map_popup(struct shell_surface *shsurf, uint32_t serial) { struct wl_input_device *device; struct weston_surface *es = shsurf->surface; @@ -799,7 +801,7 @@ shell_map_popup(struct shell_surface *shsurf, uint32_t time) shsurf->popup.initial_up = 0; wl_input_device_start_pointer_grab(shsurf->popup.grab.input_device, - &shsurf->popup.grab, shsurf->popup.time); + &shsurf->popup.grab); } static void @@ -834,7 +836,7 @@ destroy_shell_surface(struct wl_resource *resource) struct shell_surface *shsurf = resource->data; if (shsurf->popup.grab.input_device) - wl_input_device_end_pointer_grab(shsurf->popup.grab.input_device, 0); + wl_input_device_end_pointer_grab(shsurf->popup.grab.input_device); /* in case cleaning up a dead client destroys shell_surface first */ if (shsurf->surface) { @@ -851,14 +853,14 @@ destroy_shell_surface(struct wl_resource *resource) static void shell_handle_surface_destroy(struct wl_listener *listener, - struct wl_resource *resource, uint32_t time) + struct wl_resource *resource) { struct shell_surface *shsurf = container_of(listener, struct shell_surface, surface_destroy_listener); shsurf->surface = NULL; - wl_resource_destroy(&shsurf->resource, time); + wl_resource_destroy(&shsurf->resource); } static struct shell_surface * @@ -1036,8 +1038,7 @@ desktop_shell_set_background(struct wl_client *client, weston_surface_set_position(surface, shsurf->output->x, shsurf->output->y); - desktop_shell_send_configure(resource, - weston_compositor_get_time(), 0, + desktop_shell_send_configure(resource, 0, surface_resource, shsurf->output->current->width, shsurf->output->current->height); @@ -1074,8 +1075,7 @@ desktop_shell_set_panel(struct wl_client *client, weston_surface_set_position(surface, shsurf->output->x, shsurf->output->y); - desktop_shell_send_configure(resource, - weston_compositor_get_time(), 0, + desktop_shell_send_configure(resource, 0, surface_resource, shsurf->output->current->width, shsurf->output->current->height); @@ -1083,7 +1083,7 @@ desktop_shell_set_panel(struct wl_client *client, static void handle_lock_surface_destroy(struct wl_listener *listener, - struct wl_resource *resource, uint32_t time) + struct wl_resource *resource) { struct wl_shell *shell = container_of(listener, struct wl_shell, lock_surface_listener); @@ -1190,7 +1190,7 @@ move_binding(struct wl_input_device *device, uint32_t time, break; } - weston_surface_move(surface, (struct weston_input_device *) device, time); + weston_surface_move(surface, (struct weston_input_device *) device); } static void @@ -1238,7 +1238,7 @@ resize_binding(struct wl_input_device *device, uint32_t time, edges |= WL_SHELL_SURFACE_RESIZE_BOTTOM; weston_surface_resize(shsurf, (struct weston_input_device *) device, - time, edges); + edges); } static void @@ -1396,7 +1396,7 @@ rotate_grab_button(struct wl_pointer_grab *grab, weston_matrix_multiply(&shsurf->rotation.rotation, &rotate->rotation); shell_grab_finish(&rotate->base); - wl_input_device_end_pointer_grab(device, time); + wl_input_device_end_pointer_grab(device); free(rotate); } } @@ -1446,7 +1446,7 @@ rotate_binding(struct wl_input_device *device, uint32_t time, surface->surface->geometry.height / 2, &rotate->center.x, &rotate->center.y); - wl_input_device_start_pointer_grab(device, &rotate->base.grab, time); + wl_input_device_start_pointer_grab(device, &rotate->base.grab); dx = device->x - rotate->center.x; dy = device->y - rotate->center.y; @@ -1471,18 +1471,18 @@ rotate_binding(struct wl_input_device *device, uint32_t time, weston_matrix_init(&rotate->rotation); } - wl_input_device_set_pointer_focus(device, NULL, time, 0, 0); + wl_input_device_set_pointer_focus(device, NULL, 0, 0); } static void activate(struct weston_shell *base, struct weston_surface *es, - struct weston_input_device *device, uint32_t time) + struct weston_input_device *device) { struct wl_shell *shell = container_of(base, struct wl_shell, shell); struct weston_compositor *compositor = shell->compositor; struct weston_surface *surf, *prev; - weston_surface_activate(es, device, time); + weston_surface_activate(es, device); if (compositor->wxs) weston_xserver_surface_activate(es); @@ -1555,7 +1555,7 @@ click_to_activate_binding(struct wl_input_device *device, focus = upper; if (state && device->pointer_grab == &device->default_pointer_grab) - activate(compositor->shell, focus, wd, time); + activate(compositor->shell, focus, wd); } static void @@ -1565,7 +1565,6 @@ lock(struct weston_shell *base) struct weston_input_device *device; struct shell_surface *shsurf; struct weston_output *output; - uint32_t time; if (shell->locked) { wl_list_for_each(output, &shell->compositor->output_list, link) @@ -1602,10 +1601,9 @@ lock(struct weston_shell *base) weston_compositor_schedule_repaint(shell->compositor); /* reset keyboard foci */ - time = weston_compositor_get_time(); wl_list_for_each(device, &shell->compositor->input_device_list, link) { wl_input_device_set_keyboard_focus(&device->input_device, - NULL, time); + NULL); } /* TODO: disable bindings that should not work while locked. */ @@ -1753,8 +1751,7 @@ map(struct weston_shell *base, struct weston_surface *surface, if (!shell->locked) activate(base, surface, (struct weston_input_device *) - compositor->input_device, - weston_compositor_get_time()); + compositor->input_device); break; default: break; @@ -1924,7 +1921,7 @@ bind_desktop_shell(struct wl_client *client, wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, "permission to bind desktop_shell denied"); - wl_resource_destroy(resource, 0); + wl_resource_destroy(resource); } static void @@ -1979,7 +1976,7 @@ bind_screensaver(struct wl_client *client, wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, "interface object already bound"); - wl_resource_destroy(resource, 0); + wl_resource_destroy(resource); } struct switcher { @@ -2042,7 +2039,7 @@ switcher_next(struct switcher *switcher) static void switcher_handle_surface_destroy(struct wl_listener *listener, - struct wl_resource *resource, uint32_t time) + struct wl_resource *resource) { struct switcher *switcher = container_of(listener, struct switcher, listener); @@ -2064,9 +2061,9 @@ switcher_destroy(struct switcher *switcher, uint32_t time) } if (switcher->current) - activate(compositor->shell, switcher->current, device, time); + activate(compositor->shell, switcher->current, device); wl_list_remove(&switcher->listener.link); - wl_input_device_end_keyboard_grab(&device->input_device, time); + wl_input_device_end_keyboard_grab(&device->input_device); free(switcher); } @@ -2104,9 +2101,8 @@ switcher_binding(struct wl_input_device *device, uint32_t time, wl_list_init(&switcher->listener.link); switcher->grab.interface = &switcher_grab; - wl_input_device_start_keyboard_grab(device, &switcher->grab, time); - wl_input_device_set_keyboard_focus(device, NULL, - weston_compositor_get_time()); + wl_input_device_start_keyboard_grab(device, &switcher->grab); + wl_input_device_set_keyboard_focus(device, NULL); switcher_next(switcher); } diff --git a/src/tablet-shell.c b/src/tablet-shell.c index 51b1663..fc908ab 100644 --- a/src/tablet-shell.c +++ b/src/tablet-shell.c @@ -151,7 +151,7 @@ tablet_shell_surface_configure(struct weston_surface *surface, static void handle_lockscreen_surface_destroy(struct wl_listener *listener, - struct wl_resource *resource, uint32_t time) + struct wl_resource *resource) { struct tablet_shell *shell = container_of(listener, @@ -179,7 +179,7 @@ tablet_shell_set_lockscreen(struct wl_client *client, static void handle_switcher_surface_destroy(struct wl_listener *listener, - struct wl_resource *resource, uint32_t time) + struct wl_resource *resource) { struct tablet_shell *shell = container_of(listener, @@ -231,8 +231,7 @@ minimize_zoom_done(struct weston_zoom *zoom, void *data) struct weston_input_device *device = (struct weston_input_device *) compositor->input_device; - weston_surface_activate(shell->home_surface, - device, weston_compositor_get_time()); + weston_surface_activate(shell->home_surface, device); } static void @@ -259,8 +258,7 @@ tablet_shell_switch_to(struct tablet_shell *shell, } } else { fprintf(stderr, "switch to %p\n", surface); - weston_surface_activate(surface, device, - weston_compositor_get_time()); + weston_surface_activate(surface, device); tablet_shell_set_state(shell, STATE_TASK); weston_zoom_run(surface, 0.3, 1.0, NULL, NULL); } @@ -302,7 +300,7 @@ static void tablet_client_destroy(struct wl_client *client, struct wl_resource *resource) { - wl_resource_destroy(resource, weston_compositor_get_time()); + wl_resource_destroy(resource); } static void @@ -423,8 +421,7 @@ go_home(struct tablet_shell *shell) if (shell->state == STATE_SWITCHER) tablet_shell_send_hide_switcher(&shell->resource); - weston_surface_activate(shell->home_surface, device, - weston_compositor_get_time()); + weston_surface_activate(shell->home_surface, device); tablet_shell_set_state(shell, STATE_HOME); } diff --git a/src/util.c b/src/util.c index 11fa5ff..d21c275 100644 --- a/src/util.c +++ b/src/util.c @@ -110,7 +110,7 @@ weston_zoom_destroy(struct weston_zoom *zoom) static void handle_zoom_surface_destroy(struct wl_listener *listener, - struct wl_resource *resource, uint32_t time) + struct wl_resource *resource) { struct weston_zoom *zoom = container_of(listener, struct weston_zoom, listener); @@ -246,16 +246,20 @@ binding_key(struct wl_keyboard_grab *grab, struct binding_keyboard_grab *b = container_of(grab, struct binding_keyboard_grab, grab); struct wl_resource *resource; + struct wl_display *display; + uint32_t serial; resource = grab->input_device->keyboard_focus_resource; if (key == b->key) { if (!state) { - wl_input_device_end_keyboard_grab(grab->input_device, - time); + wl_input_device_end_keyboard_grab(grab->input_device); free(b); } - } else if (resource) - wl_input_device_send_key(resource, time, key, state); + } else if (resource) { + display = wl_client_get_display(resource->client); + serial = wl_display_next_serial(display); + wl_input_device_send_key(resource, serial, time, key, state); + } } static const struct wl_keyboard_grab_interface binding_grab = { @@ -271,7 +275,7 @@ install_binding_grab(struct wl_input_device *device, grab = malloc(sizeof *grab); grab->key = key; grab->grab.interface = &binding_grab; - wl_input_device_start_keyboard_grab(device, &grab->grab, time); + wl_input_device_start_keyboard_grab(device, &grab->grab); } WL_EXPORT void diff --git a/src/xserver-launcher.c b/src/xserver-launcher.c index 88ceb0c..09b4dc6 100644 --- a/src/xserver-launcher.c +++ b/src/xserver-launcher.c @@ -273,7 +273,7 @@ data_offer_receive(struct wl_client *client, struct wl_resource *resource, static void data_offer_destroy(struct wl_client *client, struct wl_resource *resource) { - wl_resource_destroy(resource, weston_compositor_get_time()); + wl_resource_destroy(resource); } static const struct wl_data_offer_interface data_offer_interface = { @@ -335,8 +335,7 @@ weston_wm_get_selection_targets(struct weston_wm *wm) } device = wm->server->compositor->input_device; - wl_input_device_set_selection(device, source, - weston_compositor_get_time()); + wl_input_device_set_selection(device, source); free(reply); } @@ -1481,8 +1480,7 @@ weston_xserver_cleanup(struct weston_process *process, int status) } static void -surface_destroy(struct wl_listener *listener, - struct wl_resource *resource, uint32_t time) +surface_destroy(struct wl_listener *listener, struct wl_resource *resource) { struct weston_wm_window *window = container_of(listener, -- 2.7.4