NPanel: reverted yesterday fix, trying another fix.

This commit is contained in:
ItsLemmy
2025-10-03 22:03:56 -04:00
parent cc59362a1a
commit cd7ac2b243
2 changed files with 5 additions and 14 deletions
+2 -1
View File
@@ -81,7 +81,8 @@ Variants {
acceptedButtons: Qt.RightButton
onClicked: function (mouse) {
if (mouse.button === Qt.RightButton) {
controlCenterPanel.toggle(BarService.lookupWidget("ControlCenter"))
// Important to pass the screen here so we get the right widget for the actual bar that was clicked.
controlCenterPanel.toggle(BarService.lookupWidget("ControlCenter", screen.name))
mouse.accepted = true
}
}
+3 -13
View File
@@ -84,22 +84,12 @@ Loader {
// -----------------------------------------
function open(buttonItem) {
// Get the button position if provided
if (buttonItem !== undefined && buttonItem !== null) {
useButtonPosition = true
// Try to get the button's window
var buttonWindow = buttonItem.Window.window
if (buttonWindow) {
// Map to button's window coordinates
var itemPosInWindow = buttonItem.mapToItem(buttonWindow.contentItem, 0, 0)
// Then account for window position on screen
buttonPosition = Qt.point(buttonWindow.x + itemPosInWindow.x, buttonWindow.y + itemPosInWindow.y)
} else {
// Fallback to old method
var itemPos = buttonItem.mapToItem(null, 0, 0)
buttonPosition = Qt.point(itemPos.x, itemPos.y)
Logger.warn("NPanel", "Falling back to mapToItem null")
}
var itemPos = buttonItem.mapToItem(null, 0, 0)
buttonPosition = Qt.point(itemPos.x, itemPos.y)
buttonWidth = buttonItem.width
buttonHeight = buttonItem.height
} else {