QEMU-Devel Archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [patch] -no-frame option for sdl
@ 2007-02-11 18:47 Christian Laursen
  0 siblings, 0 replies; only message in thread
From: Christian Laursen @ 2007-02-11 18:47 UTC (permalink / raw
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 760 bytes --]

Hi, I have made a small patch that add a -no-frame option to qemu.

It makes SDL open the window without a frame allowing qemu to use the
entire screen without entering full-screen mode.

When this is combined with the tablet usb device it allows changing to
other workspaces without first toggling from full-screen and
potentially ungrab the mouse afterwards.

If your window manager does not allow you to move windows without
frames the SDL_VIDEO_WINDOW_POS environment variable can be used to
place the window where you want it like this:

export SDL_VIDEO_WINDOW_POS=0,0

There is a screenshot of this change in action here:
http://borderworlds.dk/~xi/qemu-noframe.png

I hope this is worthy of being committed to the official qemu.

-- 
Christian Laursen

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch adding -no-frame option to qemu --]
[-- Type: text/x-patch, Size: 3298 bytes --]

diff -urN qemu-0.9.0.orig/sdl.c qemu-0.9.0/sdl.c
--- qemu-0.9.0.orig/sdl.c	Tue Feb  6 00:01:54 2007
+++ qemu-0.9.0/sdl.c	Sun Feb 11 17:17:44 2007
@@ -34,6 +34,7 @@
 static int last_vm_running;
 static int gui_saved_grab;
 static int gui_fullscreen;
+static int gui_noframe;
 static int gui_key_modifier_pressed;
 static int gui_keysym;
 static int gui_fullscreen_initial_grab;
@@ -59,6 +60,8 @@
     flags = SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_HWACCEL;
     if (gui_fullscreen)
         flags |= SDL_FULLSCREEN;
+    if (gui_noframe)
+        flags |= SDL_NOFRAME;
 
     width = w;
     height = h;
@@ -469,7 +472,7 @@
     SDL_Quit();
 }
 
-void sdl_display_init(DisplayState *ds, int full_screen)
+void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
 {
     int flags;
     uint8_t data = 0;
@@ -484,6 +487,9 @@
         if (!kbd_layout)
             exit(1);
     }
+
+    if (no_frame)
+        gui_noframe = 1;
 
     flags = SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE;
     if (SDL_Init (flags)) {
diff -urN qemu-0.9.0.orig/vl.c qemu-0.9.0/vl.c
--- qemu-0.9.0.orig/vl.c	Tue Feb  6 00:01:54 2007
+++ qemu-0.9.0/vl.c	Sun Feb 11 19:21:46 2007
@@ -148,6 +148,7 @@
 #endif
 int graphic_depth = 15;
 int full_screen = 0;
+int no_frame = 0;
 int no_quit = 0;
 CharDriverState *serial_hds[MAX_SERIAL_PORTS];
 CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
@@ -6024,6 +6025,7 @@
            "-boot [a|c|d|n] boot on floppy (a), hard disk (c), CD-ROM (d), or network (n)\n"
            "-snapshot       write to temporary files instead of disk image files\n"
 #ifdef CONFIG_SDL
+           "-no-frame       open SDL window without a frame and window decorations\n"
            "-no-quit        disable SDL window close capability\n"
 #endif
 #ifdef TARGET_I386
@@ -6192,6 +6194,7 @@
     QEMU_OPTION_parallel,
     QEMU_OPTION_loadvm,
     QEMU_OPTION_full_screen,
+    QEMU_OPTION_no_frame,
     QEMU_OPTION_no_quit,
     QEMU_OPTION_pidfile,
     QEMU_OPTION_no_kqemu,
@@ -6274,6 +6277,7 @@
     { "loadvm", HAS_ARG, QEMU_OPTION_loadvm },
     { "full-screen", 0, QEMU_OPTION_full_screen },
 #ifdef CONFIG_SDL
+    { "no-frame", 0, QEMU_OPTION_no_frame },
     { "no-quit", 0, QEMU_OPTION_no_quit },
 #endif
     { "pidfile", HAS_ARG, QEMU_OPTION_pidfile },
@@ -6894,6 +6898,9 @@
                 full_screen = 1;
                 break;
 #ifdef CONFIG_SDL
+            case QEMU_OPTION_no_frame:
+                no_frame = 1;
+                break;
             case QEMU_OPTION_no_quit:
                 no_quit = 1;
                 break;
@@ -7157,7 +7164,7 @@
 	vnc_display_init(ds, vnc_display);
     } else {
 #if defined(CONFIG_SDL)
-        sdl_display_init(ds, full_screen);
+        sdl_display_init(ds, full_screen, no_frame);
 #elif defined(CONFIG_COCOA)
         cocoa_display_init(ds, full_screen);
 #else
diff -urN qemu-0.9.0.orig/vl.h qemu-0.9.0/vl.h
--- qemu-0.9.0.orig/vl.h	Tue Feb  6 00:01:54 2007
+++ qemu-0.9.0/vl.h	Sun Feb 11 17:22:28 2007
@@ -902,7 +902,7 @@
                          unsigned long vga_ram_offset, int vga_ram_size);
 
 /* sdl.c */
-void sdl_display_init(DisplayState *ds, int full_screen);
+void sdl_display_init(DisplayState *ds, int full_screen, int no_frame);
 
 /* cocoa.m */
 void cocoa_display_init(DisplayState *ds, int full_screen);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-02-11 18:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-11 18:47 [Qemu-devel] [patch] -no-frame option for sdl Christian Laursen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).