diff src/video/ataricommon/SDL_biosevents.c @ 1420:2405517b5eab

Added preliminary support for MiNT /dev/mouse driver (disabled atm)
author Patrice Mandin <patmandin@gmail.com>
date Thu, 23 Feb 2006 21:51:10 +0000
parents d910939febfa
children 782fd950bd46 c121d94672cb f1816773a309
line wrap: on
line diff
--- a/src/video/ataricommon/SDL_biosevents.c	Thu Feb 23 04:16:08 2006 +0000
+++ b/src/video/ataricommon/SDL_biosevents.c	Thu Feb 23 21:51:10 2006 +0000
@@ -37,6 +37,7 @@
 #include "SDL_atarikeys.h"
 #include "SDL_atarievents_c.h"
 #include "SDL_xbiosevents_c.h"
+#include "SDL_ataridevmouse_c.h"
 
 /* To save state of keyboard */
 #define ATARIBIOS_MAXKEYS 128
@@ -44,6 +45,7 @@
 static unsigned char bios_currentkeyboard[ATARIBIOS_MAXKEYS];
 static unsigned char bios_previouskeyboard[ATARIBIOS_MAXKEYS];
 static unsigned char bios_currentascii[ATARIBIOS_MAXKEYS];
+static SDL_bool use_dev_mouse = SDL_FALSE;
 
 /* Special keys state */
 enum {
@@ -101,7 +103,12 @@
 	keymap[SCANCODE_LEFTALT] = SDLK_LALT;
 	keymap[SCANCODE_CAPSLOCK] = SDLK_CAPSLOCK;
 
-	vectors_mask = ATARI_XBIOS_MOUSEEVENTS|ATARI_XBIOS_JOYSTICKEVENTS;
+	use_dev_mouse = (SDL_AtariDevMouse_Open()!=0) ? SDL_TRUE : SDL_FALSE;
+
+	vectors_mask = ATARI_XBIOS_JOYSTICKEVENTS;	/* XBIOS joystick events */
+	if (!use_dev_mouse) {
+		vectors_mask |= ATARI_XBIOS_MOUSEEVENTS;	/* XBIOS mouse events */
+	}
 	if (Getcookie(C_MiNT, &dummy)==C_FOUND) {
 		vectors_mask = 0;
 	}
@@ -146,7 +153,11 @@
 				TranslateKey(i, bios_currentascii[i], &keysym, SDL_FALSE));
 	}
 
-	SDL_AtariXbios_PostMouseEvents(this, SDL_TRUE);
+	if (use_dev_mouse) {
+		SDL_AtariDevMouse_PostMouseEvents(this, SDL_TRUE);
+	} else {
+		SDL_AtariXbios_PostMouseEvents(this, SDL_TRUE);
+	}
 
 	/* Will be previous table */
 	SDL_memcpy(bios_previouskeyboard, bios_currentkeyboard, ATARIBIOS_MAXKEYS);
@@ -192,4 +203,7 @@
 void AtariBios_ShutdownEvents(void)
 {
 	SDL_AtariXbios_RestoreVectors();
+	if (use_dev_mouse) {
+		SDL_AtariDevMouse_Close();
+	}
 }