hoverpanel: add 400ms grace period on show, increase hide debounce to 150ms
This commit is contained in:
parent
f23fbda6bb
commit
8bee713fd3
1 changed files with 19 additions and 2 deletions
|
|
@ -67,16 +67,33 @@ PanelWindow {
|
||||||
panelContainer.x = Math.max(0, Math.min(Math.round(cx - root.contentWidth / 2), sw - root.contentWidth));
|
panelContainer.x = Math.max(0, Math.min(Math.round(cx - root.contentWidth / 2), sw - root.contentWidth));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Grace period: after _show(), suppress auto-close briefly so Niri has time
|
||||||
|
// to route wl_pointer.enter to the new overlay surface (cursor may be stationary).
|
||||||
|
property bool _grace: false
|
||||||
|
Timer {
|
||||||
|
id: _graceTimer
|
||||||
|
interval: 400
|
||||||
|
onTriggered: {
|
||||||
|
root._grace = false;
|
||||||
|
if (!root.showPanel)
|
||||||
|
root.dismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function _show() {
|
function _show() {
|
||||||
_updatePosition();
|
_updatePosition();
|
||||||
_winVisible = true;
|
_winVisible = true;
|
||||||
hideAnim.stop();
|
hideAnim.stop();
|
||||||
showAnim.start();
|
showAnim.start();
|
||||||
|
_grace = true;
|
||||||
|
_graceTimer.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
function dismiss() {
|
function dismiss() {
|
||||||
showAnim.stop();
|
showAnim.stop();
|
||||||
hideAnim.start();
|
hideAnim.start();
|
||||||
|
_grace = false;
|
||||||
|
_graceTimer.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: if (popupMode)
|
Component.onCompleted: if (popupMode)
|
||||||
|
|
@ -84,8 +101,8 @@ PanelWindow {
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: _hideTimer
|
id: _hideTimer
|
||||||
interval: 50
|
interval: 150
|
||||||
onTriggered: if (!root.showPanel)
|
onTriggered: if (!root.showPanel && !root._grace)
|
||||||
root.dismiss()
|
root.dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue