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
This commit is contained in:
Jonas Ådahl 2016-09-20 16:44:46 +08:00
parent c6106f90d4
commit 911a838c3a

View File

@ -269,10 +269,11 @@ meta_wayland_keyboard_broadcast_key (MetaWaylandKeyboard *keyboard,
l = &keyboard->focus_resource_list; l = &keyboard->focus_resource_list;
if (!wl_list_empty (l)) if (!wl_list_empty (l))
{ {
struct wl_client *client = wl_resource_get_client (keyboard->focus_surface->resource); MetaWaylandInputDevice *input_device =
struct wl_display *display = wl_client_get_display (client); 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) wl_resource_for_each (resource, l)
{ {
@ -356,10 +357,9 @@ meta_wayland_keyboard_broadcast_modifiers (MetaWaylandKeyboard *keyboard)
{ {
MetaWaylandInputDevice *input_device = MetaWaylandInputDevice *input_device =
META_WAYLAND_INPUT_DEVICE (keyboard); META_WAYLAND_INPUT_DEVICE (keyboard);
MetaWaylandSeat *seat = meta_wayland_input_device_get_seat (input_device);
uint32_t serial; 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) wl_resource_for_each (resource, l)
keyboard_send_modifiers (keyboard, resource, serial); keyboard_send_modifiers (keyboard, resource, serial);
@ -842,9 +842,9 @@ meta_wayland_keyboard_set_focus (MetaWaylandKeyboard *keyboard,
l = &keyboard->focus_resource_list; l = &keyboard->focus_resource_list;
if (!wl_list_empty (l)) if (!wl_list_empty (l))
{ {
struct wl_client *client = wl_resource_get_client (keyboard->focus_surface->resource); uint32_t serial;
struct wl_display *display = wl_client_get_display (client);
uint32_t serial = wl_display_next_serial (display); serial = meta_wayland_input_device_next_serial (input_device);
wl_resource_for_each (resource, l) wl_resource_for_each (resource, l)
{ {
@ -873,9 +873,8 @@ meta_wayland_keyboard_set_focus (MetaWaylandKeyboard *keyboard,
l = &keyboard->focus_resource_list; l = &keyboard->focus_resource_list;
if (!wl_list_empty (l)) if (!wl_list_empty (l))
{ {
struct wl_client *client = wl_resource_get_client (keyboard->focus_surface->resource); keyboard->focus_serial =
struct wl_display *display = wl_client_get_display (client); meta_wayland_input_device_next_serial (input_device);
keyboard->focus_serial = wl_display_next_serial (display);
wl_resource_for_each (resource, l) wl_resource_for_each (resource, l)
{ {