Grab mouse with SDL/X11

This commit is contained in:
Bradley Bell 2001-01-21 14:49:55 +00:00
parent a7ab71ae6c
commit 72ea2c9e25
2 changed files with 29 additions and 0 deletions

View file

@ -115,6 +115,9 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#endif
#endif
#ifdef SDL_INPUT
#include <SDL/SDL.h>
#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();
}

View file

@ -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 <SDL/SDL.h>
#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;