Constrain window position to monitor workarea - #554
Open
Mr-Tao wants to merge 2 commits into
Open
Conversation
Keep x_pos and y_pos as the requested position. Derive the effective position from the selected monitor workarea instead. Use the same geometry for resizing, showing, and animation so a window corrected by the window manager does not jump back after a toggle.
Reapply both configured dimensions after every workarea change. The old grow-only handler could retain a transient full-screen height after panel struts returned.
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.
Summary
x_posandy_posas the user's requestedposition rather than overwriting them with a temporary constrained value.
transiently larger workarea does not leave the window oversized.
negative-origin geometries.
Problem
Tilda currently stores the configured position separately from the size that
it derives from the monitor workarea. This can leave those values inconsistent.
For example, with a 32-pixel top panel and a
3840x2160screen, the workarea is3840x2128+0+32. A non-centered Tilda configured aty_pos=37fits at 99%height. At 100%, xfwm4 keeps a size-only request fully visible and moves the
window to
y=32. Tilda does not retain that effective position, so the nexthide/show moves the full-height window back to the configured
y=37.The workarea update handler also only grows an existing allocation. If the
workarea temporarily expands to the full
2160pixels and then returns to2128, the window retains the larger height and extends below the screen.Approach
On non-centered axes, the configured coordinates remain unchanged and therefore
continue to express the requested position. Centered axes retain their existing
behavior of storing the recalculated centered coordinate. Tilda computes a
transient effective rectangle against one selected monitor workarea, constrains
it, and uses that rectangle everywhere that needs the displayed endpoint. This
means that returning from 100% to 99% height also restores the requested
y=37.On every
_NET_WORKAREAupdate, both dimensions are derived again from theconfigured percentages. This makes workarea changes converge in both
directions instead of retaining an already larger allocation.
Validation
--enable-maintainer-flags.make check: all seven geometry cases pass.tilda-2.0.0._NET_WM_STRUT_PARTIAL:2300,32,1535,21282300,32,1535,21282300,37,1535,21062300,32,1535,2128y_posremains37after clean process exit in every case.3840x2128+0+32:2300,32,1535,21283840x2160+0+0:2300,0,1535,21603840x2128+0+32:2300,32,1535,2128y_posremains37.cycle:
2300,32,1535,2128; all user configuration files remainedbyte-identical to their pre-install backup.
Behavioral note
When a requested rectangle does not fit inside the selected workarea, its
displayed position is constrained while it is shown. On non-centered axes, the
requested coordinates are not rewritten, so temporary panel, workarea, or
monitor changes do not cause configuration drift.