diff src/video/ataricommon/SDL_gemdosevents.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_gemdosevents.c	Thu Feb 23 04:16:08 2006 +0000
+++ b/src/video/ataricommon/SDL_gemdosevents.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 gemdos_currentkeyboard[ATARIBIOS_MAXKEYS];
 static unsigned char gemdos_previouskeyboard[ATARIBIOS_MAXKEYS];
 static unsigned char gemdos_currentascii[ATARIBIOS_MAXKEYS];
+static SDL_bool use_dev_mouse = SDL_FALSE;
 
 /* Special keys state */
 enum {
@@ -106,11 +108,15 @@
 	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;
 	}
-
 	SDL_AtariXbios_InstallVectors(vectors_mask);
 }
 
@@ -151,7 +157,11 @@
 				TranslateKey(i, gemdos_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(gemdos_previouskeyboard, gemdos_currentkeyboard, ATARIBIOS_MAXKEYS);
@@ -197,4 +207,7 @@
 void AtariGemdos_ShutdownEvents(void)
 {
 	SDL_AtariXbios_RestoreVectors();
+	if (use_dev_mouse) {
+		SDL_AtariDevMouse_Close();
+	}
 }