qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH]USB tablet auto grab and ungrab
@ 2006-05-01 14:19 Scipio
  0 siblings, 0 replies; only message in thread
From: Scipio @ 2006-05-01 14:19 UTC (permalink / raw)
  To: qemu-devel

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

With this patch, automatic grab keyboard and mouse when the mouse enters the 
window, and ungrab when the mouse reachs the window edge.

I created this beacuse I want to close a window with ALT+F4 inside qemu, but I 
closed qemu window, because qemu is not grabbed.

Scipio

[-- Attachment #2: usbtablet_auto_grab_and_ungrab.diff --]
[-- Type: text/x-diff, Size: 415 bytes --]

diff -u qemu.orig/sdl.c qemu/sdl.c
--- qemu.orig/sdl.c	2006-04-12 23:09:08.000000000 +0200
+++ qemu/sdl.c	2006-05-01 15:52:43.000000000 +0200
@@ -330,6 +330,11 @@
 	}
 
 	SDL_GetMouseState(&dx, &dy);
+	if( dx==0 || dx==width-1 || dy==0 || dy==height-1 ) {
+	    if(gui_grab) sdl_grab_end();
+	} else {
+	    if(!gui_grab) sdl_grab_start();
+        }
 	dx = dx * 0x7FFF / width;
 	dy = dy * 0x7FFF / height;
     }

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

only message in thread, other threads:[~2006-05-01 14:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-01 14:19 [Qemu-devel] [PATCH]USB tablet auto grab and ungrab Scipio

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).