summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatt Hoosier <matt.hoosier@garmin.com>2018-06-12 10:54:55 -0500
committerMatt Hoosier <matt.hoosier@garmin.com>2018-06-17 01:39:02 +0000
commit254b1428724f3e79248b906ad4cba810c0d37572 (patch)
treec6907bf1648d0c1058a52fd35a4d9dfd8fa35c5e /src
parentf423482a6e619a10754111254d7b4598e2d1e37c (diff)
downloadqtwayland-254b1428724f3e79248b906ad4cba810c0d37572.tar.gz
Compositor: implement fullscreen for XdgShellV6
This is patterned closely after the existing handling for maximization. [ChangeLog][Compositor] Added support for handling xdg-shell v6 requests to enter/exit fullscreen mode. Change-Id: I1f3127694d8537d76159b56350f35a4e8aa3e56d Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/compositor/extensions/qwaylandxdgshellv6.cpp4
-rw-r--r--src/compositor/extensions/qwaylandxdgshellv6integration.cpp49
-rw-r--r--src/compositor/extensions/qwaylandxdgshellv6integration_p.h5
3 files changed, 53 insertions, 5 deletions
diff --git a/src/compositor/extensions/qwaylandxdgshellv6.cpp b/src/compositor/extensions/qwaylandxdgshellv6.cpp
index c103dc03..342edfd1 100644
--- a/src/compositor/extensions/qwaylandxdgshellv6.cpp
+++ b/src/compositor/extensions/qwaylandxdgshellv6.cpp
@@ -1054,6 +1054,8 @@ uint QWaylandXdgToplevelV6::sendUnmaximized(const QSize &size)
* Convenience for sending a configure event with the fullscreen state set, and
* maximized and resizing removed. The activated state is left in its current state.
*
+ * \sa sendUnmaximized
+ *
* \a size is the new size of the window.
*/
@@ -1061,6 +1063,8 @@ uint QWaylandXdgToplevelV6::sendUnmaximized(const QSize &size)
* Convenience for sending a configure event with the fullscreen state set, and
* maximized and resizing removed. The activated state is left in its current state.
*
+ * \sa sendUnmaximized
+ *
* \a size is the new size of the window.
*/
uint QWaylandXdgToplevelV6::sendFullscreen(const QSize &size)
diff --git a/src/compositor/extensions/qwaylandxdgshellv6integration.cpp b/src/compositor/extensions/qwaylandxdgshellv6integration.cpp
index 68230937..769b426c 100644
--- a/src/compositor/extensions/qwaylandxdgshellv6integration.cpp
+++ b/src/compositor/extensions/qwaylandxdgshellv6integration.cpp
@@ -66,6 +66,9 @@ XdgToplevelV6Integration::XdgToplevelV6Integration(QWaylandQuickShellSurfaceItem
connect(m_toplevel, &QWaylandXdgToplevelV6::setMaximized, this, &XdgToplevelV6Integration::handleSetMaximized);
connect(m_toplevel, &QWaylandXdgToplevelV6::unsetMaximized, this, &XdgToplevelV6Integration::handleUnsetMaximized);
connect(m_toplevel, &QWaylandXdgToplevelV6::maximizedChanged, this, &XdgToplevelV6Integration::handleMaximizedChanged);
+ connect(m_toplevel, &QWaylandXdgToplevelV6::setFullscreen, this, &XdgToplevelV6Integration::handleSetFullscreen);
+ connect(m_toplevel, &QWaylandXdgToplevelV6::unsetFullscreen, this, &XdgToplevelV6Integration::handleUnsetFullscreen);
+ connect(m_toplevel, &QWaylandXdgToplevelV6::fullscreenChanged, this, &XdgToplevelV6Integration::handleFullscreenChanged);
connect(m_toplevel, &QWaylandXdgToplevelV6::activatedChanged, this, &XdgToplevelV6Integration::handleActivatedChanged);
connect(m_xdgSurface->shell(), &QWaylandXdgShellV6::popupCreated, this, [item](QWaylandXdgPopupV6 *popup, QWaylandXdgSurfaceV6 *){
handlePopupCreated(item, popup);
@@ -135,8 +138,12 @@ void XdgToplevelV6Integration::handleSetMaximized()
if (!m_item->view()->isPrimary())
return;
- maximizeState.initialWindowSize = m_xdgSurface->windowGeometry().size();
- maximizeState.initialPosition = m_item->moveItem()->position();
+ QVector<QWaylandXdgToplevelV6::State> states = m_toplevel->states();
+
+ if (!states.contains(QWaylandXdgToplevelV6::State::FullscreenState) && !states.contains(QWaylandXdgToplevelV6::State::MaximizedState)) {
+ windowedGeometry.initialWindowSize = m_xdgSurface->windowGeometry().size();
+ windowedGeometry.initialPosition = m_item->moveItem()->position();
+ }
QWaylandOutput *output = m_item->view()->output();
m_toplevel->sendMaximized(output->availableGeometry().size() / output->scaleFactor());
@@ -147,7 +154,7 @@ void XdgToplevelV6Integration::handleUnsetMaximized()
if (!m_item->view()->isPrimary())
return;
- m_toplevel->sendUnmaximized(maximizeState.initialWindowSize);
+ m_toplevel->sendUnmaximized(windowedGeometry.initialWindowSize);
}
void XdgToplevelV6Integration::handleMaximizedChanged()
@@ -156,7 +163,41 @@ void XdgToplevelV6Integration::handleMaximizedChanged()
QWaylandOutput *output = m_item->view()->output();
m_item->moveItem()->setPosition(output->position() + output->availableGeometry().topLeft());
} else {
- m_item->moveItem()->setPosition(maximizeState.initialPosition);
+ m_item->moveItem()->setPosition(windowedGeometry.initialPosition);
+ }
+}
+
+void XdgToplevelV6Integration::handleSetFullscreen()
+{
+ if (!m_item->view()->isPrimary())
+ return;
+
+ QVector<QWaylandXdgToplevelV6::State> states = m_toplevel->states();
+
+ if (!states.contains(QWaylandXdgToplevelV6::State::FullscreenState) && !states.contains(QWaylandXdgToplevelV6::State::MaximizedState)) {
+ windowedGeometry.initialWindowSize = m_xdgSurface->windowGeometry().size();
+ windowedGeometry.initialPosition = m_item->moveItem()->position();
+ }
+
+ QWaylandOutput *output = m_item->view()->output();
+ m_toplevel->sendFullscreen(output->geometry().size() / output->scaleFactor());
+}
+
+void XdgToplevelV6Integration::handleUnsetFullscreen()
+{
+ if (!m_item->view()->isPrimary())
+ return;
+
+ m_toplevel->sendUnmaximized(windowedGeometry.initialWindowSize);
+}
+
+void XdgToplevelV6Integration::handleFullscreenChanged()
+{
+ if (m_toplevel->fullscreen()) {
+ QWaylandOutput *output = m_item->view()->output();
+ m_item->moveItem()->setPosition(output->position() + output->geometry().topLeft());
+ } else {
+ m_item->moveItem()->setPosition(windowedGeometry.initialPosition);
}
}
diff --git a/src/compositor/extensions/qwaylandxdgshellv6integration_p.h b/src/compositor/extensions/qwaylandxdgshellv6integration_p.h
index 4ccabfa9..afb4964b 100644
--- a/src/compositor/extensions/qwaylandxdgshellv6integration_p.h
+++ b/src/compositor/extensions/qwaylandxdgshellv6integration_p.h
@@ -72,6 +72,9 @@ private Q_SLOTS:
void handleSetMaximized();
void handleUnsetMaximized();
void handleMaximizedChanged();
+ void handleSetFullscreen();
+ void handleUnsetFullscreen();
+ void handleFullscreenChanged();
void handleActivatedChanged();
void handleSurfaceSizeChanged();
@@ -106,7 +109,7 @@ private:
struct {
QSize initialWindowSize;
QPointF initialPosition;
- } maximizeState;
+ } windowedGeometry;
};
class XdgPopupV6Integration : public QWaylandQuickShellIntegration