Repository navigation
libobs: Keep group children in place when the group resizes - #280
Merged
Merged
Conversation
Moving one child of a group changes the group's content bounds, so the group is resized on the next video tick: its children are shifted to start at the group's origin and the group is moved so the content stays where it was. The group's position is computed from the content's exact size, but the group draws with its alignment offset taken from the rounded size (ceil to whole pixels, scaled and truncated, integer halves for centred alignment), so every resize moves the content by the remainder and the moves add up. test_group_child_drift moves one child of a two-child group in 60 fractional steps on a 1920x1080 canvas, as dragging in a scaled preview does, and checks where the other child ends up. Today it moves by (-0.66, -0.57) px with a centred group and by (-29.3, -30.1) px with a bottom-right group; a top-left group stays put and guards the fix. Reported upstream in obsproject/obs-studio#9298 by Durss, confirmed by RytoEX and PatTheMav. Refs obs-rust#279. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
resize_group() moved the group to where the content's alignment anchor was, computed from the content's exact size, while the group draws with its alignment offset taken from its rounded size. With centred, right or bottom alignment each resize therefore shifted the content by the rounding remainder, and dragging one child slowly dragged its siblings across the canvas. Measure instead: note where the content's corner is on the parent with the old transform, rebuild the transform with the new size, and move the group by the difference. The content then stays exactly in place whatever the rounding, alignment, scale or rotation. Fixes obs-rust#279. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
rdoupe
added a commit
to rdoupe/obs-studio
that referenced
this pull request
Oct 11, 2026
obs_startup() needs a display on Linux, and the Tier 2 Linux lane has none. test_audio_clock_drift (obs-rust#271) and test_group_child_drift (obs-rust#280) failed their group setup there instead of skipping, which turned that lane red on master. test_pulse_monitor_device (obs-rust#275) has the same setup and would fail the same way on a machine with PipeWire but no display. Like the other core tests, they now skip their cases when libobs cannot start (and the group test also when core video cannot be reset). Under xvfb-run every case still runs. Refs obs-rust#270, obs-rust#274 and obs-rust#279. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This was referenced Oct 11, 2026
zackees
pushed a commit
to rdoupe/obs-studio
that referenced
this pull request
Oct 11, 2026
obs_startup() needs a display on Linux, and the Tier 2 Linux lane has none. test_audio_clock_drift (obs-rust#271) and test_group_child_drift (obs-rust#280) failed their group setup there instead of skipping, which turned that lane red on master. test_pulse_monitor_device (obs-rust#275) has the same setup and would fail the same way on a machine with PipeWire but no display. Like the other core tests, they now skip their cases when libobs cannot start (and the group test also when core video cannot be reset). Under xvfb-run every case still runs. Refs obs-rust#270, obs-rust#274 and obs-rust#279. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Local-Gate: v1 tree=b23e288a822896090994f89892a7a96b56da5f80 secs=109 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791758098,"gate":"rust/all/fmt","host":"linux-x86_64","key":"9087272be2f5e155c698727d45922688d933308d2c4f08bc86b0f6e131472181","lane":"lint","parents":["35bbf88c776c3a4cb7073dae0b7869a9b75af833"],"secs":15,"stamp":"25c454c9d662469fb5114491251212e2","tree":"b23e288a822896090994f89892a7a96b56da5f80","v":1,"via":"run"} Ci-Attestation: {"at":1791758098,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"9087272be2f5e155c698727d45922688d933308d2c4f08bc86b0f6e131472181","lane":"lint","parents":["35bbf88c776c3a4cb7073dae0b7869a9b75af833"],"secs":15,"stamp":"103e935b7c7d4896cf51a6593a16411a","tree":"b23e288a822896090994f89892a7a96b56da5f80","v":1,"via":"run"} Ci-Attestation: {"at":1791758098,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"2163bf0ab811b6bf62c711d254cc4f2bbd240ef3efeeb7f5425a8b720e0132d7","lane":"rust-test","parents":["35bbf88c776c3a4cb7073dae0b7869a9b75af833"],"secs":45,"stamp":"7a7452f3822e6646eb2e2c481ee772ca","tree":"b23e288a822896090994f89892a7a96b56da5f80","v":1,"via":"run"} Ci-Attestation: {"at":1791758098,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"93153b10b0a7fc6c2e9fe5745e8f1b417bf629afda1d66c21fe151867ea291a7","lane":"tier2-linux","parents":["35bbf88c776c3a4cb7073dae0b7869a9b75af833"],"secs":49,"stamp":"9d46f419860c544d1aeb889a3d125f74","tree":"b23e288a822896090994f89892a7a96b56da5f80","v":1,"via":"run"}
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.
Description
Moving one child of a group no longer drags the group's other children across the canvas.
Moving a child changes the group's content bounds, so the group is resized on the next video tick:
resize_group()shifts the children to start at the group's origin and moves the group so the content stays where it was. It computed the group's new position from the content's exact size, but the group draws with its alignment offset taken from its rounded size (ceil()to whole pixels, scaled and truncated, integer halves for centred alignment). With centred, right or bottom alignment, every resize shifted the content by the rounding remainder, and the shifts added up.test: Moving a group child must not drag its siblings (RED):test_group_child_driftbuilds a two-child group on a 1920x1080 canvas, moves one child in 60 fractional steps (as dragging in a scaled preview does), waits for the group to resize after each, and measures the other child on the canvas. Today: (−0.66, −0.57) px with a centred group, (−29.3, −30.1) px with a bottom-right group; the top-left case passes and guards the fix. 2 of 3 fail.libobs: Keep group children in place when the group resizes: note where the content's corner is on the parent with the old transform, rebuild the transform with the new size, and move the group by the difference. The content stays exactly in place whatever the rounding, alignment, scale or rotation. 3 of 3 pass.The group's own position can still differ from the content's exact edge by under a pixel, because its size is whole pixels; it no longer accumulates.
Motivation and Context
Fixes #279 (upstream obsproject/obs-studio#9298, reported by Durss)
Why this one: confirmed upstream by RytoEX and PatTheMav ("the calculated values for positions are wildly off"), with a video from the reporter; anyone laying out groups with centred or bottom/right alignment sees their sources creep while editing.
How Has This Been Tested?
Automated, in both libobs lanes (
ENABLE_RUST_LIBOBSOFF and ON), on current master:test_group_child_drift: 2 of 3 fail at the RED commit, 3 of 3 pass at GREEN.ci/test_registration.pyare clean.obs_startup()fails and the new test's cases skip, as the other core tests do.Not tested:
Types of changes
Checklist:
🤖 Generated with Claude Code