[geary/wip/77-skc-in-composer] Further refine workaround for key press handing



commit bbd9629955980767932b79beb7fe88eaf166d5f5
Author: Michael Gratton <mike vee net>
Date:   Tue Sep 11 20:55:18 2018 +1000

    Further refine workaround for key press handing
    
    Only consider keyboard modifiers that are in GTK's default mod mask
    when deciding to engage/disengage the SKC hack in MainWindow.
    
    See #77

 src/client/components/main-window.vala | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/client/components/main-window.vala b/src/client/components/main-window.vala
index ecab6280..6afa9c33 100644
--- a/src/client/components/main-window.vala
+++ b/src/client/components/main-window.vala
@@ -288,17 +288,22 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
          */
 
         bool handled = false;
-        if (event.state != 0 &&
-            event.state != Gdk.ModifierType.SHIFT_MASK) {
+        Gdk.ModifierType state = (
+            event.state & Gtk.accelerator_get_default_mod_mask()
+        );
+        if (state > 0 &&
+            state != Gdk.ModifierType.SHIFT_MASK) {
             // Have a modifier (Ctrl, Alt, etc) so we don't need to
             // worry about SKCs, so handle normally. Can't do this
             // with Shift though since that will stop chars being
             // typed in the composer that conflict with accells, like
             // `!`.
+            debug("Key press handled normally: %u/%u \"%s\"", state, event.state, event.str);
             handled = base.key_press_event(event);
         } else {
             // A modifier we don't care about is down is down, so
             // kluge input handling to make SKCs per the above.
+            debug("Key press hack engaged: %u/%u \"%s\"", state, event.state, event.str);
             handled = propagate_key_event(event);
             if (!handled) {
                 handled = activate_key(event);


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