From 72ea2c9e25bed18d6ee0d55d4b56d60bbf6d1261 Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Sun, 21 Jan 2001 14:49:55 +0000 Subject: [PATCH] Grab mouse with SDL/X11 --- main/gamecntl.c | 13 +++++++++++++ main/inferno.c | 16 ++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/main/gamecntl.c b/main/gamecntl.c index 1f3c21ab4..a4cdd9a65 100644 --- a/main/gamecntl.c +++ b/main/gamecntl.c @@ -115,6 +115,9 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #endif #endif +#ifdef SDL_INPUT +#include +#endif extern void full_palette_save(void); extern void object_goto_prev_viewer(void); @@ -491,6 +494,11 @@ int do_game_pause() show_boxed_message(Pause_msg=msg); //TXT_PAUSE); gr_update(); +#ifdef SDL_INPUT + /* give control back to the WM */ + SDL_WM_GrabInput(SDL_GRAB_OFF); +#endif + while (Game_paused) { int screen_changed; @@ -550,6 +558,11 @@ int do_game_pause() } } +#ifdef SDL_INPUT + /* keep the mouse from wandering in SDL/X11 */ + SDL_WM_GrabInput(SDL_GRAB_ON); +#endif + if (VR_screen_flags & VRF_COMPATIBLE_MENUS) { clear_boxed_message(); } diff --git a/main/inferno.c b/main/inferno.c index 1639aa6c6..da2dffe2e 100644 --- a/main/inferno.c +++ b/main/inferno.c @@ -86,6 +86,10 @@ extern int Current_display_mode; //$$ there's got to be a better way than #include "ui.h" #endif +#ifdef SDL_INPUT +#include +#endif + #include "vers_id.h" void mem_init(void); @@ -689,7 +693,19 @@ int main(int argc,char **argv) #ifdef EDITOR keyd_editor_mode = 0; #endif + +#ifdef SDL_INPUT + /* keep the mouse from wandering in SDL/X11 */ + SDL_WM_GrabInput(SDL_GRAB_ON); +#endif + game(); + +#ifdef SDL_INPUT + /* give control back to the WM */ + SDL_WM_GrabInput(SDL_GRAB_OFF); +#endif + if ( Function_mode == FMODE_MENU ) songs_play_song( SONG_TITLE, 1 ); break;