Patchwork [05/15] sdl: Fix full screen toggling from scaled mode

login
register
mail settings
Submitter Jan Kiszka
Date July 30, 2011, 9:39 a.m.
Message ID <92b0119070500bff99b47a6d4c7ffdec656114ef.1312018756.git.jan.kiszka@web.de>
Download mbox | patch
Permalink /patch/107495/
State New
Headers show

Comments

Jan Kiszka - July 30, 2011, 9:39 a.m.
From: Jan Kiszka <jan.kiszka@siemens.com>

When switching to full screen mode from a scaled window, we need to
resize to DisplayState's dimension, not the scaled "real" screen size.
Moreover, scaling mode may have manipulated the bpp. So we need to
restore it from the DisplayState as well.

CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 ui/sdl.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Patch

diff --git a/ui/sdl.c b/ui/sdl.c
index e6c9597..4acfe81 100644
--- a/ui/sdl.c
+++ b/ui/sdl.c
@@ -529,7 +529,8 @@  static void sdl_send_mouse_event(int dx, int dy, int dz, int x, int y, int state
 static void toggle_full_screen(DisplayState *ds)
 {
     gui_fullscreen = !gui_fullscreen;
-    do_sdl_resize(real_screen->w, real_screen->h, real_screen->format->BitsPerPixel);
+    do_sdl_resize(ds_get_width(ds), ds_get_height(ds),
+                  ds_get_bits_per_pixel(ds));
     if (gui_fullscreen) {
         scaling_active = 0;
         gui_saved_grab = gui_grab;