Skip to content

Commit fdc3626

Browse files
committed
WIN32: Added a timer to the event loop @1/sec even if minimized
1 parent 4b3cf92 commit fdc3626

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

bootstraps/win32/win32_microgl.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ static int _microgl_key(WPARAM wParam, LPARAM lParam, int action)
9595
}
9696
}
9797

98+
// timer callback
99+
static VOID CALLBACK event_timer_callback(HWND hWnd, UINT uMsg, UINT idTimer, DWORD dwTime){
100+
ffi_event(EVENT_IDLE,0,0);
101+
}
102+
98103
// window event callback
99104
static LRESULT CALLBACK _microgl_callback( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
100105
{
@@ -212,8 +217,9 @@ void microgl_init(void)
212217
wc.hbrBackground = NULL;
213218
wc.lpszMenuName = NULL;
214219
if (!RegisterClassEx( &wc ))
215-
printf("Error: microgl: RegisterClassEx() failed [%i]\n",
216-
(int)GetLastError());
220+
printf("Error: microgl: RegisterClassEx() failed [%i]\n", (int)GetLastError());
221+
if (!SetTimer(NULL,1,1000,event_timer_callback))
222+
printf("Error: microgl: SetTimer() failed [%i]\n", (int)GetLastError());
217223
}
218224

219225
void microgl_refresh()

0 commit comments

Comments
 (0)