qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] RFC : disable SDL window close capability\n
@ 2006-10-23 10:45 Xavier Gnata
  2006-10-23 12:33 ` Aurelien Jarno
  2006-10-23 20:08 ` John Morris
  0 siblings, 2 replies; 4+ messages in thread
From: Xavier Gnata @ 2006-10-23 10:45 UTC (permalink / raw)
  To: qemu-devel

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

Hi,
I have been asked to disable the capability to close qemu by clicking on 
the SDL window x icon.
The goal is to avoid lay users to shutdown the running OS under Qemu in 
a not clean way.
The patch is pretty simple. It adds a runtime  -no-quit option.

Any comments?

Xavier.

-- 
############################################
Xavier Gnata
CRAL - Observatoire de Lyon
9, avenue Charles André
69561 Saint Genis Laval cedex
Phone: +33 4 78 86 85 28
Fax: +33 4 78 86 83 86
E-mail: gnata@obs.univ-lyon1.fr
############################################ 


[-- Attachment #2: no-quit.patch --]
[-- Type: text/x-patch, Size: 2809 bytes --]

Index: sdl.c
===================================================================
RCS file: /sources/qemu/qemu/sdl.c,v
retrieving revision 1.31
diff -u -r1.31 sdl.c
--- sdl.c	19 Aug 2006 14:27:30 -0000	1.31
+++ sdl.c	23 Oct 2006 10:39:12 -0000
@@ -496,7 +496,9 @@
                 sdl_process_key(&ev->key);
             break;
         case SDL_QUIT:
-            qemu_system_shutdown_request();
+	  if (!no_quit) {
+             qemu_system_shutdown_request();
+	  }
             break;
         case SDL_MOUSEMOTION:
             if (gui_grab || kbd_mouse_is_absolute()) {
Index: vl.c
===================================================================
RCS file: /sources/qemu/qemu/vl.c,v
retrieving revision 1.217
diff -u -r1.217 vl.c
--- vl.c	2 Oct 2006 19:44:22 -0000	1.217
+++ vl.c	23 Oct 2006 10:39:12 -0000
@@ -143,6 +143,7 @@
 #endif
 int graphic_depth = 15;
 int full_screen = 0;
+int no_quit = 0;
 CharDriverState *serial_hds[MAX_SERIAL_PORTS];
 CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
 #ifdef TARGET_I386
@@ -5841,6 +5842,7 @@
            "-cdrom file     use 'file' as IDE cdrom image (cdrom is ide1 master)\n"
            "-boot [a|c|d]   boot on floppy (a), hard disk (c) or CD-ROM (d)\n"
 	   "-snapshot       write to temporary files instead of disk image files\n"
+	   "-no-quit        disable SDL window close capability\n"
 #ifdef TARGET_I386
            "-no-fd-bootchk  disable boot signature checking for floppy disks\n"
 #endif
@@ -6002,6 +6004,7 @@
     QEMU_OPTION_parallel,
     QEMU_OPTION_loadvm,
     QEMU_OPTION_full_screen,
+    QEMU_OPTION_no_quit,
     QEMU_OPTION_pidfile,
     QEMU_OPTION_no_kqemu,
     QEMU_OPTION_kernel_kqemu,
@@ -6078,6 +6081,7 @@
     { "parallel", 1, QEMU_OPTION_parallel },
     { "loadvm", HAS_ARG, QEMU_OPTION_loadvm },
     { "full-screen", 0, QEMU_OPTION_full_screen },
+    { "no-quit", 0, QEMU_OPTION_no_quit },
     { "pidfile", HAS_ARG, QEMU_OPTION_pidfile },
     { "win2k-hack", 0, QEMU_OPTION_win2k_hack },
     { "usbdevice", HAS_ARG, QEMU_OPTION_usbdevice },
@@ -6686,6 +6690,9 @@
             case QEMU_OPTION_full_screen:
                 full_screen = 1;
                 break;
+            case QEMU_OPTION_no_quit:
+                no_quit = 1;
+                break;	
             case QEMU_OPTION_pidfile:
                 create_pidfile(optarg);
                 break;
Index: vl.h
===================================================================
RCS file: /sources/qemu/qemu/vl.h,v
retrieving revision 1.154
diff -u -r1.154 vl.h
--- vl.h	24 Sep 2006 18:49:43 -0000	1.154
+++ vl.h	23 Oct 2006 10:39:12 -0000
@@ -152,6 +152,7 @@
 extern int win2k_install_hack;
 extern int usb_enabled;
 extern int smp_cpus;
+extern int no_quit;
 
 /* XXX: make it dynamic */
 #if defined (TARGET_PPC) || defined (TARGET_SPARC64)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] RFC : disable SDL window close capability\n
  2006-10-23 10:45 [Qemu-devel] RFC : disable SDL window close capability\n Xavier Gnata
@ 2006-10-23 12:33 ` Aurelien Jarno
  2006-10-23 20:08 ` John Morris
  1 sibling, 0 replies; 4+ messages in thread
From: Aurelien Jarno @ 2006-10-23 12:33 UTC (permalink / raw)
  To: qemu-devel

Xavier Gnata a écrit :
> Hi,
Hi,

> I have been asked to disable the capability to close qemu by clicking on 
> the SDL window x icon.
> The goal is to avoid lay users to shutdown the running OS under Qemu in 
> a not clean way.
> The patch is pretty simple. It adds a runtime  -no-quit option.
> 

This patch looks very interesting. I have tried it, and it also disables 
the effect of ALT+F4. I often mistakenly close my QEMU when I want to 
close a window in the emulated system with ALT+F4, without pressing 
CTRL+ALT first...

  --
   .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
  : :' :  Debian developer           | Electrical Engineer
  `. `'   aurel32@debian.org         | aurelien@aurel32.net
    `-    people.debian.org/~aurel32 | www.aurel32.net

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] RFC : disable SDL window close capability\n
  2006-10-23 10:45 [Qemu-devel] RFC : disable SDL window close capability\n Xavier Gnata
  2006-10-23 12:33 ` Aurelien Jarno
@ 2006-10-23 20:08 ` John Morris
  2006-10-23 20:59   ` Xavier Gnata
  1 sibling, 1 reply; 4+ messages in thread
From: John Morris @ 2006-10-23 20:08 UTC (permalink / raw)
  To: qemu-devel

On Mon, 2006-10-23 at 05:45, Xavier Gnata wrote:
> Hi,
> I have been asked to disable the capability to close qemu by clicking on 
> the SDL window x icon.
> Any comments?

Totally disabling close is pretty drastic.  When the VM has went wrong
closing it is a valid option.  How about trapping close and throwing up
an "Are you sure?" dialog?  Give enough info to let a new user know that
clicking the "Yes" button might corrupt the VM's filesystem and cause
other permanent data loss.

-- 
John M.      http://www.beau.org/~jmorris     This post is 100% M$Free!
Geekcode 3.1:GCS C+++ UL++++$ P++ L+++ W++ w--- Y++ b++ 5+++ R tv- e* r

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] RFC : disable SDL window close capability\n
  2006-10-23 20:08 ` John Morris
@ 2006-10-23 20:59   ` Xavier Gnata
  0 siblings, 0 replies; 4+ messages in thread
From: Xavier Gnata @ 2006-10-23 20:59 UTC (permalink / raw)
  To: qemu-devel

John Morris wrote:
> On Mon, 2006-10-23 at 05:45, Xavier Gnata wrote:
>   
>> Hi,
>> I have been asked to disable the capability to close qemu by clicking on 
>> the SDL window x icon.
>> Any comments?
>>     
>
> Totally disabling close is pretty drastic.  When the VM has went wrong
> closing it is a valid option.  How about trapping close and throwing up
> an "Are you sure?" dialog?  Give enough info to let a new user know that
> clicking the "Yes" button might corrupt the VM's filesystem and cause
> other permanent data loss.
>
>   
Well, it is not too drastic because my patch only adds an option. You 
can just ignore this -no-quit option.
A popup would be good solution but sdl API does not offer a way to deal 
with that :(
sdl is not done to implement buttons and so on.
An osd could be a solution but do we really need that? Not sure.
Please note that is something went wrong with the OS running under qeum 
-no-quit, you can still just (x)kill qemu. Simple.
Any comments ?

-- 
############################################
Xavier Gnata
CRAL - Observatoire de Lyon
9, avenue Charles André
69561 Saint Genis Laval cedex
Phone: +33 4 78 86 85 28
Fax: +33 4 78 86 83 86
E-mail: gnata@obs.univ-lyon1.fr
############################################ 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-10-23 21:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-23 10:45 [Qemu-devel] RFC : disable SDL window close capability\n Xavier Gnata
2006-10-23 12:33 ` Aurelien Jarno
2006-10-23 20:08 ` John Morris
2006-10-23 20:59   ` Xavier Gnata

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 NNTP newsgroup(s).