diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-11-21 19:10:19 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2015-11-21 19:10:19 +0100 |
commit | f5d20c7b488c114399a3d18c58db661d517fb38e (patch) | |
tree | 32c8766b98904f19679dd58b48740c2efa406f16 /plugingui/nativewindow_win32.cc | |
parent | 19fa719ecf5a42b96a6828c333f30c777fd9a2fc (diff) |
Handle both WM_KEYDOWN and WM_KEYUP. Allocate m_className.
Diffstat (limited to 'plugingui/nativewindow_win32.cc')
-rw-r--r-- | plugingui/nativewindow_win32.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/plugingui/nativewindow_win32.cc b/plugingui/nativewindow_win32.cc index cce5a49..9f8936f 100644 --- a/plugingui/nativewindow_win32.cc +++ b/plugingui/nativewindow_win32.cc @@ -181,6 +181,7 @@ LRESULT CALLBACK NativeWindowWin32::dialogProc(HWND hwnd, UINT msg, break; case WM_KEYDOWN: + case WM_KEYUP: { KeyEvent* keyEvent = new KeyEvent(); @@ -200,7 +201,7 @@ LRESULT CALLBACK NativeWindowWin32::dialogProc(HWND hwnd, UINT msg, } keyEvent->text = ""; - keyEvent->direction = Direction::up; + keyEvent->direction = (msg == WM_KEYDOWN) ? Direction::down : Direction::up; native->event = keyEvent; } @@ -312,7 +313,10 @@ NativeWindowWin32::NativeWindowWin32(Window& window) wcex.hbrBackground = nullptr;//(HBRUSH) COLOR_BACKGROUND + 1; // } - wcex.lpszClassName = m_className = (char*)"DrumGizmoClass"; + const char* name = "DrumGizmoClass"; + char* c_name = (char*)malloc(strlen(name) + 1); + strcpy(c_name, name); + wcex.lpszClassName = m_className = c_name; RegisterClassEx(&wcex); |