Support mouse warp and hiding

This commit is contained in:
Kevin Lange 2015-04-05 15:41:29 -07:00
parent 801e2d64fb
commit 8f0d6ea1e2
4 changed files with 20 additions and 5 deletions

View File

@ -193,6 +193,8 @@ void TOARU_PumpEvents(_THIS) {
case YUTANI_MSG_SESSION_END:
fprintf(stderr, "[sdl-toaru] Need to implement: %u\n", (unsigned int)m->type);
break;
case YUTANI_MSG_WINDOW_MOVE:
break;
default:
fprintf(stderr, "[sdl-toaru] Unhandled message from Yutani server: type=0x%x\n", (unsigned int)m->type);
break;

View File

@ -25,6 +25,9 @@
#include "../../events/SDL_events_c.h"
#include "SDL_toarumouse_c.h"
#include "../SDL_cursor_c.h"
#include <toaru/yutani.h>
/* The implementation dependent data for the window manager cursor */
@ -45,17 +48,24 @@ WMcursor *TOARU_CreateWMCursor(_THIS,
return((WMcursor *)0x01);
}
static void TOARU_MoveCursor(_THIS, SDL_Cursor *cursor, int x, int y)
void TOARU_MoveWMCursor(_THIS, int x, int y)
{
/* do nothing */
}
void TOARU_MoveWMCursor(_THIS, int x, int y)
{
/* do nothing */
void TOARU_WarpWMCursor(_THIS, Uint16 x, Uint16 y) {
yutani_window_warp_mouse(this->hidden->yctx, this->hidden->window, x + this->hidden->o_w, y + this->hidden->o_h);
}
int TOARU_ShowWMCursor(_THIS, WMcursor *wmcursor)
{
return (1);
}
void TOARU_CheckMouseMode(_THIS) {
int showing;
showing = (SDL_cursorstate & CURSOR_VISIBLE);
yutani_window_show_mouse(this->hidden->yctx, this->hidden->window, showing);
}

View File

@ -28,4 +28,6 @@ extern void TOARU_FreeWMCursor(_THIS, WMcursor *cursor);
extern WMcursor *TOARU_CreateWMCursor(_THIS,
Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
extern void TOARU_MoveWMCursor(_THIS, int x, int y);
extern void TOARU_WarpWMCursor(_THIS, Uint16 x, Uint16 y);
extern int TOARU_ShowWMCursor(_THIS, WMcursor *cursor);
extern void TOARU_CheckMouseMode(_THIS);

View File

@ -128,10 +128,11 @@ static SDL_VideoDevice *TOARU_CreateDevice(int devindex)
device->FreeWMCursor = TOARU_FreeWMCursor;
device->CreateWMCursor = TOARU_CreateWMCursor;
device->ShowWMCursor = TOARU_ShowWMCursor;
device->MoveWMCursor = TOARU_MoveWMCursor;
device->WarpWMCursor = TOARU_WarpWMCursor;
device->InitOSKeymap = TOARU_InitOSKeymap;
device->PumpEvents = TOARU_PumpEvents;
device->SetCaption = TOARU_SetCaption;
device->CheckMouseMode = TOARU_CheckMouseMode;
device->free = TOARU_DeleteDevice;