on xenial help sign in
fix restoring fullscreen windows
commitd734438bb58c753b496258ca5fb53e0e265e4079 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateWed 25 Jan 2017, 15:25 (10 years ago) parent14c72a1
3 files changed+13−4
qml/Stage/Stage.qml+11−2 tests/mocks/Unity/Application/SurfaceManager.cpp−2 tests/qmltests/tst_Shell.qml+2
qml/Stage/Stage.qml+11−2
@@ -806,7 +806,7 @@ FocusScope {
806806 maximizedTopLeft || maximizedTopRight || maximizedBottomLeft || maximizedBottomRight
807807
808808 readonly property bool minimized: windowState & WindowStateStorage.WindowStateMinimized
809− readonly property bool fullscreen: window.state === Mir.FullscreenState
809+ readonly property bool fullscreen: windowState === WindowStateStorage.WindowStateFullscreen
810810
811811 readonly property bool canBeMaximized: canBeMaximizedHorizontally && canBeMaximizedVertically
812812 readonly property bool canBeMaximizedLeftRight: (maximumWidth == 0 || maximumWidth >= appContainer.width/2) &&
@@ -818,6 +818,7 @@ FocusScope {
818818 readonly property alias orientationChangesEnabled: decoratedWindow.orientationChangesEnabled
819819
820820 property int windowState: WindowStateStorage.WindowStateNormal
821+ property int prevWindowState: WindowStateStorage.WindowStateRestored
821822 property bool animationsEnabled: true
822823 property alias title: decoratedWindow.title
823824 readonly property string appName: model.application ? model.application.name : ""
@@ -922,7 +923,14 @@ FocusScope {
922923 } else if (model.window.state === Mir.MaximizedBottomRightState) {
923924 appDelegate.maximizeBottomRight();
924925 } else if (model.window.state === Mir.RestoredState) {
925− appDelegate.restore();
926+ if (appDelegate.fullscreen && appDelegate.prevWindowState != WindowStateStorage.WindowStateRestored) {
927+ model.window.requestState(WindowStateStorage.toMirState(appDelegate.prevWindowState));
928+ } else {
929+ appDelegate.restore();
930+ }
931+ } else if (model.window.state === Mir.FullscreenState) {
932+ appDelegate.prevWindowState = appDelegate.windowState;
933+ appDelegate.windowState = WindowStateStorage.WindowStateFullscreen;
926934 }
927935 }
928936 }
@@ -1024,6 +1032,7 @@ FocusScope {
10241032 animationsEnabled = (animated === undefined) || animated;
10251033 windowState = state || WindowStateStorage.WindowStateRestored;
10261034 windowState &= ~WindowStateStorage.WindowStateMinimized; // clear the minimized bit
1035+ prevWindowState = windowState;
10271036 }
10281037
10291038 function playFocusAnimation() {
tests/mocks/Unity/Application/SurfaceManager.cpp−2
@@ -204,8 +204,6 @@ void SurfaceManager::activate(unityapi::MirSurfaceInterface *apiSurface)
204204
205205void SurfaceManager::onStateRequested(MirSurface *surface, Mir::State state)
206206{
207− Q_ASSERT(!m_underModification);
208−
209207 DEBUG_MSG("("<<surface<<","<<state<<") started");
210208 Q_EMIT modificationsStarted();
211209 m_underModification = true;
tests/qmltests/tst_Shell.qml+2
@@ -335,6 +335,8 @@ Rectangle {
335335 Row {
336336 CheckBox {
337337 id: fullscreeAppCheck
338+ activeFocusOnPress: false
339+ activeFocusOnTab: false
338340
339341 onTriggered: {
340342 if (!topLevelSurfaceList.focusedWindow) return;