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



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

    Further refine workaround for SKC 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, so things
    like NumLock being on (GDK_MOD2_MASK) don't disengage the hack.
    
    Fixes #77

 src/client/components/main-window.vala | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/src/client/components/main-window.vala b/src/client/components/main-window.vala
index ecab6280..ee79f4f6 100644
--- a/src/client/components/main-window.vala
+++ b/src/client/components/main-window.vala
@@ -288,17 +288,20 @@ public class MainWindow : Gtk.ApplicationWindow, Geary.BaseInterface {
          */
 
         bool handled = false;
-        if (event.state != 0 &&
-            event.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
+        Gdk.ModifierType state = (
+            event.state & Gtk.accelerator_get_default_mod_mask()
+        );
+        if (state > 0 && state != Gdk.ModifierType.SHIFT_MASK) {
+            // Have a modifier held down (Ctrl, Alt, etc) that is used
+            // as an accelerator so we don't need to worry about SKCs,
+            // and the key press can be handled normally. Can't do
+            // this with Shift though since that will stop chars being
+            // typed in the composer that conflict with accels, like
             // `!`.
             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.
+            // No modifier used as an accelerator is down, so kluge
+            // input handling to make SKCs work per the above.
             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]