winex11: Log keycode decimal <-> hex for keysym & MS vkey and scancode.
authorJörg Höhle <hoehle@users.sourceforge.net>
Sat, 13 Feb 2010 21:47:08 +0000 (22:47 +0100)
committerAlexandre Julliard <julliard@winehq.org>
Thu, 4 Mar 2010 11:28:22 +0000 (12:28 +0100)
dlls/user32/input.c
dlls/user32/message.c
dlls/winex11.drv/keyboard.c

index 96c703878122d4e7e661ed3ee44da5507988b181..22d236eeeb97c5c85f08afe4954a327564ba0b9f 100644 (file)
@@ -134,7 +134,7 @@ UINT WINAPI SendInput( UINT count, LPINPUT inputs, int size )
                 break;
 
             case INPUT_KEYBOARD:
-                TRACE("keyboard: vk %x, scan %x, flags %x, time %u, info %lx\n",
+                TRACE("keyboard: vk %X, scan %x, flags %x, time %u, info %lx\n",
                       inputs[i].u.ki.wVk, inputs[i].u.ki.wScan, inputs[i].u.ki.dwFlags,
                       inputs[i].u.ki.time, inputs[i].u.ki.dwExtraInfo);
                 break;
@@ -657,7 +657,7 @@ UINT WINAPI MapVirtualKeyExA(UINT code, UINT maptype, HKL hkl)
  */
 UINT WINAPI MapVirtualKeyExW(UINT code, UINT maptype, HKL hkl)
 {
-    TRACE_(keyboard)("(%d, %d, %p)\n", code, maptype, hkl);
+    TRACE_(keyboard)("(%X, %d, %p)\n", code, maptype, hkl);
 
     return USER_Driver->pMapVirtualKeyEx(code, maptype, hkl);
 }
@@ -869,7 +869,7 @@ UINT WINAPI GetKeyboardLayoutList(INT nBuff, HKL *layouts)
 BOOL WINAPI RegisterHotKey(HWND hwnd,INT id,UINT modifiers,UINT vk)
 {
     static int once;
-    if (!once++) FIXME_(keyboard)("(%p,%d,0x%08x,%d): stub\n",hwnd,id,modifiers,vk);
+    if (!once++) FIXME_(keyboard)("(%p,%d,0x%08x,%X): stub\n",hwnd,id,modifiers,vk);
     return TRUE;
 }
 
index 498b52118748f2165b00b4a5d8481575c2668252..f8e4a43cdae4f1e728af9e662a0e924dea93b089 100644 (file)
@@ -2998,7 +2998,7 @@ BOOL WINAPI TranslateMessage( const MSG *msg )
     if (msg->message < WM_KEYFIRST || msg->message > WM_KEYLAST) return FALSE;
     if (msg->message != WM_KEYDOWN && msg->message != WM_SYSKEYDOWN) return TRUE;
 
-    TRACE_(key)("Translating key %s (%04lx), scancode %04x\n",
+    TRACE_(key)("Translating key %s (%04lX), scancode %04x\n",
                 SPY_GetVKeyName(msg->wParam), msg->wParam, HIWORD(msg->lParam));
 
     switch (msg->wParam)
index 5284717bc474ee545e7865502a69074060b11621..e044d6d0f1eda1c952d42d2803200b8837699aaf 100644 (file)
 #include "wine/unicode.h"
 #include "wine/debug.h"
 
+/* log format (add 0-padding as appropriate):
+    keycode  %u  as in output from xev
+    keysym   %lx as in X11/keysymdef.h
+    vkey     %X  as in winuser.h
+    scancode %x
+*/
 WINE_DEFAULT_DEBUG_CHANNEL(keyboard);
 WINE_DECLARE_DEBUG_CHANNEL(key);
 
@@ -1145,7 +1151,7 @@ static WORD EVENT_event_to_vkey( XIC xic, XKeyEvent *e)
     if ((e->state & ControlMask) && (keysym == XK_Break))
         return VK_CANCEL;
 
-    TRACE_(key)("e->keycode = %x\n", e->keycode);
+    TRACE_(key)("e->keycode = %u\n", e->keycode);
 
     return keyc2vkey[e->keycode];
 }
@@ -1231,7 +1237,7 @@ void X11DRV_send_keyboard_input( WORD wVk, WORD wScan, DWORD event_flags, DWORD
     {
         vk_hook = wVk = VK_PACKET;
         lParam = MAKELPARAM(1 /* repeat count */, wScan);
-        TRACE_(key)(" message=0x%04x wParam=0x%04x lParam=0x%08lx\n",
+        TRACE_(key)("message=0x%04x wParam=0x%04X lParam=0x%08lx\n",
                     message, wVk, lParam);
     }
 
@@ -1263,7 +1269,7 @@ void X11DRV_send_keyboard_input( WORD wVk, WORD wScan, DWORD event_flags, DWORD
 
         lParam = MAKELPARAM(1 /* repeat count */, flags);
 
-        TRACE_(key)(" message=0x%04x wParam=0x%04x, lParam=0x%08lx, InputKeyState=0x%x\n",
+        TRACE_(key)(" message=0x%04x wParam=0x%04X, lParam=0x%08lx, InputKeyState=0x%x\n",
                     message, wVk, lParam, key_state_table[wVk]);
     }
 
@@ -1299,7 +1305,7 @@ static inline void KEYBOARD_UpdateOneState ( WORD vkey, WORD scan, int state, DW
 
         if (!state) flags |= KEYEVENTF_KEYUP;
 
-        TRACE("Adjusting state for vkey %#.2x. State before %#.2x\n",
+        TRACE("Adjusting state for vkey %#.2X. State before %#.2x\n",
               vkey, key_state_table[vkey & 0xff]);
 
         /* Fake key being pressed inside wine */
@@ -1377,7 +1383,7 @@ void X11DRV_KeyEvent( HWND hwnd, XEvent *xev )
     DWORD event_time = EVENT_x11_time_to_win32_time(event->time);
     Status status = 0;
 
-    TRACE_(key)("type %d, window %lx, state 0x%04x, keycode 0x%04x\n",
+    TRACE_(key)("type %d, window %lx, state 0x%04x, keycode %u\n",
                event->type, event->window, event->state, event->keycode);
 
     wine_tsx11_lock();
@@ -1402,7 +1408,7 @@ void X11DRV_KeyEvent( HWND hwnd, XEvent *xev )
         ascii_chars = XLookupString(event, buf, sizeof(buf), &keysym, NULL);
     wine_tsx11_unlock();
 
-    TRACE_(key)("nbyte = %d, status 0x%x\n", ascii_chars, status);
+    TRACE_(key)("nbyte = %d, status %d\n", ascii_chars, status);
 
     if (status == XLookupChars)
     {
@@ -1432,7 +1438,7 @@ void X11DRV_KeyEvent( HWND hwnd, XEvent *xev )
         wine_tsx11_unlock();
        if (!ksname)
          ksname = "No Name";
-       TRACE_(key)("%s : keysym=%lX (%s), # of chars=%d / %s\n",
+       TRACE_(key)("%s : keysym=%lx (%s), # of chars=%d / %s\n",
                     (event->type == KeyPress) ? "KeyPress" : "KeyRelease",
                     keysym, ksname, ascii_chars, debugstr_an(Str, ascii_chars));
     }
@@ -1445,7 +1451,7 @@ void X11DRV_KeyEvent( HWND hwnd, XEvent *xev )
     if (!vkey && ascii_chars) vkey = VK_NONAME;
     wine_tsx11_unlock();
 
-    TRACE_(key)("keycode 0x%x converted to vkey 0x%x\n",
+    TRACE_(key)("keycode %u converted to vkey 0x%X\n",
                 event->keycode, vkey);
 
     if (!vkey) return;
@@ -1525,7 +1531,7 @@ X11DRV_KEYBOARD_DetectLayout( Display *display )
             if (!use_xkb || !XkbTranslateKeySym(display, &keysym, 0, &ckey[keyc][i], 1, NULL))
 #endif
             {
-                TRACE("XKB could not translate keysym %ld\n", keysym);
+                TRACE("XKB could not translate keysym %04lx\n", keysym);
                 /* FIXME: query what keysym is used as Mode_switch, fill XKeyEvent
                  * with appropriate ShiftMask and Mode_switch, use XLookupString
                  * to get character in the local encoding.
@@ -1577,7 +1583,7 @@ X11DRV_KEYBOARD_DetectLayout( Display *display )
           char str[5];
           for (i = 0; i < 4; i++) str[i] = ckey[keyc][i] ? ckey[keyc][i] : ' ';
           str[4] = 0;
-          TRACE_(key)("mismatch for keysym 0x%04lX, keycode %d, got %s\n", keysym, keyc, str );
+          TRACE_(key)("mismatch for keycode %u, got %s\n", keyc, str);
           mismatch++;
           score -= syms;
        }
@@ -1822,11 +1828,11 @@ void X11DRV_InitKeyboard( Display *display )
              }
            }
         }
-        TRACE("keycode %04x => vkey %04x\n", e2.keycode, vkey);
+        TRACE("keycode %u => vkey %04X\n", e2.keycode, vkey);
         keyc2vkey[e2.keycode] = vkey;
         keyc2scan[e2.keycode] = scan;
         if ((vkey & 0xff) && vkey_used[(vkey & 0xff)])
-            WARN("vkey %04x is being used by more than one keycode\n", vkey);
+            WARN("vkey %04X is being used by more than one keycode\n", vkey);
         vkey_used[(vkey & 0xff)] = 1;
     } /* for */
 
@@ -1874,7 +1880,7 @@ void X11DRV_InitKeyboard( Display *display )
 
         if (vkey)
         {
-            TRACE("keycode %04x => vkey %04x\n", e2.keycode, vkey);
+            TRACE("keycode %u => vkey %04X\n", e2.keycode, vkey);
             keyc2vkey[e2.keycode] = vkey;
         }
     } /* for */
@@ -1912,7 +1918,7 @@ void X11DRV_InitKeyboard( Display *display )
 
         if (TRACE_ON(keyboard))
         {
-            TRACE("spare virtual key %X assigned to keycode %X:\n",
+            TRACE("spare virtual key %04X assigned to keycode %u:\n",
                              vkey, e2.keycode);
             TRACE("(");
             for (i = 0; i < keysyms_per_keycode; i += 1)
@@ -1923,12 +1929,12 @@ void X11DRV_InitKeyboard( Display *display )
                 ksname = XKeysymToString(keysym);
                 if (!ksname)
                     ksname = "NoSymbol";
-                TRACE( "%lX (%s) ", keysym, ksname);
+                TRACE( "%lx (%s) ", keysym, ksname);
             }
             TRACE(")\n");
         }
 
-        TRACE("keycode %04x => vkey %04x\n", e2.keycode, vkey);
+        TRACE("keycode %u => vkey %04X\n", e2.keycode, vkey);
         keyc2vkey[e2.keycode] = vkey;
         vkey_used[vkey] = 1;
     } /* for */
@@ -1944,7 +1950,7 @@ void X11DRV_InitKeyboard( Display *display )
 
        /* should make sure the scancode is unassigned here, but >=0x60 currently always is */
 
-       TRACE_(key)("assigning scancode %02x to unidentified keycode %02x (%s)\n",scan,keyc,ksname);
+       TRACE_(key)("assigning scancode %02x to unidentified keycode %u (%s)\n",scan,keyc,ksname);
        keyc2scan[keyc]=scan++;
       }
 
@@ -1976,7 +1982,7 @@ SHORT CDECL X11DRV_GetAsyncKeyState(INT key)
     retval = ((key_state_table[key] & 0x40) ? 0x0001 : 0) |
              ((key_state_table[key] & 0x80) ? 0x8000 : 0);
     key_state_table[key] &= ~0x40;
-    TRACE_(key)("(%x) -> %x\n", key, retval);
+    TRACE_(key)("(%X) -> %x\n", key, retval);
     return retval;
 }
 
@@ -2127,8 +2133,7 @@ SHORT CDECL X11DRV_VkKeyScanEx(WCHAR wChar, HKL hkl)
     }
     wine_tsx11_unlock();
 
-    TRACE("'%c'(%#lx, %lu): got keycode %#.2x (%d)\n",
-            cChar, keysym, keysym, keycode, keycode);
+    TRACE("'%c'(%lx): got keycode %u\n", cChar, keysym, keycode);
 
     /* keycode -> (keyc2vkey) vkey */
     ret = keyc2vkey[keycode];
@@ -2298,7 +2303,7 @@ UINT CDECL X11DRV_MapVirtualKeyEx(UINT wCode, UINT wMapType, HKL hkl)
                           wine_tsx11_unlock();
                          return 0; /* whatever */
                        }
-                       TRACE("Found keycode %d (0x%2X)\n",e.keycode,e.keycode);
+                       TRACE("Found keycode %u\n",e.keycode);
 
                         len = XLookupString(&e, s, sizeof(s), &keysym, NULL);
                         wine_tsx11_unlock();
@@ -2357,7 +2362,7 @@ INT CDECL X11DRV_GetKeyNameText(LONG lParam, LPWSTR lpBuffer, INT nSize)
   }
 
   ansi = X11DRV_MapVirtualKeyEx(vkey, MAPVK_VK_TO_CHAR, X11DRV_GetKeyboardLayout(0));
-  TRACE("scan 0x%04x, vkey 0x%04x, ANSI 0x%04x\n", scanCode, vkey, ansi);
+  TRACE("scan 0x%04x, vkey 0x%04X, ANSI 0x%04x\n", scanCode, vkey, ansi);
 
   /* first get the name of the "regular" keys which is the Upper case
      value of the keycap imprint.                                     */
@@ -2400,7 +2405,7 @@ INT CDECL X11DRV_GetKeyNameText(LONG lParam, LPWSTR lpBuffer, INT nSize)
       keys = XKeycodeToKeysym(display, keyc, 0);
       name = XKeysymToString(keys);
       wine_tsx11_unlock();
-      TRACE("found scan=%04x keyc=%04x keysym=%04x string=%s\n",
+      TRACE("found scan=%04x keyc=%u keysym=%04x string=%s\n",
             scanCode, keyc, (int)keys, name);
       if (lpBuffer && nSize && name)
           return MultiByteToWideChar(CP_UNIXCP, 0, name, -1, lpBuffer, nSize);
@@ -2408,7 +2413,7 @@ INT CDECL X11DRV_GetKeyNameText(LONG lParam, LPWSTR lpBuffer, INT nSize)
 
   /* Finally issue WARN for unknown keys   */
 
-  WARN("(%08x,%p,%d): unsupported key, vkey=%04x, ansi=%04x\n",lParam,lpBuffer,nSize,vkey,ansi);
+  WARN("(%08x,%p,%d): unsupported key, vkey=%04X, ansi=%04x\n",lParam,lpBuffer,nSize,vkey,ansi);
   if (lpBuffer && nSize)
     *lpBuffer = 0;
   return 0;
@@ -2609,9 +2614,9 @@ INT CDECL X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState
         wine_tsx11_unlock();
        return 0;
       }
-    else TRACE("Found keycode %d (0x%2X)\n",e.keycode,e.keycode);
+    else TRACE("Found keycode %u\n",e.keycode);
 
-    TRACE_(key)("type %d, window %lx, state 0x%04x, keycode 0x%04x\n",
+    TRACE_(key)("type %d, window %lx, state 0x%04x, keycode %u\n",
                e.type, e.window, e.state, e.keycode);
 
     /* Clients should pass only KeyPress events to XmbLookupString,
@@ -2647,7 +2652,7 @@ INT CDECL X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState
         ksname = XKeysymToString(keysym);
         wine_tsx11_unlock();
         if (!ksname) ksname = "No Name";
-        TRACE_(key)("%s : keysym=%lX (%s), # of chars=%d / %s\n",
+        TRACE_(key)("%s : keysym=%lx (%s), # of chars=%d / %s\n",
                     (e.type == KeyPress) ? "KeyPress" : "KeyRelease",
                     keysym, ksname, ret, debugstr_an(lpChar, ret));
     }
@@ -2706,9 +2711,9 @@ INT CDECL X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState
                ksname = "No Name";
            if ((keysym >> 8) != 0xff)
                {
-               WARN("no char for keysym %04lX (%s) :\n",
+               WARN("no char for keysym %04lx (%s) :\n",
                     keysym, ksname);
-               WARN("virtKey=%X, scanCode=%X, keycode=%X, state=%X\n",
+               WARN("virtKey=%X, scanCode=%X, keycode=%u, state=%X\n",
                     virtKey, scanCode, e.keycode, e.state);
                }
            }