summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Danielsson <jonas@threetimestwo.org>2016-08-28 21:23:43 +0200
committerJonas Danielsson <jonas@threetimestwo.org>2016-08-29 18:53:16 +0200
commit80f9b0f72d95256db42149afc148dbe18a55b4e5 (patch)
treeab794fbe5bba55ad6f0a182829b295d6be2e5d53
parent760a3567c8800f0278c8f3f3eeab566835705af0 (diff)
downloadgnome-maps-80f9b0f72d95256db42149afc148dbe18a55b4e5.tar.gz
mainWindow: Hijack '-' and '+' input if entry is focused
-rw-r--r--src/mainWindow.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mainWindow.js b/src/mainWindow.js
index dd28a8ea..b3d505ee 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -234,6 +234,24 @@ const MainWindow = new Lang.Class({
else
this._mainStack.visible_child = this._noNetworkView;
}).bind(this));
+
+ /*
+ * If the currently focused widget is an entry then we will
+ * hijack the key-press to the main window and make sure that
+ * they reach the entry before they can be swallowed as accelerator.
+ */
+ this.connect('key-press-event', function(window, event) {
+ let focusWidget = window.get_focus();
+ let keyval = event.get_keyval()[1];
+
+ if (!(focusWidget instanceof Gtk.Entry))
+ return false;
+
+ if (keyval === Gdk.KEY_plus || keyval === Gdk.KEY_minus)
+ return focusWidget.event(event);
+
+ return false;
+ });
},
_updateLocationSensitivity: function() {