Use proper GEM API to handle mouse button events

--HG--
branch : SDL-1.2
This commit is contained in:
Patrice Mandin 2010-07-09 17:19:18 +02:00
parent af92be6d1c
commit 217991f8b4

View file

@ -67,25 +67,27 @@ void GEM_InitOSKeymap(_THIS)
void GEM_PumpEvents(_THIS) void GEM_PumpEvents(_THIS)
{ {
short mousex, mousey, mouseb, dummy; short prevkc, prevks;
short kstate, prevkc, prevks; static short maskmouseb=0;
int i; int i;
SDL_keysym keysym; SDL_keysym keysym;
SDL_memset(gem_currentkeyboard,0,sizeof(gem_currentkeyboard)); SDL_memset(gem_currentkeyboard,0,sizeof(gem_currentkeyboard));
prevkc = prevks = 0; prevkc = prevks = 0;
for (;;) for (;;)
{ {
int quit, resultat, event_mask, mouse_event; int quit, resultat, event_mask, mouse_event;
short buffer[8], kc; short buffer[8], kc;
short x2,y2,w2,h2; short x2,y2,w2,h2;
short mousex, mousey, mouseb, dummy;
short kstate;
quit = quit =
mouse_event = mouse_event =
x2=y2=w2=h2 = 0; x2=y2=w2=h2 = 0;
event_mask = MU_MESAG|MU_TIMER|MU_KEYBD; event_mask = MU_MESAG|MU_TIMER|MU_KEYBD|MU_BUTTON;
if (!GEM_fullscreen && (GEM_handle>=0)) { if (!GEM_fullscreen && (GEM_handle>=0)) {
wind_get (GEM_handle, WF_WORKXYWH, &x2, &y2, &w2, &h2); wind_get (GEM_handle, WF_WORKXYWH, &x2, &y2, &w2, &h2);
event_mask |= MU_M1; event_mask |= MU_M1;
@ -95,12 +97,12 @@ void GEM_PumpEvents(_THIS)
resultat = evnt_multi( resultat = evnt_multi(
event_mask, event_mask,
0,0,0, 0x101,7,maskmouseb,
mouse_event,x2,y2,w2,h2, mouse_event,x2,y2,w2,h2,
0,0,0,0,0, 0,0,0,0,0,
buffer, buffer,
10, 10,
&dummy,&dummy,&dummy,&kstate,&kc,&dummy &mousex,&mousey,&mouseb,&kstate,&kc,&dummy
); );
/* Message event ? */ /* Message event ? */
@ -127,15 +129,17 @@ void GEM_PumpEvents(_THIS)
GEM_CheckMouseMode(this); GEM_CheckMouseMode(this);
} }
/* Mouse button event ? */
if (resultat & MU_BUTTON) {
do_mouse(this, mousex, mousey, mouseb, kstate);
maskmouseb = mouseb & 7;
}
/* Timer event ? */ /* Timer event ? */
if ((resultat & MU_TIMER) || quit) if ((resultat & MU_TIMER) || quit)
break; break;
} }
/* Update mouse */
graf_mkstate(&mousex, &mousey, &mouseb, &kstate);
do_mouse(this, mousex, mousey, mouseb, kstate);
/* Now generate keyboard events */ /* Now generate keyboard events */
for (i=0; i<ATARIBIOS_MAXKEYS; i++) { for (i=0; i<ATARIBIOS_MAXKEYS; i++) {
/* Key pressed ? */ /* Key pressed ? */
@ -342,7 +346,7 @@ static void do_mouse(_THIS, short mx, short my, short mb, short ks)
if (prevmouseb!=mb) { if (prevmouseb!=mb) {
int i; int i;
for (i=0;i<2;i++) { for (i=0;i<3;i++) {
int curbutton, prevbutton; int curbutton, prevbutton;
curbutton = mb & (1<<i); curbutton = mb & (1<<i);