atari:gem: Use flag to only call system function to hide/show cursor when state changes. SDL-1.2
authorPatrice Mandin <patmandin@gmail.com>
Wed, 13 Aug 2014 11:01:21 +0200
branchSDL-1.2
changeset 9058dc32c43c2c92
parent 9043 1a6ca0c7977e
child 9059 9a9f56143400
atari:gem: Use flag to only call system function to hide/show cursor when state changes.
src/video/gem/SDL_gemmouse.c
src/video/gem/SDL_gemvideo.h
     1.1 --- a/src/video/gem/SDL_gemmouse.c	Sun Aug 03 20:05:42 2014 +0200
     1.2 +++ b/src/video/gem/SDL_gemmouse.c	Wed Aug 13 11:01:21 2014 +0200
     1.3 @@ -168,7 +168,8 @@
     1.4  void GEM_CheckMouseMode(_THIS)
     1.5  {
     1.6  	const Uint8 full_focus = (SDL_APPACTIVE|SDL_APPINPUTFOCUS|SDL_APPMOUSEFOCUS);
     1.7 -	int set_system_cursor = 1, show_system_cursor = 1;
     1.8 +	int set_system_cursor = 1;
     1.9 +	SDL_bool hide_system_cursor = SDL_FALSE;
    1.10  
    1.11  #ifdef DEBUG_VIDEO_GEM
    1.12  	printf("sdl:video:gem: check mouse mode\n");
    1.13 @@ -187,18 +188,22 @@
    1.14  				graf_mouse(USER_DEF, GEM_cursor->mform_p);
    1.15  				set_system_cursor = 0;
    1.16  			} else {
    1.17 -				show_system_cursor = 0;
    1.18 +				hide_system_cursor = SDL_TRUE;
    1.19  			}
    1.20  		}
    1.21  	} else {
    1.22  		/* Mouse cursor hidden only over the application window */
    1.23  		if ((SDL_GetAppState() & full_focus) == full_focus) {
    1.24  			set_system_cursor = 0;
    1.25 -			show_system_cursor = 0;
    1.26 +			hide_system_cursor = SDL_TRUE;
    1.27  		}
    1.28  	}
    1.29  
    1.30 -	graf_mouse(show_system_cursor ? M_ON : M_OFF, NULL);
    1.31 +	if (hide_system_cursor != GEM_cursor_hidden) {
    1.32 +		graf_mouse(hide_system_cursor ? M_OFF : M_ON, NULL);
    1.33 +		GEM_cursor_hidden = hide_system_cursor;
    1.34 +	}
    1.35 +
    1.36  	if (set_system_cursor) {
    1.37  		graf_mouse(ARROW, NULL);
    1.38  	}
     2.1 --- a/src/video/gem/SDL_gemvideo.h	Sun Aug 03 20:05:42 2014 +0200
     2.2 +++ b/src/video/gem/SDL_gemvideo.h	Wed Aug 13 11:01:21 2014 +0200
     2.3 @@ -84,6 +84,7 @@
     2.4  	SDL_bool mouse_relative;	/* Report relative mouse movement */
     2.5  	SDL_bool locked;			/* AES locked for fullscreen ? */
     2.6  	SDL_bool lock_redraw;		/* Prevent redraw till buffers are setup */
     2.7 +	SDL_bool cursor_hidden;		/* Mouse cursor hidden flag */
     2.8  	short message[8];			/* To self-send an AES message */
     2.9  	void *menubar;				/* Menu bar save buffer when going fullscreen */
    2.10  	SDL_bool use_dev_mouse;		/* Use /dev/mouse ? */
    2.11 @@ -131,6 +132,7 @@
    2.12  #define GEM_mouse_relative	(this->hidden->mouse_relative)
    2.13  #define GEM_locked			(this->hidden->locked)
    2.14  #define GEM_lock_redraw		(this->hidden->lock_redraw)
    2.15 +#define GEM_cursor_hidden	(this->hidden->cursor_hidden)
    2.16  #define GEM_message			(this->hidden->message)
    2.17  #define SDL_modelist		(this->hidden->SDL_modelist)
    2.18  #define GEM_icon			(this->hidden->icon)