Skip to content

Commit

Permalink
haiku: mouse->ShowMouse method added
Browse files Browse the repository at this point in the history
Partially fixes Bugzilla #4442.
  • Loading branch information
Peter Kosyh committed Nov 12, 2019
1 parent 95a402d commit 79510b7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/haiku/SDL_BApp.h
Expand Up @@ -244,7 +244,7 @@ class SDL_BApp : public BApplication {
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();
}

Expand Down
30 changes: 30 additions & 0 deletions src/video/haiku/SDL_bvideo.cc
Expand Up @@ -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

Expand Down Expand Up @@ -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 */
Expand All @@ -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 */
Expand Down

0 comments on commit 79510b7

Please sign in to comment.