This is BlackView.m in view mode; [Download] [Up]
// BlackView.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. #import <libc.h> #import "BlackView.h" @implementation BlackView // This is a really simple View that makes the screen totally black // BackSpace wasn't really designed for this, so oneStep still gets // invoked. By sleeping, we insure that this doesn't suck too // many cycles. Has to wake often enough to remain moderately // responsive to events. - oneStep { usleep(1000000 * 1/2); // sleep a while (yuck!) // this time should be short enough that BackSpace remains // somewhat responsive if an event does occur. Unfortunately, // waking up keeps BackSpace hotter than I would prefer (ie paged in) return self; } - drawSelf:(const NXRect *) rects :(int) rectCount { // Actually, this method doesn't have to do anything at all since // the view is placed in a black window... return self; } - (BOOL) isBoringScreenSaver { return YES; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.