Skip to contentSkip to conversation

ioemu: pump SDL events on resize

PATCH In review Samuel Thibault 1 participant 2 messages May 2, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ioemu: pump SDL events on resize

ioemu: pump SDL events on resize

When sdl_resize resizes the SDL window, some window manager send back a ConfigureNotify event, which triggers a SDL_VIDEORESIZE event. That event, however, is seen only much later, on the next VGA refresh round. If the guest quickly switches to another resolution in between, the SDL_VIDEORESIZE event makes us erroneously rescale that new resolution into the old one.

This patch makes us pump that window manager event, so that no SDL_VIDEORESIZE event is generated.

tools/ioemu/sdl.c +3 -0
diff -r 7190027c2da8 tools/ioemu/sdl.c
@@ -294,6 +294,9 @@ static void sdl_resize(DisplayState *ds,
         };
 #endif
     }
+
+    /* Process any WM-generated resize event */
+    SDL_PumpEvents();
 }
 
 static void sdl_colourdepth(DisplayState *ds, int depth)
#1 lore raw
Quoted 9 lines · Samuel Thibault, le Fri 02 May 2008 11:21:33 +0100, a écrit :

ioemu: pump SDL events on resize

When sdl_resize resizes the SDL window, some window manager send back a ConfigureNotify event, which triggers a SDL_VIDEORESIZE event. That event, however, is seen only much later, on the next VGA refresh round. If the guest quickly switches to another resolution in between, the SDL_VIDEORESIZE event makes us erroneously rescale that new resolution into the old one.

Quoted 4 lines

This patch makes us pump that window manager event, so that no SDL_VIDEORESIZE event is generated.

Oops, I sent an old patch, here is a proper one:

tools/ioemu/sdl.c +3 -0
diff -r 7190027c2da8 tools/ioemu/sdl.c
@@ -235,6 +235,9 @@ static void sdl_resize(DisplayState *ds,
 
  again:
     screen = SDL_SetVideoMode(w, h, 0, flags);
+
+    /* Process any WM-generated resize event */
+    SDL_PumpEvents();
 
     if (!screen) {
         fprintf(stderr, "Could not open SDL display: %s\n", SDL_GetError());