From 0106494f489092d91821beccd86af025d681c171 Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Fri, 12 Oct 2012 18:35:50 +0200 Subject: [PATCH] gem: Split mouse motion and mouse buttons handling --- src/video/gem/SDL_gemevents.c | 60 +++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/src/video/gem/SDL_gemevents.c b/src/video/gem/SDL_gemevents.c index ca10d22e8..d802ea186 100644 --- a/src/video/gem/SDL_gemevents.c +++ b/src/video/gem/SDL_gemevents.c @@ -52,7 +52,8 @@ static unsigned char gem_previouskeyboard[ATARIBIOS_MAXKEYS]; static int do_messages(_THIS, short *message); static void do_keyboard(short kc); static void do_keyboard_special(short ks); -static void do_mouse(_THIS, short mx, short my, short mb); +static void do_mouse_motion(_THIS, short mx, short my); +static void do_mouse_buttons(_THIS, short mb); /* Functions */ @@ -70,7 +71,7 @@ void GEM_InitOSKeymap(_THIS) void GEM_PumpEvents(_THIS) { short prevkc; - static short maskmouseb=0; + static short prevmb=0; int i; SDL_keysym keysym; @@ -99,7 +100,7 @@ void GEM_PumpEvents(_THIS) resultat = evnt_multi( event_mask, - 0x101,7,maskmouseb, + 0x101,7,prevmb, mouse_event,x2,y2,w2,h2, 0,0,0,0,0, buffer, @@ -138,8 +139,9 @@ void GEM_PumpEvents(_THIS) /* Mouse button event ? */ if (resultat & MU_BUTTON) { - do_mouse(this, mousex, mousey, mouseb); - maskmouseb = mouseb & 7; + do_mouse_motion(this, mousex, mousey); + do_mouse_buttons(this, mouseb); + prevmb = mouseb & 7; } /* Timer event ? */ @@ -304,9 +306,9 @@ static void do_keyboard_special(short ks) gem_currentkeyboard[SCANCODE_LEFTALT]=0xFF; } -static void do_mouse(_THIS, short mx, short my, short mb) +static void do_mouse_motion(_THIS, short mx, short my) { - static short prevmousex=0, prevmousey=0, prevmouseb=0; + static short prevmousex=0, prevmousey=0; short x2, y2, w2, h2; /* Don't return mouse events if out of window */ @@ -320,11 +322,6 @@ static void do_mouse(_THIS, short mx, short my, short mb) h2 = VDI_h; if ((!GEM_fullscreen) && (GEM_handle>=0)) { wind_get (GEM_handle, WF_WORKXYWH, &x2, &y2, &w2, &h2); - - /* Do not generate mouse button event if out of window working area */ - if ((mx=x2+w2) || (my=y2+h2)) { - mb=prevmouseb; - } } /* Mouse motion ? */ @@ -351,24 +348,33 @@ static void do_mouse(_THIS, short mx, short my, short mb) prevmousex = mx; prevmousey = my; } +} - /* Mouse button ? */ - if (prevmouseb!=mb) { - int i; +static void do_mouse_buttons(_THIS, short mb) +{ + static short prevmouseb=0; + int i; - for (i=0;i<3;i++) { - int curbutton, prevbutton; - - curbutton = mb & (1<