diff options
author | David Robillard <d@drobilla.net> | 2019-08-01 09:27:24 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-09-03 08:32:16 +0200 |
commit | f76954359229c25a6c9d29d6de3e75ab3a25f8dd (patch) | |
tree | 48632ffda2651629e4ca44353dbdd78b524efc2d | |
parent | 93f4920cfc03d1a2a8c0df9c6d863cdf20c6ab32 (diff) | |
download | pugl-f76954359229c25a6c9d29d6de3e75ab3a25f8dd.tar.gz pugl-f76954359229c25a6c9d29d6de3e75ab3a25f8dd.tar.bz2 pugl-f76954359229c25a6c9d29d6de3e75ab3a25f8dd.zip |
Windows: Factor out window flag functions
-rw-r--r-- | pugl/detail/win.h | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/pugl/detail/win.h b/pugl/detail/win.h index 16d22c0..c051eb1 100644 --- a/pugl/detail/win.h +++ b/pugl/detail/win.h @@ -67,24 +67,32 @@ puglWinGetPixelFormatDescriptor(const PuglHints hints) return pfd; } +static inline unsigned +puglWinGetWindowFlags(const PuglView* const view) +{ + const bool resizable = view->hints[PUGL_RESIZABLE]; + return (WS_CLIPCHILDREN | WS_CLIPSIBLINGS | + (view->parent + ? WS_CHILD + : (WS_POPUPWINDOW | WS_CAPTION | WS_MINIMIZEBOX | + (resizable ? (WS_SIZEBOX | WS_MAXIMIZEBOX) : 0)))); +} + +static inline unsigned +puglWinGetWindowExFlags(const PuglView* const view) +{ + return WS_EX_NOINHERITLAYOUT | (view->parent ? 0u : WS_EX_APPWINDOW); +} + static inline PuglStatus puglWinCreateWindow(const PuglView* const view, const char* const title, HWND* const hwnd, HDC* const hdc) { - const char* className = view->windowClass ? view->windowClass : "Pugl"; - const bool resizable = view->hints[PUGL_RESIZABLE]; - - const unsigned winFlags = - (WS_CLIPCHILDREN | WS_CLIPSIBLINGS | - (view->parent - ? WS_CHILD - : (WS_POPUPWINDOW | WS_CAPTION | WS_MINIMIZEBOX | - (resizable ? (WS_SIZEBOX | WS_MAXIMIZEBOX) : 0)))); - - const unsigned winExFlags = - WS_EX_NOINHERITLAYOUT | (view->parent ? 0u : WS_EX_APPWINDOW); + const char* className = view->windowClass ? view->windowClass : "Pugl"; + const unsigned winFlags = puglWinGetWindowFlags(view); + const unsigned winExFlags = puglWinGetWindowExFlags(view); // Calculate total window size to accommodate requested view size RECT wr = { 0, 0, view->width, view->height }; |