From 6e31c2f068180c16c1a7ece0f166c100bf4b4616 Mon Sep 17 00:00:00 2001 From: rubidium Date: Thu, 17 Nov 2011 21:09:08 +0000 Subject: (svn r23241) -Codechange: make the decision when to go to the custom drawn cursor more prominently during the initialisation of OpenTTD --- src/video/allegro_v.cpp | 12 ++++++++++++ src/video/allegro_v.h | 2 ++ src/video/sdl_v.cpp | 7 ++++++- src/video/sdl_v.h | 2 ++ src/video/video_driver.hpp | 5 +++++ src/video/win32_v.cpp | 6 ++++++ src/video/win32_v.h | 2 ++ 7 files changed, 35 insertions(+), 1 deletion(-) (limited to 'src/video') diff --git a/src/video/allegro_v.cpp b/src/video/allegro_v.cpp index 27b7a4448..0154cb519 100644 --- a/src/video/allegro_v.cpp +++ b/src/video/allegro_v.cpp @@ -225,11 +225,23 @@ static bool CreateMainSurface(uint w, uint h) snprintf(caption, sizeof(caption), "OpenTTD %s", _openttd_revision); set_window_title(caption); + enable_hardware_cursor(); + select_mouse_cursor(MOUSE_CURSOR_ARROW); + show_mouse(_allegro_screen); + GameSizeChanged(); return true; } +bool VideoDriver_Allegro::ClaimMousePointer() +{ + select_mouse_cursor(MOUSE_CURSOR_NONE); + show_mouse(_allegro_screen); + disable_hardware_cursor(); + return true; +} + struct VkMapping { uint16 vk_from; byte vk_count; diff --git a/src/video/allegro_v.h b/src/video/allegro_v.h index 6a81159ca..da95269ce 100644 --- a/src/video/allegro_v.h +++ b/src/video/allegro_v.h @@ -31,6 +31,8 @@ public: /* virtual */ bool AfterBlitterChange(); + /* virtual */ bool ClaimMousePointer(); + /* virtual */ const char *GetName() const { return "allegro"; } }; diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp index 8768004b6..ebb0ca757 100644 --- a/src/video/sdl_v.cpp +++ b/src/video/sdl_v.cpp @@ -259,13 +259,18 @@ static bool CreateMainSurface(uint w, uint h) snprintf(caption, sizeof(caption), "OpenTTD %s", _openttd_revision); SDL_CALL SDL_WM_SetCaption(caption, caption); - SDL_CALL SDL_ShowCursor(0); GameSizeChanged(); return true; } +bool VideoDriver_SDL::ClaimMousePointer() +{ + SDL_CALL SDL_ShowCursor(0); + return true; +} + struct VkMapping { uint16 vk_from; byte vk_count; diff --git a/src/video/sdl_v.h b/src/video/sdl_v.h index baecc7ba7..e4df2a30a 100644 --- a/src/video/sdl_v.h +++ b/src/video/sdl_v.h @@ -31,6 +31,8 @@ public: /* virtual */ bool AfterBlitterChange(); + /* virtual */ bool ClaimMousePointer(); + /* virtual */ const char *GetName() const { return "sdl"; } }; diff --git a/src/video/video_driver.hpp b/src/video/video_driver.hpp index 4e8a2a0a1..306fe2803 100644 --- a/src/video/video_driver.hpp +++ b/src/video/video_driver.hpp @@ -56,6 +56,11 @@ public: return true; } + virtual bool ClaimMousePointer() + { + return true; + } + /** * Whether the driver has a graphical user interface with the end user. * Or in other words, whether we should spawn a thread for world generation diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp index cc242fb2e..f571638b8 100644 --- a/src/video/win32_v.cpp +++ b/src/video/win32_v.cpp @@ -81,6 +81,12 @@ static void UpdatePalette(HDC dc, uint start, uint count) SetDIBColorTable(dc, start, count, rgb); } +bool VideoDriver_Win32::ClaimMousePointer() +{ + MyShowCursor(false, true); + return true; +} + struct VkMapping { byte vk_from; byte vk_count; diff --git a/src/video/win32_v.h b/src/video/win32_v.h index f6c562a94..0706c0ee7 100644 --- a/src/video/win32_v.h +++ b/src/video/win32_v.h @@ -31,6 +31,8 @@ public: /* virtual */ bool AfterBlitterChange(); + /* virtual */ bool ClaimMousePointer(); + /* virtual */ const char *GetName() const { return "win32"; } bool MakeWindow(bool full_screen); -- cgit v1.2.3-54-g00ecf