Skip to content

Commit

Permalink
Use proper GEM API to handle mouse button events
Browse files Browse the repository at this point in the history
  • Loading branch information
pmandin committed Jul 9, 2010
1 parent 73262df commit d9c9775
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/video/gem/SDL_gemevents.c
Expand Up @@ -67,25 +67,27 @@ void GEM_InitOSKeymap(_THIS)

void GEM_PumpEvents(_THIS)
{
short mousex, mousey, mouseb, dummy;
short kstate, prevkc, prevks;
short prevkc, prevks;
static short maskmouseb=0;
int i;
SDL_keysym keysym;

SDL_memset(gem_currentkeyboard,0,sizeof(gem_currentkeyboard));
prevkc = prevks = 0;

for (;;)
{
int quit, resultat, event_mask, mouse_event;
short buffer[8], kc;
short x2,y2,w2,h2;
short mousex, mousey, mouseb, dummy;
short kstate;

quit =
mouse_event =
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)) {
wind_get (GEM_handle, WF_WORKXYWH, &x2, &y2, &w2, &h2);
event_mask |= MU_M1;
Expand All @@ -95,12 +97,12 @@ void GEM_PumpEvents(_THIS)

resultat = evnt_multi(
event_mask,
0,0,0,
0x101,7,maskmouseb,
mouse_event,x2,y2,w2,h2,
0,0,0,0,0,
buffer,
10,
&dummy,&dummy,&dummy,&kstate,&kc,&dummy
&mousex,&mousey,&mouseb,&kstate,&kc,&dummy
);

/* Message event ? */
Expand All @@ -127,15 +129,17 @@ void GEM_PumpEvents(_THIS)
GEM_CheckMouseMode(this);
}

/* Mouse button event ? */
if (resultat & MU_BUTTON) {
do_mouse(this, mousex, mousey, mouseb, kstate);
maskmouseb = mouseb & 7;
}

/* Timer event ? */
if ((resultat & MU_TIMER) || quit)
break;
}

/* Update mouse */
graf_mkstate(&mousex, &mousey, &mouseb, &kstate);
do_mouse(this, mousex, mousey, mouseb, kstate);

/* Now generate keyboard events */
for (i=0; i<ATARIBIOS_MAXKEYS; i++) {
/* Key pressed ? */
Expand Down Expand Up @@ -342,7 +346,7 @@ static void do_mouse(_THIS, short mx, short my, short mb, short ks)
if (prevmouseb!=mb) {
int i;

for (i=0;i<2;i++) {
for (i=0;i<3;i++) {
int curbutton, prevbutton;

curbutton = mb & (1<<i);
Expand Down

0 comments on commit d9c9775

Please sign in to comment.