comparison src/video/x11/SDL_x11mouse.c @ 79:ffadd05de74d

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.
author Sam Lantinga <slouken@lokigames.com>
date Sat, 23 Jun 2001 22:00:59 +0000
parents e9582f471c02
children 8806bc1eb80e
comparison
equal deleted inserted replaced
78:e9582f471c02 79:ffadd05de74d
227 } 227 }
228 228
229 /* Check to see if we need to enter or leave mouse relative mode */ 229 /* Check to see if we need to enter or leave mouse relative mode */
230 void X11_CheckMouseModeNoLock(_THIS) 230 void X11_CheckMouseModeNoLock(_THIS)
231 { 231 {
232 char *env_override;
233 int enable_relative = 1;
234
235 /* Allow the user to override the relative mouse mode.
236 They almost never want to do this, as it seriously affects
237 applications that rely on continuous relative mouse motion.
238 */
239 env_override = getenv("SDL_MOUSE_NORELATIVE");
240 if ( env_override ) {
241 enable_relative = atoi(env_override);
242 }
243
232 /* If the mouse is hidden and input is grabbed, we use relative mode */ 244 /* If the mouse is hidden and input is grabbed, we use relative mode */
233 if ( !(SDL_cursorstate & CURSOR_VISIBLE) && 245 if ( enable_relative &&
246 !(SDL_cursorstate & CURSOR_VISIBLE) &&
234 (this->input_grab != SDL_GRAB_OFF) && 247 (this->input_grab != SDL_GRAB_OFF) &&
235 (SDL_GetAppState() & SDL_APPACTIVE) && 248 (SDL_GetAppState() & SDL_APPACTIVE) ) {
236 !getenv("SDL_MOUSE_NORELATIVE") ) {
237 if ( ! mouse_relative ) { 249 if ( ! mouse_relative ) {
238 X11_EnableDGAMouse(this); 250 X11_EnableDGAMouse(this);
239 if ( ! (using_dga & DGA_MOUSE) ) { 251 if ( ! (using_dga & DGA_MOUSE) ) {
240 char *xmouse_accel; 252 char *xmouse_accel;
241 253