From f5d20c7b488c114399a3d18c58db661d517fb38e Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 21 Nov 2015 19:10:19 +0100 Subject: Handle both WM_KEYDOWN and WM_KEYUP. Allocate m_className. --- plugingui/nativewindow_win32.cc | 8 ++++++-- 1 file 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); -- cgit v1.2.3