ftp.nice.ch/pub/next/tools/screen/BackSpaceDuo.NIHS.bs.tar.gz#/BackSpaceDuo/Source/SleepView.m

This is SleepView.m in view mode; [Download] [Up]

//  SleepView.m
//
//  You may freely copy, distribute, and reuse the code in this example.
//  NeXT disclaims any warranty of any kind, expressed or  implied, as to its
//  fitness for any particular use.

//  This view goes in a little 4 pixel window and cause BackSpace to sleep
//  whenever the cursor goes to a preselected corner.

#import "Thinker.h"
#import "SleepView.h"
#import <libc.h>
#import <appkit/timer.h>

@implementation SleepView

- mouseEntered:(NXEvent *)theEvent
{
	int	looping = YES;
	int doSaver = NO;
    NXTrackingTimer   myTimer;

    NXBeginTimer(&myTimer, 3.0, 5.0);
	while (looping)
	{
		theEvent = [NXApp getNextEvent: NX_TIMERMASK|NX_MOUSEEXITEDMASK];

		switch (theEvent->type)
		{
			case NX_TIMER:
				doSaver = YES;
				// now fall into MOUSEEXITED code

			case NX_MOUSEEXITED:
				looping = NO;
				break;
		}
   	}

    NXEndTimer(&myTimer);
	if (doSaver) [BSThinker() showFakeScreenSaver:self];
    return self;
}

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.