xev shows an incorrect state variable when this bug occurs - it is set to zero.
From what I can see, it seems that the state normally should be set to 0x2000 and OR'd with 1,2,4,8 for each of the modifiers, ie:
0x2000 - no modifiers
0x2001 - shift key
0x2002 - caps lock key
0x2004 - control key
0x2008 - alt key
Devon's post shows the same state=0x0 problem as mine.
The last time I recreated this was when I alt-tabbed between Firefox and gnome-terminal and back. I then tried xev again and saw that the event being generated for the key sequence shift-V is a lower-case v instead of the expected upper-case V:
KeyPress event, serial 28, synthetic NO, window 0x4400001,
root 0x5a, subw 0x0, time 17124192, (1294,2), root:(1301,867),
state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 31, synthetic NO, window 0x4400001,
root 0x5a, subw 0x0, time 17125412, (1294,2), root:(1301,867),
state 0x0, keycode 55 (keysym 0x76, v), same_screen YES,
XLookupString gives 1 bytes: (76) "v"
XmbLookupString gives 1 bytes: (76) "v"
XFilterEvent returns: False
KeyRelease event, serial 31, synthetic NO, window 0x4400001,
root 0x5a, subw 0x0, time 17125640, (1294,2), root:(1301,867),
state 0x0, keycode 55 (keysym 0x76, v), same_screen YES,
XLookupString gives 1 bytes: (76) "v"
XFilterEvent returns: False
KeyRelease event, serial 31, synthetic NO, window 0x4400001,
root 0x5a, subw 0x0, time 17126506, (1294,2), root:(1301,867),
state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
This is the expected sequence where an upper-case V is generated:
KeyPress event, serial 28, synthetic NO, window 0x1200001,
root 0x5a, subw 0x0, time 17686510, (1197,-43), root:(1204,822),
state 0x2000, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 31, synthetic NO, window 0x1200001,
root 0x5a, subw 0x0, time 17687106, (1197,-43), root:(1204,822),
state 0x2001, keycode 55 (keysym 0x56, V), same_screen YES,
XLookupString gives 1 bytes: (56) "V"
XmbLookupString gives 1 bytes: (56) "V"
XFilterEvent returns: False
KeyRelease event, serial 31, synthetic NO, window 0x1200001,
root 0x5a, subw 0x0, time 17687220, (1197,-43), root:(1204,822),
state 0x2001, keycode 55 (keysym 0x56, V), same_screen YES,
XLookupString gives 1 bytes: (56) "V"
XFilterEvent returns: False
KeyRelease event, serial 31, synthetic NO, window 0x1200001,
root 0x5a, subw 0x0, time 17688138, (1197,-43), root:(1204,822),
state 0x2001, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
xev shows an incorrect state variable when this bug occurs - it is set to zero.
From what I can see, it seems that the state normally should be set to 0x2000 and OR'd with 1,2,4,8 for each of the modifiers, ie:
0x2000 - no modifiers
0x2001 - shift key
0x2002 - caps lock key
0x2004 - control key
0x2008 - alt key
Devon's post shows the same state=0x0 problem as mine.
The last time I recreated this was when I alt-tabbed between Firefox and gnome-terminal and back. I then tried xev again and saw that the event being generated for the key sequence shift-V is a lower-case v instead of the expected upper-case V:
KeyPress event, serial 28, synthetic NO, window 0x4400001,
root 0x5a, subw 0x0, time 17124192, (1294,2), root:(1301,867),
state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 31, synthetic NO, window 0x4400001,
root 0x5a, subw 0x0, time 17125412, (1294,2), root:(1301,867),
state 0x0, keycode 55 (keysym 0x76, v), same_screen YES,
XLookupString gives 1 bytes: (76) "v"
XmbLookupString gives 1 bytes: (76) "v"
XFilterEvent returns: False
KeyRelease event, serial 31, synthetic NO, window 0x4400001,
root 0x5a, subw 0x0, time 17125640, (1294,2), root:(1301,867),
state 0x0, keycode 55 (keysym 0x76, v), same_screen YES,
XLookupString gives 1 bytes: (76) "v"
XFilterEvent returns: False
KeyRelease event, serial 31, synthetic NO, window 0x4400001,
root 0x5a, subw 0x0, time 17126506, (1294,2), root:(1301,867),
state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
This is the expected sequence where an upper-case V is generated:
KeyPress event, serial 28, synthetic NO, window 0x1200001,
root 0x5a, subw 0x0, time 17686510, (1197,-43), root:(1204,822),
state 0x2000, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 31, synthetic NO, window 0x1200001,
root 0x5a, subw 0x0, time 17687106, (1197,-43), root:(1204,822),
state 0x2001, keycode 55 (keysym 0x56, V), same_screen YES,
XLookupString gives 1 bytes: (56) "V"
XmbLookupString gives 1 bytes: (56) "V"
XFilterEvent returns: False
KeyRelease event, serial 31, synthetic NO, window 0x1200001,
root 0x5a, subw 0x0, time 17687220, (1197,-43), root:(1204,822),
state 0x2001, keycode 55 (keysym 0x56, V), same_screen YES,
XLookupString gives 1 bytes: (56) "V"
XFilterEvent returns: False
KeyRelease event, serial 31, synthetic NO, window 0x1200001,
root 0x5a, subw 0x0, time 17688138, (1197,-43), root:(1204,822),
state 0x2001, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False