[gnome-shell] AppDisplay: fake a release event to dnd when opening the menu



commit a50ddd6d8c288e9fc7b80a332125d63d55397012
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Wed Feb 20 16:55:02 2013 +0100

    AppDisplay: fake a release event to dnd when opening the menu
    
    PopupMenuManager eats the next release event, which would otherwise close
    the menu, so we need to tell dnd that we're handling it, and no drag should
    be started, so it can ungrab the pointer and restore state.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=694276

 js/ui/appDisplay.js |    1 +
 js/ui/dnd.js        |   16 +++++++++++++++-
 2 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index c247189..461145b 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -790,6 +790,7 @@ const AppIcon = new Lang.Class({
     popupMenu: function() {
         this._removeMenuTimeout();
         this.actor.fake_release();
+        this._draggable.fakeRelease();
 
         if (!this._menu) {
             this._menu = new AppIconMenu(this);
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index f7d6f1a..f8eecd3 100644
--- a/js/ui/dnd.js
+++ b/js/ui/dnd.js
@@ -136,9 +136,10 @@ const _Draggable = new Lang.Class({
     },
 
     _ungrabActor: function() {
-        Clutter.ungrab_pointer();
         if (!this._onEventId)
             return;
+
+        Clutter.ungrab_pointer();
         this.actor.disconnect(this._onEventId);
         this._onEventId = null;
     },
@@ -204,6 +205,19 @@ const _Draggable = new Lang.Class({
     },
 
     /**
+     * fakeRelease:
+     *
+     * Fake a release event.
+     * Must be called if you want to intercept release events on draggable
+     * actors for other purposes (for example if you're using
+     * PopupMenu.ignoreRelease())
+     */
+    fakeRelease: function() {
+        this._buttonDown = false;
+        this._ungrabActor();
+    },
+
+    /**
      * startDrag:
      * @stageX: X coordinate of event
      * @stageY: Y coordinate of event


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]