effects: Fix QQuickItem::mapToGlobal() in qtquick effects on wayland
On Wayland, we create a dummy window to fix HiDPI issues. At the moment, the QQuickRenderControl::renderWindow() returns a fixed offset 0,0. As it turns out, QQuickItem::mapToGlobal() will poke the QQuickRenderControl::renderWindow() function to map the specified point to the global coordinate space. Since the renderWindow() function returns hardcoded offset, the mapToGlobal() function is sort of broken in fullscreen effects. In order to fix mapToGlobal() on Wayland, this change makes the EffectQuickRenderControl return the position of the associated OffscreenQuickView.
This commit is contained in:
parent
f86f159fd5
commit
97a82c97df
1 changed files with 10 additions and 4 deletions
|
@ -40,8 +40,9 @@ class EffectQuickRenderControl : public QQuickRenderControl
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EffectQuickRenderControl(QWindow *renderWindow, QObject *parent = nullptr)
|
||||
: QQuickRenderControl(parent)
|
||||
explicit EffectQuickRenderControl(OffscreenQuickView *view, QWindow *renderWindow)
|
||||
: QQuickRenderControl(view)
|
||||
, m_view(view)
|
||||
, m_renderWindow(renderWindow)
|
||||
{
|
||||
}
|
||||
|
@ -49,12 +50,17 @@ public:
|
|||
QWindow *renderWindow(QPoint *offset) override
|
||||
{
|
||||
if (offset) {
|
||||
if (m_renderWindow) {
|
||||
*offset = m_renderWindow->mapFromGlobal(m_view->geometry().topLeft());
|
||||
} else {
|
||||
*offset = QPoint(0, 0);
|
||||
}
|
||||
}
|
||||
return m_renderWindow;
|
||||
}
|
||||
|
||||
private:
|
||||
OffscreenQuickView *m_view;
|
||||
QPointer<QWindow> m_renderWindow;
|
||||
};
|
||||
|
||||
|
@ -125,7 +131,7 @@ OffscreenQuickView::OffscreenQuickView(QObject *parent, QWindow *renderWindow, E
|
|||
: QObject(parent)
|
||||
, d(new OffscreenQuickView::Private)
|
||||
{
|
||||
d->m_renderControl = new EffectQuickRenderControl(renderWindow, this);
|
||||
d->m_renderControl = new EffectQuickRenderControl(this, renderWindow);
|
||||
|
||||
d->m_view = new QQuickWindow(d->m_renderControl);
|
||||
d->m_view->setFlags(Qt::FramelessWindowHint);
|
||||
|
|
Loading…
Reference in a new issue