Skip to content

fix(stlxdm): gave the focus back when a grabbing popup closes - #598

Merged
FlareCoding merged 1 commit into
masterfrom
pr/desktop-focus
Nov 7, 2026
Merged

FlareCoding merged 1 commit into
masterfrom
pr/desktop-focus

Conversation

@FlareCoding

Copy link
Copy Markdown
Owner

Summary

A client closing its focused grabbing popup (a menu or list that takes the focus as it opens), as Qt's combo box does on a pick, left stlxdm (the display manager) focusing no window, so keys reached none until the next click. The window the popup took the focus from gets it back when the popup closes still focused, unless a later grabbing popup, such as a submenu, opened meanwhile.

Changes

  • Give the focus back however a grabbing popup closes: forget_window, which every destroyed window passes through, gives the focus to the window in m_focus_restore (the one focused before the popup opened) when the window destroyed is the grabbing popup and still holds the focus. A client's close, a press outside and a client's disconnect all reach this rule, so the press outside only dismisses the popup.
  • Keep a focus taken while the popup was open: a window that took the focus from the popup, such as a new window opened meanwhile, keeps it however the popup closes, where the press outside in route_untimed_pointer used to hand it back to the window the popup displaced.
  • Return a submenu's focus to its menu: a submenu's close gives the focus to the menu it opened from. m_grab_popup and m_focus_restore hold one grabbing popup and the window it took the focus from, both replaced when the submenu opened, so the menu's close after its submenu's still leaves no window focused.
  • Boots: with this change, the Down and Return keys reached stlxsettings (the settings app) after a click held 0.8 s on its Display page's "Main output" combo box closed the list on the release, and Down chose output 1, which Apply made the main output. In QEMU on x86_64 and on aarch64, with log lines kept out of the tree, no boot faulted, and on master both keys reached no window and output 0 stayed main.
  • Screenshots: the pictures of both outputs after the Display page's Apply show the bar and the dock moved to output 1 with this change and still on output 0 on master, on both architectures. They are kept with the landing record in reviews/desktop-13-focus/, master's above this change's, with a zoom of the combo box and each boot's steps and log lines.
  • Tests: no test in the tree covers stlxdm's focus, so a host harness outside it builds stlxdm's event, scene and window code unchanged and checks the focus and the events sent in 14 cases, among them a client's close, a press outside, a disconnect, a window focused meanwhile and a submenu's close. Its 32 checks pass, master fails 10 of them, and each of 8 mutants of the rule fails at least one.

A client closing its focused grabbing popup, as Qt's combo box does on a
pick, left no window focused, so keys reached none until the next click.
A window that took the focus meanwhile keeps it, at a press outside too.
@FlareCoding
FlareCoding merged commit a929aea into master Nov 7, 2026
10 checks passed
@FlareCoding
FlareCoding deleted the pr/desktop-focus branch November 7, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant