hide cursor on OSX
This commit is contained in:
@@ -124,6 +124,11 @@ std::mutex task_mutex;
|
||||
self = [super initWithFrame:frameRect pixelFormat:pf];
|
||||
[self setPixelFormat:pf];
|
||||
[self setOpenGLContext:context];
|
||||
|
||||
NSTrackingArea* trackingArea = [[NSTrackingArea alloc] initWithRect:frameRect
|
||||
options: (NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingActiveInKeyWindow )
|
||||
owner:self userInfo:nil];
|
||||
[self addTrackingArea:trackingArea];
|
||||
return self;
|
||||
}
|
||||
- (void)prepareOpenGL
|
||||
@@ -374,6 +379,17 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
|
||||
App::I.mouse_move(mouseLoc.x, App::I.height - mouseLoc.y - 1, p, kEventSource::Mouse, 0);
|
||||
});
|
||||
}
|
||||
-(void)mouseExited:(NSEvent *)event
|
||||
{
|
||||
self->cursor_visible = CGCursorIsVisible();
|
||||
if (!self->cursor_visible)
|
||||
[NSCursor unhide];
|
||||
}
|
||||
-(void)mouseEntered:(NSEvent *)event
|
||||
{
|
||||
if (!self->cursor_visible)
|
||||
[NSCursor hide];
|
||||
}
|
||||
- (void)scrollWheel:(NSEvent *)theEvent
|
||||
{
|
||||
auto mouseLoc = [self convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
|
||||
Reference in New Issue
Block a user