Fix for modifier keys after gaining focus patch

Vedat Hallac
Thu Mar 1 18:05:00 GMT 2012

The recent patch for sending modifier key presses when a window gains
focus depending on internal state and modifier key state has a
problem. If the right control key is pressed when a window is gaining
focus, it receives a left control keydown event, and the control state
gets stuck because the window never receives a left control keyup
event. The problem is fairly easy to replicate: run emacs-X11 from
xterm, quit with [C-x C-x] using right control (which gives focus back
to xterm), and try pressing keys. Until you press left control, all
keys you've pressed get interpreted as [C-key].

The patch is easy (and it has already been raised in, but
the idea was dismissed later because of internal state only keeping
track of control
key, and not individual left/right control keys). I have tried the
patch below, and didn't observe any side effects so far. I've also
modified the alt/ctrl check t only consider lctrl, since the other
parts of the source seemed to indicate altgr emits a spurious lctrl.

Best regards,
Vedat Hallac
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-stuck-RCtrl-key-problem.patch
Type: application/octet-stream
Size: 1451 bytes
Desc: not available
URL: <>
-------------- next part --------------
Unsubscribe info:
Problem reports:

More information about the Cygwin-xfree mailing list