Mouse events
This commit is contained in:
parent
adc62636f7
commit
bd362433e7
@ -79,7 +79,27 @@ void TOARU_PumpEvents(_THIS) {
|
|||||||
SDL_PrivateQuit();
|
SDL_PrivateQuit();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* TODO mouse events */
|
|
||||||
|
int i;
|
||||||
|
signed int x = me->new_x - this->hidden->o_w;
|
||||||
|
signed int y = me->new_y - this->hidden->o_h;
|
||||||
|
|
||||||
|
#define CONVERT_MOUSE(i) (i == 0 ? 1 : (i == 1 ? 3 : (i == 2 ? 2 : 0)))
|
||||||
|
|
||||||
|
for (i = 0; i < 3; ++i) {
|
||||||
|
int was = mouse_state & (1 << i);
|
||||||
|
int is = me->buttons & (1 << i);
|
||||||
|
if (is && (was != is)) {
|
||||||
|
SDL_PrivateMouseButton(SDL_PRESSED, CONVERT_MOUSE(i), x, y);
|
||||||
|
} else if ((was) && (was != is)) {
|
||||||
|
SDL_PrivateMouseButton(SDL_RELEASED, CONVERT_MOUSE(i), x, y);
|
||||||
|
} else if (was != is) {
|
||||||
|
SDL_PrivateMouseButton(SDL_RELEASED, CONVERT_MOUSE(i), x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mouse_state = me->buttons;
|
||||||
|
|
||||||
|
SDL_PrivateMouseMotion(0, 0, x, y);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case YUTANI_MSG_SESSION_END:
|
case YUTANI_MSG_SESSION_END:
|
||||||
|
@ -31,3 +31,31 @@
|
|||||||
struct WMcursor {
|
struct WMcursor {
|
||||||
int unused;
|
int unused;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* There isn't any implementation dependent data */
|
||||||
|
void TOARU_FreeWMCursor(_THIS, WMcursor *cursor)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* There isn't any implementation dependent data */
|
||||||
|
WMcursor *TOARU_CreateWMCursor(_THIS,
|
||||||
|
Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y)
|
||||||
|
{
|
||||||
|
return((WMcursor *)0x01);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void TOARU_MoveCursor(_THIS, SDL_Cursor *cursor, int x, int y)
|
||||||
|
{
|
||||||
|
/* do nothing */
|
||||||
|
}
|
||||||
|
|
||||||
|
void TOARU_MoveWMCursor(_THIS, int x, int y)
|
||||||
|
{
|
||||||
|
/* do nothing */
|
||||||
|
}
|
||||||
|
|
||||||
|
int TOARU_ShowWMCursor(_THIS, WMcursor *wmcursor)
|
||||||
|
{
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
@ -24,3 +24,8 @@
|
|||||||
#include "SDL_toaruvideo.h"
|
#include "SDL_toaruvideo.h"
|
||||||
|
|
||||||
/* Functions to be exported */
|
/* Functions to be exported */
|
||||||
|
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 int TOARU_ShowWMCursor(_THIS, WMcursor *cursor);
|
||||||
|
@ -125,6 +125,10 @@ static SDL_VideoDevice *TOARU_CreateDevice(int devindex)
|
|||||||
device->IconifyWindow = NULL;
|
device->IconifyWindow = NULL;
|
||||||
device->GrabInput = NULL;
|
device->GrabInput = NULL;
|
||||||
device->GetWMInfo = NULL;
|
device->GetWMInfo = NULL;
|
||||||
|
device->FreeWMCursor = TOARU_FreeWMCursor;
|
||||||
|
device->CreateWMCursor = TOARU_CreateWMCursor;
|
||||||
|
device->ShowWMCursor = TOARU_ShowWMCursor;
|
||||||
|
device->MoveWMCursor = TOARU_MoveWMCursor;
|
||||||
device->InitOSKeymap = TOARU_InitOSKeymap;
|
device->InitOSKeymap = TOARU_InitOSKeymap;
|
||||||
device->PumpEvents = TOARU_PumpEvents;
|
device->PumpEvents = TOARU_PumpEvents;
|
||||||
device->SetCaption = TOARU_SetCaption;
|
device->SetCaption = TOARU_SetCaption;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user