mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-06-11 00:47:22 +00:00
Improve auto-hide dock reveal
Expand the dock input region as soon as the reveal animation starts rather than waiting for it to finish, so the cursor can reach dock items while the panel is still sliding into view. Introduce updateInputRegion() and call it from onDockOffsetChanged, onShouldHideChanged, onActiveChanged, onWidthChanged, and onHeightChanged so the input region is always consistent with the current state. While hover-revealing with a maximised window present, switch the LayerShell exclusion zone from -1 to dockHeight so the window tiles away from the dock instead of being obscured underneath it. Reduce the hover dwell timer from a hard-coded 300 ms to Kirigami.Units.shortDuration so the dock is easier to summon.
This commit is contained in:
parent
daf6ec3fd6
commit
e5ec88a12b
1 changed files with 26 additions and 10 deletions
|
|
@ -287,7 +287,7 @@ ContainmentItem {
|
||||||
LayerShell.Window.scope: "dock-overlay"
|
LayerShell.Window.scope: "dock-overlay"
|
||||||
LayerShell.Window.layer: LayerShell.Window.LayerTop
|
LayerShell.Window.layer: LayerShell.Window.LayerTop
|
||||||
LayerShell.Window.anchors: LayerShell.Window.AnchorBottom | LayerShell.Window.AnchorLeft | LayerShell.Window.AnchorRight
|
LayerShell.Window.anchors: LayerShell.Window.AnchorBottom | LayerShell.Window.AnchorLeft | LayerShell.Window.AnchorRight
|
||||||
LayerShell.Window.exclusionZone: -1
|
LayerShell.Window.exclusionZone: shouldReserveSpace ? dockHeight : -1
|
||||||
LayerShell.Window.keyboardInteractivity: LayerShell.Window.KeyboardInteractivityOnDemand
|
LayerShell.Window.keyboardInteractivity: LayerShell.Window.KeyboardInteractivityOnDemand
|
||||||
|
|
||||||
// Auto-hide: slide dock content off-screen when a window is
|
// Auto-hide: slide dock content off-screen when a window is
|
||||||
|
|
@ -304,6 +304,25 @@ ContainmentItem {
|
||||||
|
|
||||||
readonly property bool shouldHide: ShellSettings.Settings.autoHidePanelsEnabled
|
readonly property bool shouldHide: ShellSettings.Settings.autoHidePanelsEnabled
|
||||||
&& windowMaximizedTracker.showingWindow && !hoverRevealing
|
&& windowMaximizedTracker.showingWindow && !hoverRevealing
|
||||||
|
readonly property bool shouldReserveSpace: ShellSettings.Settings.autoHidePanelsEnabled
|
||||||
|
&& windowMaximizedTracker.showingWindow && hoverRevealing
|
||||||
|
|
||||||
|
function updateInputRegion() {
|
||||||
|
if (shouldHide && dockOffset >= dockHeight) {
|
||||||
|
MobileShell.ShellUtil.setInputRegion(dockOverlay,
|
||||||
|
Qt.rect(0, dockOverlay.height - revealStripHeight,
|
||||||
|
dockOverlay.width, revealStripHeight))
|
||||||
|
} else {
|
||||||
|
MobileShell.ShellUtil.setInputRegion(dockOverlay, Qt.rect(0, 0, 0, 0))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onActiveChanged: {
|
||||||
|
hoverRevealTimer.stop()
|
||||||
|
hoverRevealing = false
|
||||||
|
dockOffset = shouldHide ? dockHeight : 0
|
||||||
|
updateInputRegion()
|
||||||
|
}
|
||||||
|
|
||||||
onShouldHideChanged: {
|
onShouldHideChanged: {
|
||||||
if (shouldHide) {
|
if (shouldHide) {
|
||||||
|
|
@ -311,26 +330,23 @@ ContainmentItem {
|
||||||
} else {
|
} else {
|
||||||
dockOffset = 0
|
dockOffset = 0
|
||||||
}
|
}
|
||||||
|
updateInputRegion()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Narrow the input region to a strip at the screen edge when hidden
|
// Narrow the input region to a strip at the screen edge when hidden
|
||||||
// so that app controls near the bottom edge are not accidentally
|
// so that app controls near the bottom edge are not accidentally
|
||||||
// intercepted. Mirrors the same pattern used by NavigationPanel.
|
// intercepted. Mirrors the same pattern used by NavigationPanel.
|
||||||
onDockOffsetChanged: {
|
onDockOffsetChanged: {
|
||||||
if (dockOffset >= dockHeight) {
|
updateInputRegion()
|
||||||
MobileShell.ShellUtil.setInputRegion(dockOverlay,
|
|
||||||
Qt.rect(0, dockOverlay.height - revealStripHeight,
|
|
||||||
dockOverlay.width, revealStripHeight))
|
|
||||||
} else if (dockOffset === 0) {
|
|
||||||
MobileShell.ShellUtil.setInputRegion(dockOverlay, Qt.rect(0, 0, 0, 0))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
onWidthChanged: updateInputRegion()
|
||||||
|
onHeightChanged: updateInputRegion()
|
||||||
|
|
||||||
// Delay reveal by 300 ms so a quick edge graze does not pop the
|
// Delay reveal briefly so a quick edge graze does not pop the
|
||||||
// dock up mid-interaction with the underlying application.
|
// dock up mid-interaction with the underlying application.
|
||||||
Timer {
|
Timer {
|
||||||
id: hoverRevealTimer
|
id: hoverRevealTimer
|
||||||
interval: 300
|
interval: Kirigami.Units.shortDuration
|
||||||
repeat: false
|
repeat: false
|
||||||
onTriggered: dockOverlay.hoverRevealing = true
|
onTriggered: dockOverlay.hoverRevealing = true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue