home *** CD-ROM | disk | FTP | other *** search
- /* WaitPointer.c Two routines to block input on a window */
- /* Will use a hires waitpointer on v39+ and a lo-res "clock" in pre v39 */
- /* Currently only allows only one invocation at a time */
- /* If a a function is called twice in a row, the 2:nd call will be ignored */
-
- #include <exec/types.h>
- #include <exec/libraries.h>
- #include <intuition/intuition.h>
- #include <intuition/intuitionbase.h>
- #include <proto/exec.h>
- #include <proto/intuition.h>
-
- extern struct IntuitionBase *IntuitionBase;
-
- /* our function prototypes */
- BOOL BlockInput(struct Window *Win, BOOL Delay);
- void FreeInput(struct Window *Win);
-
- /* Data */
- static struct Requester MyReq;
- static struct Window *RememberWin = NULL;
-
- /* data for a busy pointer.
- ** this data must be in chip memory!!!
- */
- static UWORD __chip waitPointer[] =
- {
- 0x0000, 0x0000, /* reserved, must be NULL */
-
- 0x0400, 0x07C0,
- 0x0000, 0x07C0,
- 0x0100, 0x0380,
- 0x0000, 0x07E0,
- 0x07C0, 0x1FF8,
- 0x1FF0, 0x3FEC,
- 0x3FF8, 0x7FDE,
- 0x3FF8, 0x7FBE,
- 0x7FFC, 0xFF7F,
- 0x7EFC, 0xFFFF,
- 0x7FFC, 0xFFFF,
- 0x3FF8, 0x7FFE,
- 0x3FF8, 0x7FFE,
- 0x1FF0, 0x3FFC,
- 0x07C0, 0x1FF8,
- 0x0000, 0x07E0,
-
- 0x0000, 0x0000, /* reserved, must be NULL */
- };
-
- BOOL IsInputBlocked(void)
- {
- return (BOOL)RememberWin;
- }
-
- BOOL BlockInput(struct Window *Win, BOOL Delay)
- {
- if (RememberWin) return TRUE; /* Already blocked */
- RememberWin = Win;
-
- InitRequester(&MyReq);
- if (Request(&MyReq, Win)) {
- if (IntuitionBase->LibNode.lib_Version >= 39) SetWindowPointer(
- Win, WA_BusyPointer, TRUE, WA_PointerDelay, Delay, TAG_DONE);
- else SetPointer(Win, waitPointer, 16, 16, -6, 0);
-
- return TRUE;
- }
- else return FALSE;
- }
-
-
- void FreeInput(struct Window *Win)
- {
- if (!RememberWin) return;
- RememberWin = NULL;
-
- if (IntuitionBase->LibNode.lib_Version >= 39) SetWindowPointer(Win,TAG_DONE);
- else ClearPointer(Win);
- EndRequest(&MyReq, Win);
- }