Skip to content

Commit

Permalink
Merge #2244
Browse files Browse the repository at this point in the history
2244: Give keyboard focus to menus (grabbing popups) r=Saviq a=wmww

According to XDG Shell, grabbing popups should be given keyboard focus and non-grabbing ones should not. This PR brings our keyboard focus logic in line with that.

Fixes #2241. Tested by the recently-updated canonical/wlcs#216.

Co-authored-by: William Wold <[email protected]>
Co-authored-by: Alan Griffiths <[email protected]>
  • Loading branch information
3 people committed Dec 8, 2021
1 parent 7512eb0 commit 56c5ab3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/server/shell/abstract_shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,14 +416,13 @@ void msh::AbstractShell::notify_focus_locked(
{
auto const current_focus = notified_keyboard_focus_surface.lock();

// Don't give keyboard focus to popups
// Don't give keyboard focus to non-grabbing popups
auto new_keyboard_focus = new_active_surface;
while (new_keyboard_focus)
{
auto const type = new_keyboard_focus->type();
if (type != mir_window_type_gloss &&
type != mir_window_type_tip &&
type != mir_window_type_menu)
type != mir_window_type_tip)
{
break;
}
Expand Down
4 changes: 4 additions & 0 deletions tests/acceptance-tests/wayland/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ set(EXPECTED_FAILURES
LayerShellPopup/XdgPopupTest.grabbed_popup_gets_done_event_when_new_toplevel_created/0

ForeignToplevelHandleTest.can_maximize_foreign_while_fullscreen # https://github.com/MirServer/mir/issues/2164

# Fixed by https://github.com/MirServer/wlcs/pull/216
XdgPopupStable/XdgPopupTest.grabbed_popup_does_not_get_keyboard_focus/0
XdgPopupUnstableV6/XdgPopupTest.grabbed_popup_does_not_get_keyboard_focus/0
)

if (MIR_BAD_BUFFER_TEST_ENVIRONMENT_BROKEN)
Expand Down

0 comments on commit 56c5ab3

Please sign in to comment.