Repository navigation
frontend: restore the dock layout again when the window grows after the start (#3740) - #4841
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…he start (#3740) OBSBasic restores the dock layout into the shown window. A tiling window manager (Hyprland) resizes that window to its tile right after: Qt squeezes the layout into the start size, shares the new space out on its own when the window grows, and that evened-out layout is what quit saves. DockProportions also recorded the squeezed shares as the user's. Until the user changes a dock (a separator drag that changes the layout), each window resize now restores the layout again at the new size and drops the shares seen so far. GREEN for layout_survives_window_manager_resize_after_restore: the docks keep 500/200/400/200/276 px after the resize and after restart (before: all 315 px). All 30 Qt-linked tests pass against Qt 6.11.1 with QtTest (#4837), including test_dock_proportions. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reporter starts OBS from a terminal: the window first shares the workspace with the terminal, too narrow for the layout, and gets the whole workspace when the terminal is hidden. Every resize before the user changes a dock must restore the layout again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Compiling to test on Hyprland on real hardware now. |
… stays hidden (#3740) The reporter's full-screen start: OBS starts full screen with the layout, leaves full screen into a smaller tile, nobody touches a dock, and quits. The next start must show the start layout, not the one Qt squeezed into the smaller window. And a dock hidden through its menu action must stay hidden across a window resize and a restart: the restore on a window resize must not bring it back. Co-Authored-By: Claude Opus 5.5 <[email protected]>
At 1100x700 some docks reach their minimum and the clamp rule of #2225 keeps the start layout. The reporter's tile is only a little smaller: the docks get squeezed, none reaches its minimum, and the squeezed layout is saved. Co-Authored-By: Claude Opus 5.5 <[email protected]>
DockProportions restored the start layout on every window resize until the user dragged a separator, but a dock the user hid, moved or floated came back at the next window resize, and a save from a smaller window wrote the layout Qt squeezed into it (no dock at its minimum, so the clamp rule of #2225 did not apply). Now a snapshot of saveState() is kept after each restore has settled. A different state at the same window size is a change by the user or a plugin (a dock hidden, moved, floated, a tab switched, a dock added): the restores stop and the usual rules apply. Until then a save writes the start layout. A dock shown or hidden alone in its area triggers the check too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
#3740) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…a dock (#3740) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
vpacher
marked this pull request as ready for review
November 13, 2026 15:05
This was referenced Nov 13, 2026
wesleyhawes
pushed a commit
to wesleyhawes/obs-studio
that referenced
this pull request
Nov 21, 2026
…t#5230) (obs-rust#5245) * test: a dock change or Reset Docks with a window resize stays (obs-rust#5230) On a tiling window manager a dock change and a window resize often come together: a dock dragged out of the window becomes a new window and the compositor retiles. Since obs-rust#4841, DockProportions sees a user change only at the same window size, so the resize puts the start layout back over the change, and quit saves the start layout. Reset Docks is undone the same way, and every later start repeats it. Both cases fail on master and pass with the helper from before obs-rust#4841. Co-Authored-By: Claude Opus 5.5 <[email protected]> * frontend: keep a dock change that comes with a window resize (obs-rust#5230) obs-rust#4841 restores the start layout on each window resize until the user changes a dock, and it saw a change only at the same window size. On a tiling window manager a dock change and a window resize often come together: the dock moved back, Reset Docks was undone, and quit saved the start layout again, so every start repeated it. DockProportions now also keeps where the docks are once a restore has settled (area, order in the area, floating, hidden, tabs), which a window resize does not change. A different placement ends the restores, with or without a resize. Reset Docks also ends them: the reset layout is the user's. GREEN for floated_dock_stays_when_the_window_resizes_at_the_same_time and reset_docks_stays_when_the_window_resizes_at_the_same_time; the obs-rust#3740 cases still pass. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs: features entry for dock changes kept with a window resize (obs-rust#5230) Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Refs #3740. CI does not build
test_dock_state_restartyet (the Linux Qt asset has no QtTest, #4837), so the evidence below is from a local run. Merged before the reporter's retest so it does not go stale; a fix for anything the retest finds follows in a new PR.Problem
OBSBasicshows the main window and then restores the dock layout into it. A tiling window manager (Hyprland, the reporter's setup) resizes the shown window to its tile right after. The layout is restored into the start size, Qt squeezes it to fit, and when the window grows, Qt shares the new space out on its own. Quit saves that evened-out layout, so every start loses the user's dock sizes again.DockProportionsalso recorded the squeezed shares as the user's and put them back on later resizes. Plain Qt (upstream OBS) loses the layout the same way in this sequence.Change
frontend/utility/dock-proportions.hpp:SetRestoredStatearms a re-apply. Until the user changes a dock, each change of the window size restores the saved layout again at the new size and drops the shares seen so far, and a save writes the restored layout. After the first user change, the helper works as before (#2225, #3796).What counts as a user change: after each restore has settled, the helper keeps a snapshot of
saveState(). A different state at the same window size ends the re-apply: a separator drag, and also a dock hidden through its menu action, moved, floated, a tab switched or a dock added (by the user or a plugin). A dock shown or hidden alone in its area triggers that check too. The first version ended the re-apply only on a separator drag, so a hidden dock came back at the next window resize, and a quit from a smaller window (after leaving full screen, for example) saved the layout Qt had squeezed into it: no dock was at its minimum, so the clamp rule of #2225 did not apply. Both were found by the reporter's tests on Hyprland.docs/features.md: one sentence in the existing dock entry.Tests
RED
401b87b54:layout_survives_window_manager_resize_after_restoreintest_dock_state_restartsaves a layout at 1600x900 (docks 500, 200, 400, 200, 276 px wide, 246 px high), restores it into a shown 1000x600 window and grows the window to 1600x900, then restarts. On master it fails: after the resize all five docks are 315 x 369 px, and the restart restores that.GREEN
967877ec0: after the resize and after the restart the docks are 500, 200, 400, 200, 276 x 246 px.6a70d77e9:layout_survives_several_window_manager_resizes(1000x600, then 800x900, then 1600x900: the reporter's start from a terminal).RED
53e545859and23fb35cf6, after the reporter's second test round:layout_survives_a_session_at_a_smaller_size: restore at 1600x900, shrink to 1450x800 (out of full screen into a tile), save, restart at 1600x900. Before the fix, the restart showed dock 0 at 387 px instead of 500 px.hidden_dock_stays_hidden_after_a_window_resize: hide a dock through itstoggleViewAction(), resize the window. Before the fix, the dock came back (visible=1).GREEN
e809ba48e: both pass; the restart shows 500, 200, 400, 200, 276 px, and the hidden dock stays hidden after the resize and after the restart.Guard
ebc02f236:moved_and_floated_docks_stay_after_a_window_resize(one dock floated, one moved to the left area, then a window resize and a restart).Local run, Linux, Xvfb,
ci/linux_qt_frontend.pyagainst Qt 6.11.1 built with the obs-studio-libs recipe plus-DFEATURE_testlib=ON(obs-rust/obs-studio-libs#32): all 30 Qt-linked tests pass, including the 8 cases oftest_dock_state_restartand the 9 oftest_dock_proportions(#2225). The existing casechanged_layout_after_clamped_start_survives_restartnow gets the original 500/200/400 px layout back when the window grows after a clamped start (before: 315/315/316 px); it passes either way.Test cost:
test_dock_state_restarttakes 1.48 s with its 8 cases (was 0.62 s with 4; Xvfb on CT115-class hardware); no threads of its own.Not tested here: Hyprland or another Wayland compositor; the tests resize the window the way a tiling window manager does. The reporter tests the branch on Hyprland; the second round found the two cases above, and the reporter mentioned other unwanted resets that this change may not cover.
🤖 Generated with Claude Code