summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaakov Selkowitz <yselkowitz@users.sourceforge.net>2011-12-22 20:21:05 -0600
committerYaakov Selkowitz <yselkowitz@users.sourceforge.net>2011-12-22 20:21:05 -0600
commitdc6079992c8b50581129a14fd933d354b6b16de0 (patch)
tree53ce45f10d7d88317700bb029321318ccc61a1ad
parentf1f2027ae874ca88f8e6a085388c4b59545ea646 (diff)
parenta493c0465e56ce0b7c8f3db24118031b9baec8a8 (diff)
Merge remote-tracking branch 'jturney/cygwin-release-1.10' into cygwin-release-1.10cygwin-release-1.10
-rw-r--r--hw/xwin/winkeybd.c42
1 files changed, 30 insertions, 12 deletions
diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c
index 9e5a9b02a..a403ddbbc 100644
--- a/hw/xwin/winkeybd.c
+++ b/hw/xwin/winkeybd.c
@@ -348,12 +348,21 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam)
/*
* Try again if the first call fails.
- * NOTE: This usually happens when TweakUI is enabled.
*/
if (!fReturn)
{
- /* Voodoo to make sure that the Alt_R message has posted */
- Sleep (0);
+ /*
+ Voodoo to try to make sure that the Alt_R message has posted.
+
+ Sometimes, the AltGr message is not yet posted when
+ the fake Ctrl_L message arrives.
+
+ (TweakUI has been reported to cause this to occur)
+
+ We hope that waiting 1 millisecond means that all messages
+ with the same millisecond-resolution MSG.time are now available
+ */
+ Sleep (1);
/* Look for fake Ctrl_L preceeding an Alt_R press. */
fReturn = PeekMessage (&msgNext, NULL,
@@ -368,7 +377,7 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam)
&& msgNext.time == lTime
&& (HIWORD (msgNext.lParam) & KF_EXTENDED))
{
- /*
+ /*
* Next key press is Alt_R with same timestamp as current
* Ctrl_L message. Therefore, this Ctrl_L press is a fake
* event, so discard it.
@@ -377,7 +386,7 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam)
}
}
- /*
+ /*
* Fake Ctrl_L releases will be followed by an Alt_R release
* with the same timestamp as the Ctrl_L release.
*/
@@ -392,27 +401,36 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam)
/* Look for fake Ctrl_L release preceeding an Alt_R release. */
fReturn = PeekMessage (&msgNext, NULL,
- WM_KEYUP, WM_SYSKEYUP,
+ WM_KEYUP, WM_SYSKEYUP,
PM_NOREMOVE);
/*
* Try again if the first call fails.
- * NOTE: This usually happens when TweakUI is enabled.
*/
if (!fReturn)
{
- /* Voodoo to make sure that the Alt_R message has posted */
- Sleep (0);
+ /*
+ Voodoo to try to make sure that the Alt_R message has posted.
+
+ Sometimes, the AltGr message is not yet posted when
+ the fake Ctrl_L message arrives.
+
+ (TweakUI has been reported to cause this to occur)
+
+ We hope that waiting 1 millisecond means that all messages
+ with the same millisecond-resolution MSG.time are now available
+ */
+ Sleep (1);
/* Look for fake Ctrl_L release preceeding an Alt_R release. */
fReturn = PeekMessage (&msgNext, NULL,
- WM_KEYUP, WM_SYSKEYUP,
+ WM_KEYUP, WM_SYSKEYUP,
PM_NOREMOVE);
}
if (msgNext.message != WM_KEYUP && msgNext.message != WM_SYSKEYUP)
fReturn = 0;
-
+
/* Is next press an Alt_R with the same timestamp? */
if (fReturn
&& (msgNext.message == WM_KEYUP
@@ -429,7 +447,7 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam)
return TRUE;
}
}
-
+
/* Not a fake control left press/release */
return FALSE;
}