fix text enter
This commit is contained in:
parent
6392f71641
commit
4f386a854a
|
@ -517,10 +517,12 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
case WM_CHAR:
|
case WM_CHAR:
|
||||||
{
|
{
|
||||||
|
if(wParam >= 32 && wParam <= 255) {
|
||||||
inputEvent.type = EV_TEXT_ENTER;
|
inputEvent.type = EV_TEXT_ENTER;
|
||||||
inputEvent.keychar = wParam;
|
inputEvent.keychar = wParam;
|
||||||
inputEvent.keycode = KC_UNKNOWN;
|
inputEvent.keycode = KC_UNKNOWN;
|
||||||
g_engine.onInputEvent(inputEvent);
|
g_engine.onInputEvent(inputEvent);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
|
@ -536,22 +538,15 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case WM_KEYDOWN:
|
case WM_KEYDOWN:
|
||||||
{
|
|
||||||
inputEvent.type = EV_KEY_DOWN;
|
|
||||||
inputEvent.ctrl = HIWORD(GetKeyState(VK_CONTROL)) == 0 ? false : true;
|
|
||||||
inputEvent.alt = HIWORD(GetKeyState(VK_MENU)) == 0 ? false : true;
|
|
||||||
inputEvent.shift = HIWORD(GetKeyState(VK_SHIFT)) == 0 ? false : true;
|
|
||||||
inputEvent.keycode = win32.keyMap[wParam];
|
|
||||||
g_engine.onInputEvent(inputEvent);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case WM_KEYUP:
|
case WM_KEYUP:
|
||||||
{
|
{
|
||||||
inputEvent.type = EV_KEY_UP;
|
if(win32.keyMap.find(wParam) != win32.keyMap.end()) {
|
||||||
|
inputEvent.type = uMsg == WM_KEYDOWN ? EV_KEY_DOWN : WM_KEYUP;
|
||||||
inputEvent.ctrl = HIWORD(GetKeyState(VK_CONTROL)) == 0 ? false : true;
|
inputEvent.ctrl = HIWORD(GetKeyState(VK_CONTROL)) == 0 ? false : true;
|
||||||
inputEvent.alt = HIWORD(GetKeyState(VK_MENU)) == 0 ? false : true;
|
inputEvent.alt = HIWORD(GetKeyState(VK_MENU)) == 0 ? false : true;
|
||||||
inputEvent.shift = HIWORD(GetKeyState(VK_SHIFT)) == 0 ? false : true;
|
inputEvent.shift = HIWORD(GetKeyState(VK_SHIFT)) == 0 ? false : true;
|
||||||
inputEvent.keycode = win32.keyMap[wParam];
|
inputEvent.keycode = win32.keyMap[wParam];
|
||||||
|
}
|
||||||
g_engine.onInputEvent(inputEvent);
|
g_engine.onInputEvent(inputEvent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -337,12 +337,14 @@ void Platform::poll()
|
||||||
static XComposeStatus compose = {NULL, 0};
|
static XComposeStatus compose = {NULL, 0};
|
||||||
len = XLookupString(&event.xkey, buf, sizeof(buf), &keysym, &compose);
|
len = XLookupString(&event.xkey, buf, sizeof(buf), &keysym, &compose);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(len > 0 &&
|
if(len > 0 &&
|
||||||
// for some reason these keys produces characters and we don't want that
|
// for some reason these keys produces characters and we don't want that
|
||||||
keysym != XK_BackSpace &&
|
keysym != XK_BackSpace &&
|
||||||
keysym != XK_Return &&
|
keysym != XK_Return &&
|
||||||
keysym != XK_Delete &&
|
keysym != XK_Delete &&
|
||||||
keysym != XK_Escape
|
keysym != XK_Escape &&
|
||||||
|
(uchar)(buf[0]) >= 32
|
||||||
) {
|
) {
|
||||||
//logDebug("char: %c code: %d", buf[0], (uchar)buf[0]);
|
//logDebug("char: %c code: %d", buf[0], (uchar)buf[0]);
|
||||||
inputEvent.type = EV_TEXT_ENTER;
|
inputEvent.type = EV_TEXT_ENTER;
|
||||||
|
|
Loading…
Reference in New Issue