X11: re-read _NET_WORKAREA on WM PropertyNotify#21651
Open
lambgoesbaa wants to merge 1 commit into
Open
Conversation
|
You can test this PR using the following package version. |
Collaborator
|
Author
|
@cla-avalonia agree |
1 similar comment
|
@cla-avalonia agree |
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.
What does the pull request do?
Fixes a bug on X11 where popups and menus are positioned against a stale work area
after the screen resolution is increased while the application is running. The work
area keeps its pre-resize (smaller) value until the app is restarted, so popups near a
screen edge clamp to the old bounds.
The cause is a two-event race between RandR and the window manager:
RRScreenChangeNotifyfires first.Randr15ScreensImplinvalidates its cacheand the screens are rebuilt with the new
Bounds, reading_NET_WORKAREAviaX11Screen.UpdateWorkArea()at that moment._NET_WORKAREAand emits aroot-window
PropertyNotifya short time later.At step 1 the WM has not recomputed the work area yet, so the stale value is cached.
The screen provider only listens for
RRScreenChangeNotifyand never for the_NET_WORKAREAPropertyNotify, so it never re-reads. On a resolution decrease theold work area still fits inside the new bounds, which is why only increases are visibly
broken.
What is the current behavior?
On an X11/EWMH desktop, increase the screen resolution while the app is running, then
open a menu or popup near a screen edge. The popup is clamped against the old, smaller
work area instead of the new screen size. Restarting the app clears it.
What is the updated/expected behavior with this PR?
After a resolution change, the work area refreshes when the window manager publishes the
updated
_NET_WORKAREA, and popups use the correct, current work area with no restart.To test (X11 session, e.g. GNOME/Mutter):
Verified manually on Ubuntu 26.04 (GNOME/Mutter): resolution increase no longer leaves
popups clamped to the old work area, and the decrease path remains correct.
How was the solution implemented (if it's not obvious)?
Randr15ScreensImplalso subscribes toX11Globals.RootPropertyChanged; on a_NET_WORKAREAchange it posts the existingChangednotification, reusing theestablished refresh path (
OnChanged→ScreenChanged→Refresh→UpdateWorkArea).The root window already has
PropertyChangeMaskandX11Globalsalready dispatchesRootPropertyChanged, so this adds only a delegate call and an atom comparison.Changedis posted viaDispatcher.UIThread.Post, matching the existing RandROnEvent. Cache invalidation stays on the RandR path, which owns topology changes.Checklist
requires a live machine; there is no X11 test harness; was verified manually.
Breaking changes
None.
Obsoletions / Deprecations
None.