Fix: flip the _NET_WORKAREA origin and count monitors, not outputs - #226
Open
DTW-Thalion wants to merge 5 commits into
Open
Fix: flip the _NET_WORKAREA origin and count monitors, not outputs#226DTW-Thalion wants to merge 5 commits into
DTW-Thalion wants to merge 5 commits into
Conversation
_NET_WORKAREA holds the area a window manager leaves usable, in X coordinates, where y grows downwards from the top of the screen. A screen frame is in OpenStep coordinates, where y grows upwards, so the rectangle has to be flipped. The origin was set to zero instead. The origin says which end of the screen the reserved rows are at. A panel at the top and a panel at the bottom reserve the same number of rows and report the same height, so zeroing the origin gives both the same frame. That frame is right for a panel at the top and wrong by the height of the panel for one at the bottom, where a window placed at the bottom of the screen was drawn under the panel and the rows at the top could not be reached. Measured on a 1920x1080 screen with 40 rows reserved at the bottom: a 50 pixel bar placed at the bottom of the screen was mapped at X row 1030, over a panel occupying rows 1040 to 1079, and is now mapped at row 990. A bar placed at the top was mapped at row 40 and is now at row 0.
_NET_WORKAREA refers to the composite display formed by all the monitors, so it is only used as a screen frame when there is a single monitor. That test read monitorsCount while it still held screen_res->noutput, the number of RandR outputs. monitorsCount holds the number of monitors only after the outputs have been walked, since an output the display is not using has no CRTC and is not a monitor. A driver reports an output for every connector it supports, so the count matched only on a server that reports exactly one. Measured with the Xorg dummy driver, which reports 16 outputs: with a single monitor and a work area 40 rows shorter than the screen, the screen frame was the full 1920x1080 and is now 1920x1040 at y 40, which is the frame Xvfb already gave through its single output.
A panel at the top of the screen and a panel at the bottom reserve the same number of rows, so they report the same work area height and differ only in the origin. They have to give different screen frames. The test publishes _NET_WORKAREA on the root window and reads the frame back through boundsForScreen:. It creates the display server directly, since nothing here draws, and skips when there is no display or when more than one monitor is present, which is the case the property is not used for. Tests/x11 now links the gui library, which is where GSDisplayServer lives.
This was referenced Aug 6, 2026
fredkiefer
pushed a commit
to gnustep/libs-gui
that referenced
this pull request
Aug 9, 2026
-[NSMenu _setGeometry] placed the main menu at x 0, and the vertical branch placed it at visibleFrame.size.height less the menu height. Both drop the frame's origin, which is not zero when a window manager reserves part of the screen and the backend reports the remainder. Measured on a 1920x1080 screen. With a dock 64 columns wide down the left edge the screen frame is 64,0 1856x1080 and the menu was mapped at X column 0, underneath the dock; it is now mapped at column 64. With a panel 40 rows deep at the bottom the frame is 0,40 1920x1040 and the menu top edge was 1040 against a frame top of 1080, leaving usable rows empty above it; it is now flush with the top. The horizontal branch already added screenFrame.origin.y, and NSMaxY keeps that result while correcting x. A work area origin in y needs the backend change in gnustep/libs-back#226; the x case is reached without it.
…igin # Conflicts: # Tests/x11/GNUmakefile.preamble
XGServerWindow.m keeps the two comments master already had. The header of Tests/x11/workarea.m states what the test covers and no more.
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.
_NET_WORKAREA is used as the screen frame for a single monitor. Two things are
wrong with that.
The property is in X coordinates, where y grows downwards, and the origin was
set to zero rather than flipped. A panel at the top and one at the bottom
reserve the same rows and report the same height, so only the origin tells
them apart. Zeroing it suits a panel at the top and is wrong by the height of
the panel for one at the bottom.
The single monitor test read monitorsCount while it still held
screen_res->noutput, so on a driver reporting an output per connector the work
area was not used.
Measured on a 1920x1080 screen with 40 rows reserved at the bottom: a bar
there was mapped at X row 1030, over a panel at rows 1040 to 1079, and is now
at 990. On the Xorg dummy driver, with 16 outputs, the frame was 1920x1080 and
is now 1920x1040 at y 40.
Tests/x11 gives 259 passed 0 failed against 257 passed 2 failed, and two
monitors are unchanged. The count needs several outputs, which CI has not.