home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name mopreclk -- Install or remove MOCATCH to catch mouse
- * button presses and releases.
- *
- * Synopsis ercode = mopreclk(option);
- *
- * int ercode Error return code:
- * MO_OK if successful;
- * MO_ABSENT if mouse not found;
- * MO_ALREADY if already installed
- * and MO_INSTALL is specified;
- * MO_NOT_INSTALLED if not installed
- * and MO_REMOVE is specified;
- * MO_BAD_OPT if option code
- * not recognized.
- *
- * int option MO_INSTALL or MO_REMOVE.
- *
- * Description This function installs or removes MOCATCH. (MOCATCH
- * monitors mouse button presses and releases and maintains
- * b_mohist[], the history of button events.)
- *
- * Returns ercode Error return code:
- * MO_OK if successful;
- * MO_ABSENT if mouse not found;
- * MO_ALREADY if already installed
- * and MO_INSTALL is specified;
- * MO_NOT_INSTALLED if not installed
- * and MO_REMOVE is specified;
- * MO_BAD_OPT if option not
- * recognized.
- * b_mouse Number of mouse buttons (0 if no driver).
- * b_mocatch Address of MOCATCH if MOCATCH installed,
- * zero if not installed.
- * b_momask MOCATCH's call mask if MOCATCH installed,
- * zero if not installed.
- *
- * Version 6.00 (C)Copyright Blaise Computing Inc. 1989
- *
- **/
-
- #include <bmouse.h>
-
- int far mopreclk(option)
- int option;
- {
- int result;
-
- switch (option)
- {
- case MO_INSTALL:
- if (b_mocatch)
- result = MO_ALREADY;
- else
- {
- /* Use combined call mask that */
- /* encompasses MOCATCH and user */
- /* interrupt handler, if any. */
- result = moinst(mocatch,MOCATCH_MASK | b_mohanmask);
- if (result == MO_OK)
- {
- b_mocatch = mocatch;
- b_momask = MOCATCH_MASK;
- }
- }
- break;
-
- case MO_REMOVE:
- if (b_mocatch)
- {
- /* Reinstall user handler (if any). */
- result = moinst((void (far *)(void)) b_modispat,
- b_mohanmask);
- if (result == MO_OK)
- {
- b_mocatch = 0;
- b_momask = 0;
- }
- }
- else
- result = MO_NOT_INSTALLED;
- break;
-
- default:
- result = MO_BAD_OPT;
- break;
- }
-
- return result;
- }