From 2c45682a5e8abb58f7fd0769e11c0a3b230b7ceb Mon Sep 17 00:00:00 2001 From: Jeffy Chen Date: Sat, 9 May 2020 17:23:59 +0800 Subject: [PATCH 09/17] qwaylandxdgshell: Support switching between fullscreen and maximized 1/ The weston expected a commit to apply new window states. 2/ Switching between fullscreen and maximized requests unsetting the old state firstly. Signed-off-by: Jeffy Chen --- .../shellintegration/xdg-shell/qwaylandxdgshell.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp index 61f7e8c..c663000 100644 --- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp +++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp @@ -99,6 +99,9 @@ void QWaylandXdgSurface::Toplevel::applyConfigure() m_xdgSurface->m_window->resizeFromApplyConfigure(m_pending.size); } + // Trigger a update to commit new state + m_xdgSurface->m_window->window()->requestUpdate(); + m_applied = m_pending; qCDebug(lcQpaWayland) << "Applied pending xdg_toplevel configure event:" << m_applied.size << m_applied.states; } @@ -162,6 +165,11 @@ void QWaylandXdgSurface::Toplevel::requestWindowStates(Qt::WindowStates states) // Re-send what's different from the applied state Qt::WindowStates changedStates = m_applied.states ^ states; + if (changedStates & Qt::WindowFullScreen) { + if (!(states & Qt::WindowFullScreen)) + unset_fullscreen(); + } + if (changedStates & Qt::WindowMaximized) { if (states & Qt::WindowMaximized) set_maximized(); @@ -175,8 +183,7 @@ void QWaylandXdgSurface::Toplevel::requestWindowStates(Qt::WindowStates states) if (screen) { set_fullscreen(screen->output()); } - } else - unset_fullscreen(); + } } // Minimized state is not reported by the protocol, so always send it -- 2.20.1