Allow mouse to be locked when grabbed with GEM driver SDL-1.2
authorPatrice Mandin <patmandin@gmail.com>
Tue, 12 Sep 2006 19:28:54 +0000
branchSDL-1.2
changeset 3857 be01e0b82dca
parent 3856 492ff98822fd
child 3858 9ffd318e7b64
Allow mouse to be locked when grabbed with GEM driver
src/video/ataricommon/SDL_xbiosevents.c
src/video/ataricommon/SDL_xbiosevents_c.h
src/video/ataricommon/SDL_xbiosinterrupt.S
src/video/ataricommon/SDL_xbiosinterrupt_s.h
--- a/src/video/ataricommon/SDL_xbiosevents.c	Tue Sep 12 19:20:50 2006 +0000
+++ b/src/video/ataricommon/SDL_xbiosevents.c	Tue Sep 12 19:28:54 2006 +0000
@@ -49,7 +49,8 @@
 	void *oldpile;
 
 	/* Clear variables */
-	SDL_AtariXbios_mouseb =
+	SDL_AtariXbios_mouselock =
+		SDL_AtariXbios_mouseb =
 		SDL_AtariXbios_mousex =
 		SDL_AtariXbios_mousey =
 		SDL_AtariXbios_joystick =
@@ -146,3 +147,8 @@
 		atari_prevmouseb = SDL_AtariXbios_mouseb;
 	}
 }
+
+void SDL_AtariXbios_LockMousePosition(SDL_bool lockPosition)
+{
+	SDL_AtariXbios_mouselock = lockPosition;
+}
--- a/src/video/ataricommon/SDL_xbiosevents_c.h	Tue Sep 12 19:20:50 2006 +0000
+++ b/src/video/ataricommon/SDL_xbiosevents_c.h	Tue Sep 12 19:28:54 2006 +0000
@@ -43,5 +43,6 @@
 extern void SDL_AtariXbios_InstallVectors(int vectors_mask);
 extern void SDL_AtariXbios_RestoreVectors(void);
 extern void SDL_AtariXbios_PostMouseEvents(_THIS, SDL_bool buttonEvents);
+extern void SDL_AtariXbios_LockMousePosition(SDL_bool lockPosition);
 
 #endif /* _SDL_XBIOSEVENTS_H_ */
--- a/src/video/ataricommon/SDL_xbiosinterrupt.S	Tue Sep 12 19:20:50 2006 +0000
+++ b/src/video/ataricommon/SDL_xbiosinterrupt.S	Tue Sep 12 19:28:54 2006 +0000
@@ -33,6 +33,7 @@
 	.globl	_SDL_AtariXbios_MouseVector
 	.globl	_SDL_AtariXbios_JoystickVector
 
+	.globl	_SDL_AtariXbios_mouselock
 	.globl	_SDL_AtariXbios_mouseb
 	.globl	_SDL_AtariXbios_mousex
 	.globl	_SDL_AtariXbios_mousey
@@ -125,6 +126,13 @@
 	extw	d0
 	addw	d0,_SDL_AtariXbios_mousey
 
+	/* Lock mouse position ? */
+	tstw	_SDL_AtariXbios_mouselock
+	beq.s	no_mouse_lock
+	clrb	a0@(1)
+	clrb	a0@(2)
+no_mouse_lock:
+
 	/* Jump through old vector */
 	movel	sp@+,d0
 
@@ -133,10 +141,9 @@
 
 	.data
 	.even
+	.comm	_SDL_AtariXbios_mouselock,2*1
 	.comm	_SDL_AtariXbios_mousex,2*1
-	.even
 	.comm	_SDL_AtariXbios_mousey,2*1
-	.even
 	.comm	_SDL_AtariXbios_mouseb,2*1
 
 /*--- Our joystick vector ---*/
--- a/src/video/ataricommon/SDL_xbiosinterrupt_s.h	Tue Sep 12 19:20:50 2006 +0000
+++ b/src/video/ataricommon/SDL_xbiosinterrupt_s.h	Tue Sep 12 19:28:54 2006 +0000
@@ -36,6 +36,7 @@
 
 /* Variables */
 
+extern volatile Uint16 SDL_AtariXbios_mouselock;	/* mouse lock position */
 extern volatile Uint16 SDL_AtariXbios_mouseb;	/* buttons */
 extern volatile Sint16 SDL_AtariXbios_mousex;	/* X relative motion */
 extern volatile Sint16 SDL_AtariXbios_mousey;	/* Y relative motion */