Fix Sparc64 VGA memory size bug exposed by r6604
[qemu] / sdl.c
diff --git a/sdl.c b/sdl.c
index cddf672..266fbcc 100644 (file)
--- a/sdl.c
+++ b/sdl.c
@@ -62,7 +62,7 @@ static void sdl_update(DisplayState *ds, int x, int y, int w, int h)
     //    printf("updating x=%d y=%d w=%d h=%d\n", x, y, w, h);
 
     SDL_BlitSurface(guest_screen, &rec, real_screen, &rec);
-    SDL_Flip(real_screen);
+    SDL_UpdateRect(real_screen, x, y, w, h);
 }
 
 static void sdl_setdata(DisplayState *ds)
@@ -93,7 +93,9 @@ static void sdl_resize(DisplayState *ds)
     if (gui_noframe)
         flags |= SDL_NOFRAME;
 
-    real_screen = SDL_SetVideoMode(ds_get_width(ds), ds_get_height(ds), 0, flags);
+    width = ds_get_width(ds);
+    height = ds_get_height(ds);
+    real_screen = SDL_SetVideoMode(width, height, 0, flags);
     if (!real_screen) {
         fprintf(stderr, "Could not open SDL display\n");
         exit(1);
@@ -276,7 +278,8 @@ static void sdl_grab_start(void)
 {
     if (guest_cursor) {
         SDL_SetCursor(guest_sprite);
-        SDL_WarpMouse(guest_x, guest_y);
+        if (!kbd_mouse_is_absolute() && !absolute_enabled)
+            SDL_WarpMouse(guest_x, guest_y);
     } else
         sdl_hide_cursor();
 
@@ -547,7 +550,8 @@ static void sdl_mouse_warp(int x, int y, int on)
             sdl_show_cursor();
         if (gui_grab || kbd_mouse_is_absolute() || absolute_enabled) {
             SDL_SetCursor(guest_sprite);
-            SDL_WarpMouse(x, y);
+            if (!kbd_mouse_is_absolute() && !absolute_enabled)
+                SDL_WarpMouse(x, y);
         }
     } else if (gui_grab)
         sdl_hide_cursor();
@@ -634,8 +638,6 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
     }
 
     dcl = qemu_mallocz(sizeof(DisplayChangeListener));
-    if (!dcl)
-        exit(1);
     dcl->dpy_update = sdl_update;
     dcl->dpy_resize = sdl_resize;
     dcl->dpy_refresh = sdl_refresh;