1
0
mirror of https://github.com/danog/patches.git synced 2024-11-29 20:09:09 +01:00

Backport setWindowGeometry method from Qt 5.13

This commit is contained in:
Ilya Fedin 2020-08-14 20:03:17 +04:00 committed by John Preston
parent 08351e38c3
commit ddd4084789

View File

@ -0,0 +1,103 @@
diff --git a/src/client/qwaylandshellsurface_p.h b/src/client/qwaylandshellsurface_p.h
index c7d02d16..9632e094 100644
--- a/src/client/qwaylandshellsurface_p.h
+++ b/src/client/qwaylandshellsurface_p.h
@@ -100,6 +100,8 @@ public:
virtual void propagateSizeHints() {}
+ virtual void setWindowGeometry(const QRect &rect) { Q_UNUSED(rect); }
+
private:
QWaylandWindow *m_window = nullptr;
friend class QWaylandWindow;
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index 39cc5847..fc22010e 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -357,6 +357,9 @@ void QWaylandWindow::setGeometry(const QRect &rect)
QRect exposeGeometry(QPoint(), geometry().size());
if (isExposed() && !mInResizeFromApplyConfigure && exposeGeometry != mLastExposeGeometry)
sendExposeEvent(exposeGeometry);
+
+ if (mShellSurface)
+ mShellSurface->setWindowGeometry(QRect(QPoint(0, 0), window()->frameGeometry().size()));
}
void QWaylandWindow::resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset)
diff --git a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp
index 9db6d435..822f2a4f 100644
--- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp
+++ b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp
@@ -94,9 +94,6 @@ void QWaylandXdgSurfaceV6::Toplevel::applyConfigure()
m_xdgSurface->m_window->resizeFromApplyConfigure(m_pending.size);
}
- QSize windowGeometrySize = m_xdgSurface->m_window->window()->frameGeometry().size();
- m_xdgSurface->set_window_geometry(0, 0, windowGeometrySize.width(), windowGeometrySize.height());
-
m_xdgSurface->setSizeHints();
m_applied = m_pending;
@@ -321,6 +318,11 @@ void QWaylandXdgSurfaceV6::propagateSizeHints()
m_window->commit();
}
+void QWaylandXdgSurfaceV6::setWindowGeometry(const QRect &rect)
+{
+ set_window_geometry(rect.x(), rect.y(), rect.width(), rect.height());
+}
+
void QWaylandXdgSurfaceV6::setSizeHints()
{
if (m_toplevel && m_window) {
diff --git a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h
index 3e473e95..2c6ce0be 100644
--- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h
+++ b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h
@@ -91,6 +91,7 @@ public:
void applyConfigure() override;
bool wantsDecorations() const override;
void propagateSizeHints() override;
+ void setWindowGeometry(const QRect &rect) override;
void setSizeHints();
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
index c446430d..14c835f8 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
@@ -104,9 +104,6 @@ void QWaylandXdgSurface::Toplevel::applyConfigure()
m_xdgSurface->m_window->resizeFromApplyConfigure(m_pending.size);
}
- QSize windowGeometrySize = m_xdgSurface->m_window->window()->frameGeometry().size();
- m_xdgSurface->set_window_geometry(0, 0, windowGeometrySize.width(), windowGeometrySize.height());
-
m_xdgSurface->setSizeHints();
m_applied = m_pending;
@@ -355,6 +352,11 @@ void QWaylandXdgSurface::propagateSizeHints()
m_window->commit();
}
+void QWaylandXdgSurface::setWindowGeometry(const QRect &rect)
+{
+ set_window_geometry(rect.x(), rect.y(), rect.width(), rect.height());
+}
+
void QWaylandXdgSurface::setSizeHints()
{
if (m_toplevel && m_window) {
diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h
index aec70cd1..2edf8726 100644
--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h
+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h
@@ -95,6 +95,7 @@ public:
void applyConfigure() override;
bool wantsDecorations() const override;
void propagateSizeHints() override;
+ void setWindowGeometry(const QRect &rect) override;
void setSizeHints();