# HG changeset patch # User Patrice Mandin # Date 1278688758 -7200 # Node ID 5002d6aeb85c868fa848cce2ba94c58cfbf0ac16 # Parent 4aa31b9207f2a336150b6a291c27a266feb27aeb Use proper GEM API to handle mouse button events diff -r 4aa31b9207f2 -r 5002d6aeb85c src/video/gem/SDL_gemevents.c --- a/src/video/gem/SDL_gemevents.c Tue Jul 20 00:01:26 2010 -0700 +++ b/src/video/gem/SDL_gemevents.c Fri Jul 09 17:19:18 2010 +0200 @@ -67,25 +67,27 @@ 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; @@ -95,12 +97,12 @@ 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 ? */ @@ -127,15 +129,17 @@ 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