MacOS X Mouse Cursor Image

Is there a way to change the image of the Mac OSX mouse cursor, since I am recording a video in which I want to use a different image for the Mac mouse cursor, and I tried many programs that only resize the mouse cursor, but not the image. So, how can I replace the default MacOSX mouse cursor image on the screen.

+6
source share
1 answer

You can override -(void) resetCursorRects for a subclass of NSView . Something like that:

 -(void) resetCursorRects { [super resetCursorRects]; // define cursor image and cursorRects NSRect move = NSMakeRect((reg1UserStart + REGION_RESIZE_SIZE),REGION_Y_LOCATION, (self.reg1UserLength - (REGION_RESIZE_SIZE*2)), REGION_HEIGHT); NSRect resizeStart = NSMakeRect(self.reg1UserStart, REGION_Y_LOCATION, REGION_RESIZE_SIZE, REGION_HEIGHT); NSRect resizeEnd = NSMakeRect(((self.reg1UserStart + self.reg1UserLength) - REGION_RESIZE_SIZE), REGION_Y_LOCATION, REGION_RESIZE_SIZE, REGION_HEIGHT); [self addCursorRect:move cursor:[NSCursor openHandCursor]]; [self addCursorRect:resizeStart cursor: [NSCursor resizeRightCursor]]; [self addCursorRect:resizeEnd cursor:[NSCursor resizeLeftCursor]]; } 

You must define an NSRect , which represents the area that the mouse cursor changes, and then you specify the type of NSCursor. It can also be used to create custom cursors.

Gw

0
source

Source: https://habr.com/ru/post/952913/


All Articles