diff --git a/OSBindings/Mac/Clock Signal/Views/CSOpenGLView.m b/OSBindings/Mac/Clock Signal/Views/CSOpenGLView.m index 283f6e19b..5f4267c3a 100644 --- a/OSBindings/Mac/Clock Signal/Views/CSOpenGLView.m +++ b/OSBindings/Mac/Clock Signal/Views/CSOpenGLView.m @@ -17,6 +17,7 @@ @implementation CSOpenGLView { CVDisplayLinkRef _displayLink; CGSize _backingSize; + NSScreen *_currentScreen; NSTrackingArea *_mouseTrackingArea; NSTimer *_mouseHideTimer; @@ -26,6 +27,9 @@ - (void)prepareOpenGL { [super prepareOpenGL]; + // Note the initial screen. + _currentScreen = self.window.screen; + // Synchronize buffer swaps with vertical refresh rate GLint swapInt = 1; [[self openGLContext] setValues:&swapInt forParameter:NSOpenGLCPSwapInterval]; @@ -56,6 +60,14 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt } - (void)drawAtTime:(const CVTimeStamp *)now frequency:(double)frequency { + if(self.window.screen != _currentScreen) { + _currentScreen = self.window.screen; + + // Issue a reshape, in case a switch to/from a Retina display has + // happened, changing the results of -convertSizeToBacking:, etc. + [self reshape]; + } + [self redrawWithEvent:CSOpenGLViewRedrawEventTimer]; }