From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1Bn4aY-0003FM-Vw for qemu-devel@nongnu.org; Tue, 20 Jul 2004 20:04:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1Bn4aP-0003Bb-U7 for qemu-devel@nongnu.org; Tue, 20 Jul 2004 20:03:55 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Bn4aP-000399-4a for qemu-devel@nongnu.org; Tue, 20 Jul 2004 20:03:53 -0400 Received: from [80.91.224.249] (helo=main.gmane.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Bn4XI-00035A-W0 for qemu-devel@nongnu.org; Tue, 20 Jul 2004 20:00:41 -0400 Received: from root by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1Bn4XF-0007D7-00 for ; Wed, 21 Jul 2004 02:00:37 +0200 Received: from 32.116-200-80.adsl.skynet.be ([80.200.116.32]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 21 Jul 2004 02:00:37 +0200 Received: from mark.jonckheere by 32.116-200-80.adsl.skynet.be with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 21 Jul 2004 02:00:37 +0200 From: Mark Jonckheere Date: Tue, 20 Jul 2004 18:24:18 +0200 Message-ID: <40FD4732.3030003@easynet.be> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Sender: news Subject: [Qemu-devel] three small patches Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org These patches are against current (17-7-2004) CVS. Patch 1: -------- This patch makes it possible to compile vmdk.c with the infamous RedHat-only gcc-2.96. This version of gcc doesn't like data declarations in the middle of a code block. diff -ur qemu/vmdk2raw.c qemu-patched/vmdk2raw.c --- qemu.old/vmdk2raw.c Wed Jun 16 22:34:33 2004 +++ qemu/vmdk2raw.c Sat Jun 26 14:33:03 2004 @@ -129,10 +129,11 @@ /* the last chunk of the file can not be sparse * or the file will be truncated */ if (offset + length >= disk_limit) { + const char nil = 0; + if (lseek64(out_fd, length-1, SEEK_CUR) == (off_t)-1) perror("lseek"); /* write the last NULL byte instead of seeking */ - const char nil = 0; write(out_fd, &nil, 1); } else { if (lseek64(out_fd, length, SEEK_CUR) == (off_t)-1) @@ -186,12 +187,13 @@ static int open_vmdk(const char *filename) { int fd = open(filename, O_RDONLY | O_LARGEFILE); + char magic[4]; + if (fd == -1) { perror(filename); return -1; } - char magic[4]; if (read(fd, &magic, sizeof(magic)) != sizeof(magic)) { perror("read from disk"); return -1; Patch 2: -------- This patch enables qemu to run as a background process. It initialises the current terminal only when serial- or monitor-I/O is redirected to stdin/stdout or when -nographic is selected. The program stops in the term_init() function when launched as a background process. examples: qemu -hda disk.img & xinit /usr/local/bin/qemu -hda disk.img -- :1 & The second example launches qemu with a second X server and permits to switch between host and guest operating systems using ctrl-alt-F7 and ctrl-alt-F8. diff -ur qemu/vl.c qemu-patched/vl.c --- qemu/vl.c Wed Jul 14 19:27:31 2004 +++ qemu-patched/vl.c Tue Jul 20 12:55:46 2004 @@ -3112,7 +3112,9 @@ { vm_start(); } - term_init(); + /* Change terminal settings only if stdin/out is used */ + if (client_index > 0) + term_init(); main_loop(); quit_timers(); return 0; Patch 3: -------- This patch is an extention to the previous one. Next to enable running in background mode It adds the command line option -full-screen which permits to start qemu immediatly in full screen mode. Note: the trick to make sure grab is on at startup is non-optimal. examples: qemu -hda disk.img -full-screen & xinit /usr/local/bin/qemu -hda disk.img -full-screen -- :1 & The second example launches qemu with a second X server using the screen resolution as requested by the guest operating system It permits to switch between host and guest operating systems using ctrl-alt-F7 and ctrl-alt-F8. diff -ur qemu/sdl.c qemu-patched/sdl.c --- qemu/sdl.c Wed Jul 14 19:22:33 2004 +++ qemu-patched/sdl.c Tue Jul 20 17:09:21 2004 @@ -45,6 +45,10 @@ { // printf("updating x=%d y=%d w=%d h=%d\n", x, y, w, h); SDL_UpdateRect(screen, x, y, w, h); + /* FIXME: next two lines are a quick fix, to make + * sure grab is always on in fullscreen mode */ + if (gui_fullscreen) + sdl_grab_start(); } static void sdl_resize(DisplayState *ds, int w, int h) @@ -540,7 +544,7 @@ SDL_Quit(); } -void sdl_display_init(DisplayState *ds) +void sdl_display_init(DisplayState *ds, int full) { int flags; @@ -566,4 +570,8 @@ gui_grab = 0; atexit(sdl_cleanup); + + if (full) { + gui_fullscreen = 1; + } } diff -ur qemu/vl.c qemu-patched/vl.c --- qemu/vl.c Wed Jul 14 19:27:31 2004 +++ qemu-patched/vl.c Tue Jul 20 14:00:22 2004 @@ -138,6 +138,7 @@ int graphic_width = 800; int graphic_height = 600; int graphic_depth = 15; +int full_screen = 0; TextConsole *vga_console; /***********************************************************/ @@ -2440,6 +2441,7 @@ @@ -2440,6 +2441,7 @@ QEMU_OPTION_std_vga, QEMU_OPTION_monitor, QEMU_OPTION_serial, + QEMU_OPTION_full_screen, }; typedef struct QEMUOption { @@ -2493,6 +2495,7 @@ { "std-vga", 0, QEMU_OPTION_std_vga }, { "monitor", 1, QEMU_OPTION_monitor }, { "serial", 1, QEMU_OPTION_serial }, + { "full-screen", 0, QEMU_OPTION_full_screen }, /* temporary options */ { "pci", 0, QEMU_OPTION_pci }, @@ -2832,6 +2835,9 @@ case QEMU_OPTION_serial: pstrcpy(serial_device, sizeof(serial_device), optarg); break; + case QEMU_OPTION_full_screen: + full_screen = 1; + break; } } } @@ -3015,7 +3021,7 @@ dumb_display_init(ds); } else { #ifdef CONFIG_SDL - sdl_display_init(ds); + sdl_display_init(ds, full_screen); #else dumb_display_init(ds); #endif @@ -3112,7 +3118,9 @@ { vm_start(); } - term_init(); + /* Change terminal settings only if stdin/out is used */ + if (client_index > 0) + term_init(); main_loop(); quit_timers(); return 0; diff -ur qemu/vl.h qemu-patched/vl.h --- qemu/vl.h Wed Jul 14 19:27:33 2004 +++ qemu-patched/vl.h Tue Jul 20 14:04:09 2004 @@ -629,7 +629,7 @@ unsigned long vga_ram_offset, int vga_ram_size); /* sdl.c */ -void sdl_display_init(DisplayState *ds); +void sdl_display_init(DisplayState *ds, int full); /* ide.c */ #define MAX_DISKS 4 vriendelijke groeten, Mark. -- :wq