winemac: Don't return characters for Ctrl-(non-letter symbol) keypresses from ToUnicodeEx() as X11 driver already does.

Phil Krylov phil at newstar.rinet.ru
Mon Sep 9 19:22:33 CDT 2013


-- Ph.
-------------- next part --------------
From 59cb4f67f5ef17f63aa783b0b1385f66a0f2132a Mon Sep 17 00:00:00 2001
From: Phil Krylov <phil.krylov at gmail.com>
Date: Tue, 10 Sep 2013 04:13:57 +0400
Subject: winemac: Don't return characters for Ctrl-(non-letter symbol)
 keypresses from ToUnicodeEx() as X11 driver already does.

---
 dlls/winemac.drv/keyboard.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c
index 98d17ba..47c7a3c 100644
--- a/dlls/winemac.drv/keyboard.c
+++ b/dlls/winemac.drv/keyboard.c
@@ -1422,13 +1422,26 @@ INT CDECL macdrv_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState
     if (dead && len > 0) ret = -1;
     else ret = len;
 
-    /* Control-Return produces line feed instead of carriage return. */
-    if (ret > 0 && (lpKeyState[VK_CONTROL] & 0x80) && virtKey == VK_RETURN)
+    if (ret > 0)
     {
-        int i;
-        for (i = 0; i < len; i++)
-            if (bufW[i] == '\r')
-                bufW[i] = '\n';
+        /* more areas where Carbon returns characters but Windows does not
+           CTRL + number or CTRL + symbol */
+        if (lpKeyState[VK_CONTROL] & 0x80)
+        {
+            if ((virtKey >= 33 && virtKey < 'A') || virtKey > 'Z')
+            {
+                ret = 0;
+            }
+        }
+
+        /* Control-Return produces line feed instead of carriage return. */
+        if ((lpKeyState[VK_CONTROL] & 0x80) && virtKey == VK_RETURN)
+        {
+            int i;
+            for (i = 0; i < len; i++)
+                if (bufW[i] == '\r')
+                    bufW[i] = '\n';
+        }
     }
 
 done:
-- 
1.8.2.3


More information about the wine-patches mailing list