mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
fix(bar): swallow right/middle on hot strip to avoid Qt context-menu SIGSEGV
This commit is contained in:
+38
-5
@@ -412,7 +412,10 @@ Item {
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.RightButton | Qt.MiddleButton
|
||||
enabled: bar.barRightClickAction !== "none" || Settings.data.bar.middleClickAction !== "none"
|
||||
// Keep enabled even when actions are "none" so we still swallow right/middle on
|
||||
// empty bar gaps. Otherwise Qt Quick's context-menu path can crash on Wayland
|
||||
// (QQuickDeliveryAgentPrivate::contextMenuTargets / mapToScene).
|
||||
enabled: true
|
||||
hoverEnabled: false
|
||||
preventStealing: true
|
||||
onClicked: mouse => {
|
||||
@@ -420,12 +423,14 @@ Item {
|
||||
if (bar.isPointOverWidget(mouse.x, mouse.y))
|
||||
return;
|
||||
bar.handleEmptyBarClick(bar.barRightClickAction, Settings.data.bar.rightClickFollowMouse, Settings.data.bar.rightClickCommand, mouse);
|
||||
mouse.accepted = true;
|
||||
return;
|
||||
}
|
||||
if (mouse.button === Qt.MiddleButton) {
|
||||
if (bar.isPointOverWidget(mouse.x, mouse.y))
|
||||
return;
|
||||
bar.handleEmptyBarClick(Settings.data.bar.middleClickAction || "none", Settings.data.bar.middleClickFollowMouse, Settings.data.bar.middleClickCommand, mouse);
|
||||
mouse.accepted = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -518,7 +523,14 @@ Item {
|
||||
height: Style.marginS
|
||||
x: 0
|
||||
y: 0
|
||||
onClicked: root.triggerFirstWidgetInSection("left")
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
|
||||
onClicked: function (mouse) {
|
||||
if (mouse.button !== Qt.LeftButton) {
|
||||
mouse.accepted = true;
|
||||
return;
|
||||
}
|
||||
root.triggerFirstWidgetInSection("left");
|
||||
}
|
||||
}
|
||||
|
||||
// Bottom edge hot corner - triggers last widget in right (bottom) section
|
||||
@@ -527,7 +539,14 @@ Item {
|
||||
height: Style.marginS
|
||||
x: 0
|
||||
anchors.bottom: parent.bottom
|
||||
onClicked: root.triggerLastWidgetInSection("right")
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
|
||||
onClicked: function (mouse) {
|
||||
if (mouse.button !== Qt.LeftButton) {
|
||||
mouse.accepted = true;
|
||||
return;
|
||||
}
|
||||
root.triggerLastWidgetInSection("right");
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate margin to center widgets vertically within the bar height
|
||||
@@ -625,7 +644,14 @@ Item {
|
||||
height: parent.height
|
||||
x: 0
|
||||
y: 0
|
||||
onClicked: root.triggerFirstWidgetInSection("left")
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
|
||||
onClicked: function (mouse) {
|
||||
if (mouse.button !== Qt.LeftButton) {
|
||||
mouse.accepted = true;
|
||||
return;
|
||||
}
|
||||
root.triggerFirstWidgetInSection("left");
|
||||
}
|
||||
}
|
||||
|
||||
// Right edge hot corner - triggers last widget in right section
|
||||
@@ -634,7 +660,14 @@ Item {
|
||||
height: parent.height
|
||||
anchors.right: parent.right
|
||||
y: 0
|
||||
onClicked: root.triggerLastWidgetInSection("right")
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
|
||||
onClicked: function (mouse) {
|
||||
if (mouse.button !== Qt.LeftButton) {
|
||||
mouse.accepted = true;
|
||||
return;
|
||||
}
|
||||
root.triggerLastWidgetInSection("right");
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate margin to center widgets horizontally within the bar height
|
||||
|
||||
@@ -45,6 +45,19 @@ PanelWindow {
|
||||
id: triggerArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
// Default MouseArea only accepts left; right/middle would fall through to Qt Quick's
|
||||
// Wayland context-menu delivery, which can SIGSEGV in contextMenuTargets/mapToScene.
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
|
||||
|
||||
onPressed: function (mouse) {
|
||||
if (mouse.button === Qt.RightButton || mouse.button === Qt.MiddleButton)
|
||||
mouse.accepted = true;
|
||||
}
|
||||
|
||||
onClicked: function (mouse) {
|
||||
if (mouse.button === Qt.RightButton || mouse.button === Qt.MiddleButton)
|
||||
mouse.accepted = true;
|
||||
}
|
||||
|
||||
onEntered: {
|
||||
if (root.isBeingDestroyed)
|
||||
|
||||
Reference in New Issue
Block a user