Repository navigation
frontend: docks keep the sizes the user gave them (Refs #5230) - #5411
Merged
Merged
Conversation
The Qt dock tests (test_dock_state_restart, test_dock_proportions) now drive frontend/utility/DockLayout, the adapter between QMainWindow and rust/obs-dock-layout, and persist DockState with DockSizes as OBSBasic does. New cases: P2 (move a dock in a small window), P4 (drag, shrink, move), P5 (Reset Docks small), P6 (move a floating dock), P7 (float under a tiling window manager, sizes). The adapter is a stub with upstream behavior; OBSBasic still uses DockProportions. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…5230) DockLayout feeds each window change to rust/obs-dock-layout and applies its resizes with resizeDocks(); separator drags and placement changes are the user's. OBSBasic restores DockState with its BasicWindow/DockSizes, saves both at quit, starts a reset layout without sizes, and tells the adapter about a service layout only when restoreState() accepted it. DockProportions is removed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
vpacher
force-pushed
the
fix/5230-dock-adapter
branch
from
November 21, 2026 13:09
ba26fe0 to
e688cdc
Compare
vpacher
marked this pull request as ready for review
November 21, 2026 13:20
vpacher
enabled auto-merge
November 21, 2026 13:20
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 #5230 (step 3 of the plan in #5230 (comment)). Builds on the model in #5362 (merged).
Problem
DockProportionsdecides from Qt state alone: it comparessaveState()blobs and restores old ones. A dock change in a small window (P2), after a drag and a shrink (P4), Reset Docks in a small window (P5) and a moved floating dock (P6) were lost at the next window change or quit, and a dock floated under a tiling window manager saved the row as squeezed into the half tile (P7).Change
frontend/utility/DockLayout, the adapter betweenQMainWindowandrust/obs-dock-layout(frontend: obs-dock-layout, the dock layout model (Refs #5230) #5362), through its C headerfrontend/utility/obs-dock-layout.h. Unity groupfrontend.dock-layout,feature-dock-layout.cmake, linked throughrust/obs-frontend.resizeDocks().Start()(OBSBasic sets its default layout up first), and nothing while the window is hidden; a restore is looked at once the window shows (R9).OBSBasicrestoreState(DockState), thenStart(DockSizes, DockState).saveAll):DockState=StateToSave()(the live layout, or the restored one while it has no known sizes and the user changed nothing), andBasicWindow/DockSizes= the sizes record for that blob.resizeDocks(),Start(nullptr, saveState()): a layout without known sizes.restoreState()accepted it. Before, an empty or invalid service layout became the baseline.DockProportionsremoved (frontend/utility/dock-proportions.hpp).OBS_FRONTEND_RUST, the C rollback build) the adapter is upstream OBS: livesaveState(), noDockSizes.Tests
test_dock_state_restart(25 cases, both window-manager profiles) andtest_dock_proportions(9 cases) now drive the adapter with the real model and persistDockStatewithDockSizesthroughconfig_save_safeas OBSBasic does. Both link the frontend's Rust owner interface (OBS::fallback-warning-test-frontend) and fail withoutOBS_FRONTEND_RUST.e5_move_a_dock_small, P4e6_drag_shrink_move, P5e7_reset_docks_small, P6e8_move_a_floating_dock, P7p7_float_a_dock_sizes(sizes, and the layout both profiles save must match).separator_click_does_not_save_a_clamped_layoutcompared saved blob bytes; the saved blob is now live and the sizes are inDockSizes, so it compares the layout after a restart. The proportions cases size docks with a real separator drag (several moves, events processed between them), because only a drag is the user's change now.test_dock_proportionsnow requiresHAVE_QT_WIDGETS_TEST_OWNER/HAVE_QT_WIDGETS_TESTLIB_OWNERliketest_dock_state_restart, so the Qt replay incanonical_remux_queue_runs_unchanged(Qt and cmocka only, no frontend Rust) no longer builds it;canonical_dock_proportions_is_registeredandqt_widgets_expected.jsonpin the new records.ci/test_dock_state_writers.pyaccepts the sizes argument.qt_widgets_runtime.rs(libobs-integration, needsDISPLAY) still expects 3 cases oftest_dock_state_restartand gives no frontend Rust owner. It was already stale before this PR (20 cases since test: dock layout cases under a floating and a tiling window manager (Refs #5230) #5359) and no CI lane runs it.RED
093a1ec7c(stub adapter with upstream behavior, OBSBasic unchanged):test_dock_proportionsfails 8 of 9 (the shares come back even, the column narrow);test_dock_state_restartfails 24 of 25: the first two on their asserts (the saved blob is the clamp;315 is not within the range [498, 502]), the rest crash after cmocka'slongjmpleaves the Qt windows of a failed case behind (a fixture weakness that only shows when a case fails). GREENe688cdc67: the Qt Frontend Linux lane passes on build-rust (ci/linux_qt_frontend.py, Qt 6.11.1 with QtTest), 30 Qt tests;test_dock_state_restart25/25,test_dock_proportions9/9;./lintpasses; the touched registration tests pass.Other platforms, the same two harnesses built standalone against the real model: macOS 27.2.1 (Cocoa, Qt 6.11.1) 25/25 and 9/9; Windows 11 (Qt 6.10.1, MSVC, the
windowsplatform in a console session,QT_SCALE_FACTOR=0.75for the VM's 1280x800 display) 25/25 and 9/9.e8_move_a_floating_dockmoves the dock to 120,140, because Qt keeps a floating dock on screen when it restores one.Tier 2 and Tier 3: not applicable (frontend; no C original for the adapter). Test cost:
test_dock_state_restartabout 12 s,test_dock_proportionsabout 4 s (Xvfb/offscreen), no own threads.Real app
The local Qt-lane build (X11) on build-rust, Xvfb with i3 (a tiling window manager), driven with
xdotool:DockStatewith 5 docks visible,DockSizes=v1;…;aL=280;aB=216;dcontrolsDock=210;dmixerDock=593;dscenesDock=448;dsourcesDock=448;dtransitionsDock=185Dock layout: restored 342 bytes, with its sizes; column 280 px, bottom row in the saved sharesdmixerDock=593…)aL=377; the row lengths unchangedmacOS app (Apple silicon, the user's own profile), by hand:
restored 342 bytes, no sizes for it yet; quit writesDockSizes(aL=378;aB=247;…)with its sizes; the sizes come backaL=593,dmixerDock=576,dtransitionsDock=479The macOS quit bug found on the way (a floating main dock could cancel Cmd+Q) is #5406, fixed in #5410.
Not checked yet: Wayland (Hyprland), the Windows app.
Refs, notFixes, until a Hyprland user confirms.docs/features.md: the dock entry is rewritten as one line for #2225, #3740 and #5230.🤖 Generated with Claude Code