diff options
author | Peter Kosyh <p.kosyh@gmail.com> | 2019-11-11 22:22:40 -0500 |
---|---|---|
committer | Peter Kosyh <p.kosyh@gmail.com> | 2019-11-11 22:22:40 -0500 |
commit | 6bbeb84a693d67d0e142e95806bc8fa55c01c736 (patch) | |
tree | 8ae33d6a80bf878ffa95375a7612a550e45fc8a5 | |
parent | 14fb2a9093bd689f8530c40ef9f7e08492208ff3 (diff) |
haiku: mouse->ShowMouse method added
Partially fixes Bugzilla #4442.
-rw-r--r-- | src/main/haiku/SDL_BApp.h | 2 | ||||
-rw-r--r-- | src/video/haiku/SDL_bvideo.cc | 30 |
2 files changed, 31 insertions, 1 deletions
diff --git a/src/main/haiku/SDL_BApp.h b/src/main/haiku/SDL_BApp.h index fca783545b..ab2fe30373 100644 --- a/src/main/haiku/SDL_BApp.h +++ b/src/main/haiku/SDL_BApp.h @@ -244,7 +244,7 @@ private: be_app->HideCursor(); } else { SDL_SendMouseMotion(win, 0, 0, x, y); - if (be_app->IsCursorHidden()) + if (SDL_ShowCursor(-1) && be_app->IsCursorHidden()) be_app->ShowCursor(); } diff --git a/src/video/haiku/SDL_bvideo.cc b/src/video/haiku/SDL_bvideo.cc index 52e0f1d987..68300a9670 100644 --- a/src/video/haiku/SDL_bvideo.cc +++ b/src/video/haiku/SDL_bvideo.cc @@ -19,6 +19,7 @@ 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" +#include "../../main/haiku/SDL_BApp.h" #if SDL_VIDEO_DRIVER_HAIKU @@ -132,6 +133,33 @@ void HAIKU_DeleteDevice(SDL_VideoDevice * device) SDL_free(device); } +static int HAIKU_ShowCursor(SDL_Cursor *cur) +{ + SDL_Mouse *mouse = SDL_GetMouse(); + int show; + if (!mouse) + return 0; + show = (cur || !mouse->focus); + if (show) { + if (be_app->IsCursorHidden()) + be_app->ShowCursor(); + } else { + if (!be_app->IsCursorHidden()) + be_app->HideCursor(); + } + return 0; +} + +static void HAIKU_MouseInit(_THIS) +{ + SDL_Mouse *mouse = SDL_GetMouse(); + if (!mouse) + return; + mouse->ShowCursor = HAIKU_ShowCursor; + mouse->cur_cursor = (SDL_Cursor*)0x1; + mouse->def_cursor = (SDL_Cursor*)0x2; +} + int HAIKU_VideoInit(_THIS) { /* Initialize the Be Application for appserver interaction */ @@ -145,6 +173,8 @@ int HAIKU_VideoInit(_THIS) /* Init the keymap */ HAIKU_InitOSKeymap(); + HAIKU_MouseInit(_this); + #if SDL_VIDEO_OPENGL /* testgl application doesn't load library, just tries to load symbols */ /* is it correct? if so we have to load library here */ |