Follow wayland change to serial numbers

dev
Kristian Høgsberg 13 years ago
parent ee4b4cb933
commit eae5de7609
  1. 17
      clients/desktop-shell.c
  2. 13
      clients/dnd.c
  3. 3
      clients/flower.c
  4. 19
      clients/simple-touch.c
  5. 96
      clients/window.c
  6. 11
      clients/window.h
  7. 1
      protocol/desktop-shell.xml
  8. 12
      src/compositor-drm.c
  9. 17
      src/compositor-wayland.c
  10. 13
      src/compositor-x11.c
  11. 75
      src/compositor.c
  12. 6
      src/compositor.h
  13. 6
      src/evdev.c
  14. 2
      src/screenshooter.c
  15. 112
      src/shell.c
  16. 15
      src/tablet-shell.c
  17. 16
      src/util.c
  18. 8
      src/xserver-launcher.c

@ -50,8 +50,7 @@ struct desktop {
struct surface { struct surface {
void (*configure)(void *data, void (*configure)(void *data,
struct desktop_shell *desktop_shell, struct desktop_shell *desktop_shell,
uint32_t time, uint32_t edges, uint32_t edges, struct window *window,
struct window *window,
int32_t width, int32_t height); int32_t width, int32_t height);
}; };
@ -234,7 +233,7 @@ panel_redraw_handler(struct widget *widget, void *data)
static int 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) int32_t x, int32_t y, void *data)
{ {
struct panel_launcher *launcher = data; struct panel_launcher *launcher = data;
@ -300,8 +299,7 @@ panel_resize_handler(struct widget *widget,
static void static void
panel_configure(void *data, panel_configure(void *data,
struct desktop_shell *desktop_shell, struct desktop_shell *desktop_shell,
uint32_t time, uint32_t edges, uint32_t edges, struct window *window,
struct window *window,
int32_t width, int32_t height) int32_t width, int32_t height)
{ {
struct surface *surface = window_get_user_data(window); struct surface *surface = window_get_user_data(window);
@ -424,8 +422,7 @@ background_draw(struct widget *widget, void *data)
static void static void
background_configure(void *data, background_configure(void *data,
struct desktop_shell *desktop_shell, struct desktop_shell *desktop_shell,
uint32_t time, uint32_t edges, uint32_t edges, struct window *window,
struct window *window,
int32_t width, int32_t height) int32_t width, int32_t height)
{ {
struct background *background = struct background *background =
@ -506,7 +503,7 @@ unlock_dialog_keyboard_focus_handler(struct window *window,
static int 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,
int32_t x, int32_t y, void *data) int32_t x, int32_t y, void *data)
{ {
struct unlock_dialog *dialog = data; struct unlock_dialog *dialog = data;
@ -585,14 +582,14 @@ unlock_dialog_finish(struct task *task, uint32_t events)
static void static void
desktop_shell_configure(void *data, desktop_shell_configure(void *data,
struct desktop_shell *desktop_shell, struct desktop_shell *desktop_shell,
uint32_t time, uint32_t edges, uint32_t edges,
struct wl_shell_surface *shell_surface, struct wl_shell_surface *shell_surface,
int32_t width, int32_t height) int32_t width, int32_t height)
{ {
struct window *window = wl_shell_surface_get_user_data(shell_surface); struct window *window = wl_shell_surface_get_user_data(shell_surface);
struct surface *s = window_get_user_data(window); 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 static void

@ -372,6 +372,7 @@ dnd_button_handler(struct widget *widget,
struct wl_compositor *compositor; struct wl_compositor *compositor;
struct wl_buffer *buffer; struct wl_buffer *buffer;
unsigned int i; unsigned int i;
uint32_t serial;
widget_get_allocation(dnd->widget, &allocation); widget_get_allocation(dnd->widget, &allocation);
input_get_position(input, &x, &y); input_get_position(input, &x, &y);
@ -397,6 +398,7 @@ dnd_button_handler(struct widget *widget,
display = window_get_display(dnd->window); display = window_get_display(dnd->window);
compositor = display_get_compositor(display); compositor = display_get_compositor(display);
serial = display_get_serial(display);
dnd_drag->drag_surface = dnd_drag->drag_surface =
wl_compositor_create_surface(compositor); wl_compositor_create_surface(compositor);
@ -413,7 +415,7 @@ dnd_button_handler(struct widget *widget,
dnd_drag->data_source, dnd_drag->data_source,
window_get_wl_surface(dnd->window), window_get_wl_surface(dnd->window),
dnd_drag->drag_surface, dnd_drag->drag_surface,
time); serial);
input_set_pointer_image(input, time, POINTER_DRAGGING); input_set_pointer_image(input, time, POINTER_DRAGGING);
@ -446,8 +448,7 @@ lookup_cursor(struct dnd *dnd, int x, int y)
static int static int
dnd_enter_handler(struct widget *widget, dnd_enter_handler(struct widget *widget,
struct input *input, uint32_t time, struct input *input, int32_t x, int32_t y, void *data)
int32_t x, int32_t y, void *data)
{ {
return lookup_cursor(data, x, y); return lookup_cursor(data, x, y);
} }
@ -462,15 +463,15 @@ dnd_motion_handler(struct widget *widget,
static void static void
dnd_data_handler(struct window *window, 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) int32_t x, int32_t y, const char **types, void *data)
{ {
struct dnd *dnd = data; struct dnd *dnd = data;
if (!dnd_get_item(dnd, x, y)) { if (!dnd_get_item(dnd, x, y)) {
input_accept(input, time, types[0]); input_accept(input, types[0]);
} else { } else {
input_accept(input, time, NULL); input_accept(input, NULL);
} }
} }

@ -149,7 +149,8 @@ button_handler(struct widget *widget,
switch (button) { switch (button) {
case BTN_LEFT: case BTN_LEFT:
if (state) if (state)
window_move(flower->window, input, time); window_move(flower->window, input,
display_get_serial(flower->display));
break; break;
case BTN_MIDDLE: case BTN_MIDDLE:
if (state) if (state)

@ -110,7 +110,8 @@ input_device_handle_motion(void *data, struct wl_input_device *input_device,
static void static void
input_device_handle_button(void *data, input_device_handle_button(void *data,
struct wl_input_device *input_device, 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 static void
input_device_handle_key(void *data, struct wl_input_device *input_device, 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 static void
input_device_handle_pointer_enter(void *data, input_device_handle_pointer_enter(void *data,
struct wl_input_device *input_device, 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) int32_t sx, int32_t sy)
{ {
} }
@ -137,14 +139,14 @@ input_device_handle_pointer_enter(void *data,
static void static void
input_device_handle_pointer_leave(void *data, input_device_handle_pointer_leave(void *data,
struct wl_input_device *input_device, struct wl_input_device *input_device,
uint32_t time, struct wl_surface *surface) uint32_t serial, struct wl_surface *surface)
{ {
} }
static void static void
input_device_handle_keyboard_enter(void *data, input_device_handle_keyboard_enter(void *data,
struct wl_input_device *input_device, struct wl_input_device *input_device,
uint32_t time, uint32_t serial,
struct wl_surface *surface, struct wl_surface *surface,
struct wl_array *keys) struct wl_array *keys)
{ {
@ -153,7 +155,7 @@ input_device_handle_keyboard_enter(void *data,
static void static void
input_device_handle_keyboard_leave(void *data, input_device_handle_keyboard_leave(void *data,
struct wl_input_device *input_device, struct wl_input_device *input_device,
uint32_t time, uint32_t serial,
struct wl_surface *surface) struct wl_surface *surface)
{ {
} }
@ -193,7 +195,8 @@ touch_paint(struct touch *touch, int32_t x, int32_t y, int32_t id)
static void static void
input_device_handle_touch_down(void *data, input_device_handle_touch_down(void *data,
struct wl_input_device *wl_input_device, 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) int32_t id, int32_t x, int32_t y)
{ {
struct touch *touch = data; struct touch *touch = data;
@ -204,7 +207,7 @@ input_device_handle_touch_down(void *data,
static void static void
input_device_handle_touch_up(void *data, input_device_handle_touch_up(void *data,
struct wl_input_device *wl_input_device, struct wl_input_device *wl_input_device,
uint32_t time, int32_t id) uint32_t serial, uint32_t time, int32_t id)
{ {
} }

@ -74,6 +74,7 @@ struct display {
EGLConfig argb_config; EGLConfig argb_config;
EGLContext argb_ctx; EGLContext argb_ctx;
cairo_device_t *argb_device; cairo_device_t *argb_device;
uint32_t serial;
int display_fd; int display_fd;
uint32_t mask; uint32_t mask;
@ -172,6 +173,7 @@ struct input {
struct window *keyboard_focus; struct window *keyboard_focus;
int current_pointer_image; int current_pointer_image;
uint32_t modifiers; uint32_t modifiers;
uint32_t pointer_enter_serial;
int32_t sx, sy; int32_t sx, sy;
struct wl_list link; struct wl_list link;
@ -1170,8 +1172,7 @@ window_show_frame_menu(struct window *window,
static int static int
frame_enter_handler(struct widget *widget, frame_enter_handler(struct widget *widget,
struct input *input, uint32_t time, struct input *input, int32_t x, int32_t y, void *data)
int32_t x, int32_t y, void *data)
{ {
return frame_get_pointer_image_for_location(data, input); return frame_get_pointer_image_for_location(data, input);
} }
@ -1203,10 +1204,10 @@ frame_button_handler(struct widget *widget,
if (!window->shell_surface) if (!window->shell_surface)
break; break;
input_set_pointer_image(input, time, POINTER_DRAGGING); input_set_pointer_image(input, time, POINTER_DRAGGING);
input_ungrab(input, time); input_ungrab(input);
wl_shell_surface_move(window->shell_surface, wl_shell_surface_move(window->shell_surface,
input_get_input_device(input), input_get_input_device(input),
time); display->serial);
break; break;
case WINDOW_RESIZING_TOP: case WINDOW_RESIZING_TOP:
case WINDOW_RESIZING_BOTTOM: case WINDOW_RESIZING_BOTTOM:
@ -1218,7 +1219,7 @@ frame_button_handler(struct widget *widget,
case WINDOW_RESIZING_BOTTOM_RIGHT: case WINDOW_RESIZING_BOTTOM_RIGHT:
if (!window->shell_surface) if (!window->shell_surface)
break; break;
input_ungrab(input, time); input_ungrab(input);
if (!display->dpy) { if (!display->dpy) {
/* If we're using shm, allocate a big /* 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, wl_shell_surface_resize(window->shell_surface,
input_get_input_device(input), input_get_input_device(input),
time, location); display->serial, location);
break; break;
} }
} else if (button == BTN_RIGHT && state == 1) { } else if (button == BTN_RIGHT && state == 1) {
@ -1276,7 +1277,7 @@ frame_destroy(struct frame *frame)
static void static void
input_set_focus_widget(struct input *input, struct widget *focus, 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; struct widget *old, *widget;
int pointer = POINTER_LEFT_PTR; int pointer = POINTER_LEFT_PTR;
@ -1299,12 +1300,12 @@ input_set_focus_widget(struct input *input, struct widget *focus,
if (input->grab) if (input->grab)
widget = input->grab; widget = input->grab;
if (widget->enter_handler) if (widget->enter_handler)
pointer = widget->enter_handler(focus, input, time, pointer = widget->enter_handler(focus, input, x, y,
x, y,
widget->user_data); widget->user_data);
input->focus_widget = focus; 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)) { if (!(input->grab && input->grab_button)) {
widget = widget_find_widget(window->widget, sx, 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);
} }
if (input->grab) if (input->grab)
@ -1345,7 +1346,7 @@ input_grab(struct input *input, struct widget *widget, uint32_t button)
} }
void void
input_ungrab(struct input *input, uint32_t time) input_ungrab(struct input *input)
{ {
struct widget *widget; struct widget *widget;
@ -1353,19 +1354,19 @@ input_ungrab(struct input *input, uint32_t time)
if (input->pointer_focus) { if (input->pointer_focus) {
widget = widget_find_widget(input->pointer_focus->widget, widget = widget_find_widget(input->pointer_focus->widget,
input->sx, input->sy); input->sx, input->sy);
input_set_focus_widget(input, widget, input_set_focus_widget(input, widget, input->sx, input->sy);
time, input->sx, input->sy);
} }
} }
static void static void
input_handle_button(void *data, 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) uint32_t time, uint32_t button, uint32_t state)
{ {
struct input *input = data; struct input *input = data;
struct widget *widget; struct widget *widget;
input->display->serial = serial;
if (input->focus_widget && input->grab == NULL && state) if (input->focus_widget && input->grab == NULL && state)
input_grab(input, input->focus_widget, button); input_grab(input, input->focus_widget, button);
@ -1377,7 +1378,7 @@ input_handle_button(void *data,
input->grab->user_data); input->grab->user_data);
if (input->grab && input->grab_button == button && !state) if (input->grab && input->grab_button == button && !state)
input_ungrab(input, time); input_ungrab(input);
} }
static void static void
@ -1389,13 +1390,14 @@ input_handle_axis(void *data,
static void static void
input_handle_key(void *data, struct wl_input_device *input_device, 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 input *input = data;
struct window *window = input->keyboard_focus; struct window *window = input->keyboard_focus;
struct display *d = input->display; struct display *d = input->display;
uint32_t code, sym, level; uint32_t code, sym, level;
input->display->serial = serial;
code = key + 8; code = key + 8;
if (!window || window->keyboard_device != input) if (!window || window->keyboard_device != input)
return; return;
@ -1423,14 +1425,14 @@ input_handle_key(void *data, struct wl_input_device *input_device,
} }
static void 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; struct window *window = input->pointer_focus;
if (!window) if (!window)
return; return;
input_set_focus_widget(input, NULL, 0, 0, 0); input_set_focus_widget(input, NULL, 0, 0);
input->pointer_focus = NULL; input->pointer_focus = NULL;
input->current_pointer_image = POINTER_UNSET; input->current_pointer_image = POINTER_UNSET;
@ -1439,13 +1441,15 @@ input_remove_pointer_focus(struct input *input, uint32_t time)
static void static void
input_handle_pointer_enter(void *data, input_handle_pointer_enter(void *data,
struct wl_input_device *input_device, 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) int32_t sx, int32_t sy)
{ {
struct input *input = data; struct input *input = data;
struct window *window; struct window *window;
struct widget *widget; struct widget *widget;
input->display->serial = serial;
input->pointer_enter_serial = serial;
input->pointer_focus = wl_surface_get_user_data(surface); input->pointer_focus = wl_surface_get_user_data(surface);
window = input->pointer_focus; window = input->pointer_focus;
@ -1461,17 +1465,18 @@ input_handle_pointer_enter(void *data,
input->sy = sy; input->sy = sy;
widget = widget_find_widget(window->widget, sx, 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 static void
input_handle_pointer_leave(void *data, input_handle_pointer_leave(void *data,
struct wl_input_device *input_device, struct wl_input_device *input_device,
uint32_t time, struct wl_surface *surface) uint32_t serial, struct wl_surface *surface)
{ {
struct input *input = data; struct input *input = data;
input_remove_pointer_focus(input, time); input->display->serial = serial;
input_remove_pointer_focus(input);
} }
static void static void
@ -1493,7 +1498,7 @@ input_remove_keyboard_focus(struct input *input)
static void static void
input_handle_keyboard_enter(void *data, input_handle_keyboard_enter(void *data,
struct wl_input_device *input_device, struct wl_input_device *input_device,
uint32_t time, uint32_t serial,
struct wl_surface *surface, struct wl_surface *surface,
struct wl_array *keys) struct wl_array *keys)
{ {
@ -1502,6 +1507,7 @@ input_handle_keyboard_enter(void *data,
struct display *d = input->display; struct display *d = input->display;
uint32_t *k, *end; uint32_t *k, *end;
input->display->serial = serial;
input->keyboard_focus = wl_surface_get_user_data(surface); input->keyboard_focus = wl_surface_get_user_data(surface);
end = keys->data + keys->size; end = keys->data + keys->size;
@ -1520,18 +1526,20 @@ input_handle_keyboard_enter(void *data,
static void static void
input_handle_keyboard_leave(void *data, input_handle_keyboard_leave(void *data,
struct wl_input_device *input_device, struct wl_input_device *input_device,
uint32_t time, uint32_t serial,
struct wl_surface *surface) struct wl_surface *surface)
{ {
struct input *input = data; struct input *input = data;
input->display->serial = serial;
input_remove_keyboard_focus(input); input_remove_keyboard_focus(input);
} }
static void static void
input_handle_touch_down(void *data, input_handle_touch_down(void *data,
struct wl_input_device *wl_input_device, 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) int32_t id, int32_t x, int32_t y)
{ {
} }
@ -1539,7 +1547,7 @@ input_handle_touch_down(void *data,
static void static void
input_handle_touch_up(void *data, input_handle_touch_up(void *data,
struct wl_input_device *wl_input_device, 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 static void
data_device_enter(void *data, struct wl_data_device *data_device, 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) int32_t x, int32_t y, struct wl_data_offer *offer)
{ {
struct input *input = data; struct input *input = data;
struct window *window; struct window *window;
char **p; char **p;
input->pointer_enter_serial = serial;
input->drag_offer = wl_data_offer_get_user_data(offer); input->drag_offer = wl_data_offer_get_user_data(offer);
window = wl_surface_get_user_data(surface); window = wl_surface_get_user_data(surface);
input->pointer_focus = window; input->pointer_focus = window;
@ -1684,7 +1693,7 @@ data_device_enter(void *data, struct wl_data_device *data_device,
window = input->pointer_focus; window = input->pointer_focus;
if (window->data_handler) if (window->data_handler)
window->data_handler(window, input, time, x, y, window->data_handler(window, input, x, y,
input->drag_offer->types.data, input->drag_offer->types.data,
window->user_data); window->user_data);
} }
@ -1709,7 +1718,7 @@ data_device_motion(void *data, struct wl_data_device *data_device,
input->sy = y; input->sy = y;
if (window->data_handler) if (window->data_handler)
window->data_handler(window, input, time, x, y, window->data_handler(window, input, x, y,
input->drag_offer->types.data, input->drag_offer->types.data,
window->user_data); window->user_data);
} }
@ -1788,9 +1797,10 @@ input_set_selection(struct input *input,
} }
void 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 static void
@ -1873,13 +1883,13 @@ input_receive_selection_data_to_fd(struct input *input,
} }
void 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) if (!window->shell_surface)
return; return;
wl_shell_surface_move(window->shell_surface, wl_shell_surface_move(window->shell_surface,
input->input_device, time); input->input_device, serial);
} }
static void static void
@ -1938,8 +1948,7 @@ widget_schedule_resize(struct widget *widget, int32_t width, int32_t height)
static void static void
handle_configure(void *data, struct wl_shell_surface *shell_surface, handle_configure(void *data, struct wl_shell_surface *shell_surface,
uint32_t time, uint32_t edges, uint32_t edges, int32_t width, int32_t height)
int32_t width, int32_t height)
{ {
struct window *window = data; struct window *window = data;
@ -1970,7 +1979,7 @@ handle_popup_done(void *data, struct wl_shell_surface *shell_surface)
* time. */ * time. */
menu->func(window->parent, menu->current, window->parent->user_data); menu->func(window->parent, menu->current, window->parent->user_data);
input_ungrab(menu->input, 0); input_ungrab(menu->input);
menu_destroy(menu); menu_destroy(menu);
} }
@ -2272,8 +2281,7 @@ menu_motion_handler(struct widget *widget,
static int static int
menu_enter_handler(struct widget *widget, menu_enter_handler(struct widget *widget,
struct input *input, uint32_t time, struct input *input, int32_t x, int32_t y, void *data)
int32_t x, int32_t y, void *data)
{ {
struct menu *menu = data; struct menu *menu = data;
@ -2305,7 +2313,7 @@ menu_button_handler(struct widget *widget,
* click-motion-click. */ * click-motion-click. */
menu->func(menu->window->parent, menu->func(menu->window->parent,
menu->current, menu->window->parent->user_data); menu->current, menu->window->parent->user_data);
input_ungrab(input, time); input_ungrab(input);
menu_destroy(menu); menu_destroy(menu);
} }
} }
@ -2552,7 +2560,7 @@ static void
input_destroy(struct input *input) input_destroy(struct input *input)
{ {
input_remove_keyboard_focus(input); input_remove_keyboard_focus(input);
input_remove_pointer_focus(input, 0); input_remove_pointer_focus(input);
if (input->drag_offer) if (input->drag_offer)
data_offer_destroy(input->drag_offer); data_offer_destroy(input->drag_offer);
@ -2911,6 +2919,12 @@ display_get_compositor(struct display *display)
return display->compositor; return display->compositor;
} }
uint32_t
display_get_serial(struct display *display)
{
return display->serial;
}
EGLDisplay EGLDisplay
display_get_egl_display(struct display *d) display_get_egl_display(struct display *d)
{ {

@ -70,6 +70,9 @@ display_get_shell(struct display *display);
struct output * struct output *
display_get_output(struct display *display); 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); 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); struct input *device, void *data);
typedef void (*window_data_handler_t)(struct window *window, typedef void (*window_data_handler_t)(struct window *window,
struct input *input, uint32_t time, struct input *input,
int32_t x, int32_t y, int32_t x, int32_t y,
const char **types, const char **types,
void *data); 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 void (*widget_redraw_handler_t)(struct widget *widget, void *data);
typedef int (*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,
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);
@ -362,7 +365,7 @@ void
input_grab(struct input *input, struct widget *widget, uint32_t button); input_grab(struct input *input, struct widget *widget, uint32_t button);
void void
input_ungrab(struct input *input, uint32_t time); input_ungrab(struct input *input);
struct widget * struct widget *
input_get_focus_widget(struct input *input); 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); struct wl_data_source *source, uint32_t time);
void void
input_accept(struct input *input, uint32_t time, const char *type); input_accept(struct input *input, const char *type);
void void

@ -20,7 +20,6 @@
<!-- We'll fold most of wl_shell into this interface and then <!-- We'll fold most of wl_shell into this interface and then
they'll share the configure event. --> they'll share the configure event. -->
<event name="configure"> <event name="configure">
<arg name="time" type="uint"/>
<arg name="edges" type="uint"/> <arg name="edges" type="uint"/>
<arg name="surface" type="object" interface="wl_shell_surface"/> <arg name="surface" type="object" interface="wl_shell_surface"/>
<arg name="width" type="int"/> <arg name="width" type="int"/>

@ -917,8 +917,7 @@ drm_subpixel_to_wayland(int drm_value)
static void static void
output_handle_scanout_buffer_destroy(struct wl_listener *listener, output_handle_scanout_buffer_destroy(struct wl_listener *listener,
struct wl_resource *resource, struct wl_resource *resource)
uint32_t time)
{ {
struct drm_output *output = struct drm_output *output =
container_of(listener, struct drm_output, container_of(listener, struct drm_output,
@ -932,8 +931,7 @@ output_handle_scanout_buffer_destroy(struct wl_listener *listener,
static void static void
output_handle_pending_scanout_buffer_destroy(struct wl_listener *listener, output_handle_pending_scanout_buffer_destroy(struct wl_listener *listener,
struct wl_resource *resource, struct wl_resource *resource)
uint32_t time)
{ {
struct drm_output *output = struct drm_output *output =
container_of(listener, struct drm_output, container_of(listener, struct drm_output,
@ -946,8 +944,7 @@ output_handle_pending_scanout_buffer_destroy(struct wl_listener *listener,
static void static void
sprite_handle_buffer_destroy(struct wl_listener *listener, sprite_handle_buffer_destroy(struct wl_listener *listener,
struct wl_resource *resource, struct wl_resource *resource)
uint32_t time)
{ {
struct drm_sprite *sprite = struct drm_sprite *sprite =
container_of(listener, struct drm_sprite, container_of(listener, struct drm_sprite,
@ -958,8 +955,7 @@ sprite_handle_buffer_destroy(struct wl_listener *listener,
static void static void
sprite_handle_pending_buffer_destroy(struct wl_listener *listener, sprite_handle_pending_buffer_destroy(struct wl_listener *listener,
struct wl_resource *resource, struct wl_resource *resource)
uint32_t time)
{ {
struct drm_sprite *sprite = struct drm_sprite *sprite =
container_of(listener, struct drm_sprite, container_of(listener, struct drm_sprite,

@ -530,8 +530,8 @@ input_handle_motion(void *data, struct wl_input_device *input_device,
static void static void
input_handle_button(void *data, input_handle_button(void *data,
struct wl_input_device *input_device, 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)
{ {
struct wayland_input *input = data; struct wayland_input *input = data;
struct wayland_compositor *c = input->compositor; struct wayland_compositor *c = input->compositor;
@ -541,7 +541,7 @@ input_handle_button(void *data,
static void static void
input_handle_axis(void *data, struct wl_input_device *input_device, 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_input *input = data;
struct wayland_compositor *c = input->compositor; struct wayland_compositor *c = input->compositor;
@ -551,7 +551,7 @@ input_handle_axis(void *data, struct wl_input_device *input_device,
static void static void
input_handle_key(void *data, struct wl_input_device *input_device, 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_input *input = data;
struct wayland_compositor *c = input->compositor; struct wayland_compositor *c = input->compositor;
@ -570,8 +570,7 @@ input_handle_pointer_enter(void *data,
struct wayland_compositor *c = input->compositor; struct wayland_compositor *c = input->compositor;
output = wl_surface_get_user_data(surface); output = wl_surface_get_user_data(surface);
notify_pointer_focus(c->base.input_device, notify_pointer_focus(c->base.input_device, &output->base, sx, sy);
time, &output->base, sx, sy);
wl_input_device_attach(input->input_device, time, NULL, 0, 0); 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_input *input = data;
struct wayland_compositor *c = input->compositor; 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 static void
@ -596,7 +595,7 @@ input_handle_keyboard_enter(void *data,
struct wayland_input *input = data; struct wayland_input *input = data;
struct wayland_compositor *c = input->compositor; 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 static void
@ -608,7 +607,7 @@ input_handle_keyboard_leave(void *data,
struct wayland_input *input = data; struct wayland_input *input = data;
struct wayland_compositor *c = input->compositor; 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 = { static const struct wl_input_device_listener input_device_listener = {

@ -613,9 +613,7 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data)
} }
output = x11_compositor_find_output(c, focus_in->event); output = x11_compositor_find_output(c, focus_in->event);
notify_keyboard_focus(c->base.input_device, notify_keyboard_focus(c->base.input_device, &c->keys);
weston_compositor_get_time(),
&c->keys);
free(prev); free(prev);
prev = NULL; prev = NULL;
@ -664,7 +662,6 @@ x11_compositor_handle_event(int fd, uint32_t mask, void *data)
break; break;
output = x11_compositor_find_output(c, enter_notify->event); output = x11_compositor_find_output(c, enter_notify->event);
notify_pointer_focus(c->base.input_device, notify_pointer_focus(c->base.input_device,
weston_compositor_get_time(),
&output->base, &output->base,
output->base.x + enter_notify->event_x, output->base.x + enter_notify->event_x,
output->base.y + enter_notify->event_y); 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) if (enter_notify->state >= Button1Mask)
break; break;
output = x11_compositor_find_output(c, enter_notify->event); output = x11_compositor_find_output(c, enter_notify->event);
notify_pointer_focus(c->base.input_device, notify_pointer_focus(c->base.input_device, NULL,
weston_compositor_get_time(),
NULL,
output->base.x + enter_notify->event_x, output->base.x + enter_notify->event_x,
output->base.y + enter_notify->event_y); output->base.y + enter_notify->event_y);
break; 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 || if (focus_in->mode == XCB_NOTIFY_MODE_WHILE_GRABBED ||
focus_in->mode == XCB_NOTIFY_MODE_UNGRAB) focus_in->mode == XCB_NOTIFY_MODE_UNGRAB)
break; break;
notify_keyboard_focus(c->base.input_device, notify_keyboard_focus(c->base.input_device, NULL);
weston_compositor_get_time(),
NULL);
break; break;
default: default:

@ -166,7 +166,7 @@ weston_client_launch(struct weston_compositor *compositor,
static void static void
surface_handle_buffer_destroy(struct wl_listener *listener, surface_handle_buffer_destroy(struct wl_listener *listener,
struct wl_resource *resource, uint32_t time) struct wl_resource *resource)
{ {
struct weston_surface *es = struct weston_surface *es =
container_of(listener, struct weston_surface, container_of(listener, struct weston_surface,
@ -548,11 +548,11 @@ weston_surface_is_mapped(struct weston_surface *surface)
WL_EXPORT uint32_t WL_EXPORT uint32_t
weston_compositor_get_time(void) 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 * static struct weston_surface *
@ -572,7 +572,7 @@ weston_compositor_pick_surface(struct weston_compositor *compositor,
} }
static void 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; struct weston_input_device *wd = (struct weston_input_device *) device;
const struct wl_pointer_grab_interface *interface; 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) { if (&surface->surface != device->current) {
interface = device->pointer_grab->interface; 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_x, device->current_y);
device->current = &surface->surface; device->current = &surface->surface;
} }
@ -600,14 +600,12 @@ WL_EXPORT void
weston_compositor_repick(struct weston_compositor *compositor) weston_compositor_repick(struct weston_compositor *compositor)
{ {
struct weston_input_device *device; struct weston_input_device *device;
uint32_t time;
if (!compositor->focus) if (!compositor->focus)
return; return;
time = weston_compositor_get_time();
wl_list_for_each(device, &compositor->input_device_list, link) 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 static void
@ -621,11 +619,9 @@ weston_surface_unmap(struct weston_surface *surface)
wl_list_remove(&surface->layer_link); wl_list_remove(&surface->layer_link);
if (device->keyboard_focus == &surface->surface) if (device->keyboard_focus == &surface->surface)
wl_input_device_set_keyboard_focus(device, NULL, wl_input_device_set_keyboard_focus(device, NULL);
weston_compositor_get_time());
if (device->pointer_focus == &surface->surface) if (device->pointer_focus == &surface->surface)
wl_input_device_set_pointer_focus(device, NULL, 0, 0, wl_input_device_set_pointer_focus(device, NULL, 0, 0);
weston_compositor_get_time());
weston_compositor_schedule_repaint(surface->compositor); 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_list_for_each_safe(cb, cnext, &output->frame_callback_list, link) {
wl_callback_send_done(&cb->resource, msecs); 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) 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 static void
surface_destroy(struct wl_client *client, struct wl_resource *resource) 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 WL_EXPORT void
@ -1322,7 +1318,7 @@ destroy_region(struct wl_resource *resource)
static void static void
region_destroy(struct wl_client *client, struct wl_resource *resource) region_destroy(struct wl_client *client, struct wl_resource *resource)
{ {
wl_resource_destroy(resource, weston_compositor_get_time()); wl_resource_destroy(resource);
} }
static void 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)) pixman_region32_contains_point(&output->region, x, y, NULL))
weston_output_update_zoom(output, x, y); weston_output_update_zoom(output, x, y);
weston_device_repick(device, time); weston_device_repick(device);
interface = device->pointer_grab->interface; interface = device->pointer_grab->interface;
interface->motion(device->pointer_grab, time, interface->motion(device->pointer_grab, time,
device->pointer_grab->x, device->pointer_grab->y); 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 WL_EXPORT void
weston_surface_activate(struct weston_surface *surface, 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, wl_input_device_set_keyboard_focus(&device->input_device,
&surface->surface, time); &surface->surface);
wl_data_device_set_keyboard_focus(&device->input_device); 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); 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 WL_EXPORT void
@ -1641,8 +1640,7 @@ notify_key(struct wl_input_device *device,
WL_EXPORT void WL_EXPORT void
notify_pointer_focus(struct wl_input_device *device, notify_pointer_focus(struct wl_input_device *device,
uint32_t time, struct weston_output *output, struct weston_output *output, int32_t x, int32_t y)
int32_t x, int32_t y)
{ {
struct weston_input_device *wd = (struct weston_input_device *) device; struct weston_input_device *wd = (struct weston_input_device *) device;
struct weston_compositor *compositor = wd->compositor; struct weston_compositor *compositor = wd->compositor;
@ -1663,7 +1661,7 @@ notify_pointer_focus(struct wl_input_device *device,
static void static void
destroy_device_saved_kbd_focus(struct wl_listener *listener, 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; struct weston_input_device *wd;
@ -1674,8 +1672,7 @@ destroy_device_saved_kbd_focus(struct wl_listener *listener,
} }
WL_EXPORT void WL_EXPORT void
notify_keyboard_focus(struct wl_input_device *device, notify_keyboard_focus(struct wl_input_device *device, struct wl_array *keys)
uint32_t time, struct wl_array *keys)
{ {
struct weston_input_device *wd = struct weston_input_device *wd =
(struct weston_input_device *) device; (struct weston_input_device *) device;
@ -1696,7 +1693,7 @@ notify_keyboard_focus(struct wl_input_device *device,
if (surface) { if (surface) {
wl_list_remove(&wd->saved_kbd_focus_listener.link); wl_list_remove(&wd->saved_kbd_focus_listener.link);
wl_input_device_set_keyboard_focus(&wd->input_device, wl_input_device_set_keyboard_focus(&wd->input_device,
surface, time); surface);
wd->saved_kbd_focus = NULL; wd->saved_kbd_focus = NULL;
} }
} else { } else {
@ -1715,12 +1712,11 @@ notify_keyboard_focus(struct wl_input_device *device,
&wd->saved_kbd_focus_listener.link); &wd->saved_kbd_focus_listener.link);
} }
wl_input_device_set_keyboard_focus(&wd->input_device, wl_input_device_set_keyboard_focus(&wd->input_device, NULL);
NULL, time);
/* FIXME: We really need keyboard grab cancel here to /* FIXME: We really need keyboard grab cancel here to
* let the grab shut down properly. As it is we leak * let the grab shut down properly. As it is we leak
* the grab data. */ * 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 static void
lose_touch_focus_resource(struct wl_listener *listener, lose_touch_focus_resource(struct wl_listener *listener,
struct wl_resource *resource, uint32_t time) struct wl_resource *resource)
{ {
struct weston_input_device *device = struct weston_input_device *device =
container_of(listener, struct weston_input_device, container_of(listener, struct weston_input_device,
@ -1754,7 +1750,7 @@ lose_touch_focus_resource(struct wl_listener *listener,
static void static void
lose_touch_focus(struct wl_listener *listener, lose_touch_focus(struct wl_listener *listener,
struct wl_resource *resource, uint32_t time) struct wl_resource *resource)
{ {
struct weston_input_device *device = struct weston_input_device *device =
container_of(listener, struct weston_input_device, container_of(listener, struct weston_input_device,
@ -1765,7 +1761,7 @@ lose_touch_focus(struct wl_listener *listener,
static void static void
touch_set_focus(struct weston_input_device *device, 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_input_device *input_device = &device->input_device;
struct wl_resource *resource; 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_compositor *ec = wd->compositor;
struct weston_surface *es; struct weston_surface *es;
int32_t sx, sy; int32_t sx, sy;
uint32_t serial = 0;
switch (touch_type) { switch (touch_type) {
case WL_INPUT_DEVICE_TOUCH_DOWN: 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. */ * until all touch points are up again. */
if (wd->num_tp == 1) { if (wd->num_tp == 1) {
es = weston_compositor_pick_surface(ec, x, y, &sx, &sy); 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) { } else if (wd->touch_focus) {
es = (struct weston_surface *) wd->touch_focus; es = (struct weston_surface *) wd->touch_focus;
weston_surface_from_global(es, x, y, &sx, &sy); 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) if (wd->touch_focus_resource && wd->touch_focus)
wl_input_device_send_touch_down(wd->touch_focus_resource, 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); touch_id, sx, sy);
break; break;
case WL_INPUT_DEVICE_TOUCH_MOTION: 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) if (wd->touch_focus_resource)
wl_input_device_send_touch_up(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) if (wd->num_tp == 0)
touch_set_focus(wd, NULL, time); touch_set_focus(wd, NULL);
break; break;
} }
} }
@ -1867,14 +1864,14 @@ notify_touch(struct wl_input_device *device, uint32_t time, int touch_id,
static void static void
input_device_attach(struct wl_client *client, input_device_attach(struct wl_client *client,
struct wl_resource *resource, struct wl_resource *resource,
uint32_t time, uint32_t serial,
struct wl_resource *buffer_resource, int32_t x, int32_t y) struct wl_resource *buffer_resource, int32_t x, int32_t y)
{ {
struct weston_input_device *device = resource->data; struct weston_input_device *device = resource->data;
struct weston_compositor *compositor = device->compositor; struct weston_compositor *compositor = device->compositor;
struct wl_buffer *buffer = NULL; struct wl_buffer *buffer = NULL;
if (time < device->input_device.pointer_focus_time) if (serial < device->input_device.pointer_focus_serial)
return; return;
if (device->input_device.pointer_focus == NULL) if (device->input_device.pointer_focus == NULL)
return; return;
@ -1913,7 +1910,7 @@ static const struct wl_input_device_interface input_device_interface = {
static void static void
handle_drag_surface_destroy(struct wl_listener *listener, handle_drag_surface_destroy(struct wl_listener *listener,
struct wl_resource *resource, uint32_t time) struct wl_resource *resource)
{ {
struct weston_input_device *device; struct weston_input_device *device;
@ -1944,7 +1941,7 @@ bind_input_device(struct wl_client *client,
static void static void
device_handle_new_drag_icon(struct wl_listener *listener, 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; struct weston_input_device *device;

@ -366,7 +366,7 @@ weston_spring_done(struct weston_spring *spring);
void void
weston_surface_activate(struct weston_surface *surface, weston_surface_activate(struct weston_surface *surface,
struct weston_input_device *device, uint32_t time); struct weston_input_device *device);
void void
weston_surface_draw(struct weston_surface *es, weston_surface_draw(struct weston_surface *es,
struct weston_output *output, pixman_region32_t *damage); struct weston_output *output, pixman_region32_t *damage);
@ -386,13 +386,11 @@ notify_key(struct wl_input_device *device,
void void
notify_pointer_focus(struct wl_input_device *device, notify_pointer_focus(struct wl_input_device *device,
uint32_t time,
struct weston_output *output, struct weston_output *output,
int32_t x, int32_t y); int32_t x, int32_t y);
void void
notify_keyboard_focus(struct wl_input_device *device, notify_keyboard_focus(struct wl_input_device *device, struct wl_array *keys);
uint32_t time, struct wl_array *keys);
void void
notify_touch(struct wl_input_device *device, uint32_t time, int touch_id, notify_touch(struct wl_input_device *device, uint32_t time, int touch_id,

@ -590,8 +590,7 @@ evdev_notify_keyboard_focus(struct evdev_input *input)
} }
} }
notify_keyboard_focus(&input->base.input_device, notify_keyboard_focus(&input->base.input_device, &keys);
weston_compositor_get_time(), &keys);
wl_array_release(&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) wl_list_for_each_safe(device, next, &input->devices_list, link)
device_removed(device); device_removed(device);
notify_keyboard_focus(&input->base.input_device, notify_keyboard_focus(&input->base.input_device, NULL);
weston_compositor_get_time(), NULL);
} }
void void

@ -94,7 +94,7 @@ bind_shooter(struct wl_client *client,
if (client != shooter->client) { if (client != shooter->client) {
wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
"screenshooter failed: permission denied"); "screenshooter failed: permission denied");
wl_resource_destroy(resource, 0); wl_resource_destroy(resource);
} }
} }

@ -152,7 +152,7 @@ struct rotate_grab {
static void static void
destroy_shell_grab_shsurf(struct wl_listener *listener, destroy_shell_grab_shsurf(struct wl_listener *listener,
struct wl_resource *resource, uint32_t time) struct wl_resource *resource)
{ {
struct shell_grab *grab; struct shell_grab *grab;
@ -213,7 +213,7 @@ shell_configuration(struct wl_shell *shell)
} }
static void 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) struct wl_surface *surface, int32_t x, int32_t y)
{ {
grab->focus = NULL; grab->focus = NULL;
@ -249,7 +249,7 @@ move_grab_button(struct wl_pointer_grab *grab,
if (device->button_count == 0 && state == 0) { if (device->button_count == 0 && state == 0) {
shell_grab_finish(shell_grab); shell_grab_finish(shell_grab);
wl_input_device_end_pointer_grab(device, time); wl_input_device_end_pointer_grab(device);
free(grab); free(grab);
} }
} }
@ -262,7 +262,7 @@ static const struct wl_pointer_grab_interface move_grab_interface = {
static int static int
weston_surface_move(struct weston_surface *es, 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 weston_move_grab *move;
struct shell_surface *shsurf = get_shell_surface(es); 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; move->dy = es->geometry.y - wd->input_device.grab_y;
wl_input_device_start_pointer_grab(&wd->input_device, 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; return 0;
} }
static void static void
shell_surface_move(struct wl_client *client, struct wl_resource *resource, 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 weston_input_device *wd = input_resource->data;
struct shell_surface *shsurf = resource->data; struct shell_surface *shsurf = resource->data;
if (wd->input_device.button_count == 0 || 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) wd->input_device.pointer_focus != &shsurf->surface->surface)
return; return;
if (weston_surface_move(shsurf->surface, wd, time) < 0) if (weston_surface_move(shsurf->surface, wd) < 0)
wl_resource_post_no_memory(resource); 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, wl_shell_surface_send_configure(&resize->base.shsurf->resource,
time, resize->edges, width, height); resize->edges, width, height);
} }
static void static void
@ -357,7 +357,7 @@ resize_grab_button(struct wl_pointer_grab *grab,
if (device->button_count == 0 && state == 0) { if (device->button_count == 0 && state == 0) {
shell_grab_finish(&resize->base); shell_grab_finish(&resize->base);
wl_input_device_end_pointer_grab(device, time); wl_input_device_end_pointer_grab(device);
free(grab); free(grab);
} }
} }
@ -370,8 +370,7 @@ static const struct wl_pointer_grab_interface resize_grab_interface = {
static int static int
weston_surface_resize(struct shell_surface *shsurf, weston_surface_resize(struct shell_surface *shsurf,
struct weston_input_device *wd, struct weston_input_device *wd, uint32_t edges)
uint32_t time, uint32_t edges)
{ {
struct weston_resize_grab *resize; struct weston_resize_grab *resize;
@ -393,16 +392,16 @@ weston_surface_resize(struct shell_surface *shsurf,
resize->height = shsurf->surface->geometry.height; resize->height = shsurf->surface->geometry.height;
wl_input_device_start_pointer_grab(&wd->input_device, 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; return 0;
} }
static void static void
shell_surface_resize(struct wl_client *client, struct wl_resource *resource, 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) uint32_t edges)
{ {
struct weston_input_device *wd = input_resource->data; struct weston_input_device *wd = input_resource->data;
@ -412,11 +411,11 @@ shell_surface_resize(struct wl_client *client, struct wl_resource *resource,
return; return;
if (wd->input_device.button_count == 0 || 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) wd->input_device.pointer_focus != &shsurf->surface->surface)
return; return;
if (weston_surface_resize(shsurf, wd, time, edges) < 0) if (weston_surface_resize(shsurf, wd, edges) < 0)
wl_resource_post_no_memory(resource); 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); panel_height = get_output_panel_height(wlshell, es->output);
edges = WL_SHELL_SURFACE_RESIZE_TOP|WL_SHELL_SURFACE_RESIZE_LEFT; edges = WL_SHELL_SURFACE_RESIZE_TOP|WL_SHELL_SURFACE_RESIZE_LEFT;
wl_shell_surface_send_configure(&shsurf->resource, wl_shell_surface_send_configure(&shsurf->resource, edges,
weston_compositor_get_time(), edges,
es->output->current->width, es->output->current->width,
es->output->current->height - panel_height); es->output->current->height - panel_height);
@ -702,14 +700,13 @@ shell_surface_set_fullscreen(struct wl_client *client,
if (weston_surface_is_mapped(es)) if (weston_surface_is_mapped(es))
shsurf->force_configure = 1; shsurf->force_configure = 1;
wl_shell_surface_send_configure(&shsurf->resource, wl_shell_surface_send_configure(&shsurf->resource, 0,
weston_compositor_get_time(), 0,
shsurf->output->current->width, shsurf->output->current->width,
shsurf->output->current->height); shsurf->output->current->height);
} }
static void 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_surface *surface, int32_t x, int32_t y)
{ {
struct wl_input_device *device = grab->input_device; 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; struct wl_client *client = priv->surface->surface.resource.client;
if (surface && surface->resource.client == 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; grab->focus = surface;
} else { } 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; grab->focus = NULL;
} }
} }
@ -744,15 +741,20 @@ popup_grab_button(struct wl_pointer_grab *grab,
struct wl_resource *resource; struct wl_resource *resource;
struct shell_surface *shsurf = struct shell_surface *shsurf =
container_of(grab, struct shell_surface, popup.grab); container_of(grab, struct shell_surface, popup.grab);
struct wl_display *display;
uint32_t serial;
resource = grab->input_device->pointer_focus_resource; resource = grab->input_device->pointer_focus_resource;
if (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 && } else if (state == 0 &&
(shsurf->popup.initial_up || (shsurf->popup.initial_up ||
time - shsurf->popup.time > 500)) { time - shsurf->popup.time > 500)) {
wl_shell_surface_send_popup_done(&shsurf->resource); 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; shsurf->popup.grab.input_device = NULL;
} }
@ -767,7 +769,7 @@ static const struct wl_pointer_grab_interface popup_grab_interface = {
}; };
static void 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 wl_input_device *device;
struct weston_surface *es = shsurf->surface; 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; shsurf->popup.initial_up = 0;
wl_input_device_start_pointer_grab(shsurf->popup.grab.input_device, wl_input_device_start_pointer_grab(shsurf->popup.grab.input_device,
&shsurf->popup.grab, shsurf->popup.time); &shsurf->popup.grab);
} }
static void static void
@ -834,7 +836,7 @@ destroy_shell_surface(struct wl_resource *resource)
struct shell_surface *shsurf = resource->data; struct shell_surface *shsurf = resource->data;
if (shsurf->popup.grab.input_device) 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 */ /* in case cleaning up a dead client destroys shell_surface first */
if (shsurf->surface) { if (shsurf->surface) {
@ -851,14 +853,14 @@ destroy_shell_surface(struct wl_resource *resource)
static void static void
shell_handle_surface_destroy(struct wl_listener *listener, 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 *shsurf = container_of(listener,
struct shell_surface, struct shell_surface,
surface_destroy_listener); surface_destroy_listener);
shsurf->surface = NULL; shsurf->surface = NULL;
wl_resource_destroy(&shsurf->resource, time); wl_resource_destroy(&shsurf->resource);
} }
static struct shell_surface * static struct shell_surface *
@ -1036,8 +1038,7 @@ desktop_shell_set_background(struct wl_client *client,
weston_surface_set_position(surface, shsurf->output->x, weston_surface_set_position(surface, shsurf->output->x,
shsurf->output->y); shsurf->output->y);
desktop_shell_send_configure(resource, desktop_shell_send_configure(resource, 0,
weston_compositor_get_time(), 0,
surface_resource, surface_resource,
shsurf->output->current->width, shsurf->output->current->width,
shsurf->output->current->height); shsurf->output->current->height);
@ -1074,8 +1075,7 @@ desktop_shell_set_panel(struct wl_client *client,
weston_surface_set_position(surface, shsurf->output->x, weston_surface_set_position(surface, shsurf->output->x,
shsurf->output->y); shsurf->output->y);
desktop_shell_send_configure(resource, desktop_shell_send_configure(resource, 0,
weston_compositor_get_time(), 0,
surface_resource, surface_resource,
shsurf->output->current->width, shsurf->output->current->width,
shsurf->output->current->height); shsurf->output->current->height);
@ -1083,7 +1083,7 @@ desktop_shell_set_panel(struct wl_client *client,
static void static void
handle_lock_surface_destroy(struct wl_listener *listener, handle_lock_surface_destroy(struct wl_listener *listener,
struct wl_resource *resource, uint32_t time) struct wl_resource *resource)
{ {
struct wl_shell *shell = struct wl_shell *shell =
container_of(listener, struct wl_shell, lock_surface_listener); container_of(listener, struct wl_shell, lock_surface_listener);
@ -1190,7 +1190,7 @@ move_binding(struct wl_input_device *device, uint32_t time,
break; break;
} }
weston_surface_move(surface, (struct weston_input_device *) device, time); weston_surface_move(surface, (struct weston_input_device *) device);
} }
static void static void
@ -1238,7 +1238,7 @@ resize_binding(struct wl_input_device *device, uint32_t time,
edges |= WL_SHELL_SURFACE_RESIZE_BOTTOM; edges |= WL_SHELL_SURFACE_RESIZE_BOTTOM;
weston_surface_resize(shsurf, (struct weston_input_device *) device, weston_surface_resize(shsurf, (struct weston_input_device *) device,
time, edges); edges);
} }
static void static void
@ -1396,7 +1396,7 @@ rotate_grab_button(struct wl_pointer_grab *grab,
weston_matrix_multiply(&shsurf->rotation.rotation, weston_matrix_multiply(&shsurf->rotation.rotation,
&rotate->rotation); &rotate->rotation);
shell_grab_finish(&rotate->base); shell_grab_finish(&rotate->base);
wl_input_device_end_pointer_grab(device, time); wl_input_device_end_pointer_grab(device);
free(rotate); free(rotate);
} }
} }
@ -1446,7 +1446,7 @@ rotate_binding(struct wl_input_device *device, uint32_t time,
surface->surface->geometry.height / 2, surface->surface->geometry.height / 2,
&rotate->center.x, &rotate->center.y); &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; dx = device->x - rotate->center.x;
dy = device->y - rotate->center.y; 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); 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 static void
activate(struct weston_shell *base, struct weston_surface *es, 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 wl_shell *shell = container_of(base, struct wl_shell, shell);
struct weston_compositor *compositor = shell->compositor; struct weston_compositor *compositor = shell->compositor;
struct weston_surface *surf, *prev; struct weston_surface *surf, *prev;
weston_surface_activate(es, device, time); weston_surface_activate(es, device);
if (compositor->wxs) if (compositor->wxs)
weston_xserver_surface_activate(es); weston_xserver_surface_activate(es);
@ -1555,7 +1555,7 @@ click_to_activate_binding(struct wl_input_device *device,
focus = upper; focus = upper;
if (state && device->pointer_grab == &device->default_pointer_grab) if (state && device->pointer_grab == &device->default_pointer_grab)
activate(compositor->shell, focus, wd, time); activate(compositor->shell, focus, wd);
} }
static void static void
@ -1565,7 +1565,6 @@ lock(struct weston_shell *base)
struct weston_input_device *device; struct weston_input_device *device;
struct shell_surface *shsurf; struct shell_surface *shsurf;
struct weston_output *output; struct weston_output *output;
uint32_t time;
if (shell->locked) { if (shell->locked) {
wl_list_for_each(output, &shell->compositor->output_list, link) 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); weston_compositor_schedule_repaint(shell->compositor);
/* reset keyboard foci */ /* reset keyboard foci */
time = weston_compositor_get_time();
wl_list_for_each(device, &shell->compositor->input_device_list, link) { wl_list_for_each(device, &shell->compositor->input_device_list, link) {
wl_input_device_set_keyboard_focus(&device->input_device, wl_input_device_set_keyboard_focus(&device->input_device,
NULL, time); NULL);
} }
/* TODO: disable bindings that should not work while locked. */ /* 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) if (!shell->locked)
activate(base, surface, activate(base, surface,
(struct weston_input_device *) (struct weston_input_device *)
compositor->input_device, compositor->input_device);
weston_compositor_get_time());
break; break;
default: default:
break; break;
@ -1924,7 +1921,7 @@ bind_desktop_shell(struct wl_client *client,
wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
"permission to bind desktop_shell denied"); "permission to bind desktop_shell denied");
wl_resource_destroy(resource, 0); wl_resource_destroy(resource);
} }
static void static void
@ -1979,7 +1976,7 @@ bind_screensaver(struct wl_client *client,
wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT, wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
"interface object already bound"); "interface object already bound");
wl_resource_destroy(resource, 0); wl_resource_destroy(resource);
} }
struct switcher { struct switcher {
@ -2042,7 +2039,7 @@ switcher_next(struct switcher *switcher)
static void static void
switcher_handle_surface_destroy(struct wl_listener *listener, switcher_handle_surface_destroy(struct wl_listener *listener,
struct wl_resource *resource, uint32_t time) struct wl_resource *resource)
{ {
struct switcher *switcher = struct switcher *switcher =
container_of(listener, struct switcher, listener); container_of(listener, struct switcher, listener);
@ -2064,9 +2061,9 @@ switcher_destroy(struct switcher *switcher, uint32_t time)
} }
if (switcher->current) if (switcher->current)
activate(compositor->shell, switcher->current, device, time); activate(compositor->shell, switcher->current, device);
wl_list_remove(&switcher->listener.link); 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); free(switcher);
} }
@ -2104,9 +2101,8 @@ switcher_binding(struct wl_input_device *device, uint32_t time,
wl_list_init(&switcher->listener.link); wl_list_init(&switcher->listener.link);
switcher->grab.interface = &switcher_grab; switcher->grab.interface = &switcher_grab;
wl_input_device_start_keyboard_grab(device, &switcher->grab, time); wl_input_device_start_keyboard_grab(device, &switcher->grab);
wl_input_device_set_keyboard_focus(device, NULL, wl_input_device_set_keyboard_focus(device, NULL);
weston_compositor_get_time());
switcher_next(switcher); switcher_next(switcher);
} }

@ -151,7 +151,7 @@ tablet_shell_surface_configure(struct weston_surface *surface,
static void static void
handle_lockscreen_surface_destroy(struct wl_listener *listener, handle_lockscreen_surface_destroy(struct wl_listener *listener,
struct wl_resource *resource, uint32_t time) struct wl_resource *resource)
{ {
struct tablet_shell *shell = struct tablet_shell *shell =
container_of(listener, container_of(listener,
@ -179,7 +179,7 @@ tablet_shell_set_lockscreen(struct wl_client *client,
static void static void
handle_switcher_surface_destroy(struct wl_listener *listener, handle_switcher_surface_destroy(struct wl_listener *listener,
struct wl_resource *resource, uint32_t time) struct wl_resource *resource)
{ {
struct tablet_shell *shell = struct tablet_shell *shell =
container_of(listener, 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 *device =
(struct weston_input_device *) compositor->input_device; (struct weston_input_device *) compositor->input_device;
weston_surface_activate(shell->home_surface, weston_surface_activate(shell->home_surface, device);
device, weston_compositor_get_time());
} }
static void static void
@ -259,8 +258,7 @@ tablet_shell_switch_to(struct tablet_shell *shell,
} }
} else { } else {
fprintf(stderr, "switch to %p\n", surface); fprintf(stderr, "switch to %p\n", surface);
weston_surface_activate(surface, device, weston_surface_activate(surface, device);
weston_compositor_get_time());
tablet_shell_set_state(shell, STATE_TASK); tablet_shell_set_state(shell, STATE_TASK);
weston_zoom_run(surface, 0.3, 1.0, NULL, NULL); weston_zoom_run(surface, 0.3, 1.0, NULL, NULL);
} }
@ -302,7 +300,7 @@ static void
tablet_client_destroy(struct wl_client *client, tablet_client_destroy(struct wl_client *client,
struct wl_resource *resource) struct wl_resource *resource)
{ {
wl_resource_destroy(resource, weston_compositor_get_time()); wl_resource_destroy(resource);
} }
static void static void
@ -423,8 +421,7 @@ go_home(struct tablet_shell *shell)
if (shell->state == STATE_SWITCHER) if (shell->state == STATE_SWITCHER)
tablet_shell_send_hide_switcher(&shell->resource); tablet_shell_send_hide_switcher(&shell->resource);
weston_surface_activate(shell->home_surface, device, weston_surface_activate(shell->home_surface, device);
weston_compositor_get_time());
tablet_shell_set_state(shell, STATE_HOME); tablet_shell_set_state(shell, STATE_HOME);
} }

@ -110,7 +110,7 @@ weston_zoom_destroy(struct weston_zoom *zoom)
static void static void
handle_zoom_surface_destroy(struct wl_listener *listener, handle_zoom_surface_destroy(struct wl_listener *listener,
struct wl_resource *resource, uint32_t time) struct wl_resource *resource)
{ {
struct weston_zoom *zoom = struct weston_zoom *zoom =
container_of(listener, struct weston_zoom, listener); container_of(listener, struct weston_zoom, listener);
@ -246,16 +246,20 @@ binding_key(struct wl_keyboard_grab *grab,
struct binding_keyboard_grab *b = struct binding_keyboard_grab *b =
container_of(grab, struct binding_keyboard_grab, grab); container_of(grab, struct binding_keyboard_grab, grab);
struct wl_resource *resource; struct wl_resource *resource;
struct wl_display *display;
uint32_t serial;
resource = grab->input_device->keyboard_focus_resource; resource = grab->input_device->keyboard_focus_resource;
if (key == b->key) { if (key == b->key) {
if (!state) { if (!state) {
wl_input_device_end_keyboard_grab(grab->input_device, wl_input_device_end_keyboard_grab(grab->input_device);
time);
free(b); free(b);
} }
} else if (resource) } else if (resource) {
wl_input_device_send_key(resource, time, key, state); 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 = { 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 = malloc(sizeof *grab);
grab->key = key; grab->key = key;
grab->grab.interface = &binding_grab; 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 WL_EXPORT void

@ -273,7 +273,7 @@ data_offer_receive(struct wl_client *client, struct wl_resource *resource,
static void static void
data_offer_destroy(struct wl_client *client, struct wl_resource *resource) 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 = { 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; device = wm->server->compositor->input_device;
wl_input_device_set_selection(device, source, wl_input_device_set_selection(device, source);
weston_compositor_get_time());
free(reply); free(reply);
} }
@ -1481,8 +1480,7 @@ weston_xserver_cleanup(struct weston_process *process, int status)
} }
static void static void
surface_destroy(struct wl_listener *listener, surface_destroy(struct wl_listener *listener, struct wl_resource *resource)
struct wl_resource *resource, uint32_t time)
{ {
struct weston_wm_window *window = struct weston_wm_window *window =
container_of(listener, container_of(listener,

Loading…
Cancel
Save