From 4c07a013d0943985f156101f1123c518da5fc590 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 4 Aug 2019 20:44:54 +0200 Subject: Add puglSetWindowTitle() --- pugl/detail/win.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'pugl/detail/win.c') diff --git a/pugl/detail/win.c b/pugl/detail/win.c index efd6070..e761654 100644 --- a/pugl/detail/win.c +++ b/pugl/detail/win.c @@ -161,10 +161,8 @@ puglCreateWindow(PuglView* view, const char* title) return 3; } - wchar_t* wtitle = puglUtf8ToWideChar(title); - if (wtitle) { - SetWindowTextW(impl->hwnd, wtitle); - free(wtitle); + if (title) { + puglSetWindowTitle(view, title); } SetWindowLongPtr(impl->hwnd, GWLP_USERDATA, (LONG_PTR)view); @@ -775,6 +773,20 @@ puglGetNativeWindow(PuglView* view) return (PuglNativeWindow)view->impl->hwnd; } +PuglStatus +puglSetWindowTitle(PuglView* view, const char* title) +{ + puglSetString(&view->title, title); + + wchar_t* wtitle = puglUtf8ToWideChar(title); + if (wtitle) { + SetWindowTextW(view->impl->hwnd, wtitle); + free(wtitle); + } + + return PUGL_SUCCESS; +} + PuglStatus puglSetFrame(PuglView* view, const PuglRect frame) { -- cgit v1.2.1