I want to make some kind of drawable surface that exists beneath the mouse cursor but above everything else rendered on the desktop. I am trying to create a "trail" behind the mouse.
How can I do this in Cocoa and Objective-C?
I want to make some kind of drawable surface that exists beneath the mouse cursor but above everything else rendered on the desktop. I am trying to create a "trail" behind the mouse.
How can I do this in Cocoa and Objective-C?
You need to subclass NSWindow
to create a borderless window and set its window level to something like NSScreenSaverWindowLevel - 1
.
- (id)initWithContentRect:(NSRect)contentRect
styleMask:(NSUInteger)aStyle
backing:(NSBackingStoreType)bufferingType
defer:(BOOL)flag
{
self=[super initWithContentRect:contentRect
styleMask:NSBorderlessWindowMask
backing:bufferingType
defer:flag];
if(self!=nil)
{
[self setHasShadow:NO];
[self setOpaque:NO];
[self setBackgroundColor:[NSColor clearColor]];
[self setLevel:NSScreenSaverWindowLevel - 1];
}
return self;
}