hoverpanel: add 400ms grace period on show, increase hide debounce to 150ms

This commit is contained in:
Damocles 2026-04-14 00:37:54 +02:00
parent f23fbda6bb
commit 8bee713fd3

View file

@ -67,16 +67,33 @@ PanelWindow {
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() {
_updatePosition();
_winVisible = true;
hideAnim.stop();
showAnim.start();
_grace = true;
_graceTimer.restart();
}
function dismiss() {
showAnim.stop();
hideAnim.start();
_grace = false;
_graceTimer.stop();
}
Component.onCompleted: if (popupMode)
@ -84,8 +101,8 @@ PanelWindow {
Timer {
id: _hideTimer
interval: 50
onTriggered: if (!root.showPanel)
interval: 150
onTriggered: if (!root.showPanel && !root._grace)
root.dismiss()
}