Skip to content

frontend: report a screen change as a resize to the display's layout - #4052

Merged
vpacher merged 5 commits into
masterfrom
fix/4010-display-screen-change
Nov 8, 2026
Merged

vpacher merged 5 commits into
masterfrom
fix/4010-display-screen-change

Conversation

@vpacher

@vpacher vpacher commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Refs #4010

What changes

On macOS, a window dragged to a screen with another pixel ratio keeps its size in points, so Qt sends no resize event, only QWindow::screenChanged. OBSQTDisplay resized its obs_display there but did not emit DisplayResized. The studio-mode program view lays out (ResizeProgram) only on that signal, so it kept the scale and position of the old pixel ratio until the window was resized by hand.

OBSQTDisplay's screenChanged handler now emits DisplayResized(). The main preview already followed (it also connects the window's screenChanged); the program view, projectors and other displays that lay out on DisplayResized now follow too.

Ledger line in docs/features.md.

Test

test_display_screen_change (new, Linux, Qt Widgets) builds the real OBSQTDisplay (its own unity group) on Qt's offscreen platform with two screens; QT_SCREEN_SCALE_FACTORS gives the second pixel ratio 2 (the offscreen dpr setting reaches the screen, not its windows). A real move on the offscreen platform is no model of macOS: it keeps a window's size in pixels across a screen change, so a resize event comes too and hides the bug. So the test sends the display's window what macOS sends, screenChanged and no resize, and expects DisplayResized.

RED and GREEN

  • RED cfe7bb4 (with the link and setup fixes 5bb9e01, c5d3c39 before it): screen_change_without_resize_reports_a_resize: resized > 0 is not true.
  • GREEN 37421a7: all 22 Qt-linked tests pass.

Both measured with the "Qt Frontend Linux" job's own script (ci/linux_qt_frontend.py, prebuilt Qt 6.11.1, Ubuntu 26.04) on a local machine. The local gate passed and stamped GREEN (its Tier 2 build has no Qt; CI's Qt job runs this test).

Not done yet

The check by hand on macOS (studio mode, drag the window between a Retina and a non-Retina display) follows with the next nightly. Hence Refs, not Fixes; I close #4010 after that check.

Test cost: 2 new cmocka cases, 0.02 s, no own threads.

🤖 Generated with Claude Code

vpacher and others added 5 commits November 8, 2026 18:08
… files (RED)

The test linked OBSQTDisplay without SurfaceEventFilter's moc output and
without the two platform hooks OBSQTDisplay calls. moc the filter, and stand
in for PlatformResetsHiddenDisplay and HandlePlatformDisplayNativeEvent as
the X11 platform file does.

Refs #4010

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s (RED)

The test called windowHandle()->setScreen() before the first show(), when
the top-level widget has no QWindow yet, and crashed. QWidget::setScreen()
works before and after show().

Refs #4010

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e (RED)

Qt's offscreen platform keeps a window's size in pixels across a real
screen change, so its size in points changes and a resize event comes too,
which would hide the bug. macOS keeps the points and sends only
QWindow::screenChanged. The test now sends the display's window that signal
and no resize, and the pixel ratio comes from QT_SCREEN_SCALE_FACTORS (the
offscreen "dpr" reaches the screen, not its windows).

RED, Qt Frontend Linux job locally (ci/linux_qt_frontend.py, Qt 6.11.1):
  screen_change_without_resize_reports_a_resize: resized > 0 is not true

Refs #4010

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…yout (GREEN)

On macOS a window dragged to a screen with another pixel ratio keeps its
size in points, so Qt sends no resize event, only QWindow::screenChanged.
OBSQTDisplay resized its obs_display there but did not emit
DisplayResized, so the studio-mode program view (and every display that
lays out on that signal) kept the old pixel ratio's scale and position.
The screenChanged handler now emits DisplayResized.

GREEN, Qt Frontend Linux job locally: all 22 Qt-linked tests pass. The
check by hand on macOS (Retina and an external display) follows with the
next nightly.

Refs #4010

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Local-Gate: v1 tree=c9cf9f2b5cb27e9b7171bdb8cb27f6c260a0c85c secs=401 lanes=lint:run,dylint:reused@55c72dbe3fdb,rust-test:reused@4994ca4bb9fc,cross:reused@13f0be523ab3,tier2-linux:run,macos-native:n/a,windows-native:n/a
Ci-Attestation: {"at":1794161849,"gate":"rust/all/fmt","host":"linux-x86_64","key":"efdd8a7776fd73ba13bca9a37bf3dc6c8ee284071d610de2ff56acd254d6d8c2","lane":"lint","parents":["cfe7bb49e5e52daf9415aa430bc5251bb1a93d9c"],"secs":34,"stamp":"d92eef7d88f240c287208d9d0386c4aa","tree":"c9cf9f2b5cb27e9b7171bdb8cb27f6c260a0c85c","v":1,"via":"run"}
Ci-Attestation: {"at":1794161849,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"efdd8a7776fd73ba13bca9a37bf3dc6c8ee284071d610de2ff56acd254d6d8c2","lane":"lint","parents":["cfe7bb49e5e52daf9415aa430bc5251bb1a93d9c"],"secs":34,"stamp":"beb77d7468022026f4030f4029f27978","tree":"c9cf9f2b5cb27e9b7171bdb8cb27f6c260a0c85c","v":1,"via":"run"}
Ci-Attestation: {"at":1794158143,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"4994ca4bb9fc29d79c925e3266c51cc36a844a0ed34cd874fbb0c0e063e93014","lane":"rust-test","parents":["cfe7bb49e5e52daf9415aa430bc5251bb1a93d9c"],"secs":null,"stamp":"019583631a1677152b199300c791c946","tree":"c9cf9f2b5cb27e9b7171bdb8cb27f6c260a0c85c","v":1,"via":"reused"}
Ci-Attestation: {"at":1794158143,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"13f0be523ab3f0244bcadd4f260144cb0f09f14b8c5570eb1499014f8bc26f08","lane":"cross","parents":["cfe7bb49e5e52daf9415aa430bc5251bb1a93d9c"],"secs":null,"stamp":"e28283a35e0d8b2d8a39fde538d1569c","tree":"c9cf9f2b5cb27e9b7171bdb8cb27f6c260a0c85c","v":1,"via":"reused"}
Ci-Attestation: {"at":1794158143,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"13f0be523ab3f0244bcadd4f260144cb0f09f14b8c5570eb1499014f8bc26f08","lane":"cross","parents":["cfe7bb49e5e52daf9415aa430bc5251bb1a93d9c"],"secs":null,"stamp":"4956d11d2407880c9cf43a042755323b","tree":"c9cf9f2b5cb27e9b7171bdb8cb27f6c260a0c85c","v":1,"via":"reused"}
Ci-Attestation: {"at":1794158143,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"13f0be523ab3f0244bcadd4f260144cb0f09f14b8c5570eb1499014f8bc26f08","lane":"cross","parents":["cfe7bb49e5e52daf9415aa430bc5251bb1a93d9c"],"secs":null,"stamp":"acae70a30b04fc224ff0210ba9603bd9","tree":"c9cf9f2b5cb27e9b7171bdb8cb27f6c260a0c85c","v":1,"via":"reused"}
Ci-Attestation: {"at":1794158143,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"13f0be523ab3f0244bcadd4f260144cb0f09f14b8c5570eb1499014f8bc26f08","lane":"cross","parents":["cfe7bb49e5e52daf9415aa430bc5251bb1a93d9c"],"secs":null,"stamp":"354c313e3ba4325119d1c6783315edb1","tree":"c9cf9f2b5cb27e9b7171bdb8cb27f6c260a0c85c","v":1,"via":"reused"}
Ci-Attestation: {"at":1794161849,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"5867abaaf417e0f65beb8987d5345fc3c14310d7569da92cb35ad94fcc362f23","lane":"tier2-linux","parents":["cfe7bb49e5e52daf9415aa430bc5251bb1a93d9c"],"secs":401,"stamp":"110408e1227730d353d1ce4f85b49f7c","tree":"c9cf9f2b5cb27e9b7171bdb8cb27f6c260a0c85c","v":1,"via":"run"}
@vpacher vpacher changed the title frontend: a display moved to another pixel ratio reports a resize frontend: report a screen change as a resize to the display's layout Nov 8, 2026
@vpacher
vpacher marked this pull request as ready for review November 8, 2026 18:20
@vpacher
vpacher requested a review from zackees as a code owner November 8, 2026 18:20
@vpacher
vpacher enabled auto-merge November 8, 2026 18:20
@vpacher
vpacher added this pull request to the merge queue Nov 8, 2026
Merged via the queue into master with commit 096ef55 Nov 8, 2026
41 checks passed
@vpacher
vpacher deleted the fix/4010-display-screen-change branch November 8, 2026 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bug: frontend: in studio mode the program view keeps its old size after the window moves to a screen with another pixel ratio

1 participant