gnome-shell/gnome-shell-864872-unlock-by-mouse-motion.patch

58 lines
2.1 KiB
Diff

diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js
index 7b154f2..ff7315d 100644
--- a/js/ui/screenShield.js
+++ b/js/ui/screenShield.js
@@ -431,6 +431,8 @@ var ScreenShield = class {
this.actor = Main.layoutManager.screenShieldGroup;
this._lockScreenState = MessageTray.State.HIDDEN;
+ this._last_x = -1;
+ this._last_y = -1;
this._lockScreenGroup = new St.Widget({
x_expand: true,
y_expand: true,
@@ -441,6 +443,8 @@ var ScreenShield = class {
});
this._lockScreenGroup.connect('key-press-event',
this._onLockScreenKeyPress.bind(this));
+ this._lockScreenGroup.connect('motion-event',
+ this._onLockScreenMotion.bind(this));
this._lockScreenGroup.connect('scroll-event',
this._onLockScreenScroll.bind(this));
Main.ctrlAltTabManager.addGroup(this._lockScreenGroup, _("Lock"), 'changes-prevent-symbolic');
@@ -720,6 +724,25 @@ var ScreenShield = class {
return Clutter.EVENT_STOP;
}
+ _onLockScreenMotion(actor, event) {
+ if (this._lockScreenState != MessageTray.State.SHOWN)
+ return false;
+ let [X, Y] = event.get_coords();
+
+ if (this._last_x == -1)
+ this._last_x = X;
+ if (this._last_y == -1)
+ this._last_y = Y;
+
+ let min_distance = 10
+ let distance = Math.max(Math.abs(this._last_x - X),
+ Math.abs(this._last_y - Y));
+
+ if (distance >= min_distance)
+ this._liftShield(true, 0);
+ return true;
+ }
+
_onLockScreenScroll(actor, event) {
if (this._lockScreenState != MessageTray.State.SHOWN)
return Clutter.EVENT_PROPAGATE;
@@ -1036,6 +1059,8 @@ var ScreenShield = class {
return;
this._ensureLockScreen();
+ this._last_x = -1;
+ this._last_y = -1;
this._lockDialogGroup.scale_x = 1;
this._lockDialogGroup.scale_y = 1;