/ * Mouse.inc * /
Void Pascal Set_Event_Handler (INT CALL_MASK, VOID FAR () ()) {Union Regs R; Struct Sregs Sr; IF (Mouse_There) {/ * The mouse function 12 * / RXAX = 12; rxcx = call_mask; rxdx = Fp_off (location); sr.es = fp_seg (location); int86X (0x33, & R, & R, & SR);}} / * ---------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------- * / void Near Event_Processor (int event_status, int button_status, int x, int y) / * load the mouse evenet program {i ((mouse_there) {if ((cmx! = x) || (CMY! = Y)) { MOUSE_MOVED = 1; CMX = x; CMY = y;} else MOUSE_MOVED = 0; bSTATE = button_status; if (event_status & 2) {LBUTTON_DOWN = 1; LBUTTON_UP = 0;} if (event_status & 8) {RBUTTON_DOWN = 1; RBUTTON_UP = 0;} if (event_status & 4) {lbutton_up = 1; lbutton_down = 0;} if (Event_status & 16) {RBUTTON_UP = 1; RButton_Down = 0;}} / * ---------- -------------------------------------------------- ------- * / int RET_MOUSE (void) / * the mouse function 0 * / {_ax = 0; GenInterrupt (0x33); if (_ax> 0) {mousenum = _ax; mouse_there = 1; mouse_on (); return (ok);} else {mouse_there = 0; return (error);}} / * ----- -------------------------------------------------- ------------ * / void mouse_off (void) / * the mouse function 2 * / {if (! mouse_there || mouse_visible == 0) Return; _ax = 2; GenInterrupt (0x33); Mouse_visible = 0;} / * ------------------------------------------- ------------------------ * / void mouse_on (void) / * the mouse function 1 * / {if (! mouse_there || mouse_visible == 1 Return; _ax = 1; GenInterrupt (0x33);
Mouse_visible = 1;} / * ----------------------------------------- ----------------------- * / void mouse_shape (int photo) {UNION Regs Regs; Struct Sregs Sregs; Mouse_off (); regs.x.ax = 9; regs.x.bx = hotX; regs.x.cx = hotX; regs.x.dx = fp_off (shape); SREGS.ES = fp_seg (shape); int86X ( 0x33, & regs, & regs, & sags); mouse_on ();} / * ---------------------------------- ------------------------------- * / void set_mouse_position (int x, int y) {_ax = 4; _CX = X; _DX = Y; GenInterrupt (0x33);} / * -------------------------------------------------------------------------------------------------------------------------------- ------------------------------- * // * Conditions for calling the double click to determine if the left button is called When the left button is checked. If the following, {, you just click on the left button, you must call the left button, you must call once, otherwise it is possible to lose the keystock status IF (Lbutton_down) {if (get_double_press ()) ... Double-click on how else ... Click how} * / int GET_DOUBLE_PRESS (VOID); / * get if lbutton was press twice * / int get_double_press (void) {Int x, Y; if (lbutton_down) {lbutton_down = 0; x = cmx; y = CMY; DELAY (double_click_time); if (lbutton_down && x == cmx && y == cmy) {lbutton_down = 0; Lbutton_up = 0; return (1);} else {lbutton_down = 1; return (0);}} / * ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------- * / void set_text_cursor (int Groundmask, int textmask {_ax = 10; _bx = 0; _CX = Groundmask; _dx = textmask; geninterrupt (0x33);} / * -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------- * / Void installevent (void) {set_event_handler (127, event_handler);} / * ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ------------------------- * / void reset_event_status (void) {mouse_moved = 0; lbutton_down = 0; rButton_down = 0; lbutton_up = 0; RButton_up = 0; bstate = 0;