From a57fc5b5fd3ca0c92e7a45e65e68a2dca1f8ec6b Mon Sep 17 00:00:00 2001 From: jpirnay Date: Tue, 14 Apr 2026 20:49:52 +0200 Subject: [PATCH] Fix contentRect for X3 --- src/components/UITheme.cpp | 29 +++++++++++++++++++++++++---- src/components/UITheme.h | 3 ++- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/components/UITheme.cpp b/src/components/UITheme.cpp index d4ec15ad..7fa7abe4 100644 --- a/src/components/UITheme.cpp +++ b/src/components/UITheme.cpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -77,19 +78,39 @@ Rect UITheme::getContentRect(const GfxRenderer& renderer, bool hasBottomHints, b switch (renderer.getOrientation()) { case GfxRenderer::Portrait: bottom = bh; - right = sw; + if (gpio.deviceIsX3() && hasSideHints) { + left = sw; + right = sw; + } else { + right = sw; + } break; case GfxRenderer::PortraitInverted: top = bh; - left = sw; + if (gpio.deviceIsX3() && hasSideHints) { + left = sw; + right = sw; + } else { + left = sw; + } break; case GfxRenderer::LandscapeClockwise: left = bh; - bottom = sw; + if (gpio.deviceIsX3() && hasSideHints) { + top = sw; + bottom = sw; + } else { + bottom = sw; + } break; case GfxRenderer::LandscapeCounterClockwise: right = bh; - top = sw; + if (gpio.deviceIsX3() && hasSideHints) { + top = sw; + bottom = sw; + } else { + top = sw; + } break; } diff --git a/src/components/UITheme.h b/src/components/UITheme.h index 19f576de..ed63bd7b 100644 --- a/src/components/UITheme.h +++ b/src/components/UITheme.h @@ -55,7 +55,8 @@ class UITheme { static std::function makeSelectablePredicate(int total, std::function titleGetter); // Returns the drawable content Rect accounting for screen orientation and visible button hints. - // Bottom hints occupy the physical bottom edge; side hints occupy the physical right edge. + // Bottom hints occupy the physical bottom edge. + // Side hints occupy the physical right edge on X4, and both physical sides on X3. // The mapping to logical edges is orientation-dependent. static Rect getContentRect(const GfxRenderer& renderer, bool hasBottomHints, bool hasSideHints); static std::string getCoverThumbPath(std::string coverBmpPath, int coverHeight);