[gnome-shell/eos3.8: 44/255] backgroundMenu: Release click action if actor moves from underneath us
- From: Matthew Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/eos3.8: 44/255] backgroundMenu: Release click action if actor moves from underneath us
- Date: Wed, 10 Jun 2020 19:01:39 +0000 (UTC)
commit 2609334115db9b66830c794ab9425262d16c58ea
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 | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/backgroundMenu.js b/js/ui/backgroundMenu.js
index 30abad60ba..1a3eb6e383 100644
--- a/js/ui/backgroundMenu.js
+++ b/js/ui/backgroundMenu.js
@@ -1,7 +1,7 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
/* exported addBackgroundMenu */
-const { Clutter, Shell, St } = imports.gi;
+const { Clutter, Meta, Shell, St } = imports.gi;
const AppActivation = imports.ui.appActivation;
const BoxPointer = imports.ui.boxpointer;
@@ -68,6 +68,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();
@@ -75,4 +76,15 @@ function addBackgroundMenu(actor, layoutManager) {
actor._backgroundManager = null;
global.display.disconnect(grabOpBeginId);
});
+
+ actor.connect('notify::allocation', () => {
+ // 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]