Commit b84fc3f7 authored by Sam Lantinga's avatar Sam Lantinga

Allow the user to override the relative mouse mode.

They almost never want to do this, as it seriously affects
applications that rely on continuous relative mouse motion.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%4080
parent b5105810
...@@ -229,11 +229,23 @@ static void SetMouseAccel(_THIS, const char *accel_param) ...@@ -229,11 +229,23 @@ static void SetMouseAccel(_THIS, const char *accel_param)
/* Check to see if we need to enter or leave mouse relative mode */ /* Check to see if we need to enter or leave mouse relative mode */
void X11_CheckMouseModeNoLock(_THIS) void X11_CheckMouseModeNoLock(_THIS)
{ {
char *env_override;
int enable_relative = 1;
/* Allow the user to override the relative mouse mode.
They almost never want to do this, as it seriously affects
applications that rely on continuous relative mouse motion.
*/
env_override = getenv("SDL_MOUSE_NORELATIVE");
if ( env_override ) {
enable_relative = atoi(env_override);
}
/* If the mouse is hidden and input is grabbed, we use relative mode */ /* If the mouse is hidden and input is grabbed, we use relative mode */
if ( !(SDL_cursorstate & CURSOR_VISIBLE) && if ( enable_relative &&
!(SDL_cursorstate & CURSOR_VISIBLE) &&
(this->input_grab != SDL_GRAB_OFF) && (this->input_grab != SDL_GRAB_OFF) &&
(SDL_GetAppState() & SDL_APPACTIVE) && (SDL_GetAppState() & SDL_APPACTIVE) ) {
!getenv("SDL_MOUSE_NORELATIVE") ) {
if ( ! mouse_relative ) { if ( ! mouse_relative ) {
X11_EnableDGAMouse(this); X11_EnableDGAMouse(this);
if ( ! (using_dga & DGA_MOUSE) ) { if ( ! (using_dga & DGA_MOUSE) ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment