diff options
-rw-r--r-- | pugl/pugl_osx.m | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/pugl/pugl_osx.m b/pugl/pugl_osx.m index 3b6919d..273002a 100644 --- a/pugl/pugl_osx.m +++ b/pugl/pugl_osx.m @@ -115,9 +115,9 @@ struct PuglInternalsImpl { @interface PuglOpenGLView : NSOpenGLView { @public - PuglView* puglview; - + PuglView* puglview; NSTrackingArea* trackingArea; + NSTimer* timer; } - (id) initWithFrame:(NSRect)frame; @@ -537,6 +537,36 @@ keySymToSpecial(PuglView* view, NSEvent* ev) puglview->impl->mods = mods; } +- (BOOL) preservesContentInLiveResize +{ + return NO; +} + +- (void) viewWillStartLiveResize +{ + timer = [NSTimer timerWithTimeInterval:(1 / 60.0) + target:self + selector:@selector(resizeTick) + userInfo:nil + repeats:YES]; + [[NSRunLoop currentRunLoop] addTimer:timer + forMode:NSRunLoopCommonModes]; + + [super viewWillStartLiveResize]; +} + +- (void) resizeTick +{ + puglPostRedisplay(puglview); +} + +- (void) viewDidEndLiveResize +{ + [super viewDidEndLiveResize]; + [timer invalidate]; + timer = NULL; +} + @end PuglInternals* |