[gnome-maps/wip/mlundblad/touch-gestures] contextMenu: WIP: use a GtkGestureLongPress...



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

    contextMenu: WIP: use a GtkGestureLongPress...

 src/contextMenu.js |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/contextMenu.js b/src/contextMenu.js
index 5306093..8283c10 100644
--- a/src/contextMenu.js
+++ b/src/contextMenu.js
@@ -72,6 +72,18 @@ 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 });
+        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]