From c20773d60b0c109a38d84c4c48ed94bc1978087f Mon Sep 17 00:00:00 2001 From: ItsLemmy Date: Mon, 22 Sep 2025 13:40:38 -0400 Subject: [PATCH] Prevent NPanel dragging when popup are open. --- Modules/Bar/Widgets/SidePanelToggle.qml | 8 +++++--- .../SettingsPanel/Bar/BarWidgetSettingsDialog.qml | 5 ++--- .../Bar/WidgetSettings/SidePanelToggleSettings.qml | 9 ++++----- Modules/SettingsPanel/SettingsPanel.qml | 2 +- Modules/WallpaperSelector/WallpaperSelector.qml | 3 ++- Widgets/NColorPickerDialog.qml | 13 ++++++++++--- 6 files changed, 24 insertions(+), 16 deletions(-) diff --git a/Modules/Bar/Widgets/SidePanelToggle.qml b/Modules/Bar/Widgets/SidePanelToggle.qml index f2336f69..91b53406 100644 --- a/Modules/Bar/Widgets/SidePanelToggle.qml +++ b/Modules/Bar/Widgets/SidePanelToggle.qml @@ -52,9 +52,11 @@ NIconButton { width: root.width * 0.8 height: width source: { - if (customIconPath !== "") return customIconPath; - if (useDistroLogo) return DistroLogoService.osLogo; - return ""; + if (customIconPath !== "") + return customIconPath + if (useDistroLogo) + return DistroLogoService.osLogo + return "" } visible: source !== "" smooth: true diff --git a/Modules/SettingsPanel/Bar/BarWidgetSettingsDialog.qml b/Modules/SettingsPanel/Bar/BarWidgetSettingsDialog.qml index 812f223f..74b34888 100644 --- a/Modules/SettingsPanel/Bar/BarWidgetSettingsDialog.qml +++ b/Modules/SettingsPanel/Bar/BarWidgetSettingsDialog.qml @@ -26,7 +26,7 @@ Popup { height: content.implicitHeight + padding * 2 padding: Style.marginXL * scaling modal: true - + onOpened: { // Mark this popup has opened in the PanelService PanelService.willOpenPopup(widgetSettings) @@ -120,7 +120,7 @@ Popup { } } - function loadWidgetSettings() { + function loadWidgetSettings() { const widgetSettingsMap = { "ActiveWindow": "WidgetSettings/ActiveWindowSettings.qml", "Battery": "WidgetSettings/BatterySettings.qml", @@ -147,5 +147,4 @@ Popup { }) } } - } diff --git a/Modules/SettingsPanel/Bar/WidgetSettings/SidePanelToggleSettings.qml b/Modules/SettingsPanel/Bar/WidgetSettings/SidePanelToggleSettings.qml index caae851b..ee31b3ee 100644 --- a/Modules/SettingsPanel/Bar/WidgetSettings/SidePanelToggleSettings.qml +++ b/Modules/SettingsPanel/Bar/WidgetSettings/SidePanelToggleSettings.qml @@ -38,7 +38,6 @@ ColumnLayout { } } - RowLayout { spacing: Style.marginM * scaling @@ -79,9 +78,9 @@ ColumnLayout { id: iconPicker initialIcon: valueIcon onIconSelected: iconName => { - valueIcon = iconName - valueCustomIconPath = "" - } + valueIcon = iconName + valueCustomIconPath = "" + } } NFilePicker { @@ -89,4 +88,4 @@ ColumnLayout { title: "Select a custom icon" onAccepted: paths => valueCustomIconPath = paths[0] } -} \ No newline at end of file +} diff --git a/Modules/SettingsPanel/SettingsPanel.qml b/Modules/SettingsPanel/SettingsPanel.qml index 5993f902..81772ff9 100644 --- a/Modules/SettingsPanel/SettingsPanel.qml +++ b/Modules/SettingsPanel/SettingsPanel.qml @@ -21,7 +21,7 @@ NPanel { panelKeyboardFocus: true - draggable: true + draggable: (PanelService.openedPopup === null) // Tabs enumeration, order is NOT relevant enum Tab { diff --git a/Modules/WallpaperSelector/WallpaperSelector.qml b/Modules/WallpaperSelector/WallpaperSelector.qml index 0781c11b..4828df14 100644 --- a/Modules/WallpaperSelector/WallpaperSelector.qml +++ b/Modules/WallpaperSelector/WallpaperSelector.qml @@ -18,7 +18,8 @@ NPanel { panelAnchorHorizontalCenter: true panelAnchorVerticalCenter: true panelKeyboardFocus: true - draggable: true + + draggable: (PanelService.openedPopup === null) panelContent: Rectangle { id: wallpaperPanel diff --git a/Widgets/NColorPickerDialog.qml b/Widgets/NColorPickerDialog.qml index 6cf6965f..836fb4ab 100644 --- a/Widgets/NColorPickerDialog.qml +++ b/Widgets/NColorPickerDialog.qml @@ -26,7 +26,14 @@ Popup { y: (parent.height - height) * 0.5 modal: true - clip: true + + onOpened: { + PanelService.willOpenPopup(root) + } + + onClosed: { + PanelService.willClosePopup(root) + } function rgbToHsv(r, g, b) { r /= 255 @@ -110,9 +117,9 @@ Popup { border.width: Math.max(1, Style.borderM * scaling) } - NScrollView { + contentItem: NScrollView { id: scrollView - anchors.fill: parent + width: parent.width verticalPolicy: ScrollBar.AlwaysOff horizontalPolicy: ScrollBar.AlwaysOff