2
* This file is part of unity-2d
4
* Copyright 2012 Canonical Ltd.
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 3.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
21
import "../utils.js" as Utils
23
// Shows the target when it has the focus or when you move the
24
// mouse for 500 msec to the edge of the target or there are no
25
// windows that intersect with the target
26
// Hides the target when none of the above conditions are met
27
// and you have not had the mouse over it during more than 1000 msec
28
// To use this Behavior your target needs to provide two properties
29
// - containsMouse: Defines if the mouse is inside the target
30
// - outerEdgeContainsMouse: Defines if the mouse is in the edge of the target
35
property bool shownBecauseOfMousePosition: false
37
shown: target !== undefined && (target.activeFocus || shownBecauseOfMousePosition || !windows.intersects)
39
onForcedVisibleChanged:
42
if (!target.containsMouse && forcedVisibleChangeId != "dash") {
43
shownBecauseOfMousePosition = true
44
mouseLeaveTimer.restart()
52
onTriggered: shownBecauseOfMousePosition = true
58
onTriggered: shownBecauseOfMousePosition = false
62
target: (intellihide.target !== undefined) ? intellihide.target : null
63
onOuterEdgeContainsMouseChanged: edgeHitTimer.running = target.outerEdgeContainsMouse
64
ignoreUnknownSignals: true
68
target: (intellihide.target !== undefined) ? intellihide.target : null
69
onContainsMouseChanged: {
70
if ((shown || forcedVisible) && target.containsMouse) {
71
shownBecauseOfMousePosition = true
73
mouseLeaveTimer.running = !target.containsMouse
75
ignoreUnknownSignals: true
78
WindowsIntersectMonitor {
81
if (intellihide.target) {
82
if (Utils.isLeftToRight()) {
85
intellihide.target.width,
86
intellihide.target.height)
88
return Qt.rect(declarativeView.screen.availableGeometry.width - intellihide.target.width,
90
intellihide.target.width,
91
intellihide.target.height)
94
return Qt.rect(0, 0, 0, 0)