| 494 | } |
| 495 | |
| 496 | void Window::setGeometryConstraints(uint minimumWidth, |
| 497 | uint minimumHeight, |
| 498 | const bool keepAspectRatio, |
| 499 | const bool automaticallyScale, |
| 500 | bool resizeNowIfAutoScaling) |
| 501 | { |
| 502 | DISTRHO_SAFE_ASSERT_RETURN(minimumWidth > 0,); |
| 503 | DISTRHO_SAFE_ASSERT_RETURN(minimumHeight > 0,); |
| 504 | |
| 505 | // prevent auto-scaling up 2x |
| 506 | if (resizeNowIfAutoScaling && automaticallyScale && pData->autoScaling == automaticallyScale) |
| 507 | resizeNowIfAutoScaling = false; |
| 508 | |
| 509 | pData->minWidth = minimumWidth; |
| 510 | pData->minHeight = minimumHeight; |
| 511 | pData->autoScaling = automaticallyScale; |
| 512 | pData->keepAspectRatio = keepAspectRatio; |
| 513 | |
| 514 | if (pData->view == nullptr) |
| 515 | return; |
| 516 | |
| 517 | const double scaleFactor = pData->scaleFactor; |
| 518 | |
| 519 | if (automaticallyScale && scaleFactor != 1.0) |
| 520 | { |
| 521 | minimumWidth = d_roundToUnsignedInt(minimumWidth * scaleFactor); |
| 522 | minimumHeight = d_roundToUnsignedInt(minimumHeight * scaleFactor); |
| 523 | } |
| 524 | |
| 525 | puglSetGeometryConstraints(pData->view, minimumWidth, minimumHeight, keepAspectRatio); |
| 526 | |
| 527 | if (scaleFactor != 1.0 && automaticallyScale && resizeNowIfAutoScaling) |
| 528 | { |
| 529 | const Size<uint> size(getSize()); |
| 530 | |
| 531 | setSize(d_roundToUnsignedInt(size.getWidth() * scaleFactor), |
| 532 | d_roundToUnsignedInt(size.getHeight() * scaleFactor)); |
| 533 | } |
| 534 | } |
| 535 | |
| 536 | void Window::setTransientParent(const uintptr_t transientParentWindowHandle) |
| 537 | { |
no test coverage detected