diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index a7ed6d1e..d730d1dd 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -37,7 +37,7 @@ qt_add_library(quickshell-core STATIC set_source_files_properties(main.cpp PROPERTIES COMPILE_DEFINITIONS GIT_REVISION="${GIT_REVISION}") qt_add_qml_module(quickshell-core URI Quickshell VERSION 0.1) -target_link_libraries(quickshell-core PRIVATE ${QT_DEPS}) +target_link_libraries(quickshell-core PRIVATE ${QT_DEPS} Qt6::QuickPrivate) qs_pch(quickshell-core) target_link_libraries(quickshell PRIVATE quickshell-coreplugin) diff --git a/src/core/proxywindow.cpp b/src/core/proxywindow.cpp index 4eef5f38..41d539ce 100644 --- a/src/core/proxywindow.cpp +++ b/src/core/proxywindow.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include "generation.hpp" #include "qmlglobal.hpp" @@ -182,6 +183,7 @@ void ProxyWindowBase::setVisibleDirect(bool visible) { if (visible) { this->createWindow(); + this->polishItems(); this->window->setVisible(true); emit this->backerVisibilityChanged(); } else { @@ -192,11 +194,22 @@ void ProxyWindowBase::setVisibleDirect(bool visible) { } } } else if (this->window != nullptr) { + if (visible) this->polishItems(); this->window->setVisible(visible); emit this->backerVisibilityChanged(); } } +void ProxyWindowBase::polishItems() { + // Due to QTBUG-126704, layouts in invisible windows don't update their dimensions. + // Usually this isn't an issue, but it is when the size of a window is based on the size + // of its content, and that content is in a layout. + // + // This hack manually polishes the item tree right before showing the window so it will + // always be created with the correct size. + QQuickWindowPrivate::get(this->window)->polishItems(); +} + qint32 ProxyWindowBase::x() const { if (this->window == nullptr) return 0; else return this->window->x(); diff --git a/src/core/proxywindow.hpp b/src/core/proxywindow.hpp index 40f14c4a..1c62f029 100644 --- a/src/core/proxywindow.hpp +++ b/src/core/proxywindow.hpp @@ -133,5 +133,6 @@ protected: bool reloadComplete = false; private: + void polishItems(); void updateMask(); };