Skip to content

bug: libobs: moving one child of a group drags its siblings across the canvas (upstream #9298) #279

Closed

Description

@rdoupe

Upstream OBS bug, reported by Durss in obsproject/obs-studio#9298 (confirmed upstream by RytoEX and PatTheMav). Code unchanged in this fork.

Location

  • libobs/obs-scene.c:3500: resize_group() moves the group to where the content's alignment anchor was, computed from the content's exact size (minv/maxv).
  • libobs/obs-scene.c:325 and update_item_transform(): the group draws with its alignment offset taken from its rounded size: the scene size is ceil()ed to whole pixels, scaled and truncated to an integer, and centred alignment halves it with integer division.

Class

Layout drift: moving one child of a group slowly moves its other children across the canvas.

How it is reached

Group two sources, set the group's alignment to centre (or anything with a centred axis, or bottom/right), and drag one child around in the preview. Every move changes the content bounds and resizes the group; each resize shifts the content by the rounding remainder, and the shifts add up, so the untouched child creeps away. PatTheMav measured a bottom-right anchored group moving away from its corner.

Reproduced headlessly with libobs on a 1920x1080 canvas: after 60 fractional moves of one child, the other child moved 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 does not drift.

Proposed fix and failing test

Fix: instead of deriving the group's new position from the content size, note where the content's corner is with the old transform, rebuild the transform with the new size and move the group by the difference, so the content stays exactly in place whatever the rounding, alignment, scale or rotation.

RED test (cmocka, test_group_child_drift): the scenario above for centred, bottom-right and top-left groups. 2 of 3 fail today; top-left guards the fix.

Activity

  1. rdoupe commented on Oct 11, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: this issue.

    1. RED: test_group_child_drift (2 of 3 failing): one child moved in fractional steps, the sibling measured on the canvas for centred, bottom-right and top-left groups.
    2. GREEN: resize_group() moves the group by the measured difference so its content stays exactly in place.
      PR today.
  2. rdoupe commented on Oct 11, 2026

    @rdoupe
    CollaboratorAuthor

    @Durss you reported this in obsproject/obs-studio#9298, so a heads-up: it's fixed here in obs-rust by #280, merged today with a regression test.

    Cause, close to what PatTheMav suspected upstream: when a child moves, the group resizes and repositions itself so its content stays put, but it computed that position from the content's exact size while drawing itself with a size rounded to whole pixels (and halved with integer division for centred alignment). Every move shifted the content by the rounding remainder, and the shifts added up. Now the group measures where its content actually lands after the resize and corrects by the difference, so the other children stay exactly in place. The test moves one child 60 times in small fractional steps: before, the other child drifted by about 0.7 px with a centred group and 30 px with a bottom-right group; now it doesn't move.

    Workaround on stock OBS: use top-left alignment on groups whose children you move.

    obs-rust is an AI-assisted fork of OBS; on Arch it's obs-studio-rust-git in the AUR.

    If you try it, a short reply here on whether your groups stay put would really help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions