| 342 | // set view as resizable (or not) during runtime |
| 343 | |
| 344 | void puglSetResizable(PuglView* const view, const bool resizable) |
| 345 | { |
| 346 | puglSetViewHint(view, PUGL_RESIZABLE, resizable ? PUGL_TRUE : PUGL_FALSE); |
| 347 | |
| 348 | #if defined(DISTRHO_OS_HAIKU) |
| 349 | #elif defined(DISTRHO_OS_MAC) |
| 350 | if (PuglWindow* const window = view->impl->window) |
| 351 | { |
| 352 | const uint style = (NSClosableWindowMask | NSTitledWindowMask | NSMiniaturizableWindowMask) |
| 353 | | (resizable ? NSResizableWindowMask : 0); |
| 354 | [window setStyleMask:style]; |
| 355 | } |
| 356 | // FIXME use [view setAutoresizingMask:NSViewNotSizable] ? |
| 357 | #elif defined(DISTRHO_OS_WASM) |
| 358 | puglUpdateSizeHints(view); |
| 359 | #elif defined(DISTRHO_OS_WINDOWS) |
| 360 | if (const HWND hwnd = view->impl->hwnd) |
| 361 | { |
| 362 | const uint winFlags = resizable ? GetWindowLong(hwnd, GWL_STYLE) | (WS_SIZEBOX | WS_MAXIMIZEBOX) |
| 363 | : GetWindowLong(hwnd, GWL_STYLE) & ~(WS_SIZEBOX | WS_MAXIMIZEBOX); |
| 364 | SetWindowLong(hwnd, GWL_STYLE, winFlags); |
| 365 | } |
| 366 | #elif defined(HAVE_X11) |
| 367 | puglUpdateSizeHints(view); |
| 368 | #endif |
| 369 | } |
| 370 | |
| 371 | // -------------------------------------------------------------------------------------------------------------------- |
| 372 | // set window size while also changing default |
no test coverage detected