wayland: Move device seat association to MetaWaylandInputDevice

Make the device <-> seat association permanent, and move it into
MetaWaylandInputDevice. A device will never be disassociated with a
seat, so there is no point in unsetting it.

https://bugzilla.gnome.org/show_bug.cgi?id=771305
This commit is contained in:
Jonas Ådahl
2016-09-12 23:20:36 +08:00
parent a6646b32d0
commit 87f82d9fc0
11 changed files with 140 additions and 48 deletions

View File

@@ -351,11 +351,15 @@ meta_wayland_keyboard_broadcast_modifiers (MetaWaylandKeyboard *keyboard)
struct wl_resource *resource;
struct wl_list *l;
l = &keyboard->focus_resource_list;
if (!wl_list_empty (l))
{
uint32_t serial = wl_display_next_serial (keyboard->seat->wl_display);
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);
wl_resource_for_each (resource, l)
keyboard_send_modifiers (keyboard, resource, serial);
@@ -602,14 +606,11 @@ static const MetaWaylandKeyboardGrabInterface default_keyboard_grab_interface =
};
void
meta_wayland_keyboard_enable (MetaWaylandKeyboard *keyboard,
MetaWaylandSeat *seat)
meta_wayland_keyboard_enable (MetaWaylandKeyboard *keyboard)
{
MetaBackend *backend = meta_get_backend ();
GSettingsSchema *schema;
keyboard->seat = seat;
wl_list_init (&keyboard->resource_list);
wl_list_init (&keyboard->focus_resource_list);
@@ -677,8 +678,6 @@ meta_wayland_keyboard_disable (MetaWaylandKeyboard *keyboard)
g_clear_object (&keyboard->settings);
if (keyboard->gsd_settings)
g_object_unref (keyboard->gsd_settings);
keyboard->seat = NULL;
}
static guint
@@ -826,7 +825,10 @@ void
meta_wayland_keyboard_set_focus (MetaWaylandKeyboard *keyboard,
MetaWaylandSurface *surface)
{
if (keyboard->seat == NULL)
MetaWaylandInputDevice *input_device = META_WAYLAND_INPUT_DEVICE (keyboard);
MetaWaylandSeat *seat = meta_wayland_input_device_get_seat (input_device);
if (!meta_wayland_seat_has_keyboard (seat))
return;
if (keyboard->focus_surface == surface)