GNOME Bugzilla – Bug 665215
ctrl+alt+tab does not work on some machines
Last modified: 2012-03-13 19:35:45 UTC
I have two F16 installs, on one the ctrl+alt+tab popup works fine, on the other it pops up, but when you release the keys it is not dismissed and the current item is not selected. You can just dismiss the popup with esc. It is like the key-release-event is not detected. Other people on gnome-shell are seeing the same issu.
Debugging this on IRC: It seems that the problem is related to Num Lock. Turning Num Lock on means that Mod2 is on all the time. For some reason, in the overview, this._modifierMask is 16, which is the value of Mod2Mask. I want to point out that this makes the Ctrl+Alt+Tab dialog inaccessible on some laptops. My laptop has "num lock" on all the time, and the "num lock" key is a hardware switch that switches the values that the right side of the keyboard sends.
In general, one should always assume there may be modifier bits which are "irrelevant" - so 'event.state == <something>' is basically always wrong - you either want to do (event.state & <something>) != 0 Or occasionally (event.state & mask) == <something> See gdk_get_modifier_mask() (or 3.4 - gdk_keymap_get_modifier_mask()) for the the value of "mask" - but in many cases the first version if good enough.
We do. The mask that we use is the primary modifier of the keybinding. For some reason, this happens to be Mod2Mask (16) when activating the keybinding in the overview. Outside of the overview, it's Mod1Mask (8), which is correct.
I'm pretty sure the error is somewhere lower in the stack. I was not able to reproduce the issue until a system update[0] (ibus would look like a good candidate, but I'm not using it). The password entries of the lock screen and the (old) nm-applet password dialogs show a warning that num-lock is pressed (though it is not). [0] glibc-common glibc imsettings-libs ibus-libs im-chooser im-chooser-common imsettings imsettings-gnome openssh ibus-gtk2 ibus-gtk3 ibus authconfig glusterfs graphviz graphviz-gd rest libsocialweb-keys libsocialweb folks kernel-headers glibc-headers dracut glibc-devel empathy glusterfs-fuse authconfig-gtk openssh-clients openssh-server im-chooser-xfce augeas-libs checkpolicy dosfstools dvb-apps fcoe-utils kernel-tools libass libffado libwps mcelog pinpoint setroubleshoot-plugins kernel
Created attachment 209614 [details] [review] display: Add accessor function for ignored_modifier_mask Some modifiers like NumLock and ScrollLock don't make sense in keybindings, which is why we ignore them when matching keybindings to events. We should do the same in Javascript, so add an accessor function.
Created attachment 209615 [details] [review] main: Ignore some modifiers when matching events to keybindings Some modifiers like NumLock or ScrollLock don't make sense in keybindings, which is why we ignore them in mutter when matching events to keybindings; for keybindings in the overview, we do the matching ourselves, so filter the same modifiers as mutter.
I still have no idea why NumLock appears pressed although it is not, but it does not matter if we fix the bug that is clearly on our side, e.g. the fact that we don't ignore those modifiers in the first place (like we do in mutter/metacity).
Review of attachment 209614 [details] [review]: Other than the comment looks good. ::: src/meta/display.h @@ +92,3 @@ guint32 meta_display_get_current_time_roundtrip (MetaDisplay *display); +unsigned long meta_display_get_ignored_modifier_mask (MetaDisplay *display); Probably not a problem in practice, but ignored_modifier_mask is defined as an unsigned int. In JS, bitwise operations seem to always force their operands into 32 bits anyway.
Review of attachment 209615 [details] [review]: Looks good although I can't really say if this fixes the bug since I've never experienced it.
Comment on attachment 209614 [details] [review] display: Add accessor function for ignored_modifier_mask Attachment 209614 [details] pushed as 5361e02 - display: Add accessor function for ignored_modifier_mask Pushed with s/long/int/ - good catch!
Attachment 209615 [details] pushed as 93a004b - main: Ignore some modifiers when matching events to keybindings