mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-06-08 12:52:24 +00:00
fix(bar): keep bar visible while hovering any widget by using HoverHandler on container instead of relying on background MouseArea
Problem: Parent MouseArea sat below bar content, so when the pointer hovered a child widget that handled hover, the parent did not see hover and barHovered became false, causing auto-hide to trigger unexpectedly. Solution: Add a non-invasive HoverHandler on the bar container to drive barHovered, without stealing events from child widgets. Remove hover handling from the background MouseArea (kept for right-click). Also respects auto-hide timers (cancel on enter; restart on exit).
This commit is contained in:
+19
-16
@@ -184,6 +184,24 @@ Variants {
|
||||
}
|
||||
}
|
||||
|
||||
// Mark bar hovered without stealing events from child widgets
|
||||
HoverHandler {
|
||||
id: barHoverHandler
|
||||
onHoveredChanged: {
|
||||
root.barHovered = hovered
|
||||
if (!root.autoHide)
|
||||
return
|
||||
if (hovered) {
|
||||
showTimer.stop()
|
||||
hideTimer.stop()
|
||||
root.barWindowVisible = true
|
||||
root.hidden = false
|
||||
} else if (!root.peekHovered) {
|
||||
hideTimer.restart()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Background fill with shadow
|
||||
Rectangle {
|
||||
id: bar
|
||||
@@ -198,7 +216,7 @@ Variants {
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.RightButton
|
||||
hoverEnabled: true
|
||||
hoverEnabled: false
|
||||
preventStealing: true
|
||||
onClicked: function (mouse) {
|
||||
if (mouse.button === Qt.RightButton) {
|
||||
@@ -207,21 +225,6 @@ Variants {
|
||||
mouse.accepted = true
|
||||
}
|
||||
}
|
||||
onEntered: {
|
||||
root.barHovered = true
|
||||
if (root.autoHide) {
|
||||
showTimer.stop()
|
||||
hideTimer.stop()
|
||||
root.barWindowVisible = true
|
||||
root.hidden = false
|
||||
}
|
||||
}
|
||||
onExited: {
|
||||
root.barHovered = false
|
||||
if (root.autoHide && !root.peekHovered) {
|
||||
hideTimer.restart()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
|
||||
Reference in New Issue
Block a user