src/video/x11/SDL_x11mouse.c
changeset 79 ffadd05de74d
parent 78 e9582f471c02
child 80 8806bc1eb80e
     1.1 --- a/src/video/x11/SDL_x11mouse.c	Sat Jun 23 18:51:29 2001 +0000
     1.2 +++ b/src/video/x11/SDL_x11mouse.c	Sat Jun 23 22:00:59 2001 +0000
     1.3 @@ -229,11 +229,23 @@
     1.4  /* Check to see if we need to enter or leave mouse relative mode */
     1.5  void X11_CheckMouseModeNoLock(_THIS)
     1.6  {
     1.7 +	char *env_override;
     1.8 +	int enable_relative = 1;
     1.9 +
    1.10 +	/* Allow the user to override the relative mouse mode.
    1.11 +	   They almost never want to do this, as it seriously affects
    1.12 +	   applications that rely on continuous relative mouse motion.
    1.13 +	*/
    1.14 +	env_override = getenv("SDL_MOUSE_NORELATIVE");
    1.15 +	if ( env_override ) {
    1.16 +		enable_relative = atoi(env_override);
    1.17 +	}
    1.18 +
    1.19  	/* If the mouse is hidden and input is grabbed, we use relative mode */
    1.20 -	if ( !(SDL_cursorstate & CURSOR_VISIBLE) &&
    1.21 +	if ( enable_relative &&
    1.22 +	     !(SDL_cursorstate & CURSOR_VISIBLE) &&
    1.23  	     (this->input_grab != SDL_GRAB_OFF) &&
    1.24 -             (SDL_GetAppState() & SDL_APPACTIVE) &&
    1.25 -	     !getenv("SDL_MOUSE_NORELATIVE") ) {
    1.26 +             (SDL_GetAppState() & SDL_APPACTIVE) ) {
    1.27  		if ( ! mouse_relative ) {
    1.28  			X11_EnableDGAMouse(this);
    1.29  			if ( ! (using_dga & DGA_MOUSE) ) {