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
This commit is contained in:
Michael Gratton 2018-09-11 20:55:18 +10:00
parent 093fc93ba7
commit 72cfef5efa

View file

@ -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);