// don't do anything if not initialized yet
if (vid_hidden || !scr_refresh.integer)
return;
+ // release mouse grab while loading
+ VID_GrabMouse(false);
CHECKGLERROR
qglViewport(0, 0, vid.width, vid.height);CHECKGLERROR
//qglDisable(GL_SCISSOR_TEST);CHECKGLERROR
R_Mesh_Finish();
// refresh
// not necessary when rendering to GL_FRONT buffers
- //VID_Finish(false);
+ //VID_Finish();
// however this IS necessary on Windows Vista
qglFinish();
}
double rendertime1;
float conwidth, conheight;
+ if (!scr_initialized || !con_initialized)
+ return; // not initialized yet
+
+ VID_GrabMouse((vid.fullscreen || (vid_mouse.integer && !key_consoleactive && (key_dest != key_game || !cls.demoplayback))) && vid_activewindow && !cl.csqc_wantsmousemove);
+
if(gamemode == GAME_NEXUIZ)
{
// play a bit with the palette (experimental)
if (vid_hidden || !scr_refresh.integer)
return;
- if (!scr_initialized || !con_initialized)
- return; // not initialized yet
-
rendertime1 = Sys_DoubleTime();
conwidth = bound(320, vid_conwidth.value, 2048);
else
cl_updatescreen_quality = 1;
- VID_Finish(true);
+ VID_GrabMouse((vid.fullscreen || (vid_mouse.integer && !key_consoleactive && (key_dest != key_game || !cls.demoplayback))) && vid_activewindow && !cl.csqc_wantsmousemove);
+
+ VID_Finish();
}
void CL_Screen_NewMap(void)
// (called from various shutdown/deactivation functions)
void VID_RestoreSystemGamma(void);
-void VID_Finish (qboolean allowmousegrab);
+void VID_GrabMouse (qboolean grab);
+void VID_Finish (void);
void VID_Restart_f(void);
*height = scr_height;
}
-static void IN_Activate( qboolean grab )
+void VID_GrabMouse(qboolean grab)
{
if (grab)
{
if(vid_usingmouse && (vid_usingnoaccel != !!apple_mouse_noaccel.integer))
- IN_Activate(false); // ungrab first!
+ VID_GrabMouse(false); // ungrab first!
if (!vid_usingmouse && mouse_avail && window)
{
Rect winBounds;
}
#define GAMMA_TABLE_SIZE 256
-void VID_Finish (qboolean allowmousegrab)
+void VID_Finish (void)
{
- qboolean vid_usemouse;
qboolean vid_usevsync;
- // handle the mouse state when windowed if that's changed
- vid_usemouse = false;
- if (allowmousegrab && vid_mouse.integer && !key_consoleactive && (key_dest != key_game || !cls.demoplayback))
- vid_usemouse = true;
- if (!vid_activewindow)
- vid_usemouse = false;
- if (vid_isfullscreen)
- vid_usemouse = true;
- IN_Activate(vid_usemouse);
-
// handle changes of the vsync option
vid_usevsync = (vid_vsync.integer && !cls.timedemo);
if (vid_usingvsync != vid_usevsync)
if (context == NULL && window == NULL)
return;
- IN_Activate(false);
+ VID_GrabMouse(false);
VID_RestoreSystemGamma();
if (context != NULL)
return cursor;
}
-static void IN_Activate (qboolean grab)
+void VID_GrabMouse(qboolean grab)
{
if (!vidx11_display)
return;
{
#if !defined(__APPLE__) && !defined(SUNOS)
if(vid_usingmouse && (vid_usingdgamouse != !!vid_dgamouse.integer))
- IN_Activate(false); // ungrab first!
+ VID_GrabMouse(false); // ungrab first!
#endif
if (!vid_usingmouse && mouse_avail && win)
{
if (!ctx || !vidx11_display)
return;
- if (vidx11_display)
- {
- IN_Activate(false);
- VID_RestoreSystemGamma();
-
- // FIXME: glXDestroyContext here?
- if (vid_isfullscreen)
- XF86VidModeSwitchToMode(vidx11_display, vidx11_screen, &init_vidmode);
- if (win)
- XDestroyWindow(vidx11_display, win);
- XCloseDisplay(vidx11_display);
- }
+ VID_GrabMouse(false);
+ VID_RestoreSystemGamma();
+
+ // FIXME: glXDestroyContext here?
+ if (vid_isfullscreen)
+ XF86VidModeSwitchToMode(vidx11_display, vidx11_screen, &init_vidmode);
+ if (win)
+ XDestroyWindow(vidx11_display, win);
+ XCloseDisplay(vidx11_display);
+
vid_hidden = true;
vid_isfullscreen = false;
vidx11_display = NULL;
signal(SIGTERM, signal_handler);
}
-void VID_Finish (qboolean allowmousegrab)
+void VID_Finish (void)
{
- qboolean vid_usemouse;
-
vid_usevsync = vid_vsync.integer && !cls.timedemo && gl_videosyncavailable;
if (vid_usingvsync != vid_usevsync && gl_videosyncavailable)
{
Con_Print("glXSwapIntervalSGI didn't accept the vid_vsync change, it will take effect on next vid_restart (GLX_SGI_swap_control does not allow turning off vsync)\n");
}
- // handle the mouse state when windowed if that's changed
- vid_usemouse = false;
- if (allowmousegrab && vid_mouse.integer && !key_consoleactive && (key_dest != key_game || !cls.demoplayback))
- vid_usemouse = true;
- if (!vid_activewindow)
- vid_usemouse = false;
- if (vid_isfullscreen)
- vid_usemouse = true;
- IN_Activate(vid_usemouse);
-
if (r_render.integer)
{
CHECKGLERROR
#endif
}
-void VID_Finish (qboolean allowmousegrab)
+void VID_GrabMouse (qboolean grab)
+{
+}
+
+void VID_Finish (void)
{
}
return tbl_sdltoquake[ sdlkey ];
}
-static void IN_Activate( qboolean grab )
+void VID_GrabMouse(qboolean grab)
{
//SDL_WM_GrabInput( SDL_GRAB_OFF );
//Con_Printf("< Turning off input-grabbing. --blub\n");
void VID_Shutdown (void)
{
- // this is needed to retry gamma after a vid_restart
+ VID_GrabMouse(false);
VID_RestoreSystemGamma();
- IN_Activate(false);
SDL_QuitSubSystem(SDL_INIT_VIDEO);
gl_driver[0] = 0;
return !SDL_GetGammaRamp (ramps, ramps + rampsize, ramps + rampsize*2);
}
-void VID_Finish (qboolean allowmousegrab)
+void VID_Finish (void)
{
Uint8 appstate;
- qboolean vid_usemouse;
//react on appstate changes
appstate = SDL_GetAppState();
else
vid_activewindow = true;
- vid_usemouse = false;
- if( allowmousegrab && vid_mouse.integer && !key_consoleactive && (key_dest != key_game || !cls.demoplayback) )
- vid_usemouse = true;
- if( vid_isfullscreen )
- vid_usemouse = true;
- if( !vid_activewindow )
- vid_usemouse = false;
-
- IN_Activate(vid_usemouse);
-
VID_UpdateGamma(false, 256);
if (r_render.integer && !vid_hidden)
static int window_x, window_y;
-static void IN_Activate (qboolean grab);
-
static qboolean mouseinitialized;
#ifdef SUPPORTDIRECTX
//====================================
-void VID_Finish (qboolean allowmousegrab)
+void VID_Finish (void)
{
qboolean vid_usemouse;
qwglSwapIntervalEXT (vid_usevsync);
}
-// handle the mouse state when windowed if that's changed
- vid_usemouse = false;
- if (allowmousegrab && vid_mouse.integer && !key_consoleactive && (key_dest != key_game || !cls.demoplayback))
- vid_usemouse = true;
- if (vid_isfullscreen)
- vid_usemouse = true;
- if (!vid_activewindow)
- vid_usemouse = false;
- IN_Activate(vid_usemouse);
-
if (r_render.integer && !vid_hidden)
{
CHECKGLERROR
if (!fActive)
{
- IN_Activate (false);
+ VID_GrabMouse(false);
if (vid_isfullscreen)
{
ChangeDisplaySettings (NULL, 0);
case WM_MOVE:
window_x = (int) LOWORD(lParam);
window_y = (int) HIWORD(lParam);
- IN_Activate(false);
+ VID_GrabMouse(false);
break;
case WM_KEYDOWN:
if(vid_initialized == false)
return;
+ VID_GrabMouse(false);
VID_RestoreSystemGamma();
vid_initialized = false;
vid_isfullscreen = false;
}
-static void IN_Activate (qboolean grab)
+void VID_GrabMouse(qboolean grab)
{
static qboolean restore_spi;
static int originalmouseparms[3];
static void IN_Shutdown(void)
{
- IN_Activate (false);
-
#ifdef SUPPORTDIRECTX
if (g_pMouse)
IDirectInputDevice_Release(g_pMouse);