[gnome-maps/wip/mlundblad/touch-gestures: 1/2] contextMenu: Add a long-press gesture to activate on touch



commit 243db7a2f9d357af0bbf11faff164e5ba4188ed2
Author: Marcus Lundblad <ml update uu se>
Date:   Mon Oct 16 22:21:32 2017 +0200

    contextMenu: Add a long-press gesture to activate on touch
    
    https://bugzilla.gnome.org/show_bug.cgi?id=709605

 src/contextMenu.js |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/contextMenu.js b/src/contextMenu.js
index 5306093..568d2ab 100644
--- a/src/contextMenu.js
+++ b/src/contextMenu.js
@@ -72,6 +72,19 @@ var ContextMenu = new Lang.Class({
                                        this._routingUpdate.bind(this));
         this._routeItem.visible = false;
         this._routingUpdate();
+        this._initLongPress();
+    },
+
+    _initLongPress: function() {
+        this._longPressGesture =
+            new Gtk.GestureLongPress({ widget: this._mapView, 'touch-only': true });
+        this._longPressGesture.connect('pressed', (function(gesture, x, y) {
+            Mainloop.idle_add((function() {
+                let sequence = gesture.get_last_updated_sequence();
+
+                this.popup_at_pointer(gesture.get_last_event(sequence));
+            }).bind(this));
+        }).bind(this));
     },
 
     _onButtonReleaseEvent: function(widget, event) {


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