diff --git a/src/wayland/meta-wayland-popup.c b/src/wayland/meta-wayland-popup.c index 6c4b78425..e582e6df5 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; }