make mouse movement and capture depend on window focus

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

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;