# HG changeset patch # User Sam Lantinga # Date 993333659 0 # Node ID ffadd05de74db3630ce4ec01b6dce61aa63995cb # Parent e9582f471c021616bff3b662a62b34375f62c4de 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. diff -r e9582f471c02 -r ffadd05de74d src/video/x11/SDL_x11mouse.c --- a/src/video/x11/SDL_x11mouse.c Sat Jun 23 18:51:29 2001 +0000 +++ b/src/video/x11/SDL_x11mouse.c Sat Jun 23 22:00:59 2001 +0000 @@ -229,11 +229,23 @@ /* Check to see if we need to enter or leave mouse relative mode */ 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 ( !(SDL_cursorstate & CURSOR_VISIBLE) && + if ( enable_relative && + !(SDL_cursorstate & CURSOR_VISIBLE) && (this->input_grab != SDL_GRAB_OFF) && - (SDL_GetAppState() & SDL_APPACTIVE) && - !getenv("SDL_MOUSE_NORELATIVE") ) { + (SDL_GetAppState() & SDL_APPACTIVE) ) { if ( ! mouse_relative ) { X11_EnableDGAMouse(this); if ( ! (using_dga & DGA_MOUSE) ) {