diff options
author | David Robillard <d@drobilla.net> | 2020-04-01 19:35:58 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-04-01 19:41:37 +0200 |
commit | fcddc7933dbff47754b8e4acea7406b77df1bf21 (patch) | |
tree | 8d82bc731b5e86b10e28acc85654d9be86ff321a /pugl/detail/mac.m | |
parent | 3f71daba7d92c50f7fd31e8775fc58d3ebf3900d (diff) | |
download | pugl-fcddc7933dbff47754b8e4acea7406b77df1bf21.tar.gz pugl-fcddc7933dbff47754b8e4acea7406b77df1bf21.tar.bz2 pugl-fcddc7933dbff47754b8e4acea7406b77df1bf21.zip |
Replace puglShowWindow() with puglRealize()
Diffstat (limited to 'pugl/detail/mac.m')
-rw-r--r-- | pugl/detail/mac.m | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/pugl/detail/mac.m b/pugl/detail/mac.m index f8ab084..43dca9e 100644 --- a/pugl/detail/mac.m +++ b/pugl/detail/mac.m @@ -753,7 +753,7 @@ puglConstraint(id item, NSLayoutAttribute attribute, float constant) } PuglStatus -puglCreateWindow(PuglView* view, const char* title) +puglRealize(PuglView* view) { PuglInternals* impl = view->impl; @@ -788,11 +788,6 @@ puglCreateWindow(PuglView* view, const char* title) [impl->drawView setHidden:NO]; [[impl->drawView window] makeFirstResponder:impl->wrapperView]; } else { - NSString* titleString = [[NSString alloc] - initWithBytes:title - length:strlen(title) - encoding:NSUTF8StringEncoding]; - const NSRect frame = rectToScreen( NSMakeRect(view->frame.x, view->frame.y, view->minWidth, view->minHeight)); @@ -811,13 +806,21 @@ puglCreateWindow(PuglView* view, const char* title) defer:NO ] retain]; [window setPuglview:view]; - [window setTitle:titleString]; + + if (view->title) { + NSString* titleString = [[NSString alloc] + initWithBytes:view->title + length:strlen(view->title) + encoding:NSUTF8StringEncoding]; + + [window setTitle:titleString]; + } + if (view->minWidth || view->minHeight) { [window setContentMinSize:NSMakeSize(view->minWidth, view->minHeight)]; } impl->window = window; - puglSetWindowTitle(view, title); ((NSWindow*)window).delegate = [[PuglWindowDelegate alloc] initWithPuglWindow:window]; @@ -1080,12 +1083,12 @@ puglSetWindowTitle(PuglView* view, const char* title) { puglSetString(&view->title, title); - NSString* titleString = [[NSString alloc] - initWithBytes:title - length:strlen(title) - encoding:NSUTF8StringEncoding]; - if (view->impl->window) { + NSString* titleString = [[NSString alloc] + initWithBytes:title + length:strlen(title) + encoding:NSUTF8StringEncoding]; + [view->impl->window setTitle:titleString]; } |