Add a -nograb command line option to prevent sdl from grabbing mouse
and keyboard.
Signed-off-by: Stefano Stabellini <address@hidden>
diff -r 5c78dd111aae sdl.c
--- a/sdl.c Tue Nov 04 09:04:41 2008 +0000
+++ b/sdl.c Tue Nov 04 18:31:02 2008 +0000
@@ -451,7 +451,7 @@
gui_key_modifier_pressed = 0;
if (gui_keysym == 0) {
/* exit/enter grab if pressing Ctrl-Alt */
- if (!gui_grab) {
+ if (!gui_grab && !grab_disabled) {
/* if the application is not active,
do not try to enter grab state. It
prevents
@@ -481,7 +481,7 @@
break;
case SDL_MOUSEMOTION:
if (gui_grab || kbd_mouse_is_absolute() ||
- absolute_enabled) {
+ absolute_enabled || grab_disabled) {
sdl_send_mouse_event(ev->motion.xrel, ev->motion.yrel, 0,
ev->motion.x, ev->motion.y, ev->motion.state);
}
@@ -490,7 +490,7 @@
case SDL_MOUSEBUTTONUP:
{
SDL_MouseButtonEvent *bev = &ev->button;
- if (!gui_grab && !kbd_mouse_is_absolute()) {
+ if (!gui_grab && !kbd_mouse_is_absolute() && !grab_disabled) {
if (ev->type == SDL_MOUSEBUTTONDOWN &&
(bev->button == SDL_BUTTON_LEFT)) {
/* start grabbing all events */
@@ -655,7 +655,10 @@
atexit(sdl_cleanup);
if (full_screen) {
gui_fullscreen = 1;
- gui_fullscreen_initial_grab = 1;
- sdl_grab_start();
+ if (!grab_disabled)
+ {
+ gui_fullscreen_initial_grab = 1;
+ sdl_grab_start();
+ }