Blob Blame History Raw
From c12006de1af0edb5380b0870ffdfe41d4ff153f1 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 6 Mar 2019 16:35:14 -0500
Subject: [PATCH] window-list: drop button grab when leaving button

StButton doesn't always drop its grab, if the user releases the
mouse over the wrong part of the screen.

This commit works around the problem by pretending the user
lift their finger from the mouse as soon as they leave the
boundaries of the button actor.
---
 extensions/window-list/extension.js | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js
index 716a324..af71e91 100644
--- a/extensions/window-list/extension.js
+++ b/extensions/window-list/extension.js
@@ -227,6 +227,7 @@ class BaseButton {
         this.actor.connect('allocation-changed',
                            this._updateIconGeometry.bind(this));
         this.actor.connect('clicked', this._onClicked.bind(this));
+        this.actor.connect('leave-event', this._onLeave.bind(this));
         this.actor.connect('destroy', this._onDestroy.bind(this));
         this.actor.connect('popup-menu', this._onPopupMenu.bind(this));
 
@@ -261,6 +262,11 @@ class BaseButton {
         throw new Error('Not implemented');
     }
 
+    _onLeave(actor, button) {
+        this.actor.fake_release();
+        return Clutter.EVENT_PROPAGATE;
+    }
+
     _canOpenPopupMenu() {
         return true;
     }
-- 
1.8.3.1