winex11.drv: Use symbolic names for MapVirtualKey translation types

Dmitry Timoshkov dmitry at codeweavers.com
Tue Sep 18 02:26:03 CDT 2007


Hello,

Changelog:
    winex11.drv: Use symbolic names for MapVirtualKey translation types.

---
 dlls/winex11.drv/keyboard.c |   31 ++++++++++++++++---------------
 include/winuser.h           |    7 +++++++
 2 files changed, 23 insertions(+), 15 deletions(-)

diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c
index f70aee5..2562103 100644
--- a/dlls/winex11.drv/keyboard.c
+++ b/dlls/winex11.drv/keyboard.c
@@ -2094,25 +2094,32 @@ UINT X11DRV_MapVirtualKeyEx(UINT wCode, UINT wMapType, HKL hkl)
         FIXME("keyboard layout %p is not supported\n", hkl);
 
 	switch(wMapType) {
-		case 0:	{ /* vkey-code to scan-code */
+		case MAPVK_VK_TO_VSC: /* vkey-code to scan-code */
+		case MAPVK_VK_TO_VSC_EX: /* FIXME: should differentiate between
+                                            left and right keys */
+		{
 			/* let's do vkey -> keycode -> scan */
 			int keyc;
 			for (keyc=min_keycode; keyc<=max_keycode; keyc++)
 				if ((keyc2vkey[keyc] & 0xFF) == wCode)
 					returnMVK (keyc2scan[keyc] & 0xFF);
 			TRACE("returning no scan-code.\n");
-		        return 0; }
-
-		case 1: { /* scan-code to vkey-code */
+		        return 0;
+		}
+		case MAPVK_VSC_TO_VK: /* scan-code to vkey-code */
+		case MAPVK_VSC_TO_VK_EX: /* FIXME: should differentiate between
+                                            left and right keys */
+		{
 			/* let's do scan -> keycode -> vkey */
 			int keyc;
 			for (keyc=min_keycode; keyc<=max_keycode; keyc++)
 				if ((keyc2scan[keyc] & 0xFF) == (wCode & 0xFF))
 					returnMVK (keyc2vkey[keyc] & 0xFF);
 			TRACE("returning no vkey-code.\n");
-		        return 0; }
-
-		case 2: { /* vkey-code to unshifted ANSI code */
+		        return 0;
+		}
+		case MAPVK_VK_TO_CHAR: /* vkey-code to unshifted ANSI code */
+		{
                         /* we still don't know what "unshifted" means. in windows VK_W (0x57)
                          * returns 0x57, which is upercase 'W'. So we have to return the uppercase
                          * key.. Looks like something is wrong with the MS docs?
@@ -2169,15 +2176,9 @@ UINT X11DRV_MapVirtualKeyEx(UINT wCode, UINT wMapType, HKL hkl)
 			TRACE("returning no ANSI.\n");
                         wine_tsx11_unlock();
 			return 0;
-			}
-
-		case 3:   /* **NT only** scan-code to vkey-code but distinguish between  */
-              		  /*             left and right  */
-		          FIXME(" stub for NT\n");
-                          return 0;
-
+		}
 		default: /* reserved */
-			WARN("Unknown wMapType %d !\n", wMapType);
+			FIXME("Unknown wMapType %d !\n", wMapType);
 			return 0;
 	}
 	return 0;
diff --git a/include/winuser.h b/include/winuser.h
index 4297a8d..b667aa5 100644
--- a/include/winuser.h
+++ b/include/winuser.h
@@ -3729,6 +3729,13 @@ typedef struct tagCOMPAREITEMSTRUCT
 #define VK_PA1              0xFD
 #define VK_OEM_CLEAR        0xFE
 
+/* MapVirtualKey translation types */
+#define MAPVK_VK_TO_VSC     0
+#define MAPVK_VSC_TO_VK     1
+#define MAPVK_VK_TO_CHAR    2
+#define MAPVK_VSC_TO_VK_EX  3
+#define MAPVK_VK_TO_VSC_EX  4
+
   /* Key status flags for mouse events */
 #define MK_LBUTTON	    0x0001
 #define MK_RBUTTON	    0x0002
-- 
1.5.3.1






More information about the wine-patches mailing list