Qt 5.11.0 (forwarded request 611399 from Vogtinator) OBS-URL: https://build.opensuse.org/request/show/611689 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtwayland?expand=0&rev=20
146 lines
5.2 KiB
Diff
146 lines
5.2 KiB
Diff
From da43d51dcbafc5fa1db245efd6737aa54c245afb Mon Sep 17 00:00:00 2001
|
|
From: Giulio Camuffo <giulio.camuffo@kdab.com>
|
|
Date: Sat, 1 Jul 2017 09:53:07 +0200
|
|
Subject: [PATCH] Handle maximize/minimize/fullscreen in xdg_shell_v6
|
|
|
|
Change-Id: I385eb3279d91f1c38d2f5d46bc63b324f0456ca4
|
|
---
|
|
src/client/qwaylandwindow.cpp | 6 +++-
|
|
src/client/qwaylandxdgshellv6.cpp | 61 ++++++++++++++++++++++++++++++++++++---
|
|
src/client/qwaylandxdgshellv6_p.h | 8 ++++-
|
|
3 files changed, 69 insertions(+), 6 deletions(-)
|
|
|
|
Index: qtwayland-everywhere-src-5.11.0-beta2/src/client/qwaylandwindow.cpp
|
|
===================================================================
|
|
--- qtwayland-everywhere-src-5.11.0-beta2.orig/src/client/qwaylandwindow.cpp
|
|
+++ qtwayland-everywhere-src-5.11.0-beta2/src/client/qwaylandwindow.cpp
|
|
@@ -980,7 +980,11 @@ bool QWaylandWindow::setWindowStateInter
|
|
// As of february 2013 QWindow::setWindowState sets the new state value after
|
|
// QPlatformWindow::setWindowState returns, so we cannot rely on QWindow::windowState
|
|
// here. We use then this mState variable.
|
|
- mState = state;
|
|
+ // NOTE: The compositor does not tell us when the window is not minimized anymore,
|
|
+ // so we store the state except for the WindowMinimized value, to make sure that
|
|
+ // the equality check above does not return true when setWindowState(Qt::WindowMinimized)
|
|
+ // is called, even though the window is actually not minimized anymore.
|
|
+ mState = state & ~Qt::WindowMinimized;
|
|
|
|
if (mShellSurface) {
|
|
createDecoration();
|
|
Index: qtwayland-everywhere-src-5.11.0-beta2/src/client/qwaylandxdgshellv6.cpp
|
|
===================================================================
|
|
--- qtwayland-everywhere-src-5.11.0-beta2.orig/src/client/qwaylandxdgshellv6.cpp
|
|
+++ qtwayland-everywhere-src-5.11.0-beta2/src/client/qwaylandxdgshellv6.cpp
|
|
@@ -56,6 +56,8 @@ QWaylandXdgSurfaceV6::Toplevel::Toplevel
|
|
: QtWayland::zxdg_toplevel_v6(xdgSurface->get_toplevel())
|
|
, m_xdgSurface(xdgSurface)
|
|
{
|
|
+ m_configureState.fullscreen = false;
|
|
+ m_configureState.maximized = false;
|
|
}
|
|
|
|
QWaylandXdgSurfaceV6::Toplevel::~Toplevel()
|
|
@@ -75,13 +77,35 @@ void QWaylandXdgSurfaceV6::Toplevel::zxd
|
|
m_configureState.width = width;
|
|
m_configureState.height = height;
|
|
|
|
+ bool wasMaximized = m_configureState.maximized;
|
|
+ bool wasFullscreen = m_configureState.fullscreen;
|
|
+
|
|
uint32_t *state = reinterpret_cast<uint32_t *>(states->data);
|
|
size_t numStates = states->size / sizeof(uint32_t);
|
|
- m_configureState.states.reserve(numStates);
|
|
- m_configureState.states.clear();
|
|
|
|
- for (size_t i = 0; i < numStates; i++)
|
|
- m_configureState.states << state[i];
|
|
+ m_configureState.fullscreen = false;
|
|
+ m_configureState.maximized = false;
|
|
+
|
|
+ for (size_t i = 0; i < numStates; i++) {
|
|
+ switch (state[i]) {
|
|
+ case ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED:
|
|
+ m_configureState.maximized = true;
|
|
+ break;
|
|
+ case ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN:
|
|
+ m_configureState.fullscreen = true;
|
|
+ break;
|
|
+ default:
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ if ((!wasMaximized && m_configureState.maximized) || (!wasFullscreen && m_configureState.fullscreen))
|
|
+ m_normalSize = m_xdgSurface->m_window->window()->frameGeometry().size();
|
|
+
|
|
+ if ((width == 0 || height == 0) && !m_normalSize.isEmpty()) {
|
|
+ m_configureState.width = m_normalSize.width();
|
|
+ m_configureState.height = m_normalSize.height();
|
|
+ }
|
|
}
|
|
|
|
void QWaylandXdgSurfaceV6::Toplevel::zxdg_toplevel_v6_close()
|
|
@@ -232,6 +256,35 @@ void QWaylandXdgSurfaceV6::zxdg_surface_
|
|
ack_configure(serial);
|
|
}
|
|
|
|
+void QWaylandXdgSurfaceV6::setMaximized()
|
|
+{
|
|
+ if (m_toplevel)
|
|
+ m_toplevel->set_maximized();
|
|
+}
|
|
+
|
|
+void QWaylandXdgSurfaceV6::setFullscreen()
|
|
+{
|
|
+ if (m_toplevel)
|
|
+ m_toplevel->set_fullscreen(nullptr);
|
|
+}
|
|
+
|
|
+void QWaylandXdgSurfaceV6::setNormal()
|
|
+{
|
|
+ if (!m_toplevel)
|
|
+ return;
|
|
+
|
|
+ if (m_toplevel->m_configureState.maximized)
|
|
+ m_toplevel->unset_maximized();
|
|
+ if (m_toplevel->m_configureState.fullscreen)
|
|
+ m_toplevel->unset_fullscreen();
|
|
+}
|
|
+
|
|
+void QWaylandXdgSurfaceV6::setMinimized()
|
|
+{
|
|
+ if (m_toplevel)
|
|
+ m_toplevel->set_minimized();
|
|
+}
|
|
+
|
|
|
|
|
|
QWaylandXdgShellV6::QWaylandXdgShellV6(struct ::wl_registry *registry, uint32_t id, uint32_t availableVersion)
|
|
Index: qtwayland-everywhere-src-5.11.0-beta2/src/client/qwaylandxdgshellv6_p.h
|
|
===================================================================
|
|
--- qtwayland-everywhere-src-5.11.0-beta2.orig/src/client/qwaylandxdgshellv6_p.h
|
|
+++ qtwayland-everywhere-src-5.11.0-beta2/src/client/qwaylandxdgshellv6_p.h
|
|
@@ -88,6 +88,10 @@ public:
|
|
|
|
protected:
|
|
void zxdg_surface_v6_configure(uint32_t serial) override;
|
|
+ void setMaximized() override;
|
|
+ void setFullscreen() override;
|
|
+ void setNormal() override;
|
|
+ void setMinimized() override;
|
|
|
|
private:
|
|
class Toplevel: public QtWayland::zxdg_toplevel_v6
|
|
@@ -103,8 +107,10 @@ private:
|
|
|
|
struct {
|
|
int32_t width, height;
|
|
- QVarLengthArray<uint32_t> states;
|
|
+ bool maximized;
|
|
+ bool fullscreen;
|
|
} m_configureState;
|
|
+ QSize m_normalSize;
|
|
|
|
QWaylandXdgSurfaceV6 *m_xdgSurface = nullptr;
|
|
};
|