/usr/share/unity-2d/shell/common/VisibilityController.qml is in unity-2d-shell 5.10.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | /*
* This file is part of unity-2d
*
* Copyright 2012 Canonical Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 1.0
import "utils.js" as Utils
Item {
id: controller
property bool shown: true
property variant behavior: null
property bool forceVisible: false
property bool forceHidden: false
property variant forceVisibleChangeId
property variant forceVisibleStack: {}
property variant forceHiddenStack: {}
Binding {
target: controller
property: "shown"
value: (!forceHidden) ? forceVisible || behavior.shown : false
when: behavior != null
}
function beginForceVisible(id) {
/* We need to copy the property to a JS variable before we can properly interact
with it and then copy it back to the QML property when done. This seems to be
a limitation of QML that will be fixed in QtQuick 2.0. For more information:
https://bugreports.qt.nokia.com/browse/QTBUG-21842
*/
var stack = controller.forceVisibleStack
var wasEmpty = Utils.hashEmpty(stack)
if (forceHidden) console.log("DEBUG: beginForceVisible for id \"" + id +
"\" called when forceHidden still true")
if (stack[id]) stack[id] += 1
else stack[id] = 1
controller.forceVisibleStack = stack
if (wasEmpty) {
forceVisibleChangeId = id
forceVisible = true
}
}
function endForceVisible(id) {
var stack = controller.forceVisibleStack
if (stack[id]) {
stack[id] -= 1
if (stack[id] === 0) delete stack[id]
} else console.log("DEBUG: endForceVisible for id \"" + id +
"\" called without matching startForceVisible")
controller.forceVisibleStack = stack
if (Utils.hashEmpty(stack)) {
forceVisibleChangeId = id
forceVisible = false
}
}
function beginForceHidden(id) {
var stack = controller.forceHiddenStack
var wasEmpty = Utils.hashEmpty(stack)
if (forceVisible) console.log("DEBUG: beginForceHidden for id \"" + id +
"\" called when forceVisible still true")
if (stack[id]) stack[id] += 1
else stack[id] = 1
controller.forceHiddenStack = stack
if (wasEmpty) {
forceVisibleChangeId = id
forceHidden = true
}
}
function endForceHidden(id) {
var stack = controller.forceHiddenStack
if (stack[id]) {
stack[id] -= 1
if (stack[id] === 0) delete stack[id]
} else console.log("DEBUG: endForceHidden for id \"" + id +
"\" called without matching startForceHidden")
controller.forceHiddenStack = stack
if (Utils.hashEmpty(stack)) {
forceVisibleChangeId = id
forceHidden = false
}
}
}
|