[gnome-shell/T27795: 56/138] backgroundMenu: Release click action if actor moves from underneath us
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/T27795: 56/138] backgroundMenu: Release click action if actor moves from underneath us
- Date: Tue, 1 Oct 2019 23:34:02 +0000 (UTC)
commit 1f986d379c152ecbdadaddb7395e0d1a97f1959f
Author: Sam Spilsbury <sam endlessm com>
Date: Wed Aug 23 13:27:45 2017 +0800
backgroundMenu: Release click action if actor moves from underneath us
This might happen in the case of the DesktopOverlay where
its y-position is synchronised to that of the discovery feed, in
that case, we should query the pointer position and release the
long-press action if the pointer is no longer within the window,
otherwise we'll never receive the ButtonRelease event and the
event will be fired anyway
js/ui/backgroundMenu.js | 12 ++++++++++++
1 file changed, 12 insertions(+)
---
diff --git a/js/ui/backgroundMenu.js b/js/ui/backgroundMenu.js
index db3ae9ef6b..0fe9c5f311 100644
--- a/js/ui/backgroundMenu.js
+++ b/js/ui/backgroundMenu.js
@@ -71,6 +71,7 @@ function addBackgroundMenu(actor, layoutManager) {
let grabOpBeginId = global.display.connect('grab-op-begin', () => {
clickAction.release();
});
+ let cursorTracker = Meta.CursorTracker.get_for_display(global.display);
actor.connect('destroy', () => {
actor._backgroundMenu.destroy();
@@ -78,4 +79,15 @@ function addBackgroundMenu(actor, layoutManager) {
actor._backgroundManager = null;
global.display.disconnect(grabOpBeginId);
});
+
+ actor.connect('notify::allocation', function() {
+ // If the actor moves from underneath us, we should probably not
+ // fire the long press action. It may have moved outside of the
+ // range of where the cursor is, where we will never get ButtonPress
+ // events
+ let [xHot, yHot] = cursorTracker.get_hot();
+
+ if (!actor.allocation.contains(xHot, yHot))
+ clickAction.release();
+ });
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]