From 9d10b52e1c8ce367626f165ffc834508f1bae22c Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Tue, 12 Sep 2006 19:47:40 +0000 Subject: [PATCH] Allow grabing mouse by locking its position --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402081 --- src/video/gem/SDL_gemmouse.c | 4 +++- src/video/gem/SDL_gemwm.c | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/video/gem/SDL_gemmouse.c b/src/video/gem/SDL_gemmouse.c index f9d375c3e..6b572f3bf 100644 --- a/src/video/gem/SDL_gemmouse.c +++ b/src/video/gem/SDL_gemmouse.c @@ -167,10 +167,12 @@ GEM_CheckMouseMode(_THIS) { /* If the mouse is hidden and input is grabbed, we use relative mode */ if ((!(SDL_cursorstate & CURSOR_VISIBLE)) && - /*(this->input_grab != SDL_GRAB_OFF) && *//* Damn GEM can not grab */ + (this->input_grab != SDL_GRAB_OFF) && (SDL_GetAppState() & SDL_APPACTIVE)) { + SDL_AtariXbios_LockMousePosition(SDL_TRUE); GEM_mouse_relative = SDL_TRUE; } else { + SDL_AtariXbios_LockMousePosition(SDL_FALSE); GEM_mouse_relative = SDL_FALSE; graf_mouse(M_ON, NULL); } diff --git a/src/video/gem/SDL_gemwm.c b/src/video/gem/SDL_gemwm.c index 0df9a5cdf..666b7d576 100644 --- a/src/video/gem/SDL_gemwm.c +++ b/src/video/gem/SDL_gemwm.c @@ -113,7 +113,11 @@ GEM_IconifyWindow(_THIS) SDL_GrabMode GEM_GrabInput(_THIS, SDL_GrabMode mode) { - return SDL_GRAB_OFF; + if (this->screen == NULL) { + return SDL_GRAB_OFF; + } + + return mode; } /* vi: set ts=4 sw=4 expandtab: */