1From 2c45682a5e8abb58f7fd0769e11c0a3b230b7ceb Mon Sep 17 00:00:00 2001
2From: Jeffy Chen <jeffy.chen@rock-chips.com>
3Date: Sat, 9 May 2020 17:23:59 +0800
4Subject: [PATCH 09/17] qwaylandxdgshell: Support switching between fullscreen
5 and maximized
6
71/ The weston expected a commit to apply new window states.
82/ Switching between fullscreen and maximized requests unsetting the old
9state firstly.
10
11Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
12---
13 .../shellintegration/xdg-shell/qwaylandxdgshell.cpp   | 11 +++++++++--
14 1 file changed, 9 insertions(+), 2 deletions(-)
15
16diff --git a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
17index 61f7e8c..c663000 100644
18--- a/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
19+++ b/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell.cpp
20@@ -99,6 +99,9 @@ void QWaylandXdgSurface::Toplevel::applyConfigure()
21         m_xdgSurface->m_window->resizeFromApplyConfigure(m_pending.size);
22     }
23
24+    // Trigger a update to commit new state
25+    m_xdgSurface->m_window->window()->requestUpdate();
26+
27     m_applied = m_pending;
28     qCDebug(lcQpaWayland) << "Applied pending xdg_toplevel configure event:" << m_applied.size << m_applied.states;
29 }
30@@ -162,6 +165,11 @@ void QWaylandXdgSurface::Toplevel::requestWindowStates(Qt::WindowStates states)
31     // Re-send what's different from the applied state
32     Qt::WindowStates changedStates = m_applied.states ^ states;
33
34+    if (changedStates & Qt::WindowFullScreen) {
35+        if (!(states & Qt::WindowFullScreen))
36+            unset_fullscreen();
37+    }
38+
39     if (changedStates & Qt::WindowMaximized) {
40         if (states & Qt::WindowMaximized)
41             set_maximized();
42@@ -175,8 +183,7 @@ void QWaylandXdgSurface::Toplevel::requestWindowStates(Qt::WindowStates states)
43             if (screen) {
44                 set_fullscreen(screen->output());
45             }
46-        } else
47-            unset_fullscreen();
48+        }
49     }
50
51     // Minimized state is not reported by the protocol, so always send it
52--
532.20.1
54
55