[geary/wip/trash-714212] Ignore shift key inside search box



commit e400fb3155b4df342c3851e2aa33ed66df0f7f8c
Author: Charles Lindsay <chaz yorba org>
Date:   Thu Dec 19 18:28:15 2013 -0800

    Ignore shift key inside search box

 src/client/components/main-toolbar.vala |    1 +
 src/client/components/main-window.vala  |    6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/client/components/main-toolbar.vala b/src/client/components/main-toolbar.vala
index eb08326..6a149e9 100644
--- a/src/client/components/main-toolbar.vala
+++ b/src/client/components/main-toolbar.vala
@@ -13,6 +13,7 @@ public class MainToolbar : PillToolbar {
     public FolderMenu copy_folder_menu { get; private set; default = new FolderMenu(); }
     public FolderMenu move_folder_menu { get; private set; default = new FolderMenu(); }
     public string search_text { get { return search_entry.text; } }
+    public bool search_entry_has_focus { get { return search_entry.has_focus; } }
     
     private Gtk.Button archive_button;
     private Gtk.Button trash_buttons[2];
diff --git a/src/client/components/main-window.vala b/src/client/components/main-window.vala
index 49111e6..db4948a 100644
--- a/src/client/components/main-window.vala
+++ b/src/client/components/main-window.vala
@@ -167,9 +167,8 @@ public class MainWindow : Gtk.ApplicationWindow {
     }
     
     private bool on_key_press_event(Gdk.EventKey event) {
-        // TODO: suppress sending shift signal when focus is in search box
         if ((event.keyval == Gdk.Key.Shift_L || event.keyval == Gdk.Key.Shift_R)
-            && (event.state & Gdk.ModifierType.SHIFT_MASK) == 0)
+            && (event.state & Gdk.ModifierType.SHIFT_MASK) == 0 && !main_toolbar.search_entry_has_focus)
             on_shift_key(true);
         
         // Check whether the focused widget wants to handle it, if not let the accelerators kick in
@@ -181,7 +180,8 @@ public class MainWindow : Gtk.ApplicationWindow {
         // FIXME: it's possible the user will press two shift keys.  We want
         // the shift key to report as released when they release ALL of them.
         // There doesn't seem to be an easy way to do this in Gdk.
-        if (event.keyval == Gdk.Key.Shift_L || event.keyval == Gdk.Key.Shift_R)
+        if ((event.keyval == Gdk.Key.Shift_L || event.keyval == Gdk.Key.Shift_R)
+            && !main_toolbar.search_entry_has_focus)
             on_shift_key(false);
         
         return propagate_key_event(event);


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