--- os2sdk/demos/apps/life/mouapi.c 2018/08/09 12:25:13 1.1.1.1 +++ os2sdk/demos/apps/life/mouapi.c 2018/08/09 12:25:55 1.1.1.2 @@ -11,9 +11,13 @@ * Contains subsets of: * MouOpen, MouReadEventQue, MouSetDevStatus, * MouGetNumQueEl, MouSetPtrPos + * + * Created by Microsoft Corp. 1987 */ +#define INCL_SUB -#include +#include +#include /* defines for int33h() calls. These are the offsets for the various registers * in the register array. */ @@ -23,15 +27,15 @@ #define DX 3 -/*** MOUOPEN - initializes mouse +/*** MouOpen - initializes mouse * * Initializes mouse and returns -1 in handle if mouse is present, else * if no mouse is present, returns 0 in handle and error code. */ -unsigned far pascal -MOUOPEN (name, handle) -char far *name; -unsigned far *handle; +unsigned APIENTRY +MouOpen (name, handle) +PSZ name; +PHMOU handle; { extern void int33h(); /* mouse interupt caller */ int registers[4]; /* register array for above */ @@ -53,18 +57,18 @@ unsigned far *handle; } -/*** MOUREADEVENTQUE - get mouse event +/*** MouReadEventQue - get mouse event * * Gets events like the OS/2 MouReadEventQue but this one ignores * the event mask and EventType parameter, never waiting for events, * just returning a 0 mask if nothing happened since last call. * Returns position absolute pixel coordinates */ -unsigned far pascal -MOUREADEVENTQUE (buffer, type, handle) - struct EventInfo far *buffer; - unsigned far *type; - unsigned handle; +unsigned APIENTRY +MouReadEventQue (buffer, type, handle) + PMOUEVENTINFO buffer; + PUSHORT type; + HMOU handle; { extern void int33h(); /* mouse interupt caller */ int registers[4]; /* register array for above */ @@ -74,59 +78,60 @@ MOUREADEVENTQUE (buffer, type, handle) buffer->Time=-1L; /* put in dummy time figure */ registers[AX]=3; /* ax=3, get mouse status */ int33h (registers); /* do mouse call */ - buffer->Mask=0; /* first, blank button info */ + buffer->fs=0; /* first, blank button info */ if (registers[DX]-lastrow || registers[CX]-lastcol) { - buffer->Row=registers[DX]; /* return row */ - buffer->Col=registers[CX]; /* return column */ + buffer->row=registers[DX]; /* return row */ + buffer->col=registers[CX]; /* return column */ lastrow=registers[DX]; /* save for next time */ lastcol=registers[CX]; if (registers[BX] & 1) /* if the left button is down*/ - (buffer->Mask) |= 2; /* then set appropriate bit*/ + (buffer->fs) |= 2; /* then set appropriate bit*/ if (registers[BX] & 2) /* if the right button down*/ - (buffer->Mask) |= 8; /* then set appropriate bit*/ + (buffer->fs) |= 8; /* then set appropriate bit*/ else if (!(registers[BX] & 1)) /* if no buttons, but motion */ - buffer->Mask |= 1; /* then set apporpriate bit*/ + buffer->fs |= 1; /* then set apporpriate bit*/ } if (registers[BX] & 1) /* if the left button is down*/ - (buffer->Mask) |= 4; /* then set appropriate bit*/ + (buffer->fs) |= 4; /* then set appropriate bit*/ if (registers[BX] & 2) /* if the right button down*/ - (buffer->Mask) |= 16; /* then set appropriate bit*/ + (buffer->fs) |= 16; /* then set appropriate bit*/ return (0); /* return no error */ } -/*** MOUSETDEVSTATUS - Dummy function, included for maximum compatibility +/*** MouSetDevStatus - Dummy function, included for maximum compatibility */ -unsigned far pascal -MOUSETDEVSTATUS (status, handle) -unsigned far *status; -unsigned handle; +unsigned APIENTRY +MouSetDevStatus (status, handle) +PUSHORT status; +HMOU handle; { } -/*** MOUGETNUMQUEEL - Always returns 1 in .Events +/*** MouGetNumQueEl - Always returns 1 in .Events */ -unsigned far pascal -MOUGETNUMQUEEL (info, handle) -struct QueInfo far *info; -unsigned handle; +unsigned APIENTRY +MouGetNumQueEl (info, handle) +PMOUQUEINFO info; +HMOU handle; { - info->Events = 1; + info->cEvents = 1; } -/*** MOUSETPTRPOS - Sets mouse pointer position +/*** MouSetPtrPos - Sets mouse pointer position */ -unsigned far pascal -MOUSETPTRPOS (loc, handle) -struct PtrLoc far *loc; -unsigned handle; +unsigned APIENTRY +MouSetPtrPos (loc, handle) +PPTRLOC loc; +HMOU handle; { int registers[4]; /* for int33h() */ registers[AX]=4; /* int 33 set position funct */ - registers[CX]=loc->ColPos; /* new coordinates */ - registers[DX]=loc->RowPos; + registers[CX]=loc->col; /* new coordinates */ + registers[DX]=loc->row; int33h (registers); /* do it */ } +