Fix focus loss when destroying a standalone toplevel#41
Merged
malbiruk merged 1 commit intomalbiruk:mainfrom Apr 18, 2026
Merged
Fix focus loss when destroying a standalone toplevel#41malbiruk merged 1 commit intomalbiruk:mainfrom
malbiruk merged 1 commit intomalbiruk:mainfrom
Conversation
When a focused xdg-toplevel without a parent surface is destroyed, keyboard focus was cleared with set_focus(None) instead of falling back to focus_history. With focus_follows_mouse enabled and the pointer over empty canvas, this leaves the session with no focused window until the user crosses the pointer onto another surface. Mirror the fallback already used by the XWayland widget path: prefer parent focus, otherwise pick the most recent previous window from focus_history. Fixes malbiruk#40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
In
toplevel_destroyed, when the destroyed xdg-toplevel has no parent surface, fall back to the most recent previous window fromfocus_historyinstead of callingset_focus(None).Purpose
With
focus_follows_mouse = true, closing a standalone picker window (clipboard manager, launcher wrapped in a terminal, etc.) leaves keyboard focus empty until the pointer crosses another surface. The XWayland path already has this fallback; this brings xdg_shell in line.Fixes #40