summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2016-09-20 16:44:46 +0800
committerJonas Ådahl <jadahl@gmail.com>2016-10-18 13:20:48 +0800
commitd8a02754184068775da7ac2aa6c7ba37ddd7e958 (patch)
tree1cfd6e8a0e12928c09c2c2543db3e335eb8f8781
parentaeeffbe1f78c76d6b74f43ed9cdebf980da09666 (diff)
downloadmutter-d8a02754184068775da7ac2aa6c7ba37ddd7e958.tar.gz
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
-rw-r--r--src/wayland/meta-wayland-keyboard.c21
1 files 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)
{