hopefully fix the input grabbing (and evem more hopefully, without driving

Despair to ... um... ;)
This commit is contained in:
Bill Currie 2003-03-07 03:55:51 +00:00
parent 7bdf1bdb90
commit c731afa957
7 changed files with 34 additions and 65 deletions

View file

@ -79,8 +79,7 @@ void IN_LL_Init (void);
void IN_LL_Shutdown (void);
void IN_LL_SendKeyEvents (void);
void IN_LL_ClearStates (void);
int IN_LL_Grab_Input (void);
int IN_LL_Ungrab_Input (void);
void IN_LL_Grab_Input (int grab);
extern kbutton_t in_strafe, in_klook, in_speed, in_mlook;

View file

@ -78,21 +78,11 @@ qboolean in_mouse_avail;
float in_mouse_x, in_mouse_y;
static float in_old_mouse_x, in_old_mouse_y;
static int input_grabbed = 0;
void
IN_UpdateGrab (cvar_t *var) // called from context_*.c
{
if (var) {
if (var->int_val) {
if (!input_grabbed) {
input_grabbed = IN_LL_Grab_Input ();
}
} else {
if (input_grabbed) {
input_grabbed = IN_LL_Ungrab_Input ();
}
}
IN_LL_Grab_Input (var->int_val);
}
}

View file

@ -133,16 +133,9 @@ IN_LL_SendKeyEvents (void)
}
}
int
IN_LL_Grab_Input (void)
void
IN_LL_Grab_Input (int grab)
{
return 0;
}
int
IN_LL_Ungrab_Input (void)
{
return 0;
}
void

View file

@ -851,16 +851,15 @@ IN_LL_SendKeyEvents (void)
}
}
int
IN_LL_Grab_Input (void)
void
IN_LL_Grab_Input (int grab)
{
return (SDL_GRAB_ON == SDL_WM_GrabInput (SDL_GRAB_ON));
}
static int input_grabbed = 0;
int
IN_LL_Ungrab_Input (void)
{
return (SDL_GRAB_ON == SDL_WM_GrabInput (SDL_GRAB_OFF));
if ((input_grabbed && grab) || (!input_grabbed && !grab))
return;
input_grabbed = (SDL_GRAB_ON == SDL_WM_GrabInput (grab ? SDL_GRAB_ON
: SDL_GRAB_OFF));
}
void

View file

@ -457,16 +457,9 @@ IN_LL_SendKeyEvents (void)
}
}
int
IN_LL_Grab_Input (void)
void
IN_LL_Grab_Input (int grab)
{
return 0;
}
int
IN_LL_Ungrab_Input (void)
{
return 0;
}
void

View file

@ -407,16 +407,9 @@ IN_MouseEvent (int mstate)
}
}
int
IN_LL_Grab_Input (void)
void
IN_LL_Grab_Input (int grab)
{
return 0;
}
int
IN_LL_Ungrab_Input (void)
{
return 0;
}
void

View file

@ -553,26 +553,28 @@ event_motion (XEvent *event)
}
}
int
IN_LL_Grab_Input (void)
void
IN_LL_Grab_Input (int grab)
{
if (!x_disp || !x_win)
return 0;
X11_Grabber (true);
if (in_dga->int_val)
dga_on ();
return 1;
}
static int input_grabbed = 0;
int
IN_LL_Ungrab_Input (void)
{
if (!x_disp || !x_win)
return 0;
if (in_dga->int_val)
return;
if (vid_fullscreen)
grab = grab || vid_fullscreen->int_val;
if ((input_grabbed && grab) || (!input_grabbed && !grab))
return;
input_grabbed = grab;
X11_Grabber (grab);
if (in_dga->int_val) {
if (grab)
dga_on ();
else
dga_off ();
X11_Grabber (false);
return 0;
}
}
void