sdl: improve window resizing on macOS

This enables smooth resizing of the window using a
fixed aspect ratio, instead of snapping into the
correct aspect ratio only when the resize operation
has finished, by using an SDL event filter that gets
events delivered during the resize operation
(whereas SDL_PollEvent blocks until done on macOS).

Change-Id: Ie6614e4b6f49a24469c5ee6a69721c9fbd440dae
This commit is contained in:
Christian Soffke 2024-12-29 15:29:29 +01:00
parent 8ce9d9e39e
commit 9ba59477a1
5 changed files with 14 additions and 8 deletions

View file

@ -23,7 +23,7 @@
#include "kernel.h"
#include "button.h"
#ifdef HAVE_SDL
#include "button-sdl.h"
#include "SDL.h"
#include "window-sdl.h"
#endif
@ -101,7 +101,7 @@ static inline void button_queue_wait(struct queue_event *evp, int timeout)
unsigned long curr_tick, remaining;
while(true)
{
handle_sdl_events(); /* Includes window updates after resize events */
SDL_PumpEvents();
queue_wait_w_tmo(&button_queue, evp, TIMEOUT_NOBLOCK);
if (evp->id != SYS_TIMEOUT || timeout == TIMEOUT_NOBLOCK)
return;