1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-19 17:28:18 +00:00
Interlisp.maiko/src/mouseif.c
Nick Briggs 3d9f090e70
Cleanup of includes and related changes based on include-what-you-use diagnostics (#436)
Remove unused #define PERCENT_OF_SCREEN in MyWindow.h
Move structures for dir.c to dirdefs.h where they are used
Resolve S_CHAR vs S_CHARACTER in favor of S_CHARACTER and cleanup #defines
Fix  = vs == bug in FSDEBUG code in dir.c
Eliminate duplicate/unused constant definitions in gcr.c
Declare static internal function bytecmp in mkatom.c
Update many source and include files to include headers for what they use
2022-08-10 11:07:57 -07:00

121 lines
3.8 KiB
C

/* $Id: mouseif.c,v 1.2 1999/01/03 02:07:26 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved
*/
/************************************************************************/
/* */
/* (C) Copyright 1989, 1990, 1990, 1991, 1992, 1993, 1994, 1995 Venue. */
/* All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/************************************************************************/
/* * * * D O S M O U S E I N T E R F A C E * * * */
#include "version.h"
#include "devif.h" // for MouseInterface, MouseInterfaceRec
MouseInterfaceRec curmouse;
MouseInterface currentmouse = &curmouse;
#ifdef DOS
#include <dos.h>
#include "lispemul.h"
int nomouseflag = FALSE;
extern DLword *Lisp_world;
extern LispPTR *LASTUSERACTION68k;
extern int twobuttonflag;
extern void EnterDosMouse();
extern void ExitDosMouse();
extern void DosMouseAfterRaid();
extern void DosMouseBeforeRaid();
extern unsigned long GenericReturnT();
extern void ThreeButtonHandler();
extern void TwoButtonHandler();
#endif /* DOS */
#ifdef DOS
/*****************************************************************/
/* p r o b e m o u s e */
/* */
/* Probe for mouse and return the number of buttons available. */
/*****************************************************************/
int probemouse() {
union REGS regs;
char c;
/***************************************************************************
* Reset mouse driver, exit if no mouse driver present
***************************************************************************/
/* int 33h, case 0000, ax = drive installed, bx = # of buttons. */
if (nomouseflag) {
return (666); /* return something, why not 666? */
} else {
regs.w.eax = 0; /* Func 0 = Reset mouse, ret. button info */
int86(0x33, &regs, &regs);
if (regs.x.ax == 0x0000) VESA_errorexit("No mouse driver found.", -1);
return (regs.x.bx);
}
}
#endif
void make_mouse_instance(MouseInterface mouse)
{
#ifdef DOS
int NumberOfButtons;
if (nomouseflag) {
mouse->device.enter = &GenericReturnT;
mouse->device.exit = &GenericReturnT;
mouse->device.before_raid = &GenericReturnT;
mouse->device.after_raid = &GenericReturnT;
mouse->device.active = FALSE;
NumberOfButtons = 3;
} else {
mouse->device.enter = &EnterDosMouse;
mouse->device.exit = &ExitDosMouse;
mouse->device.before_raid = &DosMouseBeforeRaid;
mouse->device.after_raid = &DosMouseAfterRaid;
mouse->device.active = FALSE;
NumberOfButtons = probemouse();
}
mouse->Button.StartTime = 2;
mouse->Cursor.Last.width = 16;
mouse->Cursor.Last.height = 16;
if (nomouseflag == FALSE) {
if (twobuttonflag) { /* We force two button handling. */
mouse->Handler = &TwoButtonHandler;
mouse->Button.TwoButtonP = TRUE;
} else /* Determine how many buttons we have. */
switch (NumberOfButtons) {
case 0x0000: /* Other than 2 buttons, assume three */
mouse->Button.TwoButtonP = FALSE;
mouse->Handler = &ThreeButtonHandler;
break;
case 0x0002: /* Two buttons. */
mouse->Button.TwoButtonP = TRUE;
mouse->Handler = &TwoButtonHandler;
break;
case 0x0003: /* Three buttons. */
mouse->Button.TwoButtonP = FALSE;
mouse->Handler = &ThreeButtonHandler;
break;
case 0xffff: /* Two buttons. */
mouse->Button.TwoButtonP = TRUE;
mouse->Handler = &TwoButtonHandler;
break;
default: /* Strange case, assume three. */
mouse->Button.TwoButtonP = FALSE;
mouse->Handler = &ThreeButtonHandler;
break;
}
}
/* mouse->timestamp = ((*LASTUSERACTION68k& 0xffffff) + Lisp_world); */
#elif XWINDOW
#endif /* DOS or XWINDOW */
}