home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************
-
- 'MouseOff' will cause the mouse pointer to disappear and reappear if
- movement is detected. It will disappear again after 10 seconds of
- inactivity.
-
- Usage: Run MouseOff
-
- 'MouseOFF' is public domain. Please feel free to pass it anywhere
- you want.
-
- Comments should be sent to: Denny Jenkins
- 5226 Greensedge Way
- Columbus, Ohio 43220
-
- CompuServe ID: 70003,2374
-
- *************************************************************************/
-
- #include <exec/types.h>
- #include <intuition/intuition.h>
-
- struct Screen *s;
- struct Window *w, *OpenWindow();
- struct IntuitionBase *IntuitionBase;
- struct Preferences MyCopy;
- void *GfxBase;
-
- struct NewWindow nw = {
- 0,0,3,10,
- -1,-1,
- NULL,
- NULL,
- NULL, NULL,
- NULL,
- NULL, NULL,
- 0,0,0,0,
- WBENCHSCREEN
- };
-
- ULONG Seconds, Micros, Limit=0, Ten=10;
- SHORT LastX, LastY;
- USHORT PointerData[POINTERSIZE];
- BOOL Pointer=TRUE;
-
- _main()
- {
- register int i;
-
- IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",0L);
- GetPrefs (&MyCopy, (long) sizeof(MyCopy));
- for (i=0; i<POINTERSIZE; i++)
- PointerData[i] = MyCopy.PointerMatrix[i];
- w = OpenWindow(&nw);
- s = w->WScreen;
- LastX = s->MouseX;
- LastY = s->MouseY;
-
- FOREVER {
- Delay(50);
- CurrentTime(&Seconds,&Micros);
- if(Seconds > Limit) {
- if ((LastX == s->MouseX) && (LastY == s->MouseY)) {
- if (Pointer) {
- for (i=0; i<POINTERSIZE; i++)
- MyCopy.PointerMatrix[i] = NULL;
- SetPrefs(&MyCopy, (long) sizeof(MyCopy));
- Pointer = FALSE;
- }
- }
- else {
- LastX = s->MouseX;
- LastY = s->MouseY;
- if (!(Pointer)) {
- for (i=0; i<POINTERSIZE; i++)
- MyCopy.PointerMatrix[i] = PointerData[i];
- SetPrefs(&MyCopy, (long) sizeof(MyCopy));
- Pointer = TRUE;
- Limit = Seconds + Ten;
- }
- }
- }
- }
- }
-