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>2013-03-07 17:19:41 +0000
commit03a7e023e33afdfcfc41aa6bc0b285aba93e6a93 (patch)
tree743bd9ba257f3ad7352798ec82afbd5f66450a12
parente71ff34d3a14abd58383fe22922e4f2fa193fac4 (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 251fb17bd..e4d0bc61b 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 */