src/video/ataricommon/SDL_xbiosmouseevents.c
changeset 305 9c6613983e85
parent 304 ec53caed9fb2
child 306 3879bed3395c
     1.1 --- a/src/video/ataricommon/SDL_xbiosmouseevents.c	Sun Mar 10 03:25:47 2002 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,127 +0,0 @@
     1.4 -/*
     1.5 -    SDL - Simple DirectMedia Layer
     1.6 -    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002  Sam Lantinga
     1.7 -
     1.8 -    This library is free software; you can redistribute it and/or
     1.9 -    modify it under the terms of the GNU Library General Public
    1.10 -    License as published by the Free Software Foundation; either
    1.11 -    version 2 of the License, or (at your option) any later version.
    1.12 -
    1.13 -    This library is distributed in the hope that it will be useful,
    1.14 -    but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.16 -    Library General Public License for more details.
    1.17 -
    1.18 -    You should have received a copy of the GNU Library General Public
    1.19 -    License along with this library; if not, write to the Free
    1.20 -    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.21 -
    1.22 -    Sam Lantinga
    1.23 -    slouken@libsdl.org
    1.24 -*/
    1.25 -
    1.26 -#ifdef SAVE_RCSID
    1.27 -static char rcsid =
    1.28 - "@(#) $Id$";
    1.29 -#endif
    1.30 -
    1.31 -/*
    1.32 - *	IKBD 6301 mouse vector
    1.33 - *
    1.34 - *	Patrice Mandin
    1.35 - */
    1.36 -
    1.37 -#include <stdlib.h>
    1.38 -#include <string.h>
    1.39 -#include <mint/osbind.h>
    1.40 -
    1.41 -#include "SDL_events_c.h"
    1.42 -#include "SDL_xbiosmouseinterrupt_s.h"
    1.43 -
    1.44 -static _KBDVECS *kbdvecs;		/* Pointer to access vectors */
    1.45 -static _KBDVECS sys_kbdvecs;	/* Backup of system vectors */
    1.46 -
    1.47 -/* Variables */
    1.48 -
    1.49 -static Uint16 atari_prevmouseb;	/* buttons */
    1.50 -
    1.51 -void AtariXbios_InstallMouseVector(void)
    1.52 -{
    1.53 -	void *oldpile;
    1.54 -
    1.55 -	/* Read IKBD vectors base */
    1.56 -	kbdvecs=Kbdvbase();
    1.57 -
    1.58 -	/* Go to supervisor mode */
    1.59 -	oldpile=(void *)Super(0);
    1.60 -
    1.61 -	/* Backup system vectors */
    1.62 -	memcpy(&sys_kbdvecs, kbdvecs, sizeof(_KBDVECS));
    1.63 -
    1.64 -	/* Install our vector */
    1.65 -	SDL_AtariXbiosMouseInstall(kbdvecs,SDL_AtariXbiosMouseVector);
    1.66 -
    1.67 -	/* Back to user mode */
    1.68 -	Super(oldpile);
    1.69 -
    1.70 -	/* Clear variables */
    1.71 -	SDL_AtariXbios_mouseb = SDL_AtariXbios_mousex = SDL_AtariXbios_mousey = 0;
    1.72 -	atari_prevmouseb = 0;
    1.73 -}
    1.74 -
    1.75 -void AtariXbios_RestoreMouseVector(void)
    1.76 -{
    1.77 -	void *oldpile;
    1.78 -
    1.79 -	/* Go to supervisor mode */
    1.80 -	oldpile=(void *)Super(NULL);
    1.81 -
    1.82 -	/* Reinstall system vector */
    1.83 -	SDL_AtariXbiosMouseInstall(kbdvecs,sys_kbdvecs.mousevec);
    1.84 -
    1.85 -	/* Back to user mode */
    1.86 -	Super(oldpile);
    1.87 -}
    1.88 -
    1.89 -static int atari_GetButton(int button)
    1.90 -{
    1.91 -	switch(button)
    1.92 -	{
    1.93 -		case 0:
    1.94 -			return SDL_BUTTON_RIGHT;
    1.95 -			break;
    1.96 -		case 1:
    1.97 -		default:
    1.98 -			return SDL_BUTTON_LEFT;
    1.99 -			break;
   1.100 -	}
   1.101 -}
   1.102 -
   1.103 -void AtariXbios_PostMouseEvents(_THIS)
   1.104 -{
   1.105 -	/* Mouse motion ? */
   1.106 -	if (SDL_AtariXbios_mousex || SDL_AtariXbios_mousey) {
   1.107 -		SDL_PrivateMouseMotion(0, 1, SDL_AtariXbios_mousex, SDL_AtariXbios_mousey);
   1.108 -		SDL_AtariXbios_mousex = SDL_AtariXbios_mousey = 0;
   1.109 -	}
   1.110 -	
   1.111 -	/* Mouse button ? */
   1.112 -	if (SDL_AtariXbios_mouseb != atari_prevmouseb) {
   1.113 -		int i;
   1.114 -
   1.115 -		for (i=0;i<2;i++) {
   1.116 -			int curbutton, prevbutton;
   1.117 -
   1.118 -			curbutton = SDL_AtariXbios_mouseb & (1<<i);
   1.119 -			prevbutton = atari_prevmouseb & (1<<i);
   1.120 -
   1.121 -			if (curbutton & !prevbutton) {
   1.122 -				SDL_PrivateMouseButton(SDL_PRESSED, atari_GetButton(i), 0, 0);
   1.123 -			}
   1.124 -			if (!curbutton & prevbutton) {
   1.125 -				SDL_PrivateMouseButton(SDL_RELEASED, atari_GetButton(i), 0, 0);
   1.126 -			}
   1.127 -		}
   1.128 -		atari_prevmouseb = SDL_AtariXbios_mouseb;
   1.129 -	}
   1.130 -}