Fixes players looking all around after they alt+tabbed.
Moves the logic for selecting the mouse mode out of screen drawing and
into SDL event handling where it's unaffected if we early-out of drawing
the frame.
Prevents mouse "grab" (raw/relative mode + cursor hiding) in a few
"loading" situations.
Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
qbool scr_initialized; // ready to draw
-static qbool scr_loading = false; // we are in a loading screen
+qbool scr_loading = false; // we are in a loading screen
unsigned int scr_con_current;
static unsigned int scr_con_margin_bottom;
#endif
qglFlush(); // ensure that the commands are submitted to the GPU before we do other things
-
- if (!vid_activewindow || key_consoleactive)
- VID_SetMouse(false, false);
- else if (key_dest == key_menu || key_dest == key_menu_grabbed || scr_loading)
- VID_SetMouse(vid_mouse.integer && !in_client_mouse && !vid_touchscreen.integer, !vid_touchscreen.integer);
- else
- VID_SetMouse(vid_mouse.integer && !cl.csqc_wantsmousemove && cl_prydoncursor.integer <= 0 && (!cls.demoplayback || cl_demo_mousegrab.integer) && !vid_touchscreen.integer, !vid_touchscreen.integer);
-
VID_Finish();
}
qbool VID_JoyBlockEmulatedKeys(int keycode);
void VID_EnableJoystick(qbool enable);
+extern cvar_t cl_demo_mousegrab;
+extern qbool scr_loading;
+
extern qbool vid_hidden;
extern qbool vid_activewindow;
extern qbool vid_supportrefreshrate;
void VID_ShowKeyboard(qbool show);
qbool VID_ShowingKeyboard(void);
-void VID_SetMouse(qbool relative, qbool hidecursor);
void VID_Finish (void);
void VID_Restart_f(struct cmd_state_s *cmd);
}
#endif
-void VID_SetMouse(qbool relative, qbool hidecursor)
-{
-}
-
void VID_Finish (void)
{
}
return SDL_IsTextInputActive() != 0;
}
-void VID_SetMouse(qbool relative, qbool hidecursor)
+static void VID_SetMouse(qbool relative, qbool hidecursor)
{
#ifndef DP_MOBILETOUCH
#ifdef MACOSX
in_windowmouse_y = y;
}
+ //Con_Printf("Mouse position: in_mouse %f %f in_windowmouse %f %f\n", in_mouse_x, in_mouse_y, in_windowmouse_x, in_windowmouse_y);
+
VID_BuildJoyState(&joystate);
VID_ApplyJoyState(&joystate);
}
break;
}
+ vid_activewindow = !vid_hidden && vid_hasfocus;
+
// enable/disable sound on focus gain/loss
- if ((!vid_hidden && vid_activewindow) || !snd_mutewhenidle.integer)
+ if (vid_activewindow || !snd_mutewhenidle.integer)
{
if (!sound_active)
{
sound_active = false;
}
}
+
+ if (!vid_activewindow || key_consoleactive || scr_loading)
+ VID_SetMouse(false, false);
+ else if (key_dest == key_menu || key_dest == key_menu_grabbed)
+ VID_SetMouse(vid_mouse.integer && !in_client_mouse && !vid_touchscreen.integer, !vid_touchscreen.integer);
+ else
+ VID_SetMouse(vid_mouse.integer && !cl.csqc_wantsmousemove && cl_prydoncursor.integer <= 0 && (!cls.demoplayback || cl_demo_mousegrab.integer) && !vid_touchscreen.integer, !vid_touchscreen.integer);
}
/////////////////
void VID_Finish (void)
{
- vid_activewindow = !vid_hidden && vid_hasfocus;
-
VID_UpdateGamma();
if (!vid_hidden)