Fix opengl core renderer message pump

This commit is contained in:
ts-korhonen
2022-01-11 08:04:56 +02:00
parent bf8227dd6c
commit 3be3acf78f

View File

@@ -200,8 +200,9 @@ static void set_parent_binding(int enable)
* @param wParam * @param wParam
* @param lParam * @param lParam
* @param fullscreen * @param fullscreen
* @return Was message handled
*/ */
static void handle_window_messages(UINT message, WPARAM wParam, LPARAM lParam, int fullscreen) static int handle_window_messages(UINT message, WPARAM wParam, LPARAM lParam, int fullscreen)
{ {
switch (message) switch (message)
{ {
@@ -219,7 +220,7 @@ static void handle_window_messages(UINT message, WPARAM wParam, LPARAM lParam, i
/* Mouse events that enter and exit capture. */ /* Mouse events that enter and exit capture. */
PostMessage(parent, message, wParam, lParam); PostMessage(parent, message, wParam, lParam);
} }
break; return 1;
case WM_KEYDOWN: case WM_KEYDOWN:
case WM_KEYUP: case WM_KEYUP:
case WM_SYSKEYDOWN: case WM_SYSKEYDOWN:
@@ -228,7 +229,7 @@ static void handle_window_messages(UINT message, WPARAM wParam, LPARAM lParam, i
{ {
PostMessage(parent, message, wParam, lParam); PostMessage(parent, message, wParam, lParam);
} }
break; return 1;
case WM_INPUT: case WM_INPUT:
if (fullscreen) if (fullscreen)
{ {
@@ -256,8 +257,10 @@ static void handle_window_messages(UINT message, WPARAM wParam, LPARAM lParam, i
} }
free(raw); free(raw);
} }
break; return 1;
} }
return 0;
} }
/** /**
@@ -638,12 +641,13 @@ static void opengl_main(void* param)
/* Handle window messages */ /* Handle window messages */
MSG msg; MSG msg;
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{ {
if (msg.hwnd == window_hwnd) if (msg.hwnd != window_hwnd || !handle_window_messages(msg.message, msg.wParam, msg.lParam, fullscreen))
handle_window_messages(msg.message, msg.wParam, msg.lParam, fullscreen); {
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessage(&msg);
}
} }
/* Wait for synchronized events for 1ms before going back to window events */ /* Wait for synchronized events for 1ms before going back to window events */