gem: Handle relative mouse motion earlier SDL-1.2
authorPatrice Mandin <patmandin@gmail.com>
Fri, 12 Oct 2012 18:37:59 +0200
branchSDL-1.2
changeset 65846b04ece9686b
parent 6583 15c1dc6ac329
child 6585 bc23c3b164fa
gem: Handle relative mouse motion earlier
src/video/gem/SDL_gemevents.c
     1.1 --- a/src/video/gem/SDL_gemevents.c	Fri Oct 12 18:35:50 2012 +0200
     1.2 +++ b/src/video/gem/SDL_gemevents.c	Fri Oct 12 18:37:59 2012 +0200
     1.3 @@ -316,6 +316,16 @@
     1.4  		return;
     1.5  	}
     1.6  
     1.7 +	/* Relative mouse motion ? */
     1.8 +	if (GEM_mouse_relative) {
     1.9 +		if (GEM_usedevmouse) {
    1.10 +			SDL_AtariDevMouse_PostMouseEvents(this, SDL_FALSE);
    1.11 +		} else {
    1.12 +			SDL_AtariXbios_PostMouseEvents(this, SDL_FALSE);
    1.13 +		}
    1.14 +		return;
    1.15 +	}
    1.16 +
    1.17  	/* Retrieve window coords, and generate mouse events accordingly */
    1.18  	x2 = y2 = 0;
    1.19  	w2 = VDI_w;
    1.20 @@ -324,30 +334,21 @@
    1.21  		wind_get (GEM_handle, WF_WORKXYWH, &x2, &y2, &w2, &h2);
    1.22  	}
    1.23  
    1.24 -	/* Mouse motion ? */
    1.25 -	if (GEM_mouse_relative) {
    1.26 -		if (GEM_usedevmouse) {
    1.27 -			SDL_AtariDevMouse_PostMouseEvents(this, SDL_FALSE);
    1.28 -		} else {
    1.29 -			SDL_AtariXbios_PostMouseEvents(this, SDL_FALSE);
    1.30 -		}
    1.31 -	} else {
    1.32 -		if ((prevmousex!=mx) || (prevmousey!=my)) {
    1.33 -			int posx, posy;
    1.34 +	if ((prevmousex!=mx) || (prevmousey!=my)) {
    1.35 +		int posx, posy;
    1.36  
    1.37 -			/* Give mouse position relative to window position */
    1.38 -			posx = mx - x2;
    1.39 -			if (posx<0) posx = 0;
    1.40 -			if (posx>w2) posx = w2-1;
    1.41 -			posy = my - y2;
    1.42 -			if (posy<0) posy = 0;
    1.43 -			if (posy>h2) posy = h2-1;
    1.44 +		/* Give mouse position relative to window position */
    1.45 +		posx = mx - x2;
    1.46 +		if (posx<0) posx = 0;
    1.47 +		if (posx>w2) posx = w2-1;
    1.48 +		posy = my - y2;
    1.49 +		if (posy<0) posy = 0;
    1.50 +		if (posy>h2) posy = h2-1;
    1.51  
    1.52 -			SDL_PrivateMouseMotion(0, 0, posx, posy);
    1.53 -		}
    1.54 -		prevmousex = mx;
    1.55 -		prevmousey = my;
    1.56 +		SDL_PrivateMouseMotion(0, 0, posx, posy);
    1.57  	}
    1.58 +	prevmousex = mx;
    1.59 +	prevmousey = my;
    1.60  }
    1.61  
    1.62  static void do_mouse_buttons(_THIS, short mb)