home *** CD-ROM | disk | FTP | other *** search
- /*
- winmoutk.c 6/05/90
-
- % winmou_Track
-
- The generic window mouse handler.
- When a mouse button is clicked over the window, the stuffcode
- is set to MOU_CLICK.
-
- OWL 3.2
- Copyright (c) 1990 by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 7/25/90 jmd put in the library
- 8/08/90 ted Changed references from disp_SetMouseCode to kb_Stuff.
- 8/08/90 jdc remove unused variable fld
- */
-
- #include "oakhead.h"
- #include "odisp.h"
- #include "scancode.h" /* for MOU codes */
-
- int winmou_Track(win_type win, int msg, mev_struct *mev)
- /*
- Messages a mouse handler receives when its window is current
- MEV_REQUEST someone else wants to be it
- MEV_STARTEVENT current, mouse entered
- MEV_EVENT current, event in win
- MEV_ENDEVENT current, mouse left
- Messages a mouse handler receives when its window is not current
- MEV_STARTOFFER not current, mouse entered
- MEV_OFFER not current, event in win
- MEV_ENDOFFER not current, mouse left
- */
- {
- switch (msg) {
- case MEV_STARTOFFER: /* we're not the current window */
- win_SetDebounced(win, mev_IsButtonDown(mev));
-
- if (mev_IsFake()) { /* ignore 'fake' events */
- mev_ClearEvent(mev);
- break;
- }
- /* no break, fall through */
-
- case MEV_OFFER: /* we're not the current window */
- /* Accept the offer */
- if (!mev_IsButtonDown(mev)) {
- win_SetDebounced(win, FALSE);
- }
- else {
- if (!win_GetDebounced(win)) {
- win_SetDebounced(win, TRUE);
-
- /* Set the mouse code to tell us that the mouse was clicked
- * when our window is eventually activated
- */
- if (!mev_IsFake()) { /* ignore 'fake' clicks */
- kb_Stuff(MOU_CLICK);
- }
- }
- }
- /* We don't care what code we return because we accepted the
- * offer, which means the REQUEST message gets to decide what
- * to return from this particular kb_Read call
- */
- break;
-
- case MEV_ENDOFFER: /* we're not the current window */
- break;
-
- case MEV_REQUEST: /* we're the current window;
- another window was selected by the mouse. */
- winmev_grantrequest(win, mev);
-
- /* Return MOU_THERE as a scancode to kb_Read to tell the win
- about the request so it can exit */
- return(MOU_THERE);
-
- case MEV_STARTEVENT:
- win_SetDebounced(win, mev_IsButtonDown(mev));
- if (mev_IsFake() && !kb_WasMouse()) {
- break; /* ignore 'fake' events */
- }
-
- /* no break, fall through */
-
- case MEV_EVENT: /* we're the current window */
- if (!mev_IsButtonDown(mev)) {
- win_SetDebounced(win, FALSE);
- }
- else {
- if (!win_GetDebounced(win)) {
- win_SetDebounced(win, TRUE);
-
- /* return MOU_CLICK so our window knows the mouse was clicked */
- return(MOU_CLICK);
- }
- }
- break;
-
- case MEV_ENDEVENT: /* we're the current window */
- break;
- }
-
- return(MOU_IGNORE); /* Ignore this mouse event */
- }
-
-