Introduce "recommended overlay rectangle" to display plugins
Showing the changes to interface/src/Application.cpp (1 of 15 files). Show all
Unified · Split
| @@ -2681,8 +2681,6 @@ void Application::idle(uint64_t now) { · 2680 unmodified lines | |||
| 2681 | _overlayConductor.setEnabled(Menu::getInstance()->isOptionChecked(MenuOption::Overlays)); | 2681 | _overlayConductor.setEnabled(Menu::getInstance()->isOptionChecked(MenuOption::Overlays)); |
| 2682 | } | 2682 | } |
| 2683 | 2683 | ||
| 2684 | |||
| 2685 | |||
| 2686 | // If the offscreen Ui has something active that is NOT the root, then assume it has keyboard focus. | 2684 | // If the offscreen Ui has something active that is NOT the root, then assume it has keyboard focus. |
| 2687 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); | 2685 | auto offscreenUi = DependencyManager::get<OffscreenUi>(); |
| 2688 | if (_keyboardDeviceHasFocus && offscreenUi && offscreenUi->getWindow()->activeFocusItem() != offscreenUi->getRootItem()) { | 2686 | if (_keyboardDeviceHasFocus && offscreenUi && offscreenUi->getWindow()->activeFocusItem() != offscreenUi->getRootItem()) { |
| @@ -4894,19 +4892,44 @@ QRect Application::getRenderingGeometry() const { · 2205 unmodified lines | |||
| 4894 | } | 4892 | } |
| 4895 | 4893 | ||
| 4896 | glm::uvec2 Application::getUiSize() const { | 4894 | glm::uvec2 Application::getUiSize() const { |
| 4897 | return getActiveDisplayPlugin()->getRecommendedUiSize(); | 4895 | static const uint MIN_SIZE = 1; |
| 4896 | glm::uvec2 result(MIN_SIZE); | ||
| 4897 | if (_displayPlugin) { | ||
| 4898 | result = getActiveDisplayPlugin()->getRecommendedUiSize(); | ||
| 4899 | } | ||
| 4900 | return result; | ||
| 4901 | } | ||
| 4902 | |||
| 4903 | QRect Application::getRecommendedOverlayRect() const { | ||
| 4904 | auto uiSize = getUiSize(); | ||
| 4905 | QRect result(0, 0, uiSize.x, uiSize.y); | ||
| 4906 | if (_displayPlugin) { | ||
| 4907 | result = getActiveDisplayPlugin()->getRecommendedOverlayRect(); | ||
| 4908 | } | ||
| 4909 | return result; | ||
| 4898 | } | 4910 | } |
| 4899 | 4911 | ||
| 4900 | QSize Application::getDeviceSize() const { | 4912 | QSize Application::getDeviceSize() const { |
| 4901 | return fromGlm(getActiveDisplayPlugin()->getRecommendedRenderSize()); | 4913 | static const int MIN_SIZE = 1; |
| 4914 | QSize result(MIN_SIZE, MIN_SIZE); | ||
| 4915 | if (_displayPlugin) { | ||
| 4916 | result = fromGlm(getActiveDisplayPlugin()->getRecommendedRenderSize()); | ||
| 4917 | } | ||
| 4918 | return result; | ||
| 4902 | } | 4919 | } |
| 4903 | 4920 | ||
| 4904 | bool Application::isThrottleRendering() const { | 4921 | bool Application::isThrottleRendering() const { |
| 4905 | return getActiveDisplayPlugin()->isThrottled(); | 4922 | if (_displayPlugin) { |
| 4923 | return getActiveDisplayPlugin()->isThrottled(); | ||
| 4924 | } | ||
| 4925 | return false; | ||
| 4906 | } | 4926 | } |
| 4907 | 4927 | ||
| 4908 | bool Application::hasFocus() const { | 4928 | bool Application::hasFocus() const { |
| 4909 | return getActiveDisplayPlugin()->hasFocus(); | 4929 | if (_displayPlugin) { |
| 4930 | return getActiveDisplayPlugin()->hasFocus(); | ||
| 4931 | } | ||
| 4932 | return (QApplication::activeWindow() != nullptr); | ||
| 4910 | } | 4933 | } |
| 4911 | 4934 | ||
| 4912 | glm::vec2 Application::getViewportDimensions() const { | 4935 | glm::vec2 Application::getViewportDimensions() const { |