From ccd4f3d267f01d448878be92a563956a3aec7c89 Mon Sep 17 00:00:00 2001 From: "p.kosyh" Date: Mon, 7 Jun 2010 13:58:16 +0000 Subject: [PATCH] mouse_cursor added --- src/sdl-instead/game.c | 3 ++- src/sdl-instead/input.c | 13 +++++++++++-- src/sdl-instead/input.h | 1 + 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/sdl-instead/game.c b/src/sdl-instead/game.c index 1d8ad32..081e35d 100644 --- a/src/sdl-instead/game.c +++ b/src/sdl-instead/game.c @@ -2395,8 +2395,9 @@ int game_from_disk(void) if (old_menu != -1) game_menu(old_menu); } - + mouse_cursor(1); g = p = open_file_dialog(); + mouse_cursor(0); if (!p) return -1; strcpy(dir, p); diff --git a/src/sdl-instead/input.c b/src/sdl-instead/input.c index e11d602..6af71ed 100644 --- a/src/sdl-instead/input.c +++ b/src/sdl-instead/input.c @@ -18,6 +18,15 @@ int mouse_focus(void) return m_focus; } +int mouse_cursor(int on) +{ + if (on) + SDL_ShowCursor(SDL_ENABLE); + else + SDL_ShowCursor(SDL_ENABLE); + return 0; +} + void push_user_event(void (*p) (void*), void *data) { SDL_Event event; @@ -72,11 +81,11 @@ int input(struct inp_event *inp, int wait) if (event.active.gain) { m_focus = 1; if (opt_fs) - SDL_ShowCursor(SDL_DISABLE); + mouse_cursor(0); } else if (event.active.state & SDL_APPMOUSEFOCUS) { m_focus = 0; if (opt_fs) - SDL_ShowCursor(SDL_ENABLE); /* is it hack?*/ + mouse_cursor(1); /* is it hack?*/ } } if (SDL_PeepEvents(&peek, 1, SDL_PEEKEVENT, SDL_EVENTMASK(SDL_ACTIVEEVENT)) > 0) diff --git a/src/sdl-instead/input.h b/src/sdl-instead/input.h index 0e39f6c..9b7e52b 100644 --- a/src/sdl-instead/input.h +++ b/src/sdl-instead/input.h @@ -26,5 +26,6 @@ void input_clear(void); void push_user_event(void (*p) (void*), void *data); int mouse_focus(void); extern int minimized(void); +extern int mouse_cursor(int on); #endif