Skip to content

Commit

Permalink
atari:gem: Use flag to only call system function to hide/show cursor …
Browse files Browse the repository at this point in the history
…when state changes.
  • Loading branch information
pmandin committed Aug 13, 2014
1 parent 54638e7 commit a5cbc93
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/video/gem/SDL_gemmouse.c
Expand Up @@ -168,7 +168,8 @@ void GEM_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
void GEM_CheckMouseMode(_THIS)
{
const Uint8 full_focus = (SDL_APPACTIVE|SDL_APPINPUTFOCUS|SDL_APPMOUSEFOCUS);
int set_system_cursor = 1, show_system_cursor = 1;
int set_system_cursor = 1;
SDL_bool hide_system_cursor = SDL_FALSE;

#ifdef DEBUG_VIDEO_GEM
printf("sdl:video:gem: check mouse mode\n");
Expand All @@ -187,18 +188,22 @@ void GEM_CheckMouseMode(_THIS)
graf_mouse(USER_DEF, GEM_cursor->mform_p);
set_system_cursor = 0;
} else {
show_system_cursor = 0;
hide_system_cursor = SDL_TRUE;
}
}
} else {
/* Mouse cursor hidden only over the application window */
if ((SDL_GetAppState() & full_focus) == full_focus) {
set_system_cursor = 0;
show_system_cursor = 0;
hide_system_cursor = SDL_TRUE;
}
}

graf_mouse(show_system_cursor ? M_ON : M_OFF, NULL);
if (hide_system_cursor != GEM_cursor_hidden) {
graf_mouse(hide_system_cursor ? M_OFF : M_ON, NULL);
GEM_cursor_hidden = hide_system_cursor;
}

if (set_system_cursor) {
graf_mouse(ARROW, NULL);
}
Expand Down
2 changes: 2 additions & 0 deletions src/video/gem/SDL_gemvideo.h
Expand Up @@ -84,6 +84,7 @@ struct SDL_PrivateVideoData {
SDL_bool mouse_relative; /* Report relative mouse movement */
SDL_bool locked; /* AES locked for fullscreen ? */
SDL_bool lock_redraw; /* Prevent redraw till buffers are setup */
SDL_bool cursor_hidden; /* Mouse cursor hidden flag */
short message[8]; /* To self-send an AES message */
void *menubar; /* Menu bar save buffer when going fullscreen */
SDL_bool use_dev_mouse; /* Use /dev/mouse ? */
Expand Down Expand Up @@ -131,6 +132,7 @@ struct SDL_PrivateVideoData {
#define GEM_mouse_relative (this->hidden->mouse_relative)
#define GEM_locked (this->hidden->locked)
#define GEM_lock_redraw (this->hidden->lock_redraw)
#define GEM_cursor_hidden (this->hidden->cursor_hidden)
#define GEM_message (this->hidden->message)
#define SDL_modelist (this->hidden->SDL_modelist)
#define GEM_icon (this->hidden->icon)
Expand Down

0 comments on commit a5cbc93

Please sign in to comment.