From 877f517a024f1a64ea1d343bc7f4a23b08151987 Mon Sep 17 00:00:00 2001 From: ItsLemmy Date: Tue, 11 Nov 2025 06:21:58 -0500 Subject: [PATCH] Bar: reimplemented hairline gap safety. --- Modules/Bar/Bar.qml | 33 ++++--------------------- Modules/MainScreen/BarContentWindow.qml | 4 +-- Modules/MainScreen/MainScreen.qml | 17 +++++++------ 3 files changed, 16 insertions(+), 38 deletions(-) diff --git a/Modules/Bar/Bar.qml b/Modules/Bar/Bar.qml index 76d0b5a1..29d356a2 100644 --- a/Modules/Bar/Bar.qml +++ b/Modules/Bar/Bar.qml @@ -27,8 +27,6 @@ Item { readonly property string barPosition: Settings.data.bar.position || "top" readonly property bool barIsVertical: barPosition === "left" || barPosition === "right" readonly property bool barFloating: Settings.data.bar.floating || false - readonly property real barMarginH: 0 //barFloating ? Settings.data.bar.marginHorizontal * Style.marginXL : 0 - readonly property real barMarginV: 0 //barFloating ? Settings.data.bar.marginVertical * Style.marginXL : 0 // Fill the parent (the Loader) anchors.fill: parent @@ -38,7 +36,6 @@ Item { if (screen && screen.name) { Logger.d("Bar", "Bar screen set to:", screen.name) Logger.d("Bar", " Position:", barPosition, "Floating:", barFloating) - Logger.d("Bar", " Margins - H:", barMarginH, "V:", barMarginV) BarService.registerBar(screen.name) } } @@ -64,31 +61,11 @@ Item { Item { id: bar - // Position and size the bar based on orientation and floating margins - x: { - var baseX = (root.barPosition === "right") ? (parent.width - Style.barHeight - root.barMarginH) : root.barMarginH - if (root.barPosition === "right") - return baseX // Extend left towards panels - return baseX - } - y: { - var baseY = (root.barPosition === "bottom") ? (parent.height - Style.barHeight - root.barMarginV) : root.barMarginV - if (root.barPosition === "bottom") - return baseY // Extend up towards panels - return baseY - } - width: { - var baseWidth = root.barIsVertical ? Style.barHeight : (parent.width - root.barMarginH * 2) - if (!root.barIsVertical) - return baseWidth // Horizontal bars extend via height, not width - return baseWidth + 1 - } - height: { - var baseHeight = root.barIsVertical ? (parent.height - root.barMarginV * 2) : Style.barHeight - if (!root.barIsVertical) - return baseHeight - return baseHeight // Vertical bars extend via width, not height - } + // Position and size the bar content based on orientation + x: (root.barPosition === "right") ? (parent.width - Style.barHeight) : 0.5 + y: (root.barPosition === "bottom") ? (parent.height - Style.barHeight) : 0.5 + width: root.barIsVertical ? Style.barHeight : parent.width + height: root.barIsVertical ? parent.height : Style.barHeight // Corner states for new unified background system // State -1: No radius (flat/square corner) diff --git a/Modules/MainScreen/BarContentWindow.qml b/Modules/MainScreen/BarContentWindow.qml index 66958b0e..d332447d 100644 --- a/Modules/MainScreen/BarContentWindow.qml +++ b/Modules/MainScreen/BarContentWindow.qml @@ -34,8 +34,8 @@ PanelWindow { readonly property string barPosition: Settings.data.bar.position || "top" readonly property bool barIsVertical: barPosition === "left" || barPosition === "right" readonly property bool barFloating: Settings.data.bar.floating || false - readonly property real barMarginH: barFloating ? Settings.data.bar.marginHorizontal * Style.marginXL : 0 - readonly property real barMarginV: barFloating ? Settings.data.bar.marginVertical * Style.marginXL : 0 + readonly property real barMarginH: Math.round(barFloating ? Settings.data.bar.marginHorizontal * Style.marginXL : 0) + readonly property real barMarginV: Math.round(barFloating ? Settings.data.bar.marginVertical * Style.marginXL : 0) // Anchor to the bar's edge anchors { diff --git a/Modules/MainScreen/MainScreen.qml b/Modules/MainScreen/MainScreen.qml index 936246af..ce34c56f 100644 --- a/Modules/MainScreen/MainScreen.qml +++ b/Modules/MainScreen/MainScreen.qml @@ -326,7 +326,7 @@ PanelWindow { } } - // Bar placeholder - just for background positioning (actual bar content is in BarContentWindow) + // Bar background placeholder - just for background positioning (actual bar content is in BarContentWindow) Item { id: barPlaceholder @@ -336,28 +336,29 @@ PanelWindow { // Screen reference property ShellScreen screen: root.screen - // Bar positioning properties (match Bar.qml logic) + // Bar background positioning properties readonly property string barPosition: Settings.data.bar.position || "top" readonly property bool barIsVertical: barPosition === "left" || barPosition === "right" readonly property bool barFloating: Settings.data.bar.floating || false - readonly property real barMarginH: barFloating ? Settings.data.bar.marginHorizontal * Style.marginXL : 0 - readonly property real barMarginV: barFloating ? Settings.data.bar.marginVertical * Style.marginXL : 0 + readonly property real barMarginH: barFloating ? Math.round(Settings.data.bar.marginHorizontal * Style.marginXL) : 0 + readonly property real barMarginV: barFloating ? Math.round(Settings.data.bar.marginVertical * Style.marginXL) : 0 + readonly property real attachmentOverlap: 1 // Attachment overlap to fix hairline gap with fractional scaling // Expose bar dimensions directly on this Item for BarBackground // Use screen dimensions directly x: { if (barPosition === "right") - return screen.width - Style.barHeight - barMarginH + return screen.width - Style.barHeight - barMarginH - attachmentOverlap // Extend left towards panels return barMarginH } y: { if (barPosition === "bottom") - return screen.height - Style.barHeight - barMarginV + return screen.height - Style.barHeight - barMarginV - attachmentOverlap return barMarginV } width: { if (barIsVertical) { - return Style.barHeight + 1 + return Style.barHeight + attachmentOverlap } return screen.width - barMarginH * 2 } @@ -365,7 +366,7 @@ PanelWindow { if (barIsVertical) { return screen.height - barMarginV * 2 } - return Style.barHeight + return Style.barHeight + attachmentOverlap } // Corner states (same as Bar.qml)