1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-30 05:24:22 +00:00

Reformat all C source files with Clang-format in Google style w/ 100 col width.

This commit is contained in:
Nick Briggs
2017-05-28 18:08:18 -07:00
parent 691645d048
commit 156c3292f8
167 changed files with 40520 additions and 48069 deletions

631
src/dosmouse.c Executable file → Normal file
View File

@@ -1,8 +1,7 @@
/* $Id: dosmouse.c,v 1.2 1999/01/03 02:06:56 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/* $Id: dosmouse.c,v 1.2 1999/01/03 02:06:56 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved
*/
static char *id = "$Id: dosmouse.c,v 1.2 1999/01/03 02:06:56 sybalsky Exp $ Copyright (C) Venue";
/************************************************************************/
/* */
/* (C) Copyright 1989, 1990, 1990, 1991, 1992, 1993, 1994, 1995 Venue. */
@@ -16,15 +15,11 @@ static char *id = "$Id: dosmouse.c,v 1.2 1999/01/03 02:06:56 sybalsky Exp $ Copy
/* */
/************************************************************************/
#include "version.h"
#include <i32.h> /* Defines "#pragma interrupt" */
#include <stk.h> /* _XSTACK struct definition */
#include <dos.h> /* Defines REGS & other structs */
#include <i32.h> /* Defines "#pragma interrupt" */
#include <stk.h> /* _XSTACK struct definition */
#include <dos.h> /* Defines REGS & other structs */
#include "lispemul.h"
#include "display.h"
@@ -46,20 +41,19 @@ extern KbdInterface currentkbd;
extern keybuffer *CTopKeyevent;
extern DLword *DisplayRegion68k;
extern DLword *Lisp_world ;
extern DLword *Lisp_world;
extern LispPTR *KEYBOARDEVENTQUEUE68k;
extern LispPTR *KEYBUFFERING68k;
extern LispPTR *LASTUSERACTION68k;
#define MOUSE_MV 0x01 /* Mouse movement occurred */
#define LB_PRESS 0x02 /* Left button pressed */
#define LB_OFF 0x04 /* Left button released */
#define RB_PRESS 0x08 /* Right button pressed */
#define RB_OFF 0x10 /* Right button released */
#define CB_PRESS 0x20 /* Center button released */
#define CB_OFF 0x40 /* Center button pressed */
#define MOUSE_MV 0x01 /* Mouse movement occurred */
#define LB_PRESS 0x02 /* Left button pressed */
#define LB_OFF 0x04 /* Left button released */
#define RB_PRESS 0x08 /* Right button pressed */
#define RB_OFF 0x10 /* Right button released */
#define CB_PRESS 0x20 /* Center button released */
#define CB_OFF 0x40 /* Center button pressed */
#pragma interrupt(TwoButtonHandler)
#pragma interrupt(ThreeButtonHandler)
@@ -67,26 +61,23 @@ extern LispPTR *LASTUSERACTION68k;
void ButtonTimer();
void MouseButtonSignal();
void EnterDosMouse(mouse, dsp)
MouseInterface mouse;
DspInterface dsp;
void EnterDosMouse(mouse, dsp) MouseInterface mouse;
DspInterface dsp;
{
union REGS regs;
probemouse();
_dpmi_lockregion((void *)&MouseButtonSignal, 4096);
/* Set up the ringbuffer */
if (eurokbd) mouse->keyeventsize = EUROKEYEVENTSIZE;
else mouse->keyeventsize = NOEUROKEYEVENTSIZE;
if (eurokbd)
mouse->keyeventsize = EUROKEYEVENTSIZE;
else
mouse->keyeventsize = NOEUROKEYEVENTSIZE;
mouse->eurokbd = eurokbd;
/* Offset of the end of the ring buffer */
mouse->maxkeyevent = (MINKEYEVENT + (NUMBEROFKEYEVENTS * mouse->keyeventsize));
mouse->maxkeyevent = (MINKEYEVENT + (NUMBEROFKEYEVENTS * mouse->keyeventsize));
/* Lock myself */
_dpmi_lockregion((void *)mouse, sizeof(*mouse));
@@ -95,9 +86,7 @@ void EnterDosMouse(mouse, dsp)
/* Lock the handler routines */
_dpmi_lockregion((void *)mouse->Handler, 4096);
if(mouse->Button.TwoButtonP) {
_dpmi_lockregion((void *)&ButtonTimer, 4096);
}
if (mouse->Button.TwoButtonP) { _dpmi_lockregion((void *)&ButtonTimer, 4096); }
/* Lock the structures used, both pointers to 'em & the whole structure. */
_dpmi_lockregion((void *)&IOPage68K, sizeof(IOPage68K));
@@ -123,49 +112,47 @@ void EnterDosMouse(mouse, dsp)
_dpmi_lockregion((void *)CTopKeyevent, sizeof(*CTopKeyevent));
/* Now Lock the lastuseraction machine. */
/* _dpmi_lockregion(mouse->timestamp, sizeof(LispPTR)); */ /* Lisp_world itself */
/* _dpmi_lockregion(mouse->timestamp, sizeof(LispPTR)); */ /* Lisp_world itself */
regs.w.eax = 0x0001; /* Function 1 = turn on mouse cursor */
regs.w.eax = 0x0001; /* Function 1 = turn on mouse cursor */
int86(0x33, &regs, &regs);
regs.w.eax = 0x0002; /* Function 2 = hide mouse cursor */
regs.w.eax = 0x0002; /* Function 2 = hide mouse cursor */
int86(0x33, &regs, &regs);
regs.w.eax = 0x0C; /* Function 0C = set user-defined mouse handler */
regs.w.ecx = LB_PRESS | LB_OFF | CB_PRESS | CB_OFF | RB_PRESS | RB_OFF | MOUSE_MV ;
regs.w.eax = 0x0C; /* Function 0C = set user-defined mouse handler */
regs.w.ecx = LB_PRESS | LB_OFF | CB_PRESS | CB_OFF | RB_PRESS | RB_OFF | MOUSE_MV;
regs.w.edx = FP_OFF(*(mouse->Handler)); /* Address of our mouse handler routine */
int86(0x33, &regs, &regs); /* Install our handler to process events */
int86(0x33, &regs, &regs); /* Install our handler to process events */
if (regs.w.eax == 'MERR')
VESA_errorexit("Unable to install mouse handler - not enough low memory.\n", -1);
regs.x.ax = 0x7; /* Set mouse horizontal range */
regs.x.ax = 0x7; /* Set mouse horizontal range */
regs.x.cx = 0x0;
regs.x.dx = (short)( dsp->Display.width - 1);
regs.x.dx = (short)(dsp->Display.width - 1);
int86(0x33, &regs, &regs);
regs.x.ax = 0x8; /* Set mouse vertical range */
regs.x.ax = 0x8; /* Set mouse vertical range */
regs.x.cx = 0x0;
regs.x.dx = (short)( dsp->Display.height - 1 );
regs.x.dx = (short)(dsp->Display.height - 1);
int86(0x33, &regs, &regs);
/* See if turning this off fixes the "mouse granularity" problem */
/* Nope. It didn't. */
regs.x.ax = 0xf; /* Set mickey per pixel range */
regs.x.ax = 0xf; /* Set mickey per pixel range */
regs.x.cx = 0x8;
regs.x.dx = 0x8;
int86(0x33, &regs, &regs);
mouse->Button.NextHandler = _dos_getvect(0x1c);
_dos_setvect(0x1c, ButtonTimer);
mouse->device.active = TRUE;
}
void ExitDosMouse(mouse)
MouseInterface mouse;
void ExitDosMouse(mouse) MouseInterface mouse;
{
if( mouse->device.active ){
if (mouse->device.active) {
/* Unlock myself */
_dpmi_unlockregion((void *)mouse, sizeof(*mouse));
_dpmi_unlockregion((void *)&currentmouse, sizeof(currentmouse));
@@ -175,7 +162,6 @@ void ExitDosMouse(mouse)
_dpmi_unlockregion((void *)&ButtonTimer, 4096);
_dpmi_unlockregion((void *)&MouseButtonSignal, 4096);
/* Unlock the structures used. */
_dpmi_unlockregion((void *)&IOPage68K, sizeof(IOPage68K));
_dpmi_unlockregion((void *)&InterfacePage, sizeof(InterfacePage));
@@ -195,41 +181,35 @@ void ExitDosMouse(mouse)
_dpmi_unlockregion((void *)&CTopKeyevent, sizeof(CTopKeyevent));
_dpmi_unlockregion((void *)CTopKeyevent, sizeof(*CTopKeyevent));
/* _dpmi_unlockregion(mouse->timestamp, sizeof(LispPTR)); */
/* _dpmi_unlockregion(mouse->timestamp, sizeof(LispPTR)); */
_dos_setvect(0x1c, mouse->Button.NextHandler);
mouse->device.active = FALSE;
}
}
void DosMouseAfterRaid(mouse, dsp)
MouseInterface mouse;
DspInterface dsp;
void DosMouseAfterRaid(mouse, dsp) MouseInterface mouse;
DspInterface dsp;
{
union REGS regs;
/* Screen mode changed. We have to reinit the ranges. */
regs.x.ax = 0x7; /* Set mouse horizontal range */
regs.x.ax = 0x7; /* Set mouse horizontal range */
regs.x.cx = 0x0;
regs.x.dx = (short)( dsp->Display.width - 1);
regs.x.dx = (short)(dsp->Display.width - 1);
int86(0x33, &regs, &regs);
regs.x.ax = 0x8; /* Set mouse vertical range */
regs.x.ax = 0x8; /* Set mouse vertical range */
regs.x.cx = 0x0;
regs.x.dx = (short)( dsp->Display.height - 1 );
regs.x.dx = (short)(dsp->Display.height - 1);
int86(0x33, &regs, &regs);
mouse->device.active = TRUE;
}
void DosMouseBeforeRaid(mouse, dsp)
MouseInterface mouse;
DspInterface dsp;
{
mouse->device.active = FALSE;
}
void DosMouseBeforeRaid(mouse, dsp) MouseInterface mouse;
DspInterface dsp;
{ mouse->device.active = FALSE; }
/***************************************************************/
/* d o s _ c u r s o r _ i n v i s s i b l e */
@@ -237,17 +217,10 @@ void DosMouseBeforeRaid(mouse, dsp)
/* and not to the emulator displaybuffer we can make the cursor*/
/* invissible just by updateing the area under the cursor! */
/***************************************************************/
void dos_cursor_invissible(dsp, iop)
DspInterface dsp;
IOPAGE *iop;
void dos_cursor_invissible(dsp, iop) DspInterface dsp;
IOPAGE *iop;
{
(dsp->bitblt_to_screen) (dsp,
DisplayRegion68k,
iop->dlcursorx,
iop->dlcursory,
16, 16);
}
{ (dsp->bitblt_to_screen)(dsp, DisplayRegion68k, iop->dlcursorx, iop->dlcursory, 16, 16); }
/***************************************************************/
/* d o s _ c u r s o r _ v i s s i b l e */
@@ -263,10 +236,8 @@ void dos_cursor_invissible(dsp, iop)
/* */
/***************************************************************/
set_DOSmouseposition(dsp, x, y)
DspInterface dsp;
int x, y;
set_DOSmouseposition(dsp, x, y) DspInterface dsp;
int x, y;
{
union REGS regs;
@@ -276,7 +247,7 @@ set_DOSmouseposition(dsp, x, y)
#ifdef NEVER
/* int 33h, case 0004, cx=col, dx = row */
regs.w.eax = 4; /* Function 4 = move cursor */
regs.w.eax = 4; /* Function 4 = move cursor */
regs.w.ecx = x;
regs.w.edx = y;
int86(0x33, &regs, &regs);
@@ -286,79 +257,77 @@ set_DOSmouseposition(dsp, x, y)
IOPage68K->dlmousex = x;
IOPage68K->dlmousey = y;
/* *(currentmouse->timestamp) = MiscStats->secondstmp; */
/* *(currentmouse->timestamp) = MiscStats->secondstmp; */
(currentdsp->mouse_invissible)( currentdsp, IOPage68K );
(currentdsp->mouse_invissible)(currentdsp, IOPage68K);
currentmouse->Cursor.New.x = IOPage68K->dlcursorx = x;
currentmouse->Cursor.New.y = IOPage68K->dlcursory = y;
(currentdsp->mouse_vissible)( x, y );
(currentdsp->mouse_vissible)(x, y);
dsp->device.locked--;
currentmouse->device.active--;
}
void docopy(newx, newy)
int newx, newy;
void docopy(newx, newy) int newx, newy;
{
register DLword *srcbase, *dstbase;
static int sx, dx, w = 16, h = 16, srcbpl, dstbpl, backwardflg=0;
static int src_comp=0, op=0, gray=0, num_gray=0, curr_gray_line=0;
register DLword *srcbase, *dstbase;
static int sx, dx, w = 16, h = 16, srcbpl, dstbpl, backwardflg = 0;
static int src_comp = 0, op = 0, gray = 0, num_gray = 0, curr_gray_line = 0;
srcbase = IOPage68K->dlcursorbitmap;
dstbase= DisplayRegion68k + ( newy * currentdsp->Display.width/16) ;
dstbase = DisplayRegion68k + (newy * currentdsp->Display.width / 16);
sx = 0;
dx = newx;
w = currentmouse->Cursor.Last.width;
h = currentmouse->Cursor.Last.height;
srcbpl = 16;
dstbpl = currentdsp->Display.width;
op = 2; /* OR-in */
op = 2; /* OR-in */
#ifdef NEWBITBLT
bitblt(srcbase, dstbase, sx, dx, w, h, srcbpl, dstbpl, backwardflg,
src_comp, 2, 0, 0, 0);
bitblt(srcbase, dstbase, sx, dx, w, h, srcbpl, dstbpl, backwardflg, src_comp, 2, 0, 0, 0);
#else
new_bitblt_code;
new_bitblt_code;
#endif /* NEWBITBLT */
}
dostaking_mouse_up(newx, newy)
int newx, newy;
dostaking_mouse_up(newx, newy) int newx, newy;
{
/* save hidden bitmap */
register DLword *srcbase, *dstbase;
static int sx, dx, w = 16, h = 16, srcbpl, dstbpl, backwardflg=0;
static int src_comp=0, op=0, gray=0, num_gray=0, curr_gray_line=0;
register DLword *srcbase, *dstbase;
static int sx, dx, w = 16, h = 16, srcbpl, dstbpl, backwardflg = 0;
static int src_comp = 0, op = 0, gray = 0, num_gray = 0, curr_gray_line = 0;
/* newx and newy are hotspot coordinates. */
/* newx -= currentmouse->Cursor.Hotspot.x; */
/* newy -= ( 15 - currentmouse->Cursor.Hotspot.y); */
/* save image */
srcbase = DisplayRegion68k + ( newy * currentdsp->Display.width/16);
srcbase = DisplayRegion68k + (newy * currentdsp->Display.width / 16);
dstbase = currentmouse->Cursor.Savebitmap;
sx = newx;
dx = 0;
if( currentdsp->Display.width < (newx + 16))
{ currentmouse->Cursor.Last.width = w = currentdsp->Display.width-newx; }
else { currentmouse->Cursor.Last.width = w = 16; };
if (currentdsp->Display.width < (newx + 16)) {
currentmouse->Cursor.Last.width = w = currentdsp->Display.width - newx;
} else {
currentmouse->Cursor.Last.width = w = 16;
};
if(currentdsp->Display.height < (newy + 16))
{ currentmouse->Cursor.Last.height = h = currentdsp->Display.height - newy;}
else
{ currentmouse->Cursor.Last.height = h = 16;};
if (currentdsp->Display.height < (newy + 16)) {
currentmouse->Cursor.Last.height = h = currentdsp->Display.height - newy;
} else {
currentmouse->Cursor.Last.height = h = 16;
};
srcbpl = currentdsp->Display.width;
dstbpl = 16;
op= 0; /* replace */
op = 0; /* replace */
#ifdef NEWBITBLT
bitblt(srcbase, dstbase, sx, dx, w, h, srcbpl, dstbpl, backwardflg,
src_comp, 0, gray, num_gray, curr_gray_line);
bitblt(srcbase, dstbase, sx, dx, w, h, srcbpl, dstbpl, backwardflg, src_comp, 0, gray, num_gray,
curr_gray_line);
#else
new_bitblt_code;
#endif /* NEWBITBLT */
@@ -369,46 +338,39 @@ dostaking_mouse_up(newx, newy)
currentmouse->Cursor.Last.x = newx;
currentmouse->Cursor.Last.y = newy;
(currentdsp->bitblt_to_screen)
(currentdsp, DisplayRegion68k,
currentmouse->Cursor.Last.x,
currentmouse->Cursor.Last.y, w, h);
(currentdsp->bitblt_to_screen)(currentdsp, DisplayRegion68k, currentmouse->Cursor.Last.x,
currentmouse->Cursor.Last.y, w, h);
}
dostaking_mouse_down(dsp, iop)
DspInterface dsp;
IOPAGE *iop;
dostaking_mouse_down(dsp, iop) DspInterface dsp;
IOPAGE *iop;
{
register DLword *srcbase, *dstbase;
static int sx, dx, w, h, srcbpl, dstbpl, backwardflg=0;
static int src_comp=0, op=0, gray=0, num_gray=0, curr_gray_line=0;
register DLword *srcbase, *dstbase;
static int sx, dx, w, h, srcbpl, dstbpl, backwardflg = 0;
static int src_comp = 0, op = 0, gray = 0, num_gray = 0, curr_gray_line = 0;
/* restore saved image */
srcbase = currentmouse->Cursor.Savebitmap;
dstbase = DisplayRegion68k + ( (currentmouse->Cursor.Last.y) * (dsp->Display.width/16)); /* old y */
sx = 0;
dx = currentmouse->Cursor.Last.x; /* old x */
w = currentmouse->Cursor.Last.width;
h = currentmouse->Cursor.Last.height;
srcbpl = 16;
dstbpl = dsp->Display.width;
op=0;
/* restore saved image */
srcbase = currentmouse->Cursor.Savebitmap;
dstbase =
DisplayRegion68k + ((currentmouse->Cursor.Last.y) * (dsp->Display.width / 16)); /* old y */
sx = 0;
dx = currentmouse->Cursor.Last.x; /* old x */
w = currentmouse->Cursor.Last.width;
h = currentmouse->Cursor.Last.height;
srcbpl = 16;
dstbpl = dsp->Display.width;
op = 0;
#ifdef NEWBITBLT
bitblt(srcbase, dstbase, sx, dx, w, h, srcbpl, dstbpl, backwardflg,
src_comp, 0, 0, 0, 0);
bitblt(srcbase, dstbase, sx, dx, w, h, srcbpl, dstbpl, backwardflg, src_comp, 0, 0, 0, 0);
#else
new_bitblt_code;
new_bitblt_code;
#endif /* NEWBITBLT */
(dsp->bitblt_to_screen)
(dsp, DisplayRegion68k,
currentmouse->Cursor.Last.x,
currentmouse->Cursor.Last.y, w, h);
(dsp->bitblt_to_screen)(dsp, DisplayRegion68k, currentmouse->Cursor.Last.x,
currentmouse->Cursor.Last.y, w, h);
}
/************************************************************************/
/* */
/* M o u s e B u t t o n S i g n a l */
@@ -419,51 +381,49 @@ dostaking_mouse_down(dsp, iop)
/* */
/************************************************************************/
void MouseButtonSignal(mouse)
MouseInterface mouse;
{
DLword w,r;
KBEVENT *kbevent;
void MouseButtonSignal(mouse) MouseInterface mouse;
{
DLword w, r;
KBEVENT *kbevent;
/* In the mouse device TRUE means button pressed */
/* In the IOPage 0 means button pressed */
/* Hence the ! in the lines below. */
PUTBASEBIT68K( &(IOPage68K->dlutilin), MOUSE_LEFT, !mouse->Button.Left);
PUTBASEBIT68K( &(IOPage68K->dlutilin), MOUSE_MIDDLE, !mouse->Button.Middle);
PUTBASEBIT68K( &(IOPage68K->dlutilin), MOUSE_RIGHT, !mouse->Button.Right);
/* In the mouse device TRUE means button pressed */
/* In the IOPage 0 means button pressed */
/* Hence the ! in the lines below. */
PUTBASEBIT68K(&(IOPage68K->dlutilin), MOUSE_LEFT, !mouse->Button.Left);
PUTBASEBIT68K(&(IOPage68K->dlutilin), MOUSE_MIDDLE, !mouse->Button.Middle);
PUTBASEBIT68K(&(IOPage68K->dlutilin), MOUSE_RIGHT, !mouse->Button.Right);
r=CTopKeyevent->ring.vectorindex.read;
w=CTopKeyevent->ring.vectorindex.write;
if(r!=w)
{
kbevent=(KBEVENT*)((DLword *)CTopKeyevent+ w);
r = CTopKeyevent->ring.vectorindex.read;
w = CTopKeyevent->ring.vectorindex.write;
/* Copy the Hardware bits. */
kbevent->W0= IOPage68K->dlkbdad0;
kbevent->W1= IOPage68K->dlkbdad1;
kbevent->W2= IOPage68K->dlkbdad2;
kbevent->W3= IOPage68K->dlkbdad3;
kbevent->W4= IOPage68K->dlkbdad4;
kbevent->W5= IOPage68K->dlkbdad5;
kbevent->WU= IOPage68K->dlutilin;
if (r != w) {
kbevent = (KBEVENT *)((DLword *)CTopKeyevent + w);
/* If queue was empty, update the read pointer */
if(r==0) CTopKeyevent->ring.vectorindex.read=w;
/* Copy the Hardware bits. */
kbevent->W0 = IOPage68K->dlkbdad0;
kbevent->W1 = IOPage68K->dlkbdad1;
kbevent->W2 = IOPage68K->dlkbdad2;
kbevent->W3 = IOPage68K->dlkbdad3;
kbevent->W4 = IOPage68K->dlkbdad4;
kbevent->W5 = IOPage68K->dlkbdad5;
kbevent->WU = IOPage68K->dlutilin;
/* Update the write pointer */
if(w >= mouse->maxkeyevent) CTopKeyevent->ring.vectorindex.write = MINKEYEVENT;
else CTopKeyevent->ring.vectorindex.write += mouse->keyeventsize;
}
/* If queue was empty, update the read pointer */
if (r == 0) CTopKeyevent->ring.vectorindex.read = w;
if(*KEYBUFFERING68k ==NIL) *KEYBUFFERING68k=ATOM_T;
KBDEventFlg++; /* Signal the emulator to tell Lisp */
Irq_Stk_Check = 0;
Irq_Stk_End = 0;
/* Update the write pointer */
if (w >= mouse->maxkeyevent)
CTopKeyevent->ring.vectorindex.write = MINKEYEVENT;
else
CTopKeyevent->ring.vectorindex.write += mouse->keyeventsize;
}
if (*KEYBUFFERING68k == NIL) *KEYBUFFERING68k = ATOM_T;
KBDEventFlg++; /* Signal the emulator to tell Lisp */
Irq_Stk_Check = 0;
Irq_Stk_End = 0;
}
/***************************************************************/
/* B u t t o n T i m e r */
@@ -473,46 +433,41 @@ void MouseButtonSignal(mouse)
/* timeout happens. We will thus obtain the ``rubbery feeling''*/
/* that proponents of chording so desire. */
/***************************************************************/
void ButtonTimer()
{
if(currentmouse->Button.RunTimer)
if(currentmouse->Button.tick-- <= 0)
{
currentmouse->Button.RunTimer = FALSE; /* Turn the timer off. */
currentmouse->Button.Left |= currentmouse->Button.StateLeft;
currentmouse->Button.Right |= currentmouse->Button.StateRight;
void ButtonTimer() {
if (currentmouse->Button.RunTimer)
if (currentmouse->Button.tick-- <= 0) {
currentmouse->Button.RunTimer = FALSE; /* Turn the timer off. */
currentmouse->Button.Left |= currentmouse->Button.StateLeft;
currentmouse->Button.Right |= currentmouse->Button.StateRight;
/* Mouse chording code. If at the end of the timeout
the left and right buttons are down we signal middle
button and bring the others up. */
/* Are L & R down? */
/* Mouse chording code. If at the end of the timeout
the left and right buttons are down we signal middle
button and bring the others up. */
/* Are L & R down? */
if(currentmouse->Button.StateLeft && currentmouse->Button.StateRight)
{
currentmouse->Button.Left = FALSE;
currentmouse->Button.Right = FALSE;
currentmouse->Button.Middle = TRUE;
}
currentmouse->Button.StateLeft = FALSE;
currentmouse->Button.StateRight = FALSE;
/* Did L & R go up after a simulated M */
/* if((currentmouse->Button.Middle &&
!(currentmouse->Button.StateLeft ||
currentmouse->Button.StateRight)))
{
currentmouse->Button.Left = FALSE;
currentmouse->Button.Right = FALSE;
currentmouse->Button.Middle = FALSE;
}
*/
MouseButtonSignal(currentmouse);
}
_chain_intr(currentmouse->Button.NextHandler);
}
if (currentmouse->Button.StateLeft && currentmouse->Button.StateRight) {
currentmouse->Button.Left = FALSE;
currentmouse->Button.Right = FALSE;
currentmouse->Button.Middle = TRUE;
}
currentmouse->Button.StateLeft = FALSE;
currentmouse->Button.StateRight = FALSE;
/* Did L & R go up after a simulated M */
/* if((currentmouse->Button.Middle &&
!(currentmouse->Button.StateLeft ||
currentmouse->Button.StateRight)))
{
currentmouse->Button.Left = FALSE;
currentmouse->Button.Right = FALSE;
currentmouse->Button.Middle = FALSE;
}
*/
MouseButtonSignal(currentmouse);
}
_chain_intr(currentmouse->Button.NextHandler);
}
/***************************************************************/
/* T w o B u t t o n H a n d l e r */
@@ -521,141 +476,122 @@ void ButtonTimer()
/* signals the dispatch loop to care of the matter. This */
/* akward solution is due to the severe braindamage in DOS. */
/***************************************************************/
void TwoButtonHandler(void)
{
_XSTACK *stk_ptr;
void TwoButtonHandler(void) {
_XSTACK *stk_ptr;
/* First save the stack frame. */
stk_ptr = (_XSTACK *)_get_stk_frame(); /* Get ptr to V86 _XSTACK frame */
stk_ptr->opts |= _STK_NOINT; /* Bypass real-mode handler */
/* First save the stack frame. */
stk_ptr = (_XSTACK *)_get_stk_frame(); /* Get ptr to V86 _XSTACK frame */
stk_ptr->opts |= _STK_NOINT; /* Bypass real-mode handler */
if(!currentmouse->device.active) return;
if (!currentmouse->device.active) return;
if (stk_ptr->eax & LB_PRESS)
if (currentmouse->Button.RunTimer) /* Prior right-down seen... */
{
currentmouse->Button.RunTimer = FALSE;
currentmouse->Button.FakeMiddle = TRUE;
currentmouse->Button.Middle = TRUE;
currentmouse->Button.StateLeft = TRUE;
MouseButtonSignal(currentmouse);
}
else if (currentmouse->Button.Right)
{
currentmouse->Button.Left = TRUE;
currentmouse->Button.StateLeft = TRUE;
MouseButtonSignal(currentmouse);
}
else /* No other button down... */
{
currentmouse->Button.StateLeft = TRUE;
currentmouse->Button.tick = currentmouse->Button.StartTime;
currentmouse->Button.RunTimer = TRUE;
}
if (stk_ptr->eax & LB_OFF) /* Left button released, and */
if (currentmouse->Button.RunTimer) /* Timer had been running */
{
currentmouse->Button.RunTimer = FALSE;
currentmouse->Button.Left = TRUE;
MouseButtonSignal(currentmouse);
currentmouse->Button.StateLeft = FALSE;
/* currentmouse->Button.Left = FALSE;
MouseButtonSignal(currentmouse); */
}
else /* timer wasn't running */
{
currentmouse->Button.StateLeft = FALSE;
currentmouse->Button.Left = FALSE;
currentmouse->Button.FakeMiddle = FALSE;
currentmouse->Button.Middle = currentmouse->Button.StateMiddle;
MouseButtonSignal(currentmouse);
}
if (stk_ptr->eax & LB_PRESS)
if (currentmouse->Button.RunTimer) /* Prior right-down seen... */
{
currentmouse->Button.RunTimer = FALSE;
currentmouse->Button.FakeMiddle = TRUE;
currentmouse->Button.Middle = TRUE;
currentmouse->Button.StateLeft = TRUE;
MouseButtonSignal(currentmouse);
} else if (currentmouse->Button.Right) {
currentmouse->Button.Left = TRUE;
currentmouse->Button.StateLeft = TRUE;
MouseButtonSignal(currentmouse);
} else /* No other button down... */
{
currentmouse->Button.StateLeft = TRUE;
currentmouse->Button.tick = currentmouse->Button.StartTime;
currentmouse->Button.RunTimer = TRUE;
}
if (stk_ptr->eax & LB_OFF) /* Left button released, and */
if (currentmouse->Button.RunTimer) /* Timer had been running */
{
currentmouse->Button.RunTimer = FALSE;
currentmouse->Button.Left = TRUE;
MouseButtonSignal(currentmouse);
currentmouse->Button.StateLeft = FALSE;
/* currentmouse->Button.Left = FALSE;
MouseButtonSignal(currentmouse); */
} else /* timer wasn't running */
{
currentmouse->Button.StateLeft = FALSE;
currentmouse->Button.Left = FALSE;
currentmouse->Button.FakeMiddle = FALSE;
currentmouse->Button.Middle = currentmouse->Button.StateMiddle;
MouseButtonSignal(currentmouse);
}
if((stk_ptr->eax & CB_PRESS) || (stk_ptr->eax & CB_OFF))
{
currentmouse->Button.Middle = ((stk_ptr->eax & CB_PRESS) && TRUE)
|| currentmouse->Button.FakeMiddle;
currentmouse->Button.StateMiddle = (stk_ptr->eax & CB_PRESS) && TRUE;
currentmouse->Button.RunTimer = FALSE;
MouseButtonSignal(currentmouse);
}
if ((stk_ptr->eax & CB_PRESS) || (stk_ptr->eax & CB_OFF)) {
currentmouse->Button.Middle =
((stk_ptr->eax & CB_PRESS) && TRUE) || currentmouse->Button.FakeMiddle;
currentmouse->Button.StateMiddle = (stk_ptr->eax & CB_PRESS) && TRUE;
currentmouse->Button.RunTimer = FALSE;
MouseButtonSignal(currentmouse);
}
if(stk_ptr->eax & RB_PRESS) /* Right button pressed, and */
if (currentmouse->Button.RunTimer) /* Timer was running... */
{
currentmouse->Button.RunTimer = FALSE;
currentmouse->Button.FakeMiddle = TRUE;
currentmouse->Button.Middle = TRUE;
currentmouse->Button.StateRight = TRUE;
MouseButtonSignal(currentmouse);
}
else if (currentmouse->Button.Left)
{
currentmouse->Button.Right = TRUE;
currentmouse->Button.StateRight = TRUE;
MouseButtonSignal(currentmouse);
}
else
{
currentmouse->Button.StateRight = TRUE;
currentmouse->Button.tick = currentmouse->Button.StartTime;
currentmouse->Button.RunTimer = TRUE;
}
if (stk_ptr->eax & RB_OFF) /* Right button released */
if (currentmouse->Button.RunTimer) /* Timer had been running */
{
currentmouse->Button.RunTimer = FALSE;
currentmouse->Button.Right = TRUE;
MouseButtonSignal(currentmouse);
currentmouse->Button.StateRight = FALSE;
/* currentmouse->Button.Right = FALSE;
MouseButtonSignal(currentmouse); */
}
else
{
currentmouse->Button.StateRight = FALSE;
currentmouse->Button.Right = FALSE;
currentmouse->Button.FakeMiddle = FALSE;
currentmouse->Button.Middle = currentmouse->Button.StateMiddle;
MouseButtonSignal(currentmouse);
}
if (stk_ptr->eax & RB_PRESS) /* Right button pressed, and */
if (currentmouse->Button.RunTimer) /* Timer was running... */
{
currentmouse->Button.RunTimer = FALSE;
currentmouse->Button.FakeMiddle = TRUE;
currentmouse->Button.Middle = TRUE;
currentmouse->Button.StateRight = TRUE;
MouseButtonSignal(currentmouse);
} else if (currentmouse->Button.Left) {
currentmouse->Button.Right = TRUE;
currentmouse->Button.StateRight = TRUE;
MouseButtonSignal(currentmouse);
} else {
currentmouse->Button.StateRight = TRUE;
currentmouse->Button.tick = currentmouse->Button.StartTime;
currentmouse->Button.RunTimer = TRUE;
}
if (stk_ptr->eax & RB_OFF) /* Right button released */
if (currentmouse->Button.RunTimer) /* Timer had been running */
{
currentmouse->Button.RunTimer = FALSE;
currentmouse->Button.Right = TRUE;
MouseButtonSignal(currentmouse);
currentmouse->Button.StateRight = FALSE;
/* currentmouse->Button.Right = FALSE;
MouseButtonSignal(currentmouse); */
} else {
currentmouse->Button.StateRight = FALSE;
currentmouse->Button.Right = FALSE;
currentmouse->Button.FakeMiddle = FALSE;
currentmouse->Button.Middle = currentmouse->Button.StateMiddle;
MouseButtonSignal(currentmouse);
}
/* The dude moved the mouse. Set the chordstate NOW. */
/* And turn the timer off. */
if ((stk_ptr->eax & MOUSE_MV) && (!currentdsp->device.locked)) {
currentmouse->Button.RunTimer = FALSE;
/* The dude moved the mouse. Set the chordstate NOW. */
/* And turn the timer off. */
if ((stk_ptr->eax & MOUSE_MV)&&(!currentdsp->device.locked))
{
currentmouse->Button.RunTimer = FALSE;
/* Are L & R down? */
/* if(currentmouse->Button.StateLeft && currentmouse->Button.StateRight)
{
currentmouse->Button.Left = FALSE;
currentmouse->Button.Right = FALSE;
currentmouse->Button.Middle = TRUE;
}
*/
/* currentmouse->Cursor.New.x = (DLword)stk_ptr->ecx & 0xFFFF;
currentmouse->Cursor.New.y = (DLword)stk_ptr->edx & 0xFFFF; */
currentmouse->Cursor.Moved = TRUE;
/* Are L & R down? */
/* if(currentmouse->Button.StateLeft && currentmouse->Button.StateRight)
{
currentmouse->Button.Left = FALSE;
currentmouse->Button.Right = FALSE;
currentmouse->Button.Middle = TRUE;
}
*/
/* currentmouse->Cursor.New.x = (DLword)stk_ptr->ecx & 0xFFFF;
currentmouse->Cursor.New.y = (DLword)stk_ptr->edx & 0xFFFF; */
currentmouse->Cursor.Moved = TRUE;
if (currentmouse->Button.StateLeft && currentmouse->Button.StateRight) {
currentmouse->Button.Left = FALSE;
currentmouse->Button.Right = FALSE;
currentmouse->Button.Middle = TRUE;
} else {
currentmouse->Button.Left |= currentmouse->Button.StateLeft;
currentmouse->Button.Right |= currentmouse->Button.StateRight;
}
if(currentmouse->Button.StateLeft && currentmouse->Button.StateRight)
{
currentmouse->Button.Left = FALSE;
currentmouse->Button.Right = FALSE;
currentmouse->Button.Middle = TRUE;
}
else
{
currentmouse->Button.Left |= currentmouse->Button.StateLeft;
currentmouse->Button.Right |= currentmouse->Button.StateRight;
}
currentmouse->Button.StateLeft = currentmouse->Button.StateRight = FALSE;
MouseButtonSignal(currentmouse);
}
currentmouse->Button.StateLeft = currentmouse->Button.StateRight = FALSE;
MouseButtonSignal(currentmouse);
}
}
/***************************************************************/
@@ -668,14 +604,14 @@ void TwoButtonHandler(void)
void ThreeButtonHandler()
{
_XSTACK *stk_ptr;
_XSTACK *stk_ptr;
unsigned long mouse_flags;
/* First save the stack frame. */
stk_ptr = (_XSTACK *)_get_stk_frame(); /* Get ptr to V86 _XSTACK frame */
stk_ptr->opts |= _STK_NOINT; /* Bypass real-mode handler */
stk_ptr->opts |= _STK_NOINT; /* Bypass real-mode handler */
if(currentmouse->device.active){
if (currentmouse->device.active) {
mouse_flags = stk_ptr->eax; /* Save event flags from mouse driver */
/* Decode the transition bits. */
@@ -688,14 +624,13 @@ void ThreeButtonHandler()
if (mouse_flags & RB_PRESS) currentmouse->Button.Right = TRUE;
if (mouse_flags & RB_OFF) currentmouse->Button.Right = FALSE;
if ((!currentdsp->device.locked) && (mouse_flags & MOUSE_MV))
{
currentmouse->Cursor.Moved = TRUE;
Irq_Stk_Check = 0;
Irq_Stk_End = 0;
}
if ((!currentdsp->device.locked) && (mouse_flags & MOUSE_MV)) {
currentmouse->Cursor.Moved = TRUE;
Irq_Stk_Check = 0;
Irq_Stk_End = 0;
}
if (mouse_flags & (LB_PRESS|LB_OFF|CB_PRESS|CB_OFF|RB_PRESS|RB_OFF))
if (mouse_flags & (LB_PRESS | LB_OFF | CB_PRESS | CB_OFF | RB_PRESS | RB_OFF))
MouseButtonSignal(currentmouse);
}
}