Keep a screen's controls with it when the layout moves it

ft-screens read a screen's pose back from SteamVR right after setting it
to place its controls. SteamVR could still return the old pose, so after
Arrange now (or a layout reset) the bar and buttons stayed where the screen
had been. ft-screens now keeps each screen's pose itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DeeJanuzandClaude Opus 5.5 committed 2026-09-26 20:13:51 -06:00
1 parent f70073b140
commit 388da117ce
1 file changed
+6 -2
+6 -2
View File
@@ -205,6 +205,7 @@ struct Screen {
float alpha = 1;
vr::TrackedDeviceIndex_t pinned = kNone; // riding on this controller
Mat pinRel = Identity(); // controller -> screen
Mat pose = Identity(); // where it is in the room, when not pinned
Drag drag = Drag::None;
vr::TrackedDeviceIndex_t dragDevice = kNone;
Mat dragRel = Identity(); // device -> screen, while moving
@@ -444,8 +445,10 @@ bool ScreenPose(const Screen &s, Mat *out) {
*out = Mul(d, s.pinRel);
return true;
}
vr::ETrackingUniverseOrigin origin;
return vr::VROverlay()->GetOverlayTransformAbsolute(s.overlay, &origin, out) == vr::VROverlayError_None;
// Our own copy: reading it back from SteamVR right after setting it could return the
// old pose, which left a moved screen's controls behind.
*out = s.pose;
return true;
}
// The controls' size from both the screen's width and its distance from the head (the
@@ -533,6 +536,7 @@ void RefreshChrome() {
void SetAbsolute(Screen &s, const Mat &pose) {
s.pinned = kNone;
s.pose = pose;
vr::VROverlay()->SetOverlayTransformAbsolute(s.overlay, vr::TrackingUniverseStanding, &pose);
PlaceChrome(s);
}