Howdy! Newbie with keyboard patches.

Peter Seebach seebs at plethora.net
Mon Jan 22 17:36:42 CST 2007


Someone asked for a copy in unified diff format.  So, here's the version that also
translates F25-F32 into control-alt-shift (F1-F8).  I don't know my way around the
rest of the tree to encode this cleanly as an option for winecfg.

--- wine-0.9.29/dlls/winex11.drv/keyboard.c	2007-01-09 09:42:47.000000000 -0600
+++ wine-0.9.29.patch/dlls/winex11.drv/keyboard.c	2007-01-22 14:18:23.000000000 -0600
@@ -1020,9 +1020,9 @@
     /* function keys */
     VK_F1, VK_F2,
     VK_F3, VK_F4, VK_F5, VK_F6, VK_F7, VK_F8, VK_F9, VK_F10,    /* FFC0 */
-    VK_F11, VK_F12, VK_F13, VK_F14, VK_F15, VK_F16, 0, 0,       /* FFC8 */
-    0, 0, 0, 0, 0, 0, 0, 0,                                     /* FFD0 */
-    0, 0, 0, 0, 0, 0, 0, 0,                                     /* FFD8 */
+    VK_F11, VK_F12, VK_F13, VK_F14, VK_F15, VK_F16, VK_F17, VK_F18,  /* FFC8 */
+    VK_F19, VK_F20, VK_F21, VK_F22, VK_F23, VK_F24, VK_F25, VK_F26,  /* FFD0 */
+    VK_F27, VK_F28, VK_F29, VK_F30, VK_F31, VK_F32, 0, 0,       /* FFD8 */
     /* modifier keys */
     0, VK_SHIFT, VK_SHIFT, VK_CONTROL,                          /* FFE0 */
     VK_CONTROL, VK_CAPITAL, 0, VK_MENU,
@@ -1066,8 +1066,8 @@
     /* function keys */
     0x3B, 0x3C,
     0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44,              /* FFC0 */
-    0x57, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,              /* FFC8 */
-    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,              /* FFD0 */
+    0x57, 0x58, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,              /* FFC8 */
+    0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x76, 0x00, 0x00,              /* FFD0 */
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,              /* FFD8 */
     /* modifier keys */
     0x00, 0x2A, 0x36, 0x1D, 0x11D, 0x3A, 0x00, 0x38,             /* FFE0 */
@@ -1465,7 +1465,35 @@
 	if ( event->type == KeyRelease ) dwFlags |= KEYEVENTF_KEYUP;
 	if ( vkey & 0x100 )              dwFlags |= KEYEVENTF_EXTENDEDKEY;
 
-        X11DRV_send_keyboard_input( vkey & 0xff, bScan, dwFlags, event_time, 0, 0 );
+	if ((vkey & 0xFF) >= VK_F13 && (vkey & 0xFF) <= VK_F24) {
+		/* translate to control-alt-F(N-12) */
+		vkey = vkey - 12;
+		if (event->type != KeyRelease) {
+			X11DRV_send_keyboard_input(VK_MENU, 0, 0, event_time, 0, 0 );
+			X11DRV_send_keyboard_input(VK_CONTROL, 0, 0, event_time, 0, 0 );
+		}
+		X11DRV_send_keyboard_input( vkey & 0xff, bScan, dwFlags, event_time, 0, 0 );
+		if (event->type != KeyRelease) {
+			X11DRV_send_keyboard_input(VK_CONTROL, 0, KEYEVENTF_KEYUP, event_time, 0, 0 );
+			X11DRV_send_keyboard_input(VK_MENU, 0, KEYEVENTF_KEYUP, event_time, 0, 0 );
+		}
+	} else if ((vkey & 0xFF) >= VK_F25 && (vkey & 0xFF) <= VK_F32) {
+		/* translate to control-alt-shift-F(N-24) */
+		vkey = vkey - 24;
+		if (event->type != KeyRelease) {
+			X11DRV_send_keyboard_input(VK_MENU, 0, 0, event_time, 0, 0 );
+			X11DRV_send_keyboard_input(VK_CONTROL, 0, 0, event_time, 0, 0 );
+			X11DRV_send_keyboard_input(VK_SHIFT, 0, 0, event_time, 0, 0 );
+		}
+		X11DRV_send_keyboard_input( vkey & 0xff, bScan, dwFlags, event_time, 0, 0 );
+		if (event->type != KeyRelease) {
+			X11DRV_send_keyboard_input(VK_SHIFT, 0, KEYEVENTF_KEYUP, event_time, 0, 0 );
+			X11DRV_send_keyboard_input(VK_CONTROL, 0, KEYEVENTF_KEYUP, event_time, 0, 0 );
+			X11DRV_send_keyboard_input(VK_MENU, 0, KEYEVENTF_KEYUP, event_time, 0, 0 );
+		}
+	} else {
+		X11DRV_send_keyboard_input( vkey & 0xff, bScan, dwFlags, event_time, 0, 0 );
+	}
     }
    }
 }
@@ -2253,8 +2281,10 @@
             function keys. Soooo.. We will leave the table alone and
             fudge the lookup here till the other part is found and fixed!!! */
 
-  if ( ((scanCode >= 0x13b) && (scanCode <= 0x144)) ||
-       (scanCode == 0x157) || (scanCode == 0x158))
+  if (((scanCode >= 0x13b) && (scanCode <= 0x144)) ||
+      ((scanCode >= 0x164) && (scanCode <= 0x16e)) ||
+       (scanCode == 0x157) || (scanCode == 0x158)  ||
+       (scanCode == 0x176))
     scanCode &= 0xff;   /* remove "extended-key" flag for Fx keys */
 
   /* let's do scancode -> keycode -> keysym -> String */
--- wine-0.9.29/include/winuser.h	2007-01-09 09:42:47.000000000 -0600
+++ wine-0.9.29.patch/include/winuser.h	2007-01-22 13:56:34.000000000 -0600
@@ -3595,7 +3595,14 @@
 #define VK_F22              0x85
 #define VK_F23              0x86
 #define VK_F24              0x87
-/*                          0x88-0x8F  Unassigned */
+#define VK_F25              0x88
+#define VK_F26              0x89
+#define VK_F27              0x8A
+#define VK_F28              0x8B
+#define VK_F29              0x8C
+#define VK_F30              0x8D
+#define VK_F31              0x8E
+#define VK_F32              0x8F
 #define VK_NUMLOCK          0x90
 #define VK_SCROLL           0x91
 #define VK_OEM_NEC_EQUAL    0x92



More information about the wine-devel mailing list