[gnome-maps/gnome-3-20] mainWindow: Hijack '-' and '+' input if entry is focused
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/gnome-3-20] mainWindow: Hijack '-' and '+' input if entry is focused
- Date: Thu, 1 Sep 2016 19:35:41 +0000 (UTC)
commit c9470fd9acce61175d4b37a7f8d2fc42d3bf74f1
Author: Jonas Danielsson <jonas threetimestwo org>
Date: Sun Aug 28 21:23:43 2016 +0200
mainWindow: Hijack '-' and '+' input if entry is focused
src/mainWindow.js | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index dd28a8e..b3d505e 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() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]