Aurorae: Add dummy window for working device pixel ratio
Aurorae uses a QQuickWindow that receives an implicit scale through the QPA. Unfortunately there's a known quirk with device pixel ratio not being followed when offscreen surfaces are never shown and an independent render control is used. Without this QQuickRenderControl::grab ends up using a buffer the size of the window * dpr, but with the contents rendered at 1x in the corner along with incorrect device pixel ratio information. This patch copies a used solution from EffectQuickView. This can be resolved more neatly with newer Qt. BUG: 452730 BUG: 465790
This commit is contained in:
parent
38cd1fc491
commit
01fd54d753
2 changed files with 14 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
|||
#include "aurorae.h"
|
||||
|
||||
#include "config-kwin.h"
|
||||
#include "kwineffects.h"
|
||||
|
||||
#include "auroraetheme.h"
|
||||
#include "kwinoffscreenquickview.h"
|
||||
|
@ -312,7 +313,18 @@ void Decoration::init()
|
|||
m_item->setParentItem(visualParent.value<QQuickItem *>());
|
||||
visualParent.value<QQuickItem *>()->setProperty("drawBackground", false);
|
||||
} else {
|
||||
m_view = std::make_unique<KWin::OffscreenQuickView>(this, KWin::OffscreenQuickView::ExportMode::Image);
|
||||
|
||||
// This is an ugly hack to make hidpi rendering work as expected on wayland until we switch
|
||||
// to Qt 6.3 or newer. See https://codereview.qt-project.org/c/qt/qtdeclarative/+/361506
|
||||
if (KWin::effects && KWin::effects->waylandDisplay()) {
|
||||
m_dummyWindow.reset(new QWindow());
|
||||
m_dummyWindow->setOpacity(0);
|
||||
m_dummyWindow->resize(1, 1);
|
||||
m_dummyWindow->setFlag(Qt::FramelessWindowHint);
|
||||
m_dummyWindow->setVisible(true);
|
||||
}
|
||||
|
||||
m_view = std::make_unique<KWin::OffscreenQuickView>(this, m_dummyWindow.get(), KWin::OffscreenQuickView::ExportMode::Image);
|
||||
m_item->setParentItem(m_view->contentItem());
|
||||
auto updateSize = [this]() {
|
||||
m_item->setSize(m_view->contentItem()->size());
|
||||
|
|
|
@ -80,6 +80,7 @@ private:
|
|||
KWin::Borders *m_padding;
|
||||
QString m_themeName;
|
||||
|
||||
std::unique_ptr<QWindow> m_dummyWindow;
|
||||
std::unique_ptr<KWin::OffscreenQuickView> m_view;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue