make mouse movement and capture depend on window focus

This commit is contained in:
veclavtalica committed 2025-01-14 02:07:54 +03:00
1 parent dbe6217e24
commit 86bf16b680
3 files changed
+17 -2

No files matched your search

+11
View File
@@ -42,6 +42,16 @@ static int event_callback(void *userdata, SDL_Event *event) {
ctx.resync_flag = true;
break;
case SDL_WINDOWEVENT_FOCUS_LOST: {
ctx.window_mouse_resident = false;
break;
}
case SDL_WINDOWEVENT_FOCUS_GAINED: {
ctx.window_mouse_resident = true;
break;
}
default:
break;
}
@@ -706,6 +716,7 @@ static bool initialize(void) {
*/
ctx.render_double_buffered = true;
ctx.window_mouse_resident = true;
return true;