1
0
Fork 0

wayland/xdg-shell: Make keyboard focus follow grabbing popup

This is the explicitly intended keyboard focus symantics of xdg-shell
unstable v6. The semantics are undefined in unstable v5.

https://bugzilla.gnome.org/show_bug.cgi?id=769936
This commit is contained in:
Jonas Ådahl 2016-07-15 17:40:51 +08:00
parent f21df37190
commit 24c3844246

View file

@ -242,7 +242,20 @@ meta_wayland_popup_dismiss (MetaWaylandPopup *popup)
meta_wayland_popup_destroy (popup);
if (wl_list_empty (&popup_grab->all_popups))
meta_wayland_pointer_end_popup_grab (popup_grab->generic.pointer);
{
meta_wayland_pointer_end_popup_grab (popup_grab->generic.pointer);
}
else
{
MetaWaylandSurface *top_popup_surface;
MetaWaylandSeat *seat;
MetaWaylandKeyboard *keyboard;
top_popup_surface = meta_wayland_popup_grab_get_top_popup (popup_grab);
seat = meta_wayland_pointer_get_seat (popup_grab->generic.pointer);
keyboard = &seat->keyboard;
meta_wayland_keyboard_set_focus (keyboard, top_popup_surface);
}
}
MetaWaylandSurface *
@ -258,6 +271,8 @@ meta_wayland_popup_create (MetaWaylandPopupSurface *popup_surface,
MetaWaylandSurface *surface =
meta_wayland_popup_surface_get_surface (popup_surface);
MetaWaylandPopup *popup;
MetaWaylandSeat *seat;
MetaWaylandKeyboard *keyboard;
/* Don't allow creating popups if the grab has a different client. */
if (grab->grab_client != wl_resource_get_client (surface->resource))
@ -269,5 +284,9 @@ meta_wayland_popup_create (MetaWaylandPopupSurface *popup_surface,
wl_list_insert (&grab->all_popups, &popup->link);
seat = meta_wayland_pointer_get_seat (grab->generic.pointer);
keyboard = &seat->keyboard;
meta_wayland_keyboard_set_focus (keyboard, surface);
return popup;
}