Skip to content

feat(framebuffer): Change orientation at runtime (6.8) - #25130

Merged
agneszitte merged 1 commit into
unoplatform:servicing/6.8from
ramezgerges:dev/rara/68-fb-runtime-orientation
Oct 13, 2026
Merged

agneszitte merged 1 commit into
unoplatform:servicing/6.8from
ramezgerges:dev/rara/68-fb-runtime-orientation

Conversation

@ramezgerges

Copy link
Copy Markdown
Contributor

GitHub Issue: #25058 (backport of #25059)

PR Type:

✨ Feature

What changed? 🚀

Backport of #25059 to 6.8.

Until now, the Linux framebuffer's display orientation was fixed at startup by FramebufferHostBuilder.Orientation(...). This PR adds an overload that also hands the app a setter, which can change the orientation while the app runs:

Action<DisplayOrientations>? setOrientation = null;

var host = UnoPlatformHostBuilder.Create()
    .App(() => new App())
    .UseLinuxFrameBuffer(fb => fb.Orientation(DisplayOrientations.Landscape, out setOrientation))
    .Build();

// later, from any thread; applied on the UI thread
setOrientation?.Invoke(DisplayOrientations.Portrait);

Behavior:

  • A change rotates rendering, remaps pointer and touch input, and updates the window bounds (raising SizeChanged when width and height swap). It also requests a redraw, because a 180° turn leaves the bounds unchanged.
  • The setter accepts only Landscape, Portrait, LandscapeFlipped and PortraitFlipped, and throws ArgumentOutOfRangeException for anything else.
  • Called before the host exists, it only changes the orientation the app starts in.
  • DisplayInformation.CurrentOrientation now reports the actual orientation. It previously always returned Landscape on the framebuffer. DisplayInformation.OrientationChanged is raised on each change, through a new internal NotifyOrientationChanged on Skia.

Implementation:

  • FrameBufferWindowWrapper keeps the orientation and the unrotated screen size together in one immutable snapshot, swapped atomically.
  • The renderer reads one snapshot per frame, and pointer and touch mapping read one per event. So neither can combine a new orientation with an old size while a change is in progress.
  • The input mapping now works from the unrotated size. It gives the same results as the previous per-orientation formulas.

Differences from #25059:

  • The 6.8 projects keep their Skia names (Uno.UI.Runtime.Skia.Linux.FrameBuffer, the builder in Uno.UI.Runtime.Skia), so the test looks up Uno.UI.Runtime.Skia.FramebufferHostBuilder.
  • 6.8's renderer passes integer offsets to PresentToOutput, so the physical size is cast to int where master uses doubles.
  • The test lives at 6.8's location, Tests/Windows_Graphics/.

Validation:

  • Runtime: a self-contained 6.8 SamplesApp.Skia.Generic (linux-x64) in the same QEMU VM as feat(framebuffer): Change orientation at runtime #25059, on the framebuffer's software renderer. The new Given_DisplayInformation_FrameBufferOrientation passes 5 of 5: a quarter turn and a half turn on the running app, two rejected values, and a call before the host exists.
  • Compile: Uno.UI.Runtime.Skia.Linux.FrameBuffer and Uno.UI.RuntimeTests.Skia build on servicing/6.8.
  • Not covered at runtime: the corner-marker screenshots from feat(framebuffer): Change orientation at runtime #25059 weren't repeated, and pointer and touch mapping still isn't exercised, since the VM has no absolute pointing device. The rotation and mapping code is the same as master's.

PR Checklist ✅

🤖 Generated with Claude Code

Closes unoplatform#25058.

FramebufferHostBuilder.Orientation(orientation, out setOrientation)
hands the app a setter it can call at any time, from any thread. The
change is applied on the UI thread: rendering and input rotate, the
window bounds swap, and DisplayInformation reports the orientation and
raises OrientationChanged. CurrentOrientation previously always
reported Landscape on the framebuffer.

Orientation and the unrotated screen size are kept in one snapshot so
the render and input threads never pair a new orientation with a stale
size.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
(cherry picked from commit 44fa00f)
@github-actions github-actions Bot added area/skia ✏️ Categorizes an issue or PR as relevant to Skia kind/documentation labels Oct 8, 2026
@unodevops

Copy link
Copy Markdown
Contributor

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 238316 did not find any UI Test snapshots differences.

@agneszitte
agneszitte merged commit f3fb01f into unoplatform:servicing/6.8 Oct 13, 2026
43 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/skia ✏️ Categorizes an issue or PR as relevant to Skia kind/documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants