src/video/gem/SDL_gemevents.c
branchSDL-1.2
changeset 6584 6b04ece9686b
parent 6583 15c1dc6ac329
child 6585 bc23c3b164fa
equal deleted inserted replaced
6583:15c1dc6ac329 6584:6b04ece9686b
   314 	/* Don't return mouse events if out of window */
   314 	/* Don't return mouse events if out of window */
   315 	if ((SDL_GetAppState() & SDL_APPMOUSEFOCUS)==0) {
   315 	if ((SDL_GetAppState() & SDL_APPMOUSEFOCUS)==0) {
   316 		return;
   316 		return;
   317 	}
   317 	}
   318 
   318 
       
   319 	/* Relative mouse motion ? */
       
   320 	if (GEM_mouse_relative) {
       
   321 		if (GEM_usedevmouse) {
       
   322 			SDL_AtariDevMouse_PostMouseEvents(this, SDL_FALSE);
       
   323 		} else {
       
   324 			SDL_AtariXbios_PostMouseEvents(this, SDL_FALSE);
       
   325 		}
       
   326 		return;
       
   327 	}
       
   328 
   319 	/* Retrieve window coords, and generate mouse events accordingly */
   329 	/* Retrieve window coords, and generate mouse events accordingly */
   320 	x2 = y2 = 0;
   330 	x2 = y2 = 0;
   321 	w2 = VDI_w;
   331 	w2 = VDI_w;
   322 	h2 = VDI_h;
   332 	h2 = VDI_h;
   323 	if ((!GEM_fullscreen) && (GEM_handle>=0)) {
   333 	if ((!GEM_fullscreen) && (GEM_handle>=0)) {
   324 		wind_get (GEM_handle, WF_WORKXYWH, &x2, &y2, &w2, &h2);
   334 		wind_get (GEM_handle, WF_WORKXYWH, &x2, &y2, &w2, &h2);
   325 	}
   335 	}
   326 
   336 
   327 	/* Mouse motion ? */
   337 	if ((prevmousex!=mx) || (prevmousey!=my)) {
   328 	if (GEM_mouse_relative) {
   338 		int posx, posy;
   329 		if (GEM_usedevmouse) {
   339 
   330 			SDL_AtariDevMouse_PostMouseEvents(this, SDL_FALSE);
   340 		/* Give mouse position relative to window position */
   331 		} else {
   341 		posx = mx - x2;
   332 			SDL_AtariXbios_PostMouseEvents(this, SDL_FALSE);
   342 		if (posx<0) posx = 0;
   333 		}
   343 		if (posx>w2) posx = w2-1;
   334 	} else {
   344 		posy = my - y2;
   335 		if ((prevmousex!=mx) || (prevmousey!=my)) {
   345 		if (posy<0) posy = 0;
   336 			int posx, posy;
   346 		if (posy>h2) posy = h2-1;
   337 
   347 
   338 			/* Give mouse position relative to window position */
   348 		SDL_PrivateMouseMotion(0, 0, posx, posy);
   339 			posx = mx - x2;
   349 	}
   340 			if (posx<0) posx = 0;
   350 	prevmousex = mx;
   341 			if (posx>w2) posx = w2-1;
   351 	prevmousey = my;
   342 			posy = my - y2;
       
   343 			if (posy<0) posy = 0;
       
   344 			if (posy>h2) posy = h2-1;
       
   345 
       
   346 			SDL_PrivateMouseMotion(0, 0, posx, posy);
       
   347 		}
       
   348 		prevmousex = mx;
       
   349 		prevmousey = my;
       
   350 	}
       
   351 }
   352 }
   352 
   353 
   353 static void do_mouse_buttons(_THIS, short mb)
   354 static void do_mouse_buttons(_THIS, short mb)
   354 {
   355 {
   355 	static short prevmouseb=0;
   356 	static short prevmouseb=0;