diff src/video/ataricommon/SDL_xbiosevents.c @ 1895:c121d94672cb

SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 10 Jul 2006 21:04:37 +0000
parents d910939febfa
children b7d426b28c18
line wrap: on
line diff
--- a/src/video/ataricommon/SDL_xbiosevents.c	Thu Jul 06 18:01:37 2006 +0000
+++ b/src/video/ataricommon/SDL_xbiosevents.c	Mon Jul 10 21:04:37 2006 +0000
@@ -35,114 +35,120 @@
 
 /* Variables */
 
-int SDL_AtariXbios_enabled=0;
+int SDL_AtariXbios_enabled = 0;
 
 /* Local variables */
 
-static _KBDVECS *kbdvecs;		/* Pointer to access system vectors */
-static Uint16 atari_prevmouseb;	/* buttons */
+static _KBDVECS *kbdvecs;       /* Pointer to access system vectors */
+static Uint16 atari_prevmouseb; /* buttons */
 
 /* Functions */
 
-void SDL_AtariXbios_InstallVectors(int vectors_mask)
+void
+SDL_AtariXbios_InstallVectors(int vectors_mask)
 {
-	void *oldpile;
+    void *oldpile;
 
-	/* Clear variables */
-	SDL_AtariXbios_mouseb =
-		SDL_AtariXbios_mousex =
-		SDL_AtariXbios_mousey =
-		SDL_AtariXbios_joystick =
-		atari_prevmouseb = 0;
+    /* Clear variables */
+    SDL_AtariXbios_mouseb =
+        SDL_AtariXbios_mousex =
+        SDL_AtariXbios_mousey =
+        SDL_AtariXbios_joystick = atari_prevmouseb = 0;
 
-	if (vectors_mask==0) {
-		SDL_AtariXbios_enabled=0;
-		return;
-	}
+    if (vectors_mask == 0) {
+        SDL_AtariXbios_enabled = 0;
+        return;
+    }
 
-	/* Read IKBD vectors base */
-	kbdvecs=Kbdvbase();
+    /* Read IKBD vectors base */
+    kbdvecs = Kbdvbase();
 
-	/* Go to supervisor mode */
-	oldpile=(void *)Super(0);
+    /* Go to supervisor mode */
+    oldpile = (void *) Super(0);
 
-	/* Install our vectors */
-	SDL_AtariXbios_Install(
-		kbdvecs,
-		(vectors_mask & ATARI_XBIOS_MOUSEEVENTS) ? SDL_AtariXbios_MouseVector : NULL,
-		(vectors_mask & ATARI_XBIOS_JOYSTICKEVENTS) ? SDL_AtariXbios_JoystickVector : NULL
-	);
+    /* Install our vectors */
+    SDL_AtariXbios_Install(kbdvecs,
+                           (vectors_mask & ATARI_XBIOS_MOUSEEVENTS) ?
+                           SDL_AtariXbios_MouseVector : NULL,
+                           (vectors_mask & ATARI_XBIOS_JOYSTICKEVENTS) ?
+                           SDL_AtariXbios_JoystickVector : NULL);
 
-	/* Back to user mode */
-	Super(oldpile);
+    /* Back to user mode */
+    Super(oldpile);
 
-	SDL_AtariXbios_enabled=1;
+    SDL_AtariXbios_enabled = 1;
 }
 
-void SDL_AtariXbios_RestoreVectors(void)
+void
+SDL_AtariXbios_RestoreVectors(void)
 {
-	void *oldpile;
+    void *oldpile;
 
-	if (SDL_AtariXbios_enabled==0) {
-		return;
-	}
+    if (SDL_AtariXbios_enabled == 0) {
+        return;
+    }
+
+    /* Read IKBD vectors base */
+    kbdvecs = Kbdvbase();
+
+    /* Go to supervisor mode */
+    oldpile = (void *) Super(NULL);
 
-	/* Read IKBD vectors base */
-	kbdvecs=Kbdvbase();
+    /* Reinstall system vector */
+    SDL_AtariXbios_Restore(kbdvecs);
 
-	/* Go to supervisor mode */
-	oldpile=(void *)Super(NULL);
+    /* Back to user mode */
+    Super(oldpile);
+}
 
-	/* Reinstall system vector */
-	SDL_AtariXbios_Restore(kbdvecs);
-
-	/* Back to user mode */
-	Super(oldpile);
+static int
+atari_GetButton(int button)
+{
+    switch (button) {
+    case 0:
+        return SDL_BUTTON_RIGHT;
+        break;
+    case 1:
+    default:
+        return SDL_BUTTON_LEFT;
+        break;
+    }
 }
 
-static int atari_GetButton(int button)
+void
+SDL_AtariXbios_PostMouseEvents(_THIS, SDL_bool buttonEvents)
 {
-	switch(button)
-	{
-		case 0:
-			return SDL_BUTTON_RIGHT;
-			break;
-		case 1:
-		default:
-			return SDL_BUTTON_LEFT;
-			break;
-	}
+    if (SDL_AtariXbios_enabled == 0) {
+        return;
+    }
+
+    /* Mouse motion ? */
+    if (SDL_AtariXbios_mousex || SDL_AtariXbios_mousey) {
+        SDL_PrivateMouseMotion(0, 1, SDL_AtariXbios_mousex,
+                               SDL_AtariXbios_mousey);
+        SDL_AtariXbios_mousex = SDL_AtariXbios_mousey = 0;
+    }
+
+    /* Mouse button ? */
+    if (buttonEvents && (SDL_AtariXbios_mouseb != atari_prevmouseb)) {
+        int i;
+
+        for (i = 0; i < 2; i++) {
+            int curbutton, prevbutton;
+
+            curbutton = SDL_AtariXbios_mouseb & (1 << i);
+            prevbutton = atari_prevmouseb & (1 << i);
+
+            if (curbutton && !prevbutton) {
+                SDL_PrivateMouseButton(SDL_PRESSED, atari_GetButton(i), 0, 0);
+            }
+            if (!curbutton && prevbutton) {
+                SDL_PrivateMouseButton(SDL_RELEASED,
+                                       atari_GetButton(i), 0, 0);
+            }
+        }
+        atari_prevmouseb = SDL_AtariXbios_mouseb;
+    }
 }
 
-void SDL_AtariXbios_PostMouseEvents(_THIS, SDL_bool buttonEvents)
-{
-	if (SDL_AtariXbios_enabled==0) {
-		return;
-	}
-
-	/* Mouse motion ? */
-	if (SDL_AtariXbios_mousex || SDL_AtariXbios_mousey) {
-		SDL_PrivateMouseMotion(0, 1, SDL_AtariXbios_mousex, SDL_AtariXbios_mousey);
-		SDL_AtariXbios_mousex = SDL_AtariXbios_mousey = 0;
-	}
-	
-	/* Mouse button ? */
-	if (buttonEvents && (SDL_AtariXbios_mouseb != atari_prevmouseb)) {
-		int i;
-
-		for (i=0;i<2;i++) {
-			int curbutton, prevbutton;
-
-			curbutton = SDL_AtariXbios_mouseb & (1<<i);
-			prevbutton = atari_prevmouseb & (1<<i);
-
-			if (curbutton && !prevbutton) {
-				SDL_PrivateMouseButton(SDL_PRESSED, atari_GetButton(i), 0, 0);
-			}
-			if (!curbutton && prevbutton) {
-				SDL_PrivateMouseButton(SDL_RELEASED, atari_GetButton(i), 0, 0);
-			}
-		}
-		atari_prevmouseb = SDL_AtariXbios_mouseb;
-	}
-}
+/* vi: set ts=4 sw=4 expandtab: */