mac: Minimal fix after scancode merge

scancodes-fix
Martin Plicht 2013-05-24 19:24:31 +02:00
parent 9506c5ad97
commit 1d829361f7
2 changed files with 12 additions and 5 deletions

View File

@ -417,7 +417,7 @@ StdStrBuf C4KeyCodeEx::KeyCode2String(C4KeyCode wCode, bool fHumanReadable, bool
// for config files and such: dump scancode
return FormatString("$%x", static_cast<unsigned int>(wCode));
}
#if defined(_WIN32) || defined(USE_COCOA)
#if defined(_WIN32)
// TODO: Works?
// StdStrBuf Name; Name.SetLength(1000);
@ -435,6 +435,13 @@ StdStrBuf C4KeyCodeEx::KeyCode2String(C4KeyCode wCode, bool fHumanReadable, bool
// buf is nullterminated name
return StdStrBuf(buf);
}
#elif defined (USE_COCOA)
// query map
const C4KeyCodeMapEntry *pCheck = KeyCodeMap;
while (pCheck->szName)
if (wCode == pCheck->wCode) return StdStrBuf((pCheck->szShortName && fShort) ? pCheck->szShortName : pCheck->szName); else ++pCheck;
// not found: Compose as direct code
return FormatString("\\x%x", static_cast<unsigned int>(wCode));
#elif defined(USE_X11)
Display * const dpy = gdk_x11_display_get_xdisplay(gdk_display_get_default());
KeySym keysym = (KeySym)XkbKeycodeToKeysym(dpy,wCode+8,0,0);

View File

@ -134,10 +134,10 @@ bool C4Window::ReInit(C4AbstractApp* pApp)
return true;
}
C4KeyCode K_SHIFT_L; // FIXME
C4KeyCode K_SHIFT_R;
C4KeyCode K_ALT_L;
C4KeyCode K_ALT_R;
C4KeyCode K_SHIFT_L = 56 + CocoaKeycodeOffset;
C4KeyCode K_SHIFT_R = 60 + CocoaKeycodeOffset;
C4KeyCode K_ALT_L = 58 + CocoaKeycodeOffset;
C4KeyCode K_ALT_R = 61 + CocoaKeycodeOffset;
C4KeyCode K_F1 = 122 + CocoaKeycodeOffset;
C4KeyCode K_F2 = 120 + CocoaKeycodeOffset;
C4KeyCode K_F3 = 99 + CocoaKeycodeOffset;