update tracking area on OSX when resizing view
This commit is contained in:
@@ -125,7 +125,7 @@ std::mutex task_mutex;
|
||||
[self setPixelFormat:pf];
|
||||
[self setOpenGLContext:context];
|
||||
|
||||
NSTrackingArea* trackingArea = [[NSTrackingArea alloc] initWithRect:frameRect
|
||||
self->trackingArea = [[NSTrackingArea alloc] initWithRect:frameRect
|
||||
options: (NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingActiveInKeyWindow )
|
||||
owner:self userInfo:nil];
|
||||
[self addTrackingArea:trackingArea];
|
||||
@@ -266,20 +266,28 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
|
||||
CGLFlushDrawable(cgl);
|
||||
CGLUnlockContext(cgl);
|
||||
}
|
||||
|
||||
- (void)updateTrackingAreas
|
||||
{
|
||||
if(self->trackingArea != nil)
|
||||
[self removeTrackingArea:self->trackingArea];
|
||||
self->trackingArea = [[NSTrackingArea alloc] initWithRect:[self bounds]
|
||||
options: (NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingActiveInKeyWindow)
|
||||
owner:self userInfo:nil];
|
||||
[self addTrackingArea:trackingArea];
|
||||
}
|
||||
- (void)reshape
|
||||
{
|
||||
[super reshape];
|
||||
|
||||
// Get the view size in Points
|
||||
NSRect viewRectPoints = [self bounds];
|
||||
|
||||
// We draw on a secondary thread through the display link. However, when
|
||||
// resizing the view, -drawRect is called on the main thread.
|
||||
// Add a mutex around to avoid the threads accessing the context
|
||||
// simultaneously when resizing.
|
||||
CGLLockContext([[self openGLContext] CGLContextObj]);
|
||||
|
||||
// Get the view size in Points
|
||||
NSRect viewRectPoints = [self bounds];
|
||||
|
||||
#if SUPPORT_RETINA_RESOLUTION
|
||||
|
||||
// Rendering at retina resolutions will reduce aliasing, but at the potential
|
||||
|
||||
Reference in New Issue
Block a user