Header
msmouse.h
Prototype
int msm_init(void);
Description
The msm_init function initializes the mouse driver. You must call
msm_init before using any other mouse functions. To terminate
the mouse driver, call msm_term.
In graphics mode, msm_init sets the cursor to be an arrow; in text
mode, msm_init sets the cursor to be inverse video. In addition,
msm_init sets the following cursor attributes: the cursor is
positioned in the middle of the screen. the cursor display is turned
off and the min/max cursor position is set to the full screen
dimensions. Finally, the mickey/pixel ratio is set to 1/1 in the x
direction and 2/1 in the y direction.
Return Value
Returns -1 if successful. Otherwise, returns 0 if initialization failed.
Failure might indicate no mouse driver is present.
Compatibility
DOS Windows 3.x Phar Lap DOSX Win32
See Also
msm_term
Example
/* Example for msm_init */
#include <stdio.h>
#include <stdlib. h>
#include <msmouse. h>
void main ()
{
int status, oldstatus = -1;
unsigned x, y;
if (! msm_init ())
{
fprintf (stderr, "Unable to initialize
mouse system\n");
exit (EXIT_FAILURE);
}
printf (" Mouse initialization succeeded\n");
msm_showcursor ();
while (1)
{
status = msm_getstatus (& x, &y);
if ((status & LEFT_BUTTON) && (status !=
oldstatus))
{
msm_hidecursor ();
printf (" x = %u, y = %u\n", x, y);
msm_showcursor ();
}
if (status & RIGHT_BUTTON)
break;
oldstatus = status;
}
msm_term ();
}
msm_lightpenon, msm_lightpenoff
Header
msmouse.h
Prototype
void msm_lightpenon(void);
void msm_lightpenoff(void);
Description
These functions turn on or off light pen emulation mode. The mouse
emulates a light pen; the "pen" is off the screen when the left and
right buttons are up, and the "pen" is down when both buttons are
down. Before using these functions, initialize the mouse driver by
calling msm_init.
Return Value
None
Compatibility
DOS Windows 3.x Phar Lap DOSX Win32
See Also
msm_init
Example
See msm_init
msm_readcounters
Header
msmouse.h
Prototype
void msm_readcounters(int *countx, int *county);
Description
The msm_readcounters function reads the mouse motion
counters in mickeys. A mickey is 1/ 200 of an inch. Before using
msm_readcounters, call msm_init to initialize the mouse driver.
Return Value
On returning the variables pointed to by countx and county
contain the mickey count since the last call; values can range
from -32768 to 32767.
Compatibility
DOS Windows 3.x Phar Lap DOSX Win32
See Also
msm_init
Example
See msm_init
msm_setareax, msm_setareay
Header
msmouse.h
Prototype
void msm_setareax(unsigned minx, unsigned maxx);
void msm_setareay(unsigned miny, unsigned maxy);
Description
The msm_setareax function sets a minimum and maximum
horizontal position for the cursor. If maxx < minx, the values are
exchanged. The mouse horizontal motion is restricted to within these
values.
The msm_setareay function sets minimum and maximum vertical
position for the cursor. If maxy < miny, the values are exchanged.
The mouse vertical motion is restricted to within these values.
Before using these functions initialize the mouse driver by calling
msm_init.
Return Value
None
Compatibility
DOS Windows 3.x Phar Lap DOSX Win32
See Also
msm_init
Example
See msm_init
msm_setcurpos
Header
msmouse.h
Prototype
void msm_setcurpos(unsigned curposx, unsigned curposy);
Description
The msm_setcurpos function sets the cursor position. The upper
left corner of the screen is 0, 0. The values for curposx and
curposy must be within the screen.
Before using msm_setcurpos initialize the mouse driver by calling
msm_init.
Return Value
None
Compatibility
DOS Windows 3.x Phar Lap DOSX Win32
See Also
msm_init
Example
See msm_init
msm_setgraphcur
Header
msmouse.h
Prototype
void msm_setgraphcur(int hotx, int hoty, int *pmasks);
Description
The msm_setgraphcur function sets the graphics cursor block. On
entry to the function hotx and hoty should point to the location of
the 'hot spot' of cursor. Values must be in the range -16 through 16.
Location 0, 0 is the upper left corner of the cursor with positive
values extending right and down. The variable pmasks should point
to an array of 32 words which contain bit masks defining the cursor.
The first 16 words define the mask — the bits of the background
which 'shine' through the cursor. A 1 means shine through, a 0
means not. The second 16 words define the bitmap of the cursor, 1
being on and 0 being off. The cursor is 16* 16, the first word forms
the top row, bit 15 forms the left-most column.
Initialize the mouse driver by calling msm_init.
Return Value
None
Compatibility
DOS Windows 3.x Phar Lap DOSX Win32
See Also
msm_init
Example
See msm_init
msm_setratio
Header
msmouse.h
Prototype
void msm_setratio(unsigned ratiox, unsigned ratioy);
Description
The msm_setratio function sets the mickey/ pixel ratio (the
sensitivity of the mouse). Higher values mean less cursor movement
for corresponding mouse movement. The default values are 8, 16.
Values for ratiox and ratioy must be in the range 1 to 32767.
Before using msm_setratio call msm_init.
Return Value
None
Compatibility
DOS Windows 3.x Phar Lap DOSX Win32
See Also
msm_init
msm_setttextcur
Header
msmouse.h
Prototype
void msm_settextcur(int select, int scanstart, int scanstop);
Description
The msm_settextcur function sets the text cursor. On entry to the
function, select is used to indicate whether or not to use a
hardware cursor. If select is 1, then the hardware text cursor is
used. If select is 0, then an attribute cursor is used. The
parameters scanstart and scanstop have different uses
depending on the value in select. If select is 1, then these
values form the starting and ending scan lines of the hardware text
cursor. If select is 0, then these values form the screen mask and
cursor mask, respectively, for the attribute cursor.
Before using msm_settextcur initialize the mouse driver by
calling msm_init.
Return Value
None
Compatibility
DOS Windows 3.x Phar Lap DOSX Win32
See Also
msm_init
msm_setthreshhold
Header
msmouse.h
Prototype
void msm_setthreshhold(unsigned speed);
Description
The msm_setthreshhold function sets the double speed
threshold, the speed at which the mickey/ pixel ratio is temporarily
halved, so that the mouse apparently moves faster. Speed is in
mickeys/ second. The default speed is 64.
Before using msm_setthreshhold initialize the mouse driver by
calling msm_init.
Return Value
None
Compatibility
DOS Windows 3.x Phar Lap DOSX Win32
See Also
msm_init
msm_showcursor
Header
msmouse.h
Prototype
void msm_showcursor(void);
Description
The msm_showcursor function shows cursor. That is, this function
increments the cursor flag. If the cursor flag is 0, then the cursor is
displayed. msm_showcursor must be called after msm_init in
order for the cursor to appear. msm_showcursor and
msm_hidecursor can be nested. If msm_hidecursor is called n
times, msm_showcursor must be called n times in order to show
the cursor. Generally, remove the cursor before any screen I/ O is
performed, and then restore the cursor.
Before using msm_showcursor initialize the mouse driver by
calling msm_init.
Return Value
None
Compatibility
DOS Windows 3.x Phar Lap DOSX Win32
See Also
msm_init
Example
See msm_init
msm_signal
Header
msmouse.h
Prototype
void msm_signal(unsigned mask, void(* func)(unsigned mask, unsigned state, unsigned curposx, unsigned curposy), void *stack);
Description
The msm_signal function sets up a user-defined subroutine input
mask. Use msm_signal to set a function to be called whenever
input is available from the mouse. Before using msm_signal call
msm_init. On input, mask defines when to call the user routine (1
is yes):
Bit/Description
- 0
- Mouse moved
- 1
- Left button is pressed
- 2
- Left button is released
- 3
- Right button is pressed
- 4
- Right button is released
- 5
- Middle button is pressed
- 6
- Middle button is released
Other bits are not used. The parameter func is a pointer to the
application-defined interrupt service routine to call whenever a
mouse button is pressed or released, or the mouse moves, according
to the bits in mask. The parameter stack contains the value to set
the stack pointer to when func is called. The stack value should
point just past the end of an area that is at least 256 bytes long.
When func is called, it is passed the following information:
- mask
- Event that occurred is indicated with the
bit set as defined above.
- state
- If button event, this is the button
number of the button that changed (0 =
left, 1 = right, 2 = middle).
- curposx, curposy
- Current mouse position.
Return Value
None
Compatibility
DOS Windows 3.x Phar Lap DOSX Win32
See Also
msm_init
msm_term
Header
msmouse.h
Prototype
void msm_term(void);
Description
The msm_term function terminates the mouse driver. You should
call this function before the program exits if you used msm_init to
initialize the mouse driver.
Return Value
None
Compatibility
DOS Windows 3.x Phar Lap DOSX Win32
See Also
msm_init
Example
See msm_init