src/video/gem/SDL_gemevents.c
branchSDL-1.2
changeset 6647 42abe340dc14
parent 6585 bc23c3b164fa
child 6648 5415ef59343a
     1.1 --- a/src/video/gem/SDL_gemevents.c	Fri Oct 12 18:45:10 2012 +0200
     1.2 +++ b/src/video/gem/SDL_gemevents.c	Sun Nov 04 19:00:20 2012 +0100
     1.3 @@ -47,6 +47,8 @@
     1.4  static unsigned char gem_currentkeyboard[ATARIBIOS_MAXKEYS];
     1.5  static unsigned char gem_previouskeyboard[ATARIBIOS_MAXKEYS];
     1.6  
     1.7 +static short prevmx=0,prevmy=0,prevmb=0;
     1.8 +
     1.9  /* Functions prototypes */
    1.10  
    1.11  static int do_messages(_THIS, short *message);
    1.12 @@ -71,19 +73,16 @@
    1.13  
    1.14  void GEM_PumpEvents(_THIS)
    1.15  {
    1.16 -	short prevkc=0;
    1.17 -	static short prevmx=0, prevmy=0, prevmb=0;
    1.18 +	short prevkc=0, mousex, mousey, mouseb, kstate;
    1.19  	int i;
    1.20 -	SDL_keysym	keysym;
    1.21 +	SDL_keysym keysym;
    1.22  
    1.23  	SDL_memset(gem_currentkeyboard,0,sizeof(gem_currentkeyboard));
    1.24  
    1.25  	for (;;)
    1.26  	{
    1.27  		int quit, resultat;
    1.28 -		short buffer[8], kc;
    1.29 -		short mousex, mousey, mouseb, dummy;
    1.30 -		short kstate;
    1.31 +		short buffer[8], kc, dummy;
    1.32  
    1.33  		quit = 0;
    1.34  
    1.35 @@ -303,7 +302,6 @@
    1.36  
    1.37  static void do_mouse_motion(_THIS, short mx, short my)
    1.38  {
    1.39 -	static short prevmousex=0, prevmousey=0;
    1.40  	short x2, y2, w2, h2;
    1.41  
    1.42  	/* Don't return mouse events if out of window */
    1.43 @@ -329,7 +327,7 @@
    1.44  		wind_get (GEM_handle, WF_WORKXYWH, &x2, &y2, &w2, &h2);
    1.45  	}
    1.46  
    1.47 -	if ((prevmousex!=mx) || (prevmousey!=my)) {
    1.48 +	if ((prevmx!=mx) || (prevmy!=my)) {
    1.49  		int posx, posy;
    1.50  
    1.51  		/* Give mouse position relative to window position */
    1.52 @@ -342,27 +340,27 @@
    1.53  
    1.54  		SDL_PrivateMouseMotion(0, 0, posx, posy);
    1.55  	}
    1.56 -	prevmousex = mx;
    1.57 -	prevmousey = my;
    1.58 +
    1.59 +	prevmx = mx;
    1.60 +	prevmy = my;
    1.61  }
    1.62  
    1.63  static void do_mouse_buttons(_THIS, short mb)
    1.64  {
    1.65 -	static short prevmouseb=0;
    1.66  	int i;
    1.67  
    1.68  	/* Don't return mouse events if out of window */
    1.69  	if ((SDL_GetAppState() & SDL_APPMOUSEFOCUS)==0)
    1.70  		return;
    1.71  
    1.72 -	if (prevmouseb==mb)
    1.73 +	if (prevmb==mb)
    1.74  		return;
    1.75  
    1.76  	for (i=0;i<3;i++) {
    1.77  		int curbutton, prevbutton;
    1.78  		
    1.79  		curbutton = mb & (1<<i);
    1.80 -		prevbutton = prevmouseb & (1<<i);
    1.81 +		prevbutton = prevmb & (1<<i);
    1.82  	
    1.83  		if (curbutton && !prevbutton) {
    1.84  			SDL_PrivateMouseButton(SDL_PRESSED, i+1, 0, 0);
    1.85 @@ -372,7 +370,7 @@
    1.86  		}
    1.87  	}
    1.88  
    1.89 -	prevmouseb = mb;
    1.90 +	prevmb = mb;
    1.91  }
    1.92  
    1.93  /* Check if mouse in visible area of the window */