Move a test inside function, rather than repeated all over the place.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2003-02-25 06:04:42 +00:00
parent a9c61bb6bf
commit 1201f615ee
3 changed files with 13 additions and 18 deletions

View File

@ -73,8 +73,7 @@ VID_UpdateFullscreen (cvar_t *vid_fullscreen)
|| (!vid_fullscreen->int_val && screen->flags & SDL_FULLSCREEN)) || (!vid_fullscreen->int_val && screen->flags & SDL_FULLSCREEN))
if (!SDL_WM_ToggleFullScreen (screen)) if (!SDL_WM_ToggleFullScreen (screen))
Con_Printf ("VID_UpdateFullscreen: error setting fullscreen\n"); Con_Printf ("VID_UpdateFullscreen: error setting fullscreen\n");
if (in_grab) IN_UpdateGrab (in_grab);
IN_UpdateGrab (in_grab);
} }
void void

View File

@ -391,23 +391,17 @@ X11_UpdateFullscreen (cvar_t *fullscreen)
X11_ForceMove (window_x, window_y); X11_ForceMove (window_x, window_y);
window_saved = 0; window_saved = 0;
} }
if (in_grab) { IN_UpdateGrab (in_grab);
IN_UpdateGrab (in_grab);
}
return; return;
} else { } else {
if (in_grab) { IN_UpdateGrab (in_grab);
IN_UpdateGrab (in_grab);
}
if (X11_GetWindowCoords (&window_x, &window_y)) if (X11_GetWindowCoords (&window_x, &window_y))
window_saved = 1; window_saved = 1;
X11_SetVidMode (scr_width, scr_height); X11_SetVidMode (scr_width, scr_height);
if (in_grab) { // FIXME: why are there two of these? IN_UpdateGrab (in_grab); // FIXME: why are there two of these?
IN_UpdateGrab (in_grab);
}
if (!vidmode_active) { if (!vidmode_active) {
window_saved = 0; window_saved = 0;

View File

@ -83,13 +83,15 @@ static int input_grabbed = 0;
void void
IN_UpdateGrab (cvar_t *var) // called from context_*.c IN_UpdateGrab (cvar_t *var) // called from context_*.c
{ {
if (var->int_val) { if (var) {
if (!input_grabbed) { if (var->int_val) {
input_grabbed = IN_LL_Grab_Input (); if (!input_grabbed) {
} input_grabbed = IN_LL_Grab_Input ();
} else { }
if (input_grabbed) { } else {
input_grabbed = IN_LL_Ungrab_Input (); if (input_grabbed) {
input_grabbed = IN_LL_Ungrab_Input ();
}
} }
} }
} }