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



commit 24c3844246e46ec1c89496e87491f98a67767529
Author: Jonas Ådahl <jadahl gmail com>
Date:   Fri Jul 15 17:40:51 2016 +0800

    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

 src/wayland/meta-wayland-popup.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/src/wayland/meta-wayland-popup.c b/src/wayland/meta-wayland-popup.c
index 6c4b784..e582e6d 100644
--- a/src/wayland/meta-wayland-popup.c
+++ b/src/wayland/meta-wayland-popup.c
@@ -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;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]