2 * Copyright 2014-2016 Canonical Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19import Lomiri.Components 1.3
20import Lomiri.Gestures 0.1 // For TouchGate
21import Utils 0.1 // for InputWatcher
22import QtMir.Application 0.1 // for MirSurfaceItem
26 objectName: "surfaceContainer"
27 implicitWidth: surfaceItem.implicitWidth
28 implicitHeight: surfaceItem.implicitHeight
30 // Must be set from outside
31 property var surface: null
33 // Might be changed from outside
34 property int requestedWidth: -1
35 property int requestedHeight: -1
36 property bool interactive
37 property int surfaceOrientationAngle: 0
38 property bool isPromptSurface: false
39 property var stage : null
40 // FIME - dont export, use interactive property. Need to fix qtmir to handle consumesInputChanged
41 // to update surface activeFocus. See mock MirSurfaceItem.
42 property alias consumesInput: surfaceItem.consumesInput
44 property bool hadSurface: false
46 signal sizeChanged(size size)
49 // Not a binding because animations might remove the surface from the surfaceItem
50 // programatically (in order to signal that a zombie surface is free for deletion),
51 // even though root.surface is still !null.
53 root.hadSurface = true;
55 surfaceItem.surface = surface;
60 onTargetPressedChanged: {
61 if (targetPressed && root.interactive) {
63 root.forceActiveFocus();
70 objectName: "surfaceItem"
75 fillMode: MirSurfaceItem.PadOrCrop
78 surfaceWidth: root.requestedWidth
79 surfaceHeight: root.requestedHeight
81 enabled: root.interactive
82 antialiasing: !root.interactive
83 orientationAngle: root.surfaceOrientationAngle
86 target: surfaceItem.surface
88 root.sizeChanged(value)
91 clip: stage && stage.mode === "windowed"
95 targetItem: surfaceItem
97 enabled: surfaceItem.enabled
102 objectName: "animationsLoader"
103 active: root.surface || root.hadSurface
105 if (root.isPromptSurface) {
106 return "PromptSurfaceAnimations.qml";
108 // Let ApplicationWindow do the animations
113 target: animationsLoader.item
114 when: animationsLoader.item
115 property: "surfaceItem"
117 restoreMode: Binding.RestoreBinding
120 target: animationsLoader.item
121 when: animationsLoader.item
122 property: "container"
124 restoreMode: Binding.RestoreBinding
127 target: animationsLoader.item
128 when: animationsLoader.item
129 property: "hadSurface"
131 restoreMode: Binding.RestoreBinding