on xenial help sign in
SurfaceManager from ShellApplication.qml
1a5e0d4Nick Dedekind
qml/OrientedShell.qml+1
@@ -34,6 +34,7 @@ Item {
34
34
35 property alias deviceConfiguration: _deviceConfiguration
35 property alias deviceConfiguration: _deviceConfiguration
36 property alias orientations: d.orientations
36 property alias orientations: d.orientations
37+ property alias surfaceManager: shell.surfaceManager
37
38
38 onWidthChanged: calculateUsageMode();
39 onWidthChanged: calculateUsageMode();
39
40
qml/Shell.qml+1−5
@@ -53,6 +53,7 @@ StyledItem {
53 theme.name: "Ubuntu.Components.Themes.SuruDark"
53 theme.name: "Ubuntu.Components.Themes.SuruDark"
54
54
55 // to be set from outside
55 // to be set from outside
56+ property alias surfaceManager: topLevelSurfaceList.surfaceManager
56 property int orientationAngle: 0
57 property int orientationAngle: 0
57 property int orientation
58 property int orientation
58 property Orientations orientations
59 property Orientations orientations
@@ -269,15 +270,10 @@ StyledItem {
269 width: parent.width
270 width: parent.width
270 height: parent.height
271 height: parent.height
271
272
272− SurfaceManager {
273− id: surfaceMan
274− objectName: "surfaceManager"
275− }
276 TopLevelWindowModel {
273 TopLevelWindowModel {
277 id: topLevelSurfaceList
274 id: topLevelSurfaceList
278 objectName: "topLevelSurfaceList"
275 objectName: "topLevelSurfaceList"
279 applicationManager: ApplicationManager // it's a singleton
276 applicationManager: ApplicationManager // it's a singleton
280− surfaceManager: surfaceMan
281 }
277 }
282
278
283 Stage {
279 Stage {
qml/ShellApplication.qml+4
@@ -17,17 +17,21 @@
17import QtQuick 2.4
17import QtQuick 2.4
18import QtQuick.Window 2.2
18import QtQuick.Window 2.2
19import Unity.Screens 0.1
19import Unity.Screens 0.1
20+import Unity.Application 0.1
20
21
21Instantiator {
22Instantiator {
22 id: root
23 id: root
23 model: Screens
24 model: Screens
24
25
26+ property QtObject surfaceMan: SurfaceManager {}
27+
25 ShellScreen {
28 ShellScreen {
26 id: screen
29 id: screen
27 objectName: "screen"+index
30 objectName: "screen"+index
28 screen: model.screen
31 screen: model.screen
29 visibility: applicationArguments.hasFullscreen ? Window.FullScreen : Window.Windowed
32 visibility: applicationArguments.hasFullscreen ? Window.FullScreen : Window.Windowed
30 flags: applicationArguments.hasFrameless ? Qt.FramelessWindowHint : 0
33 flags: applicationArguments.hasFrameless ? Qt.FramelessWindowHint : 0
34+ surfaceManager: surfaceMan
31
35
32 Binding {
36 Binding {
33 when: applicationArguments.hasGeometry
37 when: applicationArguments.hasGeometry
qml/ShellScreen.qml+2
@@ -26,6 +26,7 @@ ScreenWindow {
26 color: "black"
26 color: "black"
27 title: "Unity8 Shell"
27 title: "Unity8 Shell"
28 property bool primary: false
28 property bool primary: false
29+ property QtObject surfaceManager: null
29
30
30 DeviceConfiguration {
31 DeviceConfiguration {
31 id: deviceConfiguration
32 id: deviceConfiguration
@@ -49,6 +50,7 @@ ScreenWindow {
49 OrientedShell {
50 OrientedShell {
50 implicitWidth: screenWindow.width
51 implicitWidth: screenWindow.width
51 implicitHeight: screenWindow.height
52 implicitHeight: screenWindow.height
53+ surfaceManager: screenWindow.surfaceManager
52
54
53 deviceConfiguration {
55 deviceConfiguration {
54 name: Screens.count > 1 ? "desktop" : applicationArguments.deviceName
56 name: Screens.count > 1 ? "desktop" : applicationArguments.deviceName
tests/mocks/Unity/Application/SurfaceManager.cpp+1−1
@@ -21,7 +21,7 @@
21
21
22#include <paths.h>
22#include <paths.h>
23
23
24−#define SURFACEMANAGER_DEBUG 0
24+#define SURFACEMANAGER_DEBUG 1
25
25
26#if SURFACEMANAGER_DEBUG
26#if SURFACEMANAGER_DEBUG
27#define DEBUG_MSG(params) qDebug().nospace() << "SurfaceManager[" << (void*)this << "]::" << __func__ << params
27#define DEBUG_MSG(params) qDebug().nospace() << "SurfaceManager[" << (void*)this << "]::" << __func__ << params
tests/qmltests/tst_OrientedShell.qml+5
@@ -172,6 +172,11 @@ Rectangle {
172 Component.onDestruction: {
172 Component.onDestruction: {
173 orientedShellLoader.itemDestroyed = true;
173 orientedShellLoader.itemDestroyed = true;
174 }
174 }
175+
176+ SurfaceManager {
177+ id: surfaceMan
178+ }
179+ surfaceManager: surfaceMan
175 }
180 }
176 }
181 }
177 }
182 }
tests/qmltests/tst_Shell.qml+6−1
@@ -144,6 +144,11 @@ Rectangle {
144 Component.onDestruction: {
144 Component.onDestruction: {
145 shellLoader.itemDestroyed = true;
145 shellLoader.itemDestroyed = true;
146 }
146 }
147+
148+ SurfaceManager {
149+ id: surfaceMan
150+ }
151+ surfaceManager: surfaceMan
147 }
152 }
148 }
153 }
149 }
154 }
@@ -680,7 +685,7 @@ Rectangle {
680 }
685 }
681
686
682 function ensureInputMethodSurface() {
687 function ensureInputMethodSurface() {
683− var surfaceManager = findInvisibleChild(shell, "surfaceManager");
688+ var surfaceManager = shell.surfaceManager;
684 verify(surfaceManager);
689 verify(surfaceManager);
685 surfaceManager.createInputMethodSurface();
690 surfaceManager.createInputMethodSurface();
686
691