| 372 | // set window size while also changing default |
| 373 | |
| 374 | PuglStatus puglSetSizeAndDefault(PuglView* const view, const uint width, const uint height) |
| 375 | { |
| 376 | // set default size first |
| 377 | view->sizeHints[PUGL_DEFAULT_SIZE].width = view->sizeHints[PUGL_CURRENT_SIZE].width = width; |
| 378 | view->sizeHints[PUGL_DEFAULT_SIZE].height = view->sizeHints[PUGL_CURRENT_SIZE].height = height; |
| 379 | |
| 380 | #if defined(DISTRHO_OS_HAIKU) |
| 381 | #elif defined(DISTRHO_OS_MAC) |
| 382 | // matches upstream pugl |
| 383 | if (view->impl->wrapperView) |
| 384 | { |
| 385 | // nothing to do for PUGL_DEFAULT_SIZE hint |
| 386 | |
| 387 | if (const PuglStatus status = puglSetWindowSize(view, width, height)) |
| 388 | return status; |
| 389 | } |
| 390 | #elif defined(DISTRHO_OS_WASM) |
| 391 | if (const PuglStatus status = puglUpdateSizeHints(view)) |
| 392 | return status; |
| 393 | |
| 394 | emscripten_set_canvas_element_size(view->world->strings[PUGL_CLASS_NAME], width, height); |
| 395 | #elif defined(DISTRHO_OS_WINDOWS) |
| 396 | // matches upstream pugl, except we re-enter context after resize |
| 397 | if (view->impl->hwnd) |
| 398 | { |
| 399 | // nothing to do for PUGL_DEFAULT_SIZE hint |
| 400 | |
| 401 | if (const PuglStatus status = puglSetWindowSize(view, width, height)) |
| 402 | return status; |
| 403 | |
| 404 | // make sure to return context back to ourselves |
| 405 | puglBackendEnter(view); |
| 406 | } |
| 407 | #elif defined(HAVE_X11) |
| 408 | // matches upstream pugl, adds flush at the end |
| 409 | if (view->impl->win) |
| 410 | { |
| 411 | if (const PuglStatus status = puglUpdateSizeHints(view)) |
| 412 | return status; |
| 413 | |
| 414 | if (const PuglStatus status = puglSetWindowSize(view, width, height)) |
| 415 | return status; |
| 416 | |
| 417 | // flush size changes |
| 418 | XFlush(view->world->impl->display); |
| 419 | } |
| 420 | #endif |
| 421 | |
| 422 | return PUGL_SUCCESS; |
| 423 | } |
| 424 | |
| 425 | // -------------------------------------------------------------------------------------------------------------------- |
| 426 | // DGL specific, build-specific drawing prepare |
no test coverage detected