Fix Alt+F4 on Windows #40
|
@ -287,6 +287,8 @@ LRESULT oc_win32_win_proc(HWND windowHandle, UINT message, WPARAM wParam, LPARAM
|
||||||
oc_window_data* mpWindow = GetPropW(windowHandle, L"MilePost");
|
oc_window_data* mpWindow = GetPropW(windowHandle, L"MilePost");
|
||||||
//TODO: put messages in queue
|
//TODO: put messages in queue
|
||||||
|
|
||||||
|
bool handled = true;
|
||||||
|
|
||||||
switch(message)
|
switch(message)
|
||||||
{
|
{
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
|
@ -471,6 +473,13 @@ LRESULT oc_win32_win_proc(HWND windowHandle, UINT message, WPARAM wParam, LPARAM
|
||||||
case WM_KEYDOWN:
|
case WM_KEYDOWN:
|
||||||
case WM_SYSKEYDOWN:
|
case WM_SYSKEYDOWN:
|
||||||
{
|
{
|
||||||
|
// Need to pass these through to the normal event handler to handle system shortcuts like Alt+F4.
|
||||||
|
// Same for WM_SYSKEYUP
|
||||||
|
if (message == WM_SYSKEYDOWN)
|
||||||
|
{
|
||||||
|
handled = false;
|
||||||
|
}
|
||||||
|
|
||||||
oc_event event = {0};
|
oc_event event = {0};
|
||||||
event.window = oc_window_handle_from_ptr(mpWindow);
|
event.window = oc_window_handle_from_ptr(mpWindow);
|
||||||
event.type = OC_EVENT_KEYBOARD_KEY;
|
event.type = OC_EVENT_KEYBOARD_KEY;
|
||||||
|
@ -483,6 +492,11 @@ LRESULT oc_win32_win_proc(HWND windowHandle, UINT message, WPARAM wParam, LPARAM
|
||||||
case WM_KEYUP:
|
case WM_KEYUP:
|
||||||
case WM_SYSKEYUP:
|
case WM_SYSKEYUP:
|
||||||
{
|
{
|
||||||
|
if (message == WM_SYSKEYUP)
|
||||||
|
{
|
||||||
|
handled = false;
|
||||||
|
}
|
||||||
|
|
||||||
oc_event event = {0};
|
oc_event event = {0};
|
||||||
event.window = oc_window_handle_from_ptr(mpWindow);
|
event.window = oc_window_handle_from_ptr(mpWindow);
|
||||||
event.type = OC_EVENT_KEYBOARD_KEY;
|
event.type = OC_EVENT_KEYBOARD_KEY;
|
||||||
|
@ -531,10 +545,16 @@ LRESULT oc_win32_win_proc(HWND windowHandle, UINT message, WPARAM wParam, LPARAM
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
result = DefWindowProc(windowHandle, message, wParam, lParam);
|
handled = false;
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (handled == false)
|
||||||
|
{
|
||||||
|
result = DefWindowProc(windowHandle, message, wParam, lParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue