[geary/wip/730495-fix-inline-plain-text-paste-0.12: 18/18] Further refine workaround for SKC key press handing
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/730495-fix-inline-plain-text-paste-0.12: 18/18] Further refine workaround for SKC key press handing
- Date: Wed, 12 Sep 2018 11:55:28 +0000 (UTC)
commit b94f360bb2d46f54c5bc67300eb19886472c77c6
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 f4acb284..bc798fd7 100644
--- a/src/client/components/main-window.vala
+++ b/src/client/components/main-window.vala
@@ -260,17 +260,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]