|
|
1.1 ! root 1: // BlackView.m ! 2: // ! 3: // You may freely copy, distribute, and reuse the code in this example. ! 4: // NeXT disclaims any warranty of any kind, expressed or implied, as to its ! 5: // fitness for any particular use. ! 6: ! 7: ! 8: #import "BlackView.h" ! 9: #import <math.h> ! 10: #import <libc.h> ! 11: #import <dpsclient/wraps.h> ! 12: ! 13: @implementation BlackView ! 14: ! 15: // This is a really simple View that makes the screen totally black ! 16: // BackSpace wasn't really designed for this, so oneStep still gets ! 17: // invoked. By sleeping, we insure that this doesn't suck too ! 18: // many cycles. Has to wake often enough to remain moderately ! 19: // responsive to events. ! 20: ! 21: - oneStep ! 22: { ! 23: usleep(1000000 * 1/2 ); //sleep a while (yuck!) ! 24: // this time should be short enough that BackSpace remains ! 25: // somewhat responsive if an event does occur. Unfortunately, ! 26: // waking up keeps BackSpace hotter than I would prefer (ie paged in) ! 27: ! 28: return self; ! 29: } ! 30: ! 31: - drawSelf:(const NXRect *)rects :(int)rectCount ! 32: { ! 33: //Actually, this method doesn't have to do anything at all since ! 34: // the view is placed in a black window... ! 35: ! 36: return self; ! 37: } ! 38: ! 39: - (BOOL)isBoringScreenSaver ! 40: { ! 41: return YES; ! 42: } ! 43: ! 44: @end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.