From 911a838c3a1683c70ecea17340f0fa25839a9550 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 20 Sep 2016 16:44:46 +0800 Subject: [PATCH] wayland/keyboard: Simplify getting the serial serial Use the MetaWaylandInputDevice helper for getting the next event serial number. https://bugzilla.gnome.org/show_bug.cgi?id=771646 --- src/wayland/meta-wayland-keyboard.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/wayland/meta-wayland-keyboard.c b/src/wayland/meta-wayland-keyboard.c index 69e97e00c..de4540c15 100644 --- a/src/wayland/meta-wayland-keyboard.c +++ b/src/wayland/meta-wayland-keyboard.c @@ -269,10 +269,11 @@ meta_wayland_keyboard_broadcast_key (MetaWaylandKeyboard *keyboard, l = &keyboard->focus_resource_list; if (!wl_list_empty (l)) { - struct wl_client *client = wl_resource_get_client (keyboard->focus_surface->resource); - struct wl_display *display = wl_client_get_display (client); + MetaWaylandInputDevice *input_device = + META_WAYLAND_INPUT_DEVICE (keyboard); - keyboard->key_serial = wl_display_next_serial (display); + keyboard->key_serial = + meta_wayland_input_device_next_serial (input_device); wl_resource_for_each (resource, l) { @@ -356,10 +357,9 @@ meta_wayland_keyboard_broadcast_modifiers (MetaWaylandKeyboard *keyboard) { MetaWaylandInputDevice *input_device = META_WAYLAND_INPUT_DEVICE (keyboard); - MetaWaylandSeat *seat = meta_wayland_input_device_get_seat (input_device); uint32_t serial; - serial = wl_display_next_serial (seat->wl_display); + serial = meta_wayland_input_device_next_serial (input_device); wl_resource_for_each (resource, l) keyboard_send_modifiers (keyboard, resource, serial); @@ -842,9 +842,9 @@ meta_wayland_keyboard_set_focus (MetaWaylandKeyboard *keyboard, l = &keyboard->focus_resource_list; if (!wl_list_empty (l)) { - struct wl_client *client = wl_resource_get_client (keyboard->focus_surface->resource); - struct wl_display *display = wl_client_get_display (client); - uint32_t serial = wl_display_next_serial (display); + uint32_t serial; + + serial = meta_wayland_input_device_next_serial (input_device); wl_resource_for_each (resource, l) { @@ -873,9 +873,8 @@ meta_wayland_keyboard_set_focus (MetaWaylandKeyboard *keyboard, l = &keyboard->focus_resource_list; if (!wl_list_empty (l)) { - struct wl_client *client = wl_resource_get_client (keyboard->focus_surface->resource); - struct wl_display *display = wl_client_get_display (client); - keyboard->focus_serial = wl_display_next_serial (display); + keyboard->focus_serial = + meta_wayland_input_device_next_serial (input_device); wl_resource_for_each (resource, l) {