From 0706f4a121f6f9c5b96a19c4272a8636fc230cbc Mon Sep 17 00:00:00 2001 From: Michael Fisher Date: Sun, 1 Sep 2019 03:02:08 -0400 Subject: Mac: Dispatch expose events from drawing view --- pugl/detail/mac.h | 1 + pugl/detail/mac.m | 4 ++-- pugl/detail/mac_cairo.m | 6 ++++++ pugl/detail/mac_gl.m | 6 ++++++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/pugl/detail/mac.h b/pugl/detail/mac.h index 9a5997d..8146373 100644 --- a/pugl/detail/mac.h +++ b/pugl/detail/mac.h @@ -36,6 +36,7 @@ } - (void) dispatchConfigure:(NSRect)bounds; +- (void) dispatchExpose:(NSRect)rect; @end diff --git a/pugl/detail/mac.m b/pugl/detail/mac.m index 6900ed6..36aff9b 100644 --- a/pugl/detail/mac.m +++ b/pugl/detail/mac.m @@ -77,7 +77,7 @@ puglview->backend->resize(puglview, bounds.size.width, bounds.size.height); } -- (void) drawRect:(NSRect)rect +- (void) dispatchExpose:(NSRect)rect { const PuglEventExpose ev = { PUGL_EXPOSE, @@ -850,7 +850,7 @@ puglGetTime(PuglView* view) void puglPostRedisplay(PuglView* view) { - [view->impl->wrapperView setNeedsDisplay: YES]; + [view->impl->drawView setNeedsDisplay: YES]; } PuglNativeWindow diff --git a/pugl/detail/mac_cairo.m b/pugl/detail/mac_cairo.m index b0a8db5..1f4452f 100644 --- a/pugl/detail/mac_cairo.m +++ b/pugl/detail/mac_cairo.m @@ -53,6 +53,12 @@ [wrapper dispatchConfigure:[self bounds]]; } +- (void) drawRect:(NSRect)rect +{ + PuglWrapperView* wrapper = (PuglWrapperView*)[self superview]; + [wrapper dispatchExpose:rect]; +} + @end static int diff --git a/pugl/detail/mac_gl.m b/pugl/detail/mac_gl.m index 4a6e39a..6cdf6f6 100644 --- a/pugl/detail/mac_gl.m +++ b/pugl/detail/mac_gl.m @@ -91,6 +91,12 @@ typedef NSUInteger NSWindowStyleMask; [wrapper dispatchConfigure:[self bounds]]; } +- (void) drawRect:(NSRect)rect +{ + PuglWrapperView* wrapper = (PuglWrapperView*)[self superview]; + [wrapper dispatchExpose:rect]; +} + @end static int -- cgit v1.2.1