On 10/21/2011 1:43 PM, Michel Hummel wrote:
> Can I know the exact patch list applied to generate it ?
you can see the source code of my current playground version at
https://github.com/osch/cygwin-xserver
Commit 1ec241341cf1c85abf0372e00ae9acc8be66894b contains the official
sources from xserver-cygwin-1.10.3-1.
I'm also attaching a patch file of my current version against
xserver-cygwin-1.10.3-1 to this email.
Best regards,
Oliver
diff --git a/cygwin/dix/dispatch.c b/cygwin/dix/dispatch.c
index 44f8087..18e9697 100644
--- a/cygwin/dix/dispatch.c
+++ b/cygwin/dix/dispatch.c
@@ -343,33 +343,27 @@ DisableLimitedSchedulingLatency(void)
#define MAJOROP ((xReq *)client->requestBuffer)->reqType
-void
-Dispatch(void)
-{
-int*clientReady; /* array of request ready clients */
-intresult;
-ClientPtr client;
-intnready;
-HWEventQueuePtr* icheck = checkForInput;
-long start_tick;
+static int*clientReady; /* array of request ready clients */
+static int result;
+static ClientPtr client;
+static int nready;
+static HWEventQueuePtr* icheck = checkForInput;
+static longstart_tick;
-nextFreeClientID = 1;
-nClients = 0;
-
-clientReady = malloc(sizeof(int) * MaxClients);
-if (!clientReady)
- return;
-
-SmartScheduleSlice = SmartScheduleInterval;
-while (!dispatchException)
-{
+int DispatchOneStep(Bool handleWindowMessage)
+{
+int rslt = 0;
+
if (*icheck[0] != *icheck[1])
{
ProcessInputEvents();
FlushIfCriticalOutputPending();
}
-
nready = WaitForSomething(clientReady);
+ rslt = nready;
+
+if (handleWindowMessage)
+handleNextWindowMessage();
if (nready && !SmartScheduleDisable)
{
@@ -460,6 +454,24 @@ Dispatch(void)
client->smart_stop_tick = SmartScheduleTime;
}
dispatchException &= ~DE_PRIORITYCHANGE;
+
+return rslt;
+}
+
+void
+Dispatch(void)
+{
+nextFreeClientID = 1;
+nClients = 0;
+
+clientReady = malloc(sizeof(int) * MaxClients);
+if (!clientReady)
+ return;
+
+SmartScheduleSlice = SmartScheduleInterval;
+while (!dispatchException)
+{
+DispatchOneStep(TRUE);
}
if (ddxHooks.ddxBeforeReset)
diff --git a/cygwin/hw/xwin/winkeybd.c b/cygwin/hw/xwin/winkeybd.c
index 9e5a9b0..99c822d 100644
--- a/cygwin/hw/xwin/winkeybd.c
+++ b/cygwin/hw/xwin/winkeybd.c
@@ -282,6 +282,29 @@ winRestoreModeKeyStates (void)
* have a logical XOR operator, so we use a macro instead.
*/
+ {
+/* consider modifer keys */
+
+BOOL ctrl = (GetAsyncKeyState (VK_CONTROL) < 0);
+BOOL shift = (GetAsyncKeyState (VK_SHIFT) < 0);
+BOOL alt= (GetAsyncKeyState (VK_LMENU) < 0);
+BOOL altgr = (GetAsyncKeyState (VK_RMENU) < 0);
+
+if (ctrl && altgr) ctrl = FALSE;
+
+if (WIN_XOR (internalKeyStates & ControlMask, ctrl))
+ winSendKeyEvent (KEY_LCtrl, ctrl);
+
+if (WIN_XOR (internalKeyStates & ShiftMask, shift))
+ winSendKeyEvent (KEY_ShiftL, shift);
+
+if (WIN_XOR (internalKeyStates & Mod1Mask, alt))
+ winSendKeyEvent (KEY_Alt, alt);
+
+if (WIN_XOR (internalKeyStates & Mod5Mask, altgr))
+ winSendKeyEvent (KEY_AltLang, altgr);
+ }
+
/* Has the key state changed? */
dwKeyState = GetKeyState (VK_NUMLOCK) & 0x0001;
if (WIN_XOR (internalKeyStates & NumLockMask, dwKeyState))
@@ -327,6 +350,12 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM
lParam)
MSG msgNext;
LONG lTime;
Bool fReturn;
+
+ static Bool hasLastControlL = FALSE;
+ static UINT lastMessage;
+ static WPARAM lastWparam;
+ static LPARAM lastLparam;
+ static LONG lastTime;
/*
* Fake Ctrl_L presses will be followed by an Alt_R keypress
@@ -360,9 +389,22 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM
lParam)
WM_KEYDOWN, WM_SYSKEYDOWN,
PM_NOREMOVE);
}
- if (msgNext.message != WM_KEYDOWN && msgNext.message != WM_SYSKEYDOWN)
+ if (fReturn && msgNext.message != WM_KEYDOWN && msgNext.message !=
WM_SYSKEYDOWN)
fReturn = 0;
+ if (!fReturn)
+{
+ hasLastControlL = TRUE;
+ lastMessage = message;
+ lastWparam = wParam;
+ lastLparam = lParam;
+ lastTime= lTime;
+}
+ else
+{
+ hasLastControlL = FALSE;
+}
+
/* Is next press an Alt_R with the same timestamp? */
if (fReturn && msgNext.wParam == VK_MENU
&& msgNext.time == lTime
@@ -377,11 +419,33 @@ winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM
lParam)
}
}
+ /*
+ * Check for Alt_R keypress, that was not ready when the
+ * last Ctrl_L appeared.
+ */
+ else if ((message == W