diff options
Diffstat (limited to 'src/plugins/shellintegration')
4 files changed, 66 insertions, 0 deletions
diff --git a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp index 01122769e..6652c8768 100644 --- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp +++ b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6.cpp @@ -46,6 +46,8 @@ #include <QtWaylandClient/private/qwaylandscreen_p.h> #include <QtWaylandClient/private/qwaylandabstractdecoration_p.h> +#include <QtGui/private/qwindow_p.h> + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -94,6 +96,9 @@ void QWaylandXdgSurfaceV6::Toplevel::applyConfigure() 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; qCDebug(lcQpaWayland) << "Applied pending zxdg_toplevel_v6 configure event:" << m_applied.size << m_applied.states; } @@ -305,6 +310,31 @@ bool QWaylandXdgSurfaceV6::wantsDecorations() const return m_toplevel && !(m_toplevel->m_pending.states & Qt::WindowFullScreen); } +void QWaylandXdgSurfaceV6::propagateSizeHints() +{ + setSizeHints(); + + if (m_toplevel && m_window) + m_window->commit(); +} + +void QWaylandXdgSurfaceV6::setSizeHints() +{ + if (m_toplevel && m_window) { + const int minWidth = qMax(0, m_window->windowMinimumSize().width()); + const int minHeight = qMax(0, m_window->windowMinimumSize().height()); + m_toplevel->set_min_size(minWidth, minHeight); + + int maxWidth = qMax(0, m_window->windowMaximumSize().width()); + if (maxWidth == QWINDOWSIZE_MAX) + maxWidth = 0; + int maxHeight = qMax(0, m_window->windowMaximumSize().height()); + if (maxHeight == QWINDOWSIZE_MAX) + maxHeight = 0; + m_toplevel->set_max_size(maxWidth, maxHeight); + } +} + void QWaylandXdgSurfaceV6::requestWindowStates(Qt::WindowStates states) { if (m_toplevel) diff --git a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h index e688f751a..62c13157e 100644 --- a/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h +++ b/src/plugins/shellintegration/xdg-shell-v6/qwaylandxdgshellv6_p.h @@ -88,6 +88,9 @@ public: bool handlesActiveState() const { return m_toplevel; } void applyConfigure() override; bool wantsDecorations() const override; + void propagateSizeHints() override; + + void setSizeHints(); protected: void requestWindowStates(Qt::WindowStates states) override; diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index cabba5b3b..fc515ca1b 100644 --- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -46,6 +46,8 @@ #include <QtWaylandClient/private/qwaylandscreen_p.h> #include <QtWaylandClient/private/qwaylandabstractdecoration_p.h> +#include <QtGui/private/qwindow_p.h> + QT_BEGIN_NAMESPACE namespace QtWaylandClient { @@ -104,6 +106,9 @@ void QWaylandXdgSurface::Toplevel::applyConfigure() 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; qCDebug(lcQpaWayland) << "Applied pending xdg_toplevel configure event:" << m_applied.size << m_applied.states; } @@ -339,6 +344,31 @@ bool QWaylandXdgSurface::wantsDecorations() const return m_toplevel && m_toplevel->wantsDecorations(); } +void QWaylandXdgSurface::propagateSizeHints() +{ + setSizeHints(); + + if (m_toplevel && m_window) + m_window->commit(); +} + +void QWaylandXdgSurface::setSizeHints() +{ + if (m_toplevel && m_window) { + const int minWidth = qMax(0, m_window->windowMinimumSize().width()); + const int minHeight = qMax(0, m_window->windowMinimumSize().height()); + m_toplevel->set_min_size(minWidth, minHeight); + + int maxWidth = qMax(0, m_window->windowMaximumSize().width()); + if (maxWidth == QWINDOWSIZE_MAX) + maxWidth = 0; + int maxHeight = qMax(0, m_window->windowMaximumSize().height()); + if (maxHeight == QWINDOWSIZE_MAX) + maxHeight = 0; + m_toplevel->set_max_size(maxWidth, maxHeight); + } +} + void QWaylandXdgSurface::requestWindowStates(Qt::WindowStates states) { if (m_toplevel) diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h index 416feee2c..c39ccde3b 100644 --- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h +++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h @@ -92,6 +92,9 @@ public: bool handlesActiveState() const { return m_toplevel; } void applyConfigure() override; bool wantsDecorations() const override; + void propagateSizeHints() override; + + void setSizeHints(); protected: void requestWindowStates(Qt::WindowStates states) override; |