From 9cb91cde90fc7e54e611805170058efebe32b5a7 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 1 Dec 2020 19:18:23 +0100 Subject: Make puglShow() realize automatically on Windows and MacOS --- src/mac.m | 7 +++++++ src/win.c | 7 +++++++ 2 files changed, 14 insertions(+) (limited to 'src') diff --git a/src/mac.m b/src/mac.m index bb4bf45..adac2a5 100644 --- a/src/mac.m +++ b/src/mac.m @@ -1004,6 +1004,13 @@ puglRealize(PuglView* view) PuglStatus puglShow(PuglView* view) { + if (!view->impl->wrapperView) { + const PuglStatus st = puglRealize(view); + if (st) { + return st; + } + } + if (![view->impl->window isVisible]) { [view->impl->window setIsVisible:YES]; [view->impl->drawView setNeedsDisplay: YES]; diff --git a/src/win.c b/src/win.c index 5cfd89a..ff296c2 100644 --- a/src/win.c +++ b/src/win.c @@ -217,6 +217,13 @@ puglShow(PuglView* view) { PuglInternals* impl = view->impl; + if (!impl->hwnd) { + const PuglStatus st = puglRealize(view); + if (st) { + return st; + } + } + ShowWindow(impl->hwnd, SW_SHOWNORMAL); SetFocus(impl->hwnd); return PUGL_SUCCESS; -- cgit v1.2.1