on xenial help sign in
Fix handling of fullscreen on ARM

* Loosely compare against the Mir::State enum everywhere since it doesn't play nice with strict comparison * Adjust the ApplicationInfo mock so it does not return fullscreen() to QML. This ensures that Unity is using the application surface's state rather than falling back to the application's state. Better for multi window apps. * In test_appRotatesWindowContents, use the Surface rather than the Application when appropriate

commit9cb310036e2e5262af0534cb84b785d14fe8d842 authorDalton Durst <dalton@ubports.com> dateFri 24 May 2019, 22:20 (7 years ago) parentd9f9c66
7 files changed+18−17
qml/Shell.qml+1−1 qml/Stage/TabletStage.qml+1−1 qml/Stage/WindowedFullscreenPolicy.qml+1−1 tests/mocks/Unity/Application/ApplicationInfo.cpp+7−1 tests/mocks/Unity/Application/ApplicationInfo.h+2−6 tests/qmltests/tst_OrientedShell.qml+5−6 tests/qmltests/tst_Shell.qml+1−1
qml/Shell.qml+1−1
@@ -552,7 +552,7 @@ StyledItem {
552552 }
553553
554554 readonly property bool focusedSurfaceIsFullscreen: topLevelSurfaceList.focusedWindow
555− ? topLevelSurfaceList.focusedWindow.state === Mir.FullscreenState
555+ ? topLevelSurfaceList.focusedWindow.state == Mir.FullscreenState
556556 : false
557557 fullscreenMode: (focusedSurfaceIsFullscreen && !LightDMService.greeter.active && launcher.progress == 0 && !stage.spreadShown)
558558 || greeter.hasLockedApp
qml/Stage/TabletStage.qml+1−1
@@ -775,7 +775,7 @@ AbstractStage {
775775 if (priv.mainStageDelegate && stage === ApplicationInfoInterface.SideStage) {
776776 return priv.mainStageDelegate.fullscreen;
777777 } else if (surface) {
778− return surface.state === Mir.FullscreenState;
778+ return surface.state == Mir.FullscreenState;
779779 } else if (application) {
780780 return application.fullscreen;
781781 } else {
qml/Stage/WindowedFullscreenPolicy.qml+1−1
@@ -23,7 +23,7 @@ import Unity.Application 0.1
2323// state of the window is returned to restored.
2424QtObject {
2525 function applyPolicy(surfaceState, surfaceChrome) {
26− if (surfaceState === Mir.FullscreenState && surfaceChrome === Mir.LowChrome) {
26+ if (surfaceState == Mir.FullscreenState && surfaceChrome === Mir.LowChrome) {
2727 return Mir.RestoredState;
2828 }
2929 return surfaceState;
tests/mocks/Unity/Application/ApplicationInfo.cpp+7−1
@@ -268,7 +268,13 @@ void ApplicationInfo::setFullscreen(bool value)
268268{
269269 m_fullscreen = value;
270270 if (m_surfaceList->rowCount() > 0) {
271− m_surfaceList->get(0)->requestState(Mir::FullscreenState);
271+ Mir::State newState;
272+ if (value) {
273+ newState = Mir::FullscreenState;
274+ } else {
275+ newState = Mir::RestoredState;
276+ }
277+ m_surfaceList->get(0)->requestState(newState);
272278 }
273279}
274280
tests/mocks/Unity/Application/ApplicationInfo.h+2−6
@@ -36,15 +36,11 @@ using namespace unity::shell::application;
3636class ApplicationInfo : public ApplicationInfoInterface {
3737 Q_OBJECT
3838
39− ////
40− // FIXME: Remove those
41− Q_PROPERTY(bool fullscreen READ fullscreen WRITE setFullscreen NOTIFY fullscreenChanged)
42−
43− // Only exists in this fake implementation
44−
4539 // whether the test code will explicitly control the creation of the application surface
40+ // Only exists in this mock
4641 Q_PROPERTY(bool manualSurfaceCreation READ manualSurfaceCreation WRITE setManualSurfaceCreation NOTIFY manualSurfaceCreationChanged)
4742
43+ // Only exists in this mock
4844 Q_PROPERTY(QString screenshot READ screenshot CONSTANT)
4945
5046public:
tests/qmltests/tst_OrientedShell.qml+5−6
@@ -649,18 +649,17 @@ Rectangle {
649649 var cameraSurfaceId = topLevelSurfaceList.nextId;
650650 var cameraApp = ApplicationManager.startApplication("camera-app");
651651 verify(cameraApp);
652+ tryVerify(function() {return cameraApp.surfaceList.get(0)});
653+ var cameraSurface = cameraApp.surfaceList.get(0);
652654
653655 // ensure the mock camera-app is as we expect
654− compare(cameraApp.fullscreen, true);
656+ tryCompare(cameraSurface, "state", Mir.FullscreenState, 1000);
655657 compare(cameraApp.rotatesWindowContents, true);
656658 compare(cameraApp.supportedOrientations, Qt.PortraitOrientation | Qt.LandscapeOrientation
657659 | Qt.InvertedPortraitOrientation | Qt.InvertedLandscapeOrientation);
658660
659661 waitUntilAppWindowIsFullyLoaded(cameraSurfaceId);
660662
661− var cameraSurface = cameraApp.surfaceList.get(0);
662− verify(cameraSurface);
663−
664663 var focusChangedSpy = signalSpy;
665664 focusChangedSpy.clear();
666665 focusChangedSpy.target = cameraSurface;
@@ -697,8 +696,8 @@ Rectangle {
697696
698697 if (!data.windowed) { // subject to shell-chrome policies
699698 // It should retain native dimensions regardless of its rotation/orientation
700− compare(cameraSurface.width, orientedShell.width);
701− compare(cameraSurface.height, orientedShell.height);
699+ tryCompare(cameraSurface, "width", orientedShell.width);
700+ tryCompare(cameraSurface, "height", orientedShell.height);
702701 }
703702
704703 // Surface focus shouldn't have been touched because of the rotation
tests/qmltests/tst_Shell.qml+1−1
@@ -349,7 +349,7 @@ Rectangle {
349349 target: fullscreenAppCheck
350350 when: topLevelSurfaceList && topLevelSurfaceList.focusedWindow
351351 property: "checked"
352− value: topLevelSurfaceList.focusedWindow.state === Mir.FullscreenState
352+ value: topLevelSurfaceList.focusedWindow.state == Mir.FullscreenState
353353 }
354354 }
355355 Label {