]> git.proxmox.com Git - qemu.git/blobdiff - sdl.c
Merge remote branch 'qemu-kvm/uq/stable-0.12' into stable-0.12
[qemu.git] / sdl.c
diff --git a/sdl.c b/sdl.c
index 238ef085cb537344cbf5052e6b6bea5402f80b45..7912c9159dc6cf4d125e6f143617db19a3d4625e 100644 (file)
--- a/sdl.c
+++ b/sdl.c
@@ -407,24 +407,30 @@ static void sdl_process_key(SDL_KeyboardEvent *ev)
 
 static void sdl_update_caption(void)
 {
-    char buf[1024];
+    char win_title[1024];
+    char icon_title[1024];
     const char *status = "";
 
     if (!vm_running)
         status = " [Stopped]";
     else if (gui_grab) {
-        if (!alt_grab)
-            status = " - Press Ctrl-Alt to exit grab";
-        else
+        if (alt_grab)
             status = " - Press Ctrl-Alt-Shift to exit grab";
+        else if (ctrl_grab)
+            status = " - Press Right-Ctrl to exit grab";
+        else
+            status = " - Press Ctrl-Alt to exit grab";
     }
 
-    if (qemu_name)
-        snprintf(buf, sizeof(buf), "QEMU (%s)%s", qemu_name, status);
-    else
-        snprintf(buf, sizeof(buf), "QEMU%s", status);
+    if (qemu_name) {
+        snprintf(win_title, sizeof(win_title), "QEMU (%s)%s", qemu_name, status);
+        snprintf(icon_title, sizeof(icon_title), "QEMU (%s)", qemu_name);
+    } else {
+        snprintf(win_title, sizeof(win_title), "QEMU%s", status);
+        snprintf(icon_title, sizeof(icon_title), "QEMU");
+    }
 
-    SDL_WM_SetCaption(buf, "QEMU");
+    SDL_WM_SetCaption(win_title, icon_title);
 }
 
 static void sdl_hide_cursor(void)
@@ -519,6 +525,7 @@ 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);
     if (gui_fullscreen) {
         scaling_active = 0;
         gui_saved_grab = gui_grab;
@@ -553,12 +560,14 @@ static void sdl_refresh(DisplayState *ds)
         case SDL_KEYDOWN:
         case SDL_KEYUP:
             if (ev->type == SDL_KEYDOWN) {
-                if (!alt_grab) {
-                    mod_state = (SDL_GetModState() & gui_grab_code) ==
-                                gui_grab_code;
-                } else {
+                if (alt_grab) {
                     mod_state = (SDL_GetModState() & (gui_grab_code | KMOD_LSHIFT)) ==
                                 (gui_grab_code | KMOD_LSHIFT);
+                } else if (ctrl_grab) {
+                    mod_state = (SDL_GetModState() & KMOD_RCTRL) == KMOD_RCTRL;
+                } else {
+                    mod_state = (SDL_GetModState() & gui_grab_code) ==
+                                gui_grab_code;
                 }
                 gui_key_modifier_pressed = mod_state;
                 if (gui_key_modifier_pressed) {
@@ -569,6 +578,12 @@ static void sdl_refresh(DisplayState *ds)
                         toggle_full_screen(ds);
                         gui_keysym = 1;
                         break;
+                    case 0x16: /* 'u' key on US keyboard */
+                        scaling_active = 0;
+                        sdl_resize(ds);
+                        vga_hw_invalidate();
+                        vga_hw_update();
+                        break;
                     case 0x02 ... 0x0a: /* '1' to '9' keys */
                         /* Reset the modifiers sent to the current console */
                         reset_keys();
@@ -720,6 +735,10 @@ static void sdl_refresh(DisplayState *ds)
                 bpp = 32;
             do_sdl_resize(rev->w, rev->h, bpp);
             scaling_active = 1;
+            if (!is_buffer_shared(ds->surface)) {
+                ds->surface = qemu_resize_displaysurface(ds, ds_get_width(ds), ds_get_height(ds));
+                dpy_resize(ds);
+            }
             vga_hw_invalidate();
             vga_hw_update();
             break;
@@ -767,6 +786,9 @@ static void sdl_mouse_define(int width, int height, int bpp,
         line = image;
         for (x = 0; x < width; x ++, dst ++) {
             switch (bpp) {
+            case 32:
+                src = *(line ++); src |= *(line ++); src |= *(line ++); line++;
+                break;
             case 24:
                 src = *(line ++); src |= *(line ++); src |= *(line ++);
                 break;