summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2012-12-17 22:38:00 +0000
committerJon TURNEY <jon.turney@dronecode.org.uk>2012-12-19 13:37:19 +0000
commit2d9169e8b1e2690fb2969b461197b34391d5c4e1 (patch)
tree7719236266eeb67ac49fd72adec73b38582cfc5b
parent8b81d8947b5836eca36bc9aa3bf817f86496e283 (diff)
Change winTranslateKey() to return it's result as it's return value
Change winTranslateKey() to return it's result as it's return value, and change it's uses as well.
-rw-r--r--hw/xwin/winwndproc.c4
-rw-r--r--hw/xwin/wmutil/keyboard.c19
-rw-r--r--hw/xwin/wmutil/keyboard.h2
3 files changed, 14 insertions, 11 deletions
diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c
index 05b56fc87..790e1a09c 100644
--- a/hw/xwin/winwndproc.c
+++ b/hw/xwin/winwndproc.c
@@ -1067,7 +1067,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
}
/* Translate Windows key code to X scan code */
- winTranslateKey(wParam, lParam, &iScanCode);
+ iScanCode = winTranslateKey(wParam, lParam);
/* Ignore repeats for CapsLock */
if (wParam == VK_CAPITAL)
@@ -1096,7 +1096,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
return 0;
/* Enqueue a keyup event */
- winTranslateKey(wParam, lParam, &iScanCode);
+ iScanCode = winTranslateKey(wParam, lParam);
winSendKeyEvent(iScanCode, FALSE);
/* Release all pressed shift keys */
diff --git a/hw/xwin/wmutil/keyboard.c b/hw/xwin/wmutil/keyboard.c
index b5343200d..2553ff1b3 100644
--- a/hw/xwin/wmutil/keyboard.c
+++ b/hw/xwin/wmutil/keyboard.c
@@ -52,13 +52,14 @@ static bool g_winKeyState[NUM_KEYCODES];
* like AltGr on European keyboards.
*/
-void
-winTranslateKey(WPARAM wParam, LPARAM lParam, int *piScanCode)
+int
+winTranslateKey(WPARAM wParam, LPARAM lParam)
{
int iKeyFixup = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 1];
int iKeyFixupEx = g_iKeyMap[wParam * WIN_KEYMAP_COLS + 2];
int iParam = HIWORD(lParam);
int iParamScanCode = LOBYTE(iParam);
+ int iScanCode;
winDebug("winTranslateKey: wParam %08x lParam %08x\n", wParam, lParam);
@@ -83,23 +84,25 @@ winTranslateKey(WPARAM wParam, LPARAM lParam, int *piScanCode)
/* Branch on special extended, special non-extended, or normal key */
if ((iParam & KF_EXTENDED) && iKeyFixupEx)
- *piScanCode = iKeyFixupEx;
+ iScanCode = iKeyFixupEx;
else if (iKeyFixup)
- *piScanCode = iKeyFixup;
+ iScanCode = iKeyFixup;
else if (wParam == 0 && iParamScanCode == 0x70)
- *piScanCode = KEY_HKTG;
+ iScanCode = KEY_HKTG;
else
switch (iParamScanCode) {
case 0x70:
- *piScanCode = KEY_HKTG;
+ iScanCode = KEY_HKTG;
break;
case 0x73:
- *piScanCode = KEY_BSlash2;
+ iScanCode = KEY_BSlash2;
break;
default:
- *piScanCode = iParamScanCode;
+ iScanCode = iParamScanCode;
break;
}
+
+ return iScanCode;
}
/*
diff --git a/hw/xwin/wmutil/keyboard.h b/hw/xwin/wmutil/keyboard.h
index 1af343bbb..5b229c25c 100644
--- a/hw/xwin/wmutil/keyboard.h
+++ b/hw/xwin/wmutil/keyboard.h
@@ -33,7 +33,7 @@ void winSendKeyEventCallback(DWORD dwKey, bool fDown);
void winKeybdReleaseKeys(void);
bool winIsFakeCtrl_L(UINT message, WPARAM wParam, LPARAM lParam);
bool winCheckKeyPressed(WPARAM wParam, LPARAM lParam);
-void winTranslateKey(WPARAM wParam, LPARAM lParam, int *piScanCode);
+int winTranslateKey(WPARAM wParam, LPARAM lParam);
void winFixShiftKeys(int iScanCode);
#endif /* WMUTILS_KEYBOARD_H */