Merge lp:~fboucault/unity-2d/no_dash_when_spread_shown into lp:unity-2d
- no_dash_when_spread_shown
- Merge into trunk
Proposed by
Florian Boucault
Status: | Superseded |
---|---|
Proposed branch: | lp:~fboucault/unity-2d/no_dash_when_spread_shown |
Merge into: | lp:unity-2d |
Diff against target: |
10395 lines (+3863/-3645) 141 files modified
.bzrignore (+7/-12) CMakeLists.txt (+2/-2) README (+8/-9) debian/control (+36/-26) debian/manpages/unity-2d-launcher.1 (+0/-12) debian/manpages/unity-2d-places.1 (+0/-12) debian/manpages/unity-2d-shell.1 (+17/-0) debian/unity-2d-launcher.install.in (+0/-5) debian/unity-2d-launcher.manpages (+0/-1) debian/unity-2d-places.install.in (+0/-6) debian/unity-2d-places.manpages (+0/-1) debian/unity-2d-shell.install.in (+9/-0) debian/unity-2d-shell.manpages (+1/-0) launcher/CMakeLists.txt (+0/-20) launcher/app/CMakeLists.txt (+0/-70) launcher/app/launcher.cpp (+0/-137) launcher/app/launcherview.cpp (+0/-299) launcher/app/launcherview.h (+0/-79) launcher/app/unity-2d-launcher.desktop (+0/-13) launcher/app/visibilitycontroller.cpp (+0/-163) launcher/app/visibilitycontroller.h (+0/-93) launcher/launcher.qmlproject (+0/-18) launcher/tests/CMakeLists.txt (+0/-29) launcher/tests/launcherviewtest.cpp (+0/-42) libunity-2d-private/CMakeLists.txt (+1/-0) libunity-2d-private/Unity2d/CMakeLists.txt (+0/-2) libunity-2d-private/Unity2d/plugin.cpp (+26/-10) libunity-2d-private/Unity2d/qmldir (+0/-1) libunity-2d-private/src/CMakeLists.txt (+10/-6) libunity-2d-private/src/abstractdbusservicemonitor.cpp (+86/-0) libunity-2d-private/src/abstractdbusservicemonitor.h (+59/-0) libunity-2d-private/src/abstractvisibilitybehavior.cpp (+0/-59) libunity-2d-private/src/abstractvisibilitybehavior.h (+0/-63) libunity-2d-private/src/autohidebehavior.cpp (+0/-143) libunity-2d-private/src/autohidebehavior.h (+0/-69) libunity-2d-private/src/bfb.cpp (+39/-14) libunity-2d-private/src/bfb.h (+9/-1) libunity-2d-private/src/edgehitdetector.cpp (+0/-65) libunity-2d-private/src/edgehitdetector.h (+0/-44) libunity-2d-private/src/forcevisiblebehavior.cpp (+0/-36) libunity-2d-private/src/forcevisiblebehavior.h (+0/-41) libunity-2d-private/src/gesturehandler.cpp (+27/-15) libunity-2d-private/src/gesturehandler.h (+15/-4) libunity-2d-private/src/inputshapemanager.cpp (+105/-0) libunity-2d-private/src/inputshapemanager.h (+59/-0) libunity-2d-private/src/inputshapemask.cpp (+111/-0) libunity-2d-private/src/inputshapemask.h (+71/-0) libunity-2d-private/src/inputshaperectangle.cpp (+126/-0) libunity-2d-private/src/inputshaperectangle.h (+75/-0) libunity-2d-private/src/intellihidebehavior.cpp (+0/-256) libunity-2d-private/src/intellihidebehavior.h (+0/-75) libunity-2d-private/src/launcherclient.cpp (+0/-48) libunity-2d-private/src/launcherclient.h (+1/-14) libunity-2d-private/src/mousearea.cpp (+0/-117) libunity-2d-private/src/mousearea.h (+0/-60) libunity-2d-private/src/spreadmonitor.cpp (+61/-0) libunity-2d-private/src/spreadmonitor.h (+48/-0) libunity-2d-private/src/strutmanager.cpp (+191/-0) libunity-2d-private/src/strutmanager.h (+92/-0) libunity-2d-private/src/unity2dpanel.cpp (+9/-109) libunity-2d-private/src/unity2dpanel.h (+1/-5) libunity-2d-private/src/windowsintersectmonitor.cpp (+183/-0) libunity-2d-private/src/windowsintersectmonitor.h (+55/-0) libunity-2d-private/tests/CMakeLists.txt (+0/-7) libunity-2d-private/tests/mouseareademo.cpp (+0/-48) panel/applets/CMakeLists.txt (+0/-1) panel/applets/homebutton/CMakeLists.txt (+0/-33) panel/applets/homebutton/homebutton.cpp (+0/-63) panel/applets/homebutton/homebutton.h (+0/-43) panel/applets/homebutton/homebuttonapplet.cpp (+0/-112) panel/applets/homebutton/homebuttonapplet.h (+0/-55) panel/applets/homebutton/plugin.cpp (+0/-39) panel/applets/homebutton/plugin.h (+0/-40) shell/CMakeLists.txt (+18/-5) shell/Shell.qml (+178/-0) shell/app/CMakeLists.txt (+30/-19) shell/app/dashdbus.cpp (+92/-0) shell/app/dashdbus.h (+64/-0) shell/app/launcher.xml (+0/-14) shell/app/launcherdbus.cpp (+3/-22) shell/app/launcherdbus.h (+3/-7) shell/app/shell.cpp (+64/-17) shell/app/shelldeclarativeview.cpp (+376/-182) shell/app/shelldeclarativeview.h (+75/-25) shell/app/unity-2d-launcher.service.in (+1/-1) shell/app/unity-2d-places.service.in (+1/-1) shell/app/unity-2d-shell.desktop (+6/-5) shell/common/AlwaysVisibleBehavior.qml (+23/-0) shell/common/BaseBehavior.qml (+26/-0) shell/common/VisibilityController.qml (+71/-0) shell/common/utils.js (+13/-0) shell/dash/CategoryHeader.qml (+1/-0) shell/dash/Dash.qml (+106/-21) shell/dash/FilterLoader.qml (+2/-1) shell/dash/FilterPane.qml (+1/-0) shell/dash/FoldingArrow.qml (+1/-1) shell/dash/Home.qml (+10/-7) shell/dash/HomeButton.qml (+1/-0) shell/dash/HomeButtonApplication.qml (+1/-4) shell/dash/HomeButtonDefaultApplication.qml (+1/-4) shell/dash/HomeShortcuts.qml (+8/-0) shell/dash/LensBar.qml (+1/-1) shell/dash/LensButton.qml (+2/-1) shell/dash/LensView.qml (+5/-4) shell/dash/ListViewWithScrollbar.qml (+2/-2) shell/dash/MultiRangeButton.qml (+1/-0) shell/dash/RatingStars.qml (+1/-1) shell/dash/SearchEntry.qml (+4/-3) shell/dash/TickBox.qml (+1/-0) shell/dash/TileHorizontal.qml (+2/-4) shell/dash/TileVertical.qml (+2/-4) shell/launcher/AutoHideBehavior.qml (+46/-0) shell/launcher/IntelliHideBehavior.qml (+90/-0) shell/launcher/Launcher.qml (+19/-28) shell/launcher/LauncherItem.qml (+8/-7) shell/launcher/LauncherList.qml (+22/-13) shell/launcher/LauncherLoader.qml (+94/-0) shell/tests/CMakeLists.txt (+29/-0) shell/tests/launcherviewtest.cpp (+42/-0) spread/app/spread.cpp (+2/-1) spread/app/spreadcontrol.cpp (+1/-8) spread/app/spreadview.h (+0/-1) tests/dash/dash-tests.rb (+59/-67) tests/dash/fullscreen.rb (+24/-27) tests/getshape/CMakeLists.txt (+22/-0) tests/getshape/getshape.cpp (+131/-0) tests/launcher/always_visible_tests.rb (+5/-5) tests/launcher/autohide_show_tests.rb (+11/-11) tests/launcher/autohide_show_tests_common.rb (+1/-1) tests/launcher/autohide_show_tests_rtl.rb (+12/-12) tests/launcher/launcher_sizing.rb (+11/-20) tests/launcher/update_pips_tests.rb (+0/-316) tests/launcher/visual_verification.rb (+7/-7) tests/manual-tests/dash.txt (+1/-1) tests/run-tests.rb (+8/-9) tests/shell/input_shaping.rb (+92/-0) tests/shell/input_shaping_common.rb (+180/-0) tests/shell/input_shaping_rtl.rb (+92/-0) tests/shell/root_qml_param.rb (+97/-0) tests/shell/rootqmlparamtest.qml (+12/-0) tests/spread/spread-tests.rb (+8/-8) |
To merge this branch: | bzr merge lp:~fboucault/unity-2d/no_dash_when_spread_shown |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Albert Astals Cid | Pending | ||
Review via email: mp+92181@code.launchpad.net |
Commit message
Description of the change
Inhibit Dash.qml's activateLens() and activateHome() if spread is shown.
To post a comment you must log in.
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2012-01-18 16:08:06 +0000 |
3 | +++ .bzrignore 2012-02-09 02:13:26 +0000 |
4 | @@ -1,14 +1,10 @@ |
5 | config.h |
6 | |
7 | -launcher/app/unity-2d-launcher |
8 | -launcher/app/launcheradaptor.* |
9 | -launcher/app/unity-2d-launcher.service |
10 | -launcher/tests/launchermenutest |
11 | -launcher/tests/launcherviewtest |
12 | - |
13 | -places/app/unity-2d-places |
14 | -places/app/unity-2d-places.service |
15 | -places/app/dashadaptor.* |
16 | +shell/app/dashadaptor.* |
17 | +shell/app/launcheradaptor.* |
18 | +shell/app/unity-2d-launcher.service |
19 | +shell/app/unity-2d-places.service |
20 | +shell/app/unity-2d-shell |
21 | |
22 | spread/app/unity-2d-spread |
23 | spread/app/unity-2d-spread.service |
24 | @@ -19,7 +15,6 @@ |
25 | panel/applets/indicator/indicator-config.h |
26 | panel/applets/libpanelplugin-*.so.* |
27 | panel/lib/libuqpanel.so* |
28 | -panel/tests/homebuttonapplettest |
29 | |
30 | libunity-2d-private/src/libunity-2d-private.so.* |
31 | libunity-2d-private/src/unity-2d-private.pc |
32 | @@ -44,6 +39,7 @@ |
33 | po/*.gmo |
34 | |
35 | tests/misc/binary_dir.txt |
36 | +tests/getshape/getshape |
37 | |
38 | # Cmake files and generated files |
39 | Makefile |
40 | @@ -77,10 +73,9 @@ |
41 | debian/stamp-* |
42 | debian/tmp |
43 | debian/unity-2d |
44 | -debian/unity-2d-launcher |
45 | debian/unity-2d-panel |
46 | -debian/unity-2d-places |
47 | debian/unity-2d-spread |
48 | +debian/unity-2d-shell |
49 | debian/libunity-2d-private0 |
50 | debian/libunity-2d-private-dev |
51 | data/gschemas.compiled |
52 | |
53 | === modified file 'CMakeLists.txt' |
54 | --- CMakeLists.txt 2011-12-15 15:34:37 +0000 |
55 | +++ CMakeLists.txt 2012-02-09 02:13:26 +0000 |
56 | @@ -93,11 +93,11 @@ |
57 | |
58 | # Source |
59 | add_subdirectory(libunity-2d-private) |
60 | -add_subdirectory(launcher) |
61 | add_subdirectory(panel) |
62 | -add_subdirectory(places) |
63 | add_subdirectory(spread) |
64 | +add_subdirectory(shell) |
65 | add_subdirectory(po) |
66 | +add_subdirectory(tests/getshape) |
67 | |
68 | # uninstall target |
69 | configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) |
70 | |
71 | === modified file 'README' |
72 | --- README 2011-03-22 23:20:29 +0000 |
73 | +++ README 2012-02-09 02:13:26 +0000 |
74 | @@ -1,19 +1,18 @@ |
75 | -Compiling unity-2d |
76 | +Compiling Unity 2D |
77 | ================== |
78 | |
79 | cmake . && make |
80 | |
81 | |
82 | -Running separate components |
83 | -=========================== |
84 | +Running |
85 | +======= |
86 | |
87 | -./launcher/app/unity-2d-launcher |
88 | +./shell/app/unity-2d-shell |
89 | ./panel/app/unity-2d-panel |
90 | -./places/app/unity-2d-places |
91 | - |
92 | - |
93 | -Notes on the dash (places) |
94 | -========================== |
95 | + |
96 | + |
97 | +Notes on the Dash |
98 | +================= |
99 | |
100 | The dash exposes a D-Bus property for activation and deactivation: |
101 | |
102 | |
103 | === modified file 'debian/control' |
104 | --- debian/control 2012-02-03 09:51:46 +0000 |
105 | +++ debian/control 2012-02-09 02:13:26 +0000 |
106 | @@ -31,10 +31,9 @@ |
107 | Package: unity-2d |
108 | Architecture: all |
109 | Depends: ${misc:Depends}, |
110 | - unity-2d-launcher, |
111 | unity-2d-panel, |
112 | - unity-2d-places, |
113 | unity-2d-spread, |
114 | + unity-2d-shell, |
115 | metacity (>= 2.30.3-0ubuntu5) |
116 | Description: Unity interface for non-accelerated graphics cards |
117 | The Unity 2D interface installs a fully usable 2D session and provides the |
118 | @@ -72,21 +71,13 @@ |
119 | This package contains the development header files. |
120 | |
121 | Package: unity-2d-launcher |
122 | -Architecture: any |
123 | -Depends: ${shlibs:Depends}, |
124 | - ${misc:Depends}, |
125 | - unity-asset-pool, |
126 | - libunity-2d-private0 (= ${binary:Version}), |
127 | - libqt4-svg, |
128 | -Recommends: unity-lens-files, |
129 | - unity-lens-applications, |
130 | - unity-lens-music, |
131 | -Description: Unity 2D Launcher |
132 | - The Unity 2D launcher displays a list of running applications as well as a |
133 | - list of favorite applications in a panel at the left of the screen. |
134 | - Notifications from individual applications are also highlighted in the |
135 | - launcher. |
136 | - |
137 | +Architecture: all |
138 | +Depends: ${misc:Depends}, |
139 | + unity-2d-shell, |
140 | +Description: Transitional package for unity-2d-launcher |
141 | + This is a transitional package for unity-2d-launcher, and can be safely removed |
142 | + after the installation is complete. |
143 | + |
144 | Package: unity-2d-panel |
145 | Architecture: any |
146 | Depends: ${shlibs:Depends}, |
147 | @@ -105,15 +96,12 @@ |
148 | application outside of the Unity 2D environment. |
149 | |
150 | Package: unity-2d-places |
151 | -Architecture: any |
152 | -Depends: ${shlibs:Depends}, |
153 | - ${misc:Depends}, |
154 | - libunity-2d-private0 (= ${binary:Version}), |
155 | - libqt4-svg |
156 | -Description: Unity 2D Places |
157 | - The Unity 2D places overlay over the desktop to provide quick access to |
158 | - various categories of applications. It is part of Unity 2D and can not run |
159 | - as a standalone application outside of the Unity 2D environment. |
160 | +Architecture: all |
161 | +Depends: ${misc:Depends}, |
162 | + unity-2d-shell, |
163 | +Description: Transitional package for unity-2d-places |
164 | + This is a transitional package for unity-2d-places, and can be safely removed |
165 | + after the installation is complete. |
166 | |
167 | Package: unity-2d-spread |
168 | Architecture: any |
169 | @@ -127,6 +115,28 @@ |
170 | switch to. It is part of Unity 2D and can not run as a standalone application |
171 | outside of the Unity 2D environment. |
172 | |
173 | +Package: unity-2d-shell |
174 | +Architecture: any |
175 | +Depends: ${shlibs:Depends}, |
176 | + ${misc:Depends}, |
177 | + unity-asset-pool, |
178 | + libunity-2d-private0 (= ${binary:Version}), |
179 | + libqt4-svg, |
180 | +Recommends: unity-lens-files, |
181 | + unity-lens-applications, |
182 | + unity-lens-music, |
183 | +Replaces: unity-2d-launcher (<< 5.4~), |
184 | + unity-2d-places (<< 5.4~), |
185 | +Breaks: unity-2d-launcher (<< 5.4~), |
186 | + unity-2d-places (<< 5.4~), |
187 | +Description: Dash and Launcher for the Unity 2D environment |
188 | + This is part of Unity 2D and can not run as a standalone application outside |
189 | + of the Unity 2D environment. The components included are: |
190 | + * Dash: an overlay over the desktop to provide quick access to |
191 | + various categories of applications. |
192 | + * Launcher: displays in a panel at the left of the screen a list of running |
193 | + and favorite applications as well as highlighting their notifications. |
194 | + |
195 | Package: unity-2d-dbg |
196 | Architecture: any |
197 | Section: debug |
198 | |
199 | === removed file 'debian/manpages/unity-2d-launcher.1' |
200 | --- debian/manpages/unity-2d-launcher.1 2011-01-14 22:41:51 +0000 |
201 | +++ debian/manpages/unity-2d-launcher.1 1970-01-01 00:00:00 +0000 |
202 | @@ -1,12 +0,0 @@ |
203 | -.TH unity-2d-launcher 1 |
204 | -.SH NAME |
205 | -unity-2d-launcher \- Provides launcher sidebar in the Unity 2D environment |
206 | -.SH SYNOPSIS |
207 | -.B unity-2d-launcher |
208 | -provides the launcher sidebar for the Unity 2D launcher, which provides the |
209 | -icons and application switcher. It is meant to be used as the full Unity 2D |
210 | -environment |
211 | -.SH OPTIONS |
212 | -.TP |
213 | -This application takes no arguments. |
214 | - |
215 | |
216 | === removed file 'debian/manpages/unity-2d-places.1' |
217 | --- debian/manpages/unity-2d-places.1 2011-01-14 23:08:50 +0000 |
218 | +++ debian/manpages/unity-2d-places.1 1970-01-01 00:00:00 +0000 |
219 | @@ -1,12 +0,0 @@ |
220 | -.TH unity-2d-places 1 |
221 | -.SH NAME |
222 | -unity-2d-places \- Unity 2D Places |
223 | -.SH SYNOPSIS |
224 | -.B unity-2d-places |
225 | -displays a top panel containing the application menu and various indicators. |
226 | -It functions as part Unity 2D, and is not meant to be used as a standalone |
227 | -application. |
228 | -.SH OPTIONS |
229 | -.TP |
230 | -This application takes no arguments. |
231 | - |
232 | |
233 | === added file 'debian/manpages/unity-2d-shell.1' |
234 | --- debian/manpages/unity-2d-shell.1 1970-01-01 00:00:00 +0000 |
235 | +++ debian/manpages/unity-2d-shell.1 2012-02-09 02:13:26 +0000 |
236 | @@ -0,0 +1,17 @@ |
237 | +.TH unity-2d-shell 1 |
238 | +.SH NAME |
239 | +unity-2d-shell \- Unity 2D Shell |
240 | +.SH SYNOPSIS |
241 | +.B unity-2d-shell [-opengl] [-rootqml File.qml] |
242 | +displays some components of Unity 2D. It contains the launcher and dash. |
243 | +It functions as part Unity 2D, and is not meant to be used as a standalone |
244 | +application. |
245 | +It can however be used for testing or prototyping of only specific components |
246 | +of Unity 2D by using the rootqml argument. |
247 | +.SH OPTIONS |
248 | +.TP |
249 | +\fB\-opengl\fR |
250 | +Run the application using an openGL-enabled widget |
251 | +.TP |
252 | +\fB\qmlfile\fR |
253 | +The path of a QML file to load instead of the full shell |
254 | |
255 | === removed file 'debian/unity-2d-launcher.install.in' |
256 | --- debian/unity-2d-launcher.install.in 2011-11-09 22:26:57 +0000 |
257 | +++ debian/unity-2d-launcher.install.in 1970-01-01 00:00:00 +0000 |
258 | @@ -1,5 +0,0 @@ |
259 | -@DEBIAN_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/unity-2d-launcher |
260 | -@DEBIAN_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/dbus-1/services/unity-2d-launcher.service |
261 | -@DEBIAN_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/applications/unity-2d-launcher.desktop |
262 | -@DEBIAN_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/unity-2d/launcher/*.qml |
263 | -@DEBIAN_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/unity-2d/launcher/artwork |
264 | |
265 | === removed file 'debian/unity-2d-launcher.manpages' |
266 | --- debian/unity-2d-launcher.manpages 2011-01-14 22:28:06 +0000 |
267 | +++ debian/unity-2d-launcher.manpages 1970-01-01 00:00:00 +0000 |
268 | @@ -1,1 +0,0 @@ |
269 | -debian/manpages/unity-2d-launcher.1 |
270 | |
271 | === removed file 'debian/unity-2d-places.install.in' |
272 | --- debian/unity-2d-places.install.in 2011-11-09 22:26:57 +0000 |
273 | +++ debian/unity-2d-places.install.in 1970-01-01 00:00:00 +0000 |
274 | @@ -1,6 +0,0 @@ |
275 | -@DEBIAN_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/unity-2d-places |
276 | -@DEBIAN_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/applications/unity-2d-places.desktop |
277 | -@DEBIAN_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/dbus-1/services/unity-2d-places.service |
278 | -@DEBIAN_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/unity-2d/places/*.qml |
279 | -@DEBIAN_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/unity-2d/places/*.js |
280 | -@DEBIAN_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/unity-2d/places/artwork |
281 | |
282 | === removed file 'debian/unity-2d-places.manpages' |
283 | --- debian/unity-2d-places.manpages 2011-01-14 23:08:50 +0000 |
284 | +++ debian/unity-2d-places.manpages 1970-01-01 00:00:00 +0000 |
285 | @@ -1,1 +0,0 @@ |
286 | -debian/manpages/unity-2d-places.1 |
287 | |
288 | === added file 'debian/unity-2d-shell.install.in' |
289 | --- debian/unity-2d-shell.install.in 1970-01-01 00:00:00 +0000 |
290 | +++ debian/unity-2d-shell.install.in 2012-02-09 02:13:26 +0000 |
291 | @@ -0,0 +1,9 @@ |
292 | +@DEBIAN_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/unity-2d-shell |
293 | +@DEBIAN_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/applications/unity-2d-shell.desktop |
294 | +@DEBIAN_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/dbus-1/services/unity-2d-places.service |
295 | +@DEBIAN_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/dbus-1/services/unity-2d-launcher.service |
296 | +@DEBIAN_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/unity-2d/shell/*.qml |
297 | +@DEBIAN_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/unity-2d/shell/dash |
298 | +@DEBIAN_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/unity-2d/shell/launcher |
299 | +@DEBIAN_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/unity-2d/shell/common |
300 | +@DEBIAN_INSTALL_PREFIX@/@CMAKE_INSTALL_DATADIR@/unity-2d/shell/artwork |
301 | |
302 | === added file 'debian/unity-2d-shell.manpages' |
303 | --- debian/unity-2d-shell.manpages 1970-01-01 00:00:00 +0000 |
304 | +++ debian/unity-2d-shell.manpages 2012-02-09 02:13:26 +0000 |
305 | @@ -0,0 +1,1 @@ |
306 | +debian/manpages/unity-2d-shell.1 |
307 | |
308 | === removed directory 'launcher' |
309 | === removed file 'launcher/CMakeLists.txt' |
310 | --- launcher/CMakeLists.txt 2011-06-08 20:43:09 +0000 |
311 | +++ launcher/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
312 | @@ -1,20 +0,0 @@ |
313 | -project(unity-2d-launcher) |
314 | - |
315 | -include_directories( |
316 | - ${libunity-2d-private_SOURCE_DIR}/src |
317 | - ) |
318 | - |
319 | -# Source |
320 | -add_subdirectory(app) |
321 | -add_subdirectory(tests) |
322 | - |
323 | -file(GLOB launcher_QML *.qml) |
324 | - |
325 | -# Install |
326 | -install(FILES ${launcher_QML} |
327 | - DESTINATION ${UNITY_2D_DIR}/launcher |
328 | - ) |
329 | - |
330 | -install(DIRECTORY artwork |
331 | - DESTINATION ${UNITY_2D_DIR}/launcher |
332 | - ) |
333 | |
334 | === removed directory 'launcher/app' |
335 | === removed file 'launcher/app/CMakeLists.txt' |
336 | --- launcher/app/CMakeLists.txt 2011-11-18 10:15:49 +0000 |
337 | +++ launcher/app/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
338 | @@ -1,70 +0,0 @@ |
339 | -# Dependencies |
340 | -pkg_check_modules(GEIS REQUIRED libutouch-geis) |
341 | -pkg_check_modules(QTGCONF REQUIRED libqtgconf) |
342 | - |
343 | -# Sources |
344 | -set(launcher_SRCS |
345 | - visibilitycontroller.cpp |
346 | - launcherview.cpp |
347 | - launcherdbus.cpp |
348 | - gesturehandler.cpp |
349 | - ) |
350 | - |
351 | -set(launcher_MOC_HDRS |
352 | - visibilitycontroller.h |
353 | - launcherview.h |
354 | - launcherdbus.h |
355 | - gesturehandler.h |
356 | - ) |
357 | - |
358 | -qt4_wrap_cpp(launcher_MOC_SRCS ${launcher_MOC_HDRS}) |
359 | - |
360 | -configure_file(unity-2d-launcher.service.in unity-2d-launcher.service) |
361 | - |
362 | -qt4_add_dbus_adaptor(launcher_SRCS launcher.xml |
363 | - launcherdbus.h LauncherDBus |
364 | - ) |
365 | - |
366 | -# Build |
367 | -add_library(uqlauncher ${launcher_SRCS} ${launcher_MOC_SRCS}) |
368 | -add_executable(unity-2d-launcher launcher.cpp) |
369 | - |
370 | -include_directories( |
371 | - ${CMAKE_CURRENT_SOURCE_DIR} |
372 | - ${CMAKE_CURRENT_BINARY_DIR} |
373 | - ${GTK_INCLUDE_DIRS} |
374 | - ${X11_INCLUDE_DIRS} |
375 | - ${GEIS_INCLUDE_DIRS} |
376 | - ${QTGCONF_INCLUDE_DIRS} |
377 | - ${libunity-2d-private_SOURCE_DIR}/src |
378 | - ) |
379 | - |
380 | -target_link_libraries(uqlauncher |
381 | - ${QT_QTCORE_LIBRARIES} |
382 | - ${QT_QTGUI_LIBRARIES} |
383 | - ${QT_QTDBUS_LIBRARIES} |
384 | - ${QT_QTDECLARATIVE_LIBRARIES} |
385 | - ${GTK_LDFLAGS} |
386 | - ${X11_LDFLAGS} |
387 | - ${GEIS_LDFLAGS} |
388 | - ${QTGCONF_LDFLAGS} |
389 | - ${DCONFQT_LDFLAGS} |
390 | - unity-2d-private |
391 | - ) |
392 | - |
393 | -target_link_libraries(unity-2d-launcher |
394 | - uqlauncher) |
395 | - |
396 | -# Install |
397 | -install(TARGETS unity-2d-launcher |
398 | - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} |
399 | - ) |
400 | - |
401 | -install(FILES unity-2d-launcher.desktop |
402 | - DESTINATION ${CMAKE_INSTALL_DATADIR}/applications |
403 | - ) |
404 | - |
405 | -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/unity-2d-launcher.service |
406 | - DESTINATION ${CMAKE_INSTALL_DATADIR}/dbus-1/services |
407 | - ) |
408 | - |
409 | |
410 | === removed file 'launcher/app/launcher.cpp' |
411 | --- launcher/app/launcher.cpp 2012-02-01 15:01:21 +0000 |
412 | +++ launcher/app/launcher.cpp 1970-01-01 00:00:00 +0000 |
413 | @@ -1,137 +0,0 @@ |
414 | -/* |
415 | - * Copyright (C) 2010 Canonical, Ltd. |
416 | - * |
417 | - * Authors: |
418 | - * Olivier Tilloy <olivier.tilloy@canonical.com> |
419 | - * |
420 | - * This program is free software; you can redistribute it and/or modify |
421 | - * it under the terms of the GNU General Public License as published by |
422 | - * the Free Software Foundation; version 3. |
423 | - * |
424 | - * This program is distributed in the hope that it will be useful, |
425 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
426 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
427 | - * GNU General Public License for more details. |
428 | - * |
429 | - * You should have received a copy of the GNU General Public License |
430 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
431 | - */ |
432 | - |
433 | -// unity-2d |
434 | -#include <gnomesessionclient.h> |
435 | -#include <launcherclient.h> |
436 | -#include <unity2dapplication.h> |
437 | - |
438 | -// Qt |
439 | -#include <QApplication> |
440 | -#include <QDesktopWidget> |
441 | -#include <QDeclarativeEngine> |
442 | -#include <QDeclarativeContext> |
443 | -#include <QDir> |
444 | -#include <QGraphicsObject> |
445 | - |
446 | -#include "config.h" |
447 | -#include "launcherview.h" |
448 | -#include "launcherdbus.h" |
449 | -#include "visibilitycontroller.h" |
450 | -#include "unity2ddebug.h" |
451 | -#include "unity2dpanel.h" |
452 | -#include "gesturehandler.h" |
453 | -#include "screeninfo.h" |
454 | - |
455 | -// libc |
456 | -#include <stdlib.h> |
457 | - |
458 | -#if defined(QMLJSDEBUGGER) |
459 | -#include <qt_private/qdeclarativedebughelper_p.h> |
460 | -#endif |
461 | - |
462 | -#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) |
463 | -#include <jsdebuggeragent.h> |
464 | -#endif |
465 | -#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) |
466 | -#include <qdeclarativeviewobserver.h> |
467 | -#endif |
468 | - |
469 | -#if defined(QMLJSDEBUGGER) |
470 | - |
471 | -// Enable debugging before any QDeclarativeEngine is created |
472 | -struct QmlJsDebuggingEnabler |
473 | -{ |
474 | - QmlJsDebuggingEnabler() |
475 | - { |
476 | - QDeclarativeDebugHelper::enableDebugging(); |
477 | - } |
478 | -}; |
479 | - |
480 | -// Execute code in constructor before first QDeclarativeEngine is instantiated |
481 | -static QmlJsDebuggingEnabler enableDebuggingHelper; |
482 | - |
483 | -#endif // QMLJSDEBUGGER |
484 | - |
485 | -int main(int argc, char *argv[]) |
486 | -{ |
487 | - Unity2dApplication::earlySetup(argc, argv); |
488 | - Unity2dApplication application(argc, argv); |
489 | - application.setApplicationName("Unity 2D Launcher"); |
490 | - QSet<QString> arguments = QSet<QString>::fromList(QCoreApplication::arguments()); |
491 | - |
492 | - GnomeSessionClient client(INSTALL_PREFIX "/share/applications/unity-2d-launcher.desktop"); |
493 | - client.connectToSessionManager(); |
494 | - |
495 | - /* Configure "artwork:" prefix so that any access to a file whose name starts |
496 | - with that prefix resolves properly. */ |
497 | - QDir::addSearchPath("artwork", unity2dDirectory() + "/launcher/artwork"); |
498 | - |
499 | - /* Panel containing the QML declarative view, topleft screen */ |
500 | - Unity2dPanel panel(true, -1, ScreenInfo::TopLeft); |
501 | - |
502 | - panel.setEdge(Unity2dPanel::LeftEdge); |
503 | - panel.setFixedWidth(LauncherClient::MaximumWidth); |
504 | - panel.setAccessibleName("Launcher"); |
505 | - |
506 | - VisibilityController* visibilityController = new VisibilityController(&panel); |
507 | - |
508 | - /* QML declarative view */ |
509 | - LauncherView *launcherView = new LauncherView(&panel); |
510 | - if (arguments.contains("-opengl")) { |
511 | - launcherView->setUseOpenGL(true); |
512 | - } |
513 | - |
514 | - launcherView->setResizeMode(QDeclarativeView::SizeRootObjectToView); |
515 | - launcherView->setFocus(); |
516 | - |
517 | - launcherView->engine()->addImportPath(unity2dImportPath()); |
518 | - /* Note: baseUrl seems to be picky: if it does not end with a slash, |
519 | - setSource() will fail */ |
520 | - launcherView->engine()->setBaseUrl(QUrl::fromLocalFile(unity2dDirectory() + "/launcher/")); |
521 | - |
522 | - launcherView->rootContext()->setContextProperty("declarativeView", launcherView); |
523 | - launcherView->rootContext()->setContextProperty("launcherView", launcherView); |
524 | - launcherView->rootContext()->setContextProperty("panel", &panel); |
525 | - launcherView->rootContext()->setContextProperty("visibilityController", visibilityController); |
526 | - |
527 | - LauncherDBus launcherDBus(visibilityController, launcherView); |
528 | - launcherDBus.connectToBus(); |
529 | - |
530 | - launcherView->setSource(QUrl("./Launcher.qml")); |
531 | - |
532 | - /* Composing the QML declarative view inside the panel */ |
533 | - panel.addWidget(launcherView); |
534 | - panel.show(); |
535 | - |
536 | - /* Unset DESKTOP_AUTOSTART_ID in order to avoid child processes (launched |
537 | - applications) to use the same client id. |
538 | - This would prevent some applications (e.g. nautilus) from launching when |
539 | - the launcher itself was autostarted (which is the common case when |
540 | - running installed). |
541 | - For a discussion, see https://bugs.launchpad.net/upicek/+bug/684160. */ |
542 | - unsetenv("DESKTOP_AUTOSTART_ID"); |
543 | - |
544 | - /* Gesture handler instance in charge of listening to gesture events and |
545 | - trigger appropriate actions in response. */ |
546 | - GestureHandler gestureHandler(&panel); |
547 | - |
548 | - return application.exec(); |
549 | -} |
550 | - |
551 | |
552 | === removed file 'launcher/app/launcherview.cpp' |
553 | --- launcher/app/launcherview.cpp 2012-02-07 10:43:40 +0000 |
554 | +++ launcher/app/launcherview.cpp 1970-01-01 00:00:00 +0000 |
555 | @@ -1,299 +0,0 @@ |
556 | -/* |
557 | - * Copyright (C) 2010 Canonical, Ltd. |
558 | - * |
559 | - * Authors: |
560 | - * Olivier Tilloy <olivier.tilloy@canonical.com> |
561 | - * |
562 | - * This program is free software; you can redistribute it and/or modify |
563 | - * it under the terms of the GNU General Public License as published by |
564 | - * the Free Software Foundation; version 3. |
565 | - * |
566 | - * This program is distributed in the hope that it will be useful, |
567 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
568 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
569 | - * GNU General Public License for more details. |
570 | - * |
571 | - * You should have received a copy of the GNU General Public License |
572 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
573 | - */ |
574 | - |
575 | -#include "launcherview.h" |
576 | - |
577 | -#include <config.h> |
578 | -#include <keyboardmodifiersmonitor.h> |
579 | -#include <hotkey.h> |
580 | -#include <hotkeymonitor.h> |
581 | -#include <keymonitor.h> |
582 | -#include <screeninfo.h> |
583 | -#include <debug_p.h> |
584 | - |
585 | -#include <QApplication> |
586 | -#include <QDesktopWidget> |
587 | -#include <QX11Info> |
588 | -#include <QDebug> |
589 | -#include <QGraphicsObject> |
590 | - |
591 | -#include <QtDeclarative/qdeclarative.h> |
592 | -#include <QDeclarativeEngine> |
593 | -#include <QDeclarativeContext> |
594 | -#include <QDeclarativeImageProvider> |
595 | -#include <QtDBus/QDBusInterface> |
596 | -#include <QtDBus/QDBusPendingCall> |
597 | -#include <QtDBus/QDBusReply> |
598 | -#include <QtDBus/QDBusConnectionInterface> |
599 | - |
600 | -#include <X11/Xlib.h> |
601 | -#include <X11/Xatom.h> |
602 | - |
603 | -static const int KEY_HOLD_THRESHOLD = 250; |
604 | - |
605 | -static const char* DASH_DBUS_SERVICE = "com.canonical.Unity2d.Dash"; |
606 | -static const char* DASH_DBUS_PATH = "/Dash"; |
607 | -static const char* DASH_DBUS_INTERFACE = "com.canonical.Unity2d.Dash"; |
608 | -static const char* SPREAD_DBUS_SERVICE = "com.canonical.Unity2d.Spread"; |
609 | -static const char* SPREAD_DBUS_PATH = "/Spread"; |
610 | -static const char* SPREAD_DBUS_INTERFACE = "com.canonical.Unity2d.Spread"; |
611 | - |
612 | -static const char* DASH_DBUS_PROPERTY_ACTIVE = "active"; |
613 | -static const char* DASH_DBUS_METHOD_ACTIVATE_HOME = "activateHome"; |
614 | -static const char* SPREAD_DBUS_METHOD_IS_SHOWN = "IsShown"; |
615 | -static const char* COMMANDS_LENS_ID = "commands.lens"; |
616 | - |
617 | -LauncherView::LauncherView(QWidget* parent) : |
618 | - Unity2DDeclarativeView(parent), |
619 | - m_superKeyPressed(false), m_superKeyHeld(false) |
620 | -{ |
621 | - setTransparentBackground(QX11Info::isCompositingManagerRunning()); |
622 | - |
623 | - m_superKeyHoldTimer.setSingleShot(true); |
624 | - m_superKeyHoldTimer.setInterval(KEY_HOLD_THRESHOLD); |
625 | - connect(&m_superKeyHoldTimer, SIGNAL(timeout()), SLOT(updateSuperKeyHoldState())); |
626 | - connect(this, SIGNAL(superKeyTapped()), SLOT(toggleDash())); |
627 | - |
628 | - m_screenInfo = new ScreenInfo(ScreenInfo::TopLeft, this); |
629 | - |
630 | - connect(&launcher2dConfiguration(), SIGNAL(superKeyEnableChanged(bool)), SLOT(updateSuperKeyMonitoring())); |
631 | - updateSuperKeyMonitoring(); |
632 | - |
633 | - /* Alt+F1 toggle the keyboard focus between laucher and other(previous) application. */ |
634 | - Hotkey* altF1 = HotkeyMonitor::instance().getHotkeyFor(Qt::Key_F1, Qt::AltModifier); |
635 | - connect(altF1, SIGNAL(pressed()), SLOT(onAltF1Pressed())); |
636 | - |
637 | - /* Alt+F2 shows the dash with the commands lens activated. */ |
638 | - Hotkey* altF2 = HotkeyMonitor::instance().getHotkeyFor(Qt::Key_F2, Qt::AltModifier); |
639 | - connect(altF2, SIGNAL(pressed()), SLOT(showCommandsLens())); |
640 | - |
641 | - /* Super+S before 'Spread'ing, close all the contextual menus/tooltips in the launcher. */ |
642 | - Hotkey* superS = HotkeyMonitor::instance().getHotkeyFor(Qt::Key_S, Qt::MetaModifier); |
643 | - connect(superS, SIGNAL(pressed()), SLOT(onSuperSPressed())); |
644 | - |
645 | - /* Super+{n} for 0 ≤ n ≤ 9 activates the item with index (n + 9) % 10. */ |
646 | - for (Qt::Key key = Qt::Key_0; key <= Qt::Key_9; key = (Qt::Key) (key + 1)) { |
647 | - Hotkey* hotkey = HotkeyMonitor::instance().getHotkeyFor(key, Qt::MetaModifier); |
648 | - connect(hotkey, SIGNAL(pressed()), SLOT(forwardNumericHotkey())); |
649 | - hotkey = HotkeyMonitor::instance().getHotkeyFor(key, Qt::MetaModifier | Qt::ShiftModifier); |
650 | - connect(hotkey, SIGNAL(pressed()), SLOT(forwardNumericHotkey())); |
651 | - } |
652 | -} |
653 | - |
654 | -LauncherView::~LauncherView() |
655 | -{ |
656 | -} |
657 | - |
658 | -void |
659 | -LauncherView::focusInEvent(QFocusEvent* event) |
660 | -{ |
661 | - QDeclarativeView::focusInEvent(event); |
662 | - Q_EMIT focusChanged(true); |
663 | -} |
664 | - |
665 | -void |
666 | -LauncherView::focusOutEvent(QFocusEvent* event) |
667 | -{ |
668 | - QDeclarativeView::focusOutEvent(event); |
669 | - Q_EMIT focusChanged(false); |
670 | -} |
671 | - |
672 | -void |
673 | -LauncherView::updateSuperKeyMonitoring() |
674 | -{ |
675 | - KeyboardModifiersMonitor *modifiersMonitor = KeyboardModifiersMonitor::instance(); |
676 | - KeyMonitor *keyMonitor = KeyMonitor::instance(); |
677 | - HotkeyMonitor& hotkeyMonitor = HotkeyMonitor::instance(); |
678 | - |
679 | - QVariant value = launcher2dConfiguration().property("superKeyEnable"); |
680 | - if (!value.isValid() || value.toBool() == true) { |
681 | - hotkeyMonitor.enableModifiers(Qt::MetaModifier); |
682 | - QObject::connect(modifiersMonitor, |
683 | - SIGNAL(keyboardModifiersChanged(Qt::KeyboardModifiers)), |
684 | - this, SLOT(setHotkeysForModifiers(Qt::KeyboardModifiers))); |
685 | - /* Ignore Super presses if another key was pressed simultaneously |
686 | - (i.e. a shortcut). https://bugs.launchpad.net/unity-2d/+bug/801073 */ |
687 | - QObject::connect(keyMonitor, |
688 | - SIGNAL(keyPressed()), |
689 | - this, SLOT(ignoreSuperPress())); |
690 | - setHotkeysForModifiers(modifiersMonitor->keyboardModifiers()); |
691 | - } else { |
692 | - hotkeyMonitor.disableModifiers(Qt::MetaModifier); |
693 | - QObject::disconnect(modifiersMonitor, |
694 | - SIGNAL(keyboardModifiersChanged(Qt::KeyboardModifiers)), |
695 | - this, SLOT(setHotkeysForModifiers(Qt::KeyboardModifiers))); |
696 | - QObject::disconnect(keyMonitor, |
697 | - SIGNAL(keyPressed()), |
698 | - this, SLOT(ignoreSuperPress())); |
699 | - m_superKeyHoldTimer.stop(); |
700 | - m_superKeyPressed = false; |
701 | - if (m_superKeyHeld) { |
702 | - m_superKeyHeld = false; |
703 | - Q_EMIT superKeyHeldChanged(false); |
704 | - } |
705 | - } |
706 | -} |
707 | - |
708 | -void |
709 | -LauncherView::setHotkeysForModifiers(Qt::KeyboardModifiers modifiers) |
710 | -{ |
711 | - /* This is the new new state of the Super key (AKA Meta key), while |
712 | - m_superKeyPressed is the previous state of the key at the last modifiers change. */ |
713 | - bool superKeyPressed = modifiers.testFlag(Qt::MetaModifier); |
714 | - |
715 | - if (m_superKeyPressed != superKeyPressed) { |
716 | - m_superKeyPressed = superKeyPressed; |
717 | - if (superKeyPressed) { |
718 | - m_superPressIgnored = false; |
719 | - /* If the key is pressed, start up a timer to monitor if it's being held short |
720 | - enough to qualify as just a "tap" or as a proper hold */ |
721 | - m_superKeyHoldTimer.start(); |
722 | - } else { |
723 | - m_superKeyHoldTimer.stop(); |
724 | - |
725 | - /* If the key is released, and was not being held, it means that the user just |
726 | - performed a "tap". Unless we're told to ignore that tap, that is. */ |
727 | - if (!m_superKeyHeld && !m_superPressIgnored) { |
728 | - Q_EMIT superKeyTapped(); |
729 | - } |
730 | - /* Otherwise the user just terminated a hold. */ |
731 | - else if(m_superKeyHeld){ |
732 | - m_superKeyHeld = false; |
733 | - Q_EMIT superKeyHeldChanged(m_superKeyHeld); |
734 | - } |
735 | - } |
736 | - } |
737 | -} |
738 | - |
739 | -void |
740 | -LauncherView::updateSuperKeyHoldState() |
741 | -{ |
742 | - /* If the key was released in the meantime, just do nothing, otherwise |
743 | - consider the key being held, unless we're told to ignore it. */ |
744 | - if (m_superKeyPressed && !m_superPressIgnored) { |
745 | - m_superKeyHeld = true; |
746 | - Q_EMIT superKeyHeldChanged(m_superKeyHeld); |
747 | - } |
748 | -} |
749 | - |
750 | -void |
751 | -LauncherView::ignoreSuperPress() |
752 | -{ |
753 | - /* There was a key pressed, ignore current super tap/hold */ |
754 | - m_superPressIgnored = true; |
755 | -} |
756 | - |
757 | -void |
758 | -LauncherView::forwardNumericHotkey() |
759 | -{ |
760 | - Hotkey* hotkey = qobject_cast<Hotkey*>(sender()); |
761 | - if (hotkey != NULL) { |
762 | - /* Shortcuts from 1 to 9 should activate the items with index |
763 | - from 1 to 9 (index 0 being the so-called "BFB" or Dash launcher). |
764 | - Shortcut for 0 should activate item with index 10. |
765 | - In other words, the indexes are activated in the same order as |
766 | - the keys appear on a standard keyboard. */ |
767 | - Qt::Key key = hotkey->key(); |
768 | - if (key >= Qt::Key_1 && key <= Qt::Key_9) { |
769 | - int index = key - Qt::Key_0; |
770 | - if (hotkey->modifiers() & Qt::ShiftModifier) { |
771 | - Q_EMIT newInstanceShortcutPressed(index); |
772 | - } else { |
773 | - Q_EMIT activateShortcutPressed(index); |
774 | - } |
775 | - } else if (key == Qt::Key_0) { |
776 | - if (hotkey->modifiers() & Qt::ShiftModifier) { |
777 | - Q_EMIT newInstanceShortcutPressed(10); |
778 | - } else { |
779 | - Q_EMIT activateShortcutPressed(10); |
780 | - } |
781 | - } |
782 | - } |
783 | -} |
784 | - |
785 | -void |
786 | -LauncherView::toggleDash() |
787 | -{ |
788 | - QDBusInterface dashInterface(DASH_DBUS_SERVICE, DASH_DBUS_PATH, DASH_DBUS_INTERFACE); |
789 | - |
790 | - QVariant dashActiveResult = dashInterface.property(DASH_DBUS_PROPERTY_ACTIVE); |
791 | - if (!dashActiveResult.isValid()) { |
792 | - UQ_WARNING << "Can't read the DBUS Dash property" << DASH_DBUS_PROPERTY_ACTIVE |
793 | - << "on" << DASH_DBUS_SERVICE << DASH_DBUS_PATH << DASH_DBUS_INTERFACE; |
794 | - return; |
795 | - } |
796 | - |
797 | - bool dashActive = dashActiveResult.toBool(); |
798 | - if (dashActive) { |
799 | - if (!dashInterface.setProperty(DASH_DBUS_PROPERTY_ACTIVE, false)) { |
800 | - UQ_WARNING << "Can't set the DBUS Dash property" << DASH_DBUS_PROPERTY_ACTIVE |
801 | - << "on" << DASH_DBUS_SERVICE << DASH_DBUS_PATH << DASH_DBUS_INTERFACE; |
802 | - } |
803 | - } else { |
804 | - /* Check if the spread is active before activating the dash. |
805 | - We need to do this since the spread can't prevent the launcher from |
806 | - monitoring the super key and therefore getting to this point if |
807 | - it's tapped. */ |
808 | - |
809 | - /* Check if the spread is present on DBUS first, as we don't want to have DBUS |
810 | - activate it if it's not running yet */ |
811 | - QDBusConnectionInterface* sessionBusIFace = QDBusConnection::sessionBus().interface(); |
812 | - QDBusReply<bool> reply = sessionBusIFace->isServiceRegistered(SPREAD_DBUS_SERVICE); |
813 | - if (reply.isValid() && reply.value() == true) { |
814 | - QDBusInterface spreadInterface(SPREAD_DBUS_SERVICE, SPREAD_DBUS_PATH, |
815 | - SPREAD_DBUS_INTERFACE); |
816 | - |
817 | - QDBusReply<bool> spreadActiveResult = spreadInterface.call(SPREAD_DBUS_METHOD_IS_SHOWN); |
818 | - if (spreadActiveResult.isValid() && spreadActiveResult.value() == true) { |
819 | - return; |
820 | - } |
821 | - } |
822 | - |
823 | - dashInterface.asyncCall(DASH_DBUS_METHOD_ACTIVATE_HOME); |
824 | - } |
825 | -} |
826 | - |
827 | -void |
828 | -LauncherView::showCommandsLens() |
829 | -{ |
830 | - QDBusInterface dashInterface(DASH_DBUS_SERVICE, DASH_DBUS_PATH, DASH_DBUS_INTERFACE); |
831 | - dashInterface.asyncCall("activateLens", COMMANDS_LENS_ID); |
832 | -} |
833 | - |
834 | -/* BUGFIX:881458 */ |
835 | -void |
836 | -LauncherView::onSuperSPressed() |
837 | -{ |
838 | - QGraphicsObject* launcher = rootObject(); |
839 | - QMetaObject::invokeMethod(launcher, "hideMenu", Qt::AutoConnection); |
840 | -} |
841 | - |
842 | -void |
843 | -LauncherView::onAltF1Pressed() |
844 | -{ |
845 | - QGraphicsObject* launcher = rootObject(); |
846 | - |
847 | - if (hasFocus()) { |
848 | - QMetaObject::invokeMethod(launcher, "hideMenu", Qt::AutoConnection); |
849 | - forceDeactivateWindow(); |
850 | - } else { |
851 | - forceActivateWindow(); |
852 | - QMetaObject::invokeMethod(launcher, "focusBFB", Qt::AutoConnection); |
853 | - } |
854 | -} |
855 | |
856 | === removed file 'launcher/app/launcherview.h' |
857 | --- launcher/app/launcherview.h 2011-11-25 12:32:03 +0000 |
858 | +++ launcher/app/launcherview.h 1970-01-01 00:00:00 +0000 |
859 | @@ -1,79 +0,0 @@ |
860 | -/* |
861 | - * Copyright (C) 2010 Canonical, Ltd. |
862 | - * |
863 | - * Authors: |
864 | - * Olivier Tilloy <olivier.tilloy@canonical.com> |
865 | - * |
866 | - * This program is free software; you can redistribute it and/or modify |
867 | - * it under the terms of the GNU General Public License as published by |
868 | - * the Free Software Foundation; version 3. |
869 | - * |
870 | - * This program is distributed in the hope that it will be useful, |
871 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
872 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
873 | - * GNU General Public License for more details. |
874 | - * |
875 | - * You should have received a copy of the GNU General Public License |
876 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
877 | - */ |
878 | - |
879 | -#ifndef LAUNCHERVIEW |
880 | -#define LAUNCHERVIEW |
881 | - |
882 | -#include <QDeclarativeView> |
883 | -#include <QList> |
884 | -#include <QUrl> |
885 | -#include <QTimer> |
886 | -#include <QVariant> |
887 | - |
888 | -#include <unity2ddeclarativeview.h> |
889 | - |
890 | -class DeclarativeDragDropEvent; |
891 | -class LauncherDBus; |
892 | - |
893 | -class LauncherView : public Unity2DDeclarativeView |
894 | -{ |
895 | - Q_OBJECT |
896 | - Q_PROPERTY(bool superKeyHeld READ superKeyHeld NOTIFY superKeyHeldChanged) |
897 | - Q_PROPERTY(bool focus READ hasFocus NOTIFY focusChanged) // overridden |
898 | - |
899 | -public: |
900 | - explicit LauncherView(QWidget* parent = NULL); |
901 | - ~LauncherView(); |
902 | - |
903 | - bool superKeyHeld() const { return m_superKeyHeld; } |
904 | - |
905 | -Q_SIGNALS: |
906 | - void activateShortcutPressed(int itemIndex); |
907 | - void newInstanceShortcutPressed(int itemIndex); |
908 | - void superKeyHeldChanged(bool superKeyHeld); |
909 | - void superKeyTapped(); |
910 | - void addWebFavoriteRequested(const QUrl& url); |
911 | - void focusChanged(bool focus); |
912 | - |
913 | -private Q_SLOTS: |
914 | - void setHotkeysForModifiers(Qt::KeyboardModifiers modifiers); |
915 | - void forwardNumericHotkey(); |
916 | - void ignoreSuperPress(); |
917 | - void updateSuperKeyMonitoring(); |
918 | - void updateSuperKeyHoldState(); |
919 | - void toggleDash(); |
920 | - void showCommandsLens(); |
921 | - void onSuperSPressed(); |
922 | - void onAltF1Pressed(); |
923 | - |
924 | -protected: |
925 | - void focusInEvent(QFocusEvent* event); |
926 | - void focusOutEvent(QFocusEvent* event); |
927 | - |
928 | -private: |
929 | - bool m_superKeyPressed; |
930 | - bool m_superKeyHeld; |
931 | - bool m_superPressIgnored; |
932 | - QTimer m_superKeyHoldTimer; |
933 | - |
934 | - friend class LauncherDBus; |
935 | -}; |
936 | - |
937 | -#endif // LAUNCHERVIEW |
938 | - |
939 | |
940 | === removed file 'launcher/app/unity-2d-launcher.desktop' |
941 | --- launcher/app/unity-2d-launcher.desktop 2011-09-19 16:29:49 +0000 |
942 | +++ launcher/app/unity-2d-launcher.desktop 1970-01-01 00:00:00 +0000 |
943 | @@ -1,13 +0,0 @@ |
944 | -[Desktop Entry] |
945 | -Name=Unity 2d Launcher |
946 | -Comment=A Qt-based applications launcher |
947 | -Icon=gnome-fs-desktop |
948 | -Exec=unity-2d-launcher |
949 | -Terminal=false |
950 | -Type=Application |
951 | -Categories=Utility; |
952 | -NoDisplay=true |
953 | -X-Ubuntu-Gettext-Domain=unity-2d-launcher |
954 | -X-GNOME-Autostart-Notify=false |
955 | -X-GNOME-Autostart-Phase=Panel |
956 | -X-GNOME-AutoRestart=true |
957 | |
958 | === removed file 'launcher/app/visibilitycontroller.cpp' |
959 | --- launcher/app/visibilitycontroller.cpp 2011-12-01 09:55:45 +0000 |
960 | +++ launcher/app/visibilitycontroller.cpp 1970-01-01 00:00:00 +0000 |
961 | @@ -1,163 +0,0 @@ |
962 | -/* |
963 | - * This file is part of unity-2d |
964 | - * |
965 | - * Copyright 2011 Canonical Ltd. |
966 | - * |
967 | - * Authors: |
968 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
969 | - * |
970 | - * This program is free software; you can redistribute it and/or modify |
971 | - * it under the terms of the GNU General Public License as published by |
972 | - * the Free Software Foundation; version 3. |
973 | - * |
974 | - * This program is distributed in the hope that it will be useful, |
975 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
976 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
977 | - * GNU General Public License for more details. |
978 | - * |
979 | - * You should have received a copy of the GNU General Public License |
980 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
981 | - */ |
982 | -// Self |
983 | -#include "visibilitycontroller.h" |
984 | - |
985 | -// Local |
986 | -#include <autohidebehavior.h> |
987 | -#include <forcevisiblebehavior.h> |
988 | -#include <intellihidebehavior.h> |
989 | - |
990 | -// unity-2d |
991 | -#include <debug_p.h> |
992 | -#include <unity2dpanel.h> |
993 | -#include <config.h> |
994 | - |
995 | -// Qt |
996 | -#include <QDBusConnection> |
997 | -#include <QDBusServiceWatcher> |
998 | - |
999 | -VisibilityController::VisibilityController(Unity2dPanel* panel) |
1000 | -: QObject(panel) |
1001 | -, m_panel(panel) |
1002 | -, m_dbusWatcher(new QDBusServiceWatcher(this)) |
1003 | -{ |
1004 | - m_dbusWatcher->setConnection(QDBusConnection::sessionBus()); |
1005 | - m_dbusWatcher->setWatchMode(QDBusServiceWatcher::WatchForUnregistration); |
1006 | - |
1007 | - connect(&launcher2dConfiguration(), SIGNAL(hideModeChanged(int)), SLOT(update())); |
1008 | - connect(m_panel, SIGNAL(manualSlidingChanged(bool)), SLOT(update())); |
1009 | - connect(m_dbusWatcher, SIGNAL(serviceUnregistered(const QString&)), SLOT(slotServiceUnregistered(const QString&))); |
1010 | - update(); |
1011 | -} |
1012 | - |
1013 | -VisibilityController::~VisibilityController() |
1014 | -{ |
1015 | -} |
1016 | - |
1017 | -void VisibilityController::update(UpdateReason reason) |
1018 | -{ |
1019 | - if (!m_forceVisibleCountHash.isEmpty()) { |
1020 | - return; |
1021 | - } |
1022 | - AutoHideMode mode = AutoHideMode(launcher2dConfiguration().property("hideMode").toInt()); |
1023 | - |
1024 | - setBehavior(0); |
1025 | - |
1026 | - /* Do not use any hiding controller if the panel is being slid manually */ |
1027 | - if (!m_panel->manualSliding()) { |
1028 | - switch (mode) { |
1029 | - case ManualHide: |
1030 | - m_panel->setUseStrut(true); |
1031 | - m_panel->slideIn(); |
1032 | - break; |
1033 | - case AutoHide: |
1034 | - m_panel->setUseStrut(false); |
1035 | - setBehavior(new AutoHideBehavior(m_panel)); |
1036 | - break; |
1037 | - case IntelliHide: |
1038 | - m_panel->setUseStrut(false); |
1039 | - setBehavior(new IntelliHideBehavior(m_panel)); |
1040 | - if (reason == UpdateFromForceVisibilityEnded && !m_panel->geometry().contains(QCursor::pos())) { |
1041 | - // The first thing IntelliHideBehavior does is checking if there is |
1042 | - // a window behind the panel, and if there is one, hide the panel immediately |
1043 | - // This is correct for some cases, but in the case we come from an update because the |
1044 | - // panel is not forced visible anymore and the mouse is not in the panel, |
1045 | - // i.e. the launcher was visible and the user clicked in an action of the tile menu, |
1046 | - // we should still give the user the wait 1 second before hiding behaviour. |
1047 | - // To achieve this we tell the behaviour controller to show the panel |
1048 | - // and simulate a mouse leave on the panel to start the hiding timer |
1049 | - QMetaObject::invokeMethod(m_behavior.data(), "showPanel"); |
1050 | - QEvent e(QEvent::Leave); |
1051 | - QCoreApplication::sendEvent(m_panel, &e); |
1052 | - } |
1053 | - break; |
1054 | - } |
1055 | - } |
1056 | -} |
1057 | - |
1058 | -void VisibilityController::beginForceVisible(const QString& service) |
1059 | -{ |
1060 | - bool wasEmpty = m_forceVisibleCountHash.isEmpty(); |
1061 | - if (m_forceVisibleCountHash.contains(service)) { |
1062 | - ++m_forceVisibleCountHash[service]; |
1063 | - } else { |
1064 | - m_forceVisibleCountHash[service] = 1; |
1065 | - if (!service.isEmpty()) { |
1066 | - m_dbusWatcher->addWatchedService(service); |
1067 | - } |
1068 | - } |
1069 | - if (wasEmpty) { |
1070 | - setBehavior(new ForceVisibleBehavior(m_panel)); |
1071 | - } |
1072 | -} |
1073 | - |
1074 | -void VisibilityController::endForceVisible(const QString& service) |
1075 | -{ |
1076 | - if (m_forceVisibleCountHash.contains(service)) { |
1077 | - if (m_forceVisibleCountHash[service] == 1) { |
1078 | - m_forceVisibleCountHash.remove(service); |
1079 | - m_dbusWatcher->removeWatchedService(service); |
1080 | - } else { |
1081 | - --m_forceVisibleCountHash[service]; |
1082 | - } |
1083 | - } else { |
1084 | - UQ_WARNING << "Application" << service << "called endForceVisible() more than beginForceVisible()."; |
1085 | - } |
1086 | - if (m_forceVisibleCountHash.isEmpty()) { |
1087 | - update(UpdateFromForceVisibilityEnded); |
1088 | - } |
1089 | -} |
1090 | - |
1091 | -void VisibilityController::setBehavior(AbstractVisibilityBehavior* behavior) |
1092 | -{ |
1093 | - // This method could be replaced by code calling reset() directly but |
1094 | - // having only one point where the behavior is changed makes it easy to log |
1095 | - // behavior changes using something like: UQ_VAR(behavior); |
1096 | - m_behavior.reset(behavior); |
1097 | - if (behavior != NULL) { |
1098 | - connect(behavior, SIGNAL(visibleChanged(bool)), SLOT(updatePanelVisibility(bool))); |
1099 | - updatePanelVisibility(behavior->visible()); |
1100 | - } |
1101 | -} |
1102 | - |
1103 | -void VisibilityController::updatePanelVisibility(bool visible) |
1104 | -{ |
1105 | - if (visible) { |
1106 | - m_panel->slideIn(); |
1107 | - } else { |
1108 | - m_panel->slideOut(); |
1109 | - } |
1110 | -} |
1111 | - |
1112 | -void VisibilityController::slotServiceUnregistered(const QString& service) |
1113 | -{ |
1114 | - if (!m_forceVisibleCountHash.contains(service)) { |
1115 | - return; |
1116 | - } |
1117 | - |
1118 | - UQ_WARNING << "Application" << service << "quit without calling endForceVisible()."; |
1119 | - m_forceVisibleCountHash.remove(service); |
1120 | - m_dbusWatcher->removeWatchedService(service); |
1121 | - if (m_forceVisibleCountHash.isEmpty()) { |
1122 | - update(UpdateFromForceVisibilityEnded); |
1123 | - } |
1124 | -} |
1125 | |
1126 | === removed file 'launcher/app/visibilitycontroller.h' |
1127 | --- launcher/app/visibilitycontroller.h 2011-11-24 15:12:00 +0000 |
1128 | +++ launcher/app/visibilitycontroller.h 1970-01-01 00:00:00 +0000 |
1129 | @@ -1,93 +0,0 @@ |
1130 | -/* |
1131 | - * This file is part of unity-2d |
1132 | - * |
1133 | - * Copyright 2011 Canonical Ltd. |
1134 | - * |
1135 | - * Authors: |
1136 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
1137 | - * |
1138 | - * This program is free software; you can redistribute it and/or modify |
1139 | - * it under the terms of the GNU General Public License as published by |
1140 | - * the Free Software Foundation; version 3. |
1141 | - * |
1142 | - * This program is distributed in the hope that it will be useful, |
1143 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1144 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1145 | - * GNU General Public License for more details. |
1146 | - * |
1147 | - * You should have received a copy of the GNU General Public License |
1148 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1149 | - */ |
1150 | -#ifndef VISIBILITYCONTROLLER_H |
1151 | -#define VISIBILITYCONTROLLER_H |
1152 | - |
1153 | -// Local |
1154 | - |
1155 | -// Qt |
1156 | -#include <QHash> |
1157 | -#include <QObject> |
1158 | -#include <QScopedPointer> |
1159 | - |
1160 | -class AbstractVisibilityBehavior; |
1161 | -class Unity2dPanel; |
1162 | -class QDBusServiceWatcher; |
1163 | - |
1164 | -/** |
1165 | - * This class monitors the hide_mode dconf key and set up an instance of |
1166 | - * AbstractVisibilityBehavior depending on its value |
1167 | - * |
1168 | - * It also tracks requests for forced visibility: the launcher or another |
1169 | - * application (through launcher DBus API) can request the launcher to stay |
1170 | - * visible for a while, for example because an application requests attention |
1171 | - * or because the dash is visible. This is handled by the beginForceVisible() |
1172 | - * and endForceVisible() methods. |
1173 | - * |
1174 | - * Internally it maintains a refcount-per-app of forced visibility requests so |
1175 | - * that it can restore the default mode if an application quits without calling |
1176 | - * endForceVisible(). |
1177 | - */ |
1178 | -class VisibilityController : public QObject |
1179 | -{ |
1180 | -Q_OBJECT |
1181 | -public: |
1182 | - VisibilityController(Unity2dPanel* panel); |
1183 | - ~VisibilityController(); |
1184 | - |
1185 | - /** |
1186 | - * Force visibility of the launcher. |
1187 | - * service is the dbus service (@see QDBusConnection::baseService()) of the |
1188 | - * application which requested forced visibility. It is set to an empty |
1189 | - * string for internal requests. |
1190 | - */ |
1191 | - Q_INVOKABLE void beginForceVisible(const QString& service = QString()); |
1192 | - Q_INVOKABLE void endForceVisible(const QString& service = QString()); |
1193 | - |
1194 | -private: |
1195 | - enum UpdateReason { |
1196 | - RegularUpdate, |
1197 | - UpdateFromForceVisibilityEnded |
1198 | - }; |
1199 | - |
1200 | -private Q_SLOTS: |
1201 | - void update(UpdateReason reason = RegularUpdate); |
1202 | - void slotServiceUnregistered(const QString&); |
1203 | - void updatePanelVisibility(bool); |
1204 | - |
1205 | -private: |
1206 | - enum AutoHideMode { |
1207 | - ManualHide, |
1208 | - AutoHide, |
1209 | - IntelliHide |
1210 | - }; |
1211 | - Q_DISABLE_COPY(VisibilityController); |
1212 | - Unity2dPanel* m_panel; |
1213 | - QDBusServiceWatcher* m_dbusWatcher; |
1214 | - QScopedPointer<AbstractVisibilityBehavior> m_behavior; |
1215 | - |
1216 | - typedef QHash<QString, int> ForceVisibleCountHash; |
1217 | - ForceVisibleCountHash m_forceVisibleCountHash; |
1218 | - |
1219 | - void setBehavior(AbstractVisibilityBehavior*); |
1220 | -}; |
1221 | - |
1222 | -#endif /* VISIBILITYCONTROLLER_H */ |
1223 | |
1224 | === removed directory 'launcher/artwork' |
1225 | === removed file 'launcher/artwork/launcher_arrow_outline_ltr.png' |
1226 | Binary files launcher/artwork/launcher_arrow_outline_ltr.png 2012-02-03 13:48:01 +0000 and launcher/artwork/launcher_arrow_outline_ltr.png 1970-01-01 00:00:00 +0000 differ |
1227 | === removed file 'launcher/launcher.qmlproject' |
1228 | --- launcher/launcher.qmlproject 2010-10-12 00:33:09 +0000 |
1229 | +++ launcher/launcher.qmlproject 1970-01-01 00:00:00 +0000 |
1230 | @@ -1,18 +0,0 @@ |
1231 | -/* File generated by QtCreator */ |
1232 | - |
1233 | -import QmlProject 1.0 |
1234 | - |
1235 | -Project { |
1236 | - /* Include .qml, .js, and image files from current directory and subdirectories */ |
1237 | - QmlFiles { |
1238 | - directory: "." |
1239 | - } |
1240 | - JavaScriptFiles { |
1241 | - directory: "." |
1242 | - } |
1243 | - ImageFiles { |
1244 | - directory: "." |
1245 | - } |
1246 | - /* List of plugin directories passed to QML runtime */ |
1247 | - // importPaths: [ "../exampleplugin" ] |
1248 | -} |
1249 | |
1250 | === removed directory 'launcher/tests' |
1251 | === removed file 'launcher/tests/CMakeLists.txt' |
1252 | --- launcher/tests/CMakeLists.txt 2011-12-07 12:46:10 +0000 |
1253 | +++ launcher/tests/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
1254 | @@ -1,29 +0,0 @@ |
1255 | -macro(launcher_tests) |
1256 | - set(_test_list "") |
1257 | - foreach(_test ${ARGN}) |
1258 | - add_test(NAME ${_test} |
1259 | - COMMAND /bin/bash ${CMAKE_SOURCE_DIR}/tests/misc/run-with-xvfb.sh ./${_test} |
1260 | - ) |
1261 | - add_executable(${_test} ${_test}.cpp ${_test}.moc) |
1262 | - qt4_generate_moc(${_test}.cpp ${_test}.moc) |
1263 | - target_link_libraries(${_test} |
1264 | - ${QT_QTTEST_LIBRARIES} |
1265 | - uqlauncher |
1266 | - ) |
1267 | - set(_test_list "${_test_list};${_test}") |
1268 | - endforeach(_test) |
1269 | -endmacro(launcher_tests) |
1270 | - |
1271 | -include_directories( |
1272 | - ${CMAKE_SOURCE_DIR}/tests |
1273 | - ${CMAKE_CURRENT_SOURCE_DIR}/../app |
1274 | - ${CMAKE_CURRENT_BINARY_DIR} |
1275 | - ${QT_QTTEST_INCLUDE_DIR} |
1276 | - ${QTGCONF_INCLUDE_DIRS} |
1277 | - ) |
1278 | - |
1279 | -launcher_tests( |
1280 | -# FIXME: test need a mock dbus object to message with via dbus-test-runner |
1281 | -# launcherviewtest |
1282 | - ) |
1283 | - |
1284 | |
1285 | === removed file 'launcher/tests/launcherviewtest.cpp' |
1286 | --- launcher/tests/launcherviewtest.cpp 2011-11-17 20:10:19 +0000 |
1287 | +++ launcher/tests/launcherviewtest.cpp 1970-01-01 00:00:00 +0000 |
1288 | @@ -1,42 +0,0 @@ |
1289 | -/* |
1290 | - * This file is part of unity-2d |
1291 | - * |
1292 | - * Copyright 2010 Canonical Ltd. |
1293 | - * |
1294 | - * Authors: |
1295 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
1296 | - * |
1297 | - * This program is free software; you can redistribute it and/or modify |
1298 | - * it under the terms of the GNU General Public License as published by |
1299 | - * the Free Software Foundation; version 3. |
1300 | - * |
1301 | - * This program is distributed in the hope that it will be useful, |
1302 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1303 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1304 | - * GNU General Public License for more details. |
1305 | - * |
1306 | - * You should have received a copy of the GNU General Public License |
1307 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1308 | - */ |
1309 | - |
1310 | -// Local |
1311 | -#include <unitytestmacro.h> |
1312 | -#include <launcherview.h> |
1313 | - |
1314 | -// Qt |
1315 | -#include <QtTestGui> |
1316 | - |
1317 | -class LauncherViewTest : public QObject |
1318 | -{ |
1319 | - Q_OBJECT |
1320 | -private Q_SLOTS: |
1321 | - void testCreate() |
1322 | - { |
1323 | - LauncherView view; |
1324 | - } |
1325 | -}; |
1326 | - |
1327 | -QAPP_TEST_MAIN(LauncherViewTest) |
1328 | - |
1329 | -#include "launcherviewtest.moc" |
1330 | - |
1331 | |
1332 | === modified file 'libunity-2d-private/CMakeLists.txt' |
1333 | --- libunity-2d-private/CMakeLists.txt 2011-12-07 13:05:37 +0000 |
1334 | +++ libunity-2d-private/CMakeLists.txt 2012-02-09 02:13:26 +0000 |
1335 | @@ -10,6 +10,7 @@ |
1336 | pkg_check_modules(UNITYCORE REQUIRED unity-core-5.0) |
1337 | pkg_check_modules(DEE REQUIRED dee-1.0) |
1338 | pkg_check_modules(XINPUT REQUIRED xi) |
1339 | +pkg_check_modules(GEIS REQUIRED libutouch-geis) |
1340 | |
1341 | set(libunity-2d-private_SOVERSION 0) |
1342 | set(libunity-2d-private_VERSION ${libunity-2d-private_SOVERSION}.0.0) |
1343 | |
1344 | === modified file 'libunity-2d-private/Unity2d/CMakeLists.txt' |
1345 | --- libunity-2d-private/Unity2d/CMakeLists.txt 2011-11-29 17:17:35 +0000 |
1346 | +++ libunity-2d-private/Unity2d/CMakeLists.txt 2012-02-09 02:13:26 +0000 |
1347 | @@ -59,7 +59,5 @@ |
1348 | #Allow build in different directory |
1349 | execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/GnomeBackground.qml" |
1350 | "${CMAKE_CURRENT_BINARY_DIR}/GnomeBackground.qml") |
1351 | -execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/AbstractScrollbar.qml" |
1352 | - "${CMAKE_CURRENT_BINARY_DIR}/AbstractScrollbar.qml") |
1353 | execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/qmldir" |
1354 | "${CMAKE_CURRENT_BINARY_DIR}/qmldir") |
1355 | |
1356 | === modified file 'libunity-2d-private/Unity2d/plugin.cpp' |
1357 | --- libunity-2d-private/Unity2d/plugin.cpp 2012-02-01 13:59:49 +0000 |
1358 | +++ libunity-2d-private/Unity2d/plugin.cpp 2012-02-09 02:13:26 +0000 |
1359 | @@ -22,6 +22,7 @@ |
1360 | */ |
1361 | #include "plugin.h" |
1362 | |
1363 | +#include "dashclient.h" |
1364 | #include "launcherapplication.h" |
1365 | #include "launcherdevice.h" |
1366 | #include "trash.h" |
1367 | @@ -50,12 +51,9 @@ |
1368 | #include "launcherdropitem.h" |
1369 | |
1370 | #include "config.h" |
1371 | -#include "dashclient.h" |
1372 | |
1373 | -#include "autohidebehavior.h" |
1374 | -#include "intellihidebehavior.h" |
1375 | -#include "forcevisiblebehavior.h" |
1376 | #include "bfb.h" |
1377 | +#include "gesturehandler.h" |
1378 | |
1379 | #include "lenses.h" |
1380 | #include "lens.h" |
1381 | @@ -68,8 +66,17 @@ |
1382 | #include "radiooptionfilter.h" |
1383 | #include "checkoptionfilter.h" |
1384 | #include "multirangefilter.h" |
1385 | +#include "windowsintersectmonitor.h" |
1386 | +#include "spreadmonitor.h" |
1387 | #include "focuspath.h" |
1388 | |
1389 | +#include "unity2ddeclarativeview.h" |
1390 | +#include "inputshapemanager.h" |
1391 | +#include "inputshaperectangle.h" |
1392 | +#include "inputshapemask.h" |
1393 | +#include "unity2dpanel.h" |
1394 | +#include "strutmanager.h" |
1395 | + |
1396 | #include <QtDeclarative/qdeclarative.h> |
1397 | #include <QDeclarativeEngine> |
1398 | #include <QDeclarativeContext> |
1399 | @@ -99,6 +106,8 @@ |
1400 | { |
1401 | qmlRegisterType<QSortFilterProxyModelQML>(uri, 0, 1, "SortFilterProxyModel"); |
1402 | |
1403 | + qmlRegisterType<DashClient>(); |
1404 | + |
1405 | qmlRegisterType<WindowInfo>(uri, 0, 1, "WindowInfo"); |
1406 | qmlRegisterType<WindowsList>(uri, 0, 1, "WindowsList"); |
1407 | qmlRegisterType<ScreenInfo>(uri, 0, 1, "ScreenInfo"); |
1408 | @@ -136,10 +145,6 @@ |
1409 | qmlRegisterType<WorkspacesList>(uri, 0, 1, "WorkspacesList"); |
1410 | qmlRegisterType<Workspaces>(uri, 0, 1, "Workspaces"); |
1411 | |
1412 | - qmlRegisterType<IntelliHideBehavior>(uri, 0, 1, "IntelliHideBehavior"); |
1413 | - qmlRegisterType<AutoHideBehavior>(uri, 0, 1, "AutoHideBehavior"); |
1414 | - qmlRegisterType<ForceVisibleBehavior>(uri, 0, 1, "ForceVisibleBehavior"); |
1415 | - |
1416 | qmlRegisterType<IconUtilities>(); // Register the type as non creatable |
1417 | |
1418 | qmlRegisterType<GioDefaultApplication>(uri, 0, 1, "GioDefaultApplication"); |
1419 | @@ -160,7 +165,17 @@ |
1420 | qmlRegisterType<FilterOption>(); |
1421 | qmlRegisterType<FilterOptions>(); |
1422 | |
1423 | - qmlRegisterType<DashClient>(); |
1424 | + qmlRegisterType<GestureHandler>(uri, 0, 1, "GestureHandler"); |
1425 | + qmlRegisterType<WindowsIntersectMonitor>(uri, 0, 1, "WindowsIntersectMonitor"); |
1426 | + qmlRegisterType<SpreadMonitor>(uri, 0, 1, "SpreadMonitor"); |
1427 | + |
1428 | + qmlRegisterType<InputShapeManager>(uri, 0, 1, "InputShapeManager"); |
1429 | + qmlRegisterType<InputShapeRectangle>(uri, 0, 1, "InputShapeRectangle"); |
1430 | + qmlRegisterType<InputShapeMask>(uri, 0, 1, "InputShapeMask"); |
1431 | + qmlRegisterType<Unity2DDeclarativeView>(); |
1432 | + |
1433 | + qmlRegisterType<Unity2dPanel>(uri, 0, 1, "Unity2dPanel"); |
1434 | + qmlRegisterType<StrutManager>(uri, 0, 1, "StrutManager"); |
1435 | } |
1436 | |
1437 | void Unity2dPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri) |
1438 | @@ -179,8 +194,9 @@ |
1439 | engine->rootContext()->setContextProperty("iconUtilities", new IconUtilities(engine)); |
1440 | |
1441 | /* Expose QConf objects as a context property not to initialize it multiple times */ |
1442 | + engine->rootContext()->setContextProperty("unity2dConfiguration", &unity2dConfiguration()); |
1443 | + engine->rootContext()->setContextProperty("launcher2dConfiguration", &launcher2dConfiguration()); |
1444 | engine->rootContext()->setContextProperty("dash2dConfiguration", &dash2dConfiguration()); |
1445 | - engine->rootContext()->setContextProperty("dashClient", DashClient::instance()); |
1446 | |
1447 | /* Critically important to set the client type to pager because wnck |
1448 | will pass that type over to the window manager through XEvents. |
1449 | |
1450 | === modified file 'libunity-2d-private/Unity2d/qmldir' |
1451 | --- libunity-2d-private/Unity2d/qmldir 2011-11-29 17:17:35 +0000 |
1452 | +++ libunity-2d-private/Unity2d/qmldir 2012-02-09 02:13:26 +0000 |
1453 | @@ -1,4 +1,3 @@ |
1454 | plugin unity-2d-private-qml |
1455 | |
1456 | GnomeBackground 1.0 GnomeBackground.qml |
1457 | -AbstractScrollbar 1.0 AbstractScrollbar.qml |
1458 | |
1459 | === modified file 'libunity-2d-private/src/CMakeLists.txt' |
1460 | --- libunity-2d-private/src/CMakeLists.txt 2012-01-31 15:09:02 +0000 |
1461 | +++ libunity-2d-private/src/CMakeLists.txt 2012-02-09 02:13:26 +0000 |
1462 | @@ -13,7 +13,6 @@ |
1463 | hotkey.cpp |
1464 | keymonitor.cpp |
1465 | launcherclient.cpp |
1466 | - mousearea.cpp |
1467 | unity2dapplication.cpp |
1468 | unity2ddebug.cpp |
1469 | unity2dpanel.cpp |
1470 | @@ -22,11 +21,7 @@ |
1471 | mimedata.cpp |
1472 | dragdropevent.cpp |
1473 | propertybinder.cpp |
1474 | - abstractvisibilitybehavior.cpp |
1475 | - autohidebehavior.cpp |
1476 | - edgehitdetector.cpp |
1477 | - forcevisiblebehavior.cpp |
1478 | - intellihidebehavior.cpp |
1479 | + gesturehandler.cpp |
1480 | giodefaultapplication.cpp |
1481 | qsortfilterproxymodelqml.cpp |
1482 | blendedimageprovider.cpp |
1483 | @@ -72,7 +67,14 @@ |
1484 | panelapplet.cpp |
1485 | panelstyle.cpp |
1486 | percentcoder.cpp |
1487 | + windowsintersectmonitor.cpp |
1488 | + abstractdbusservicemonitor.cpp |
1489 | + spreadmonitor.cpp |
1490 | focuspath.cpp |
1491 | + inputshapemanager.cpp |
1492 | + inputshaperectangle.cpp |
1493 | + inputshapemask.cpp |
1494 | + strutmanager.cpp |
1495 | ) |
1496 | |
1497 | # Build |
1498 | @@ -100,6 +102,7 @@ |
1499 | ${NUXCORE_INCLUDE_DIRS} |
1500 | ${DEE_INCLUDE_DIRS} |
1501 | ${XINPUT_INCLUDE_DIRS} |
1502 | + ${GEIS_INCLUDE_DIRS} |
1503 | ) |
1504 | |
1505 | add_library(${LIB_NAME} SHARED ${libunity-2d-private_SRCS} listmodelwrapper.h) |
1506 | @@ -135,6 +138,7 @@ |
1507 | ${NUXCORE_LDFLAGS} |
1508 | ${DEE_LDFLAGS} |
1509 | ${XINPUT_LDFLAGS} |
1510 | + ${GEIS_LDFLAGS} |
1511 | ) |
1512 | |
1513 | # Install |
1514 | |
1515 | === added file 'libunity-2d-private/src/abstractdbusservicemonitor.cpp' |
1516 | --- libunity-2d-private/src/abstractdbusservicemonitor.cpp 1970-01-01 00:00:00 +0000 |
1517 | +++ libunity-2d-private/src/abstractdbusservicemonitor.cpp 2012-02-09 02:13:26 +0000 |
1518 | @@ -0,0 +1,86 @@ |
1519 | +/* |
1520 | + * Copyright (C) 2011 Canonical, Ltd. |
1521 | + * |
1522 | + * Authors: |
1523 | + * Ugo Riboni <ugo.riboni@canonical.com> |
1524 | + * |
1525 | + * This program is free software; you can redistribute it and/or modify |
1526 | + * it under the terms of the GNU General Public License as published by |
1527 | + * the Free Software Foundation; version 3. |
1528 | + * |
1529 | + * This program is distributed in the hope that it will be useful, |
1530 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1531 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1532 | + * GNU General Public License for more details. |
1533 | + * |
1534 | + * You should have received a copy of the GNU General Public License |
1535 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1536 | + */ |
1537 | + |
1538 | +#include "abstractdbusservicemonitor.h" |
1539 | + |
1540 | +#include <QDBusConnection> |
1541 | +#include <QDBusConnectionInterface> |
1542 | +#include <QDBusReply> |
1543 | + |
1544 | +AbstractDBusServiceMonitor::AbstractDBusServiceMonitor(QString service, QString path, |
1545 | + QString interface, QObject *parent) |
1546 | + : QObject(parent) |
1547 | + , m_service(service) |
1548 | + , m_path(path) |
1549 | + , m_interface(interface) |
1550 | + , m_watcher(new QDBusServiceWatcher(service, QDBusConnection::sessionBus())) |
1551 | + , m_dbusInterface(0) |
1552 | +{ |
1553 | + connect(m_watcher, SIGNAL(serviceRegistered(QString)), SLOT(createInterface())); |
1554 | + connect(m_watcher, SIGNAL(serviceUnregistered(QString)), SLOT(destroyInterface())); |
1555 | + |
1556 | + // Connect to the service if it's up already |
1557 | + QDBusConnectionInterface* sessionBus = QDBusConnection::sessionBus().interface(); |
1558 | + QDBusReply<bool> reply = sessionBus->isServiceRegistered(m_service); |
1559 | + if (reply.isValid() && reply.value()) { |
1560 | + createInterface(); |
1561 | + } |
1562 | +} |
1563 | + |
1564 | +AbstractDBusServiceMonitor::~AbstractDBusServiceMonitor() |
1565 | +{ |
1566 | + delete m_watcher; |
1567 | + if (m_dbusInterface) { |
1568 | + delete m_dbusInterface; |
1569 | + } |
1570 | +} |
1571 | + |
1572 | +void AbstractDBusServiceMonitor::createInterface() |
1573 | +{ |
1574 | + if (m_dbusInterface != 0) { |
1575 | + delete m_dbusInterface; |
1576 | + m_dbusInterface = 0; |
1577 | + } |
1578 | + |
1579 | + m_dbusInterface = new QDBusInterface(m_service, m_path, m_interface, |
1580 | + QDBusConnection::sessionBus()); |
1581 | + Q_EMIT serviceAvailableChanged(true); |
1582 | +} |
1583 | + |
1584 | +void AbstractDBusServiceMonitor::destroyInterface() |
1585 | +{ |
1586 | + if (m_dbusInterface != 0) { |
1587 | + delete m_dbusInterface; |
1588 | + m_dbusInterface = 0; |
1589 | + } |
1590 | + |
1591 | + Q_EMIT serviceAvailableChanged(false); |
1592 | +} |
1593 | + |
1594 | +QDBusInterface* AbstractDBusServiceMonitor::dbusInterface() const |
1595 | +{ |
1596 | + return m_dbusInterface; |
1597 | +} |
1598 | + |
1599 | +bool AbstractDBusServiceMonitor::serviceAvailable() const |
1600 | +{ |
1601 | + return m_dbusInterface != 0; |
1602 | +} |
1603 | + |
1604 | +#include "abstractdbusservicemonitor.moc" |
1605 | |
1606 | === added file 'libunity-2d-private/src/abstractdbusservicemonitor.h' |
1607 | --- libunity-2d-private/src/abstractdbusservicemonitor.h 1970-01-01 00:00:00 +0000 |
1608 | +++ libunity-2d-private/src/abstractdbusservicemonitor.h 2012-02-09 02:13:26 +0000 |
1609 | @@ -0,0 +1,59 @@ |
1610 | +/* |
1611 | + * Copyright (C) 2011 Canonical, Ltd. |
1612 | + * |
1613 | + * Authors: |
1614 | + * Ugo Riboni <ugo.riboni@canonical.com> |
1615 | + * |
1616 | + * This program is free software; you can redistribute it and/or modify |
1617 | + * it under the terms of the GNU General Public License as published by |
1618 | + * the Free Software Foundation; version 3. |
1619 | + * |
1620 | + * This program is distributed in the hope that it will be useful, |
1621 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1622 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1623 | + * GNU General Public License for more details. |
1624 | + * |
1625 | + * You should have received a copy of the GNU General Public License |
1626 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1627 | + */ |
1628 | + |
1629 | +#ifndef ABSTRACTDBUSSERVICEMONITOR_H |
1630 | +#define ABSTRACTDBUSSERVICEMONITOR_H |
1631 | + |
1632 | +#include <QObject> |
1633 | + |
1634 | +#include <QDBusInterface> |
1635 | +#include <QDBusServiceWatcher> |
1636 | +#include <QObject> |
1637 | +#include <QString> |
1638 | + |
1639 | +class AbstractDBusServiceMonitor : public QObject |
1640 | +{ |
1641 | + Q_OBJECT |
1642 | + Q_PROPERTY(bool serviceAvailable READ serviceAvailable NOTIFY serviceAvailableChanged) |
1643 | + |
1644 | +public: |
1645 | + explicit AbstractDBusServiceMonitor(QString service, QString path, QString interface, |
1646 | + QObject *parent = 0); |
1647 | + ~AbstractDBusServiceMonitor(); |
1648 | + |
1649 | + QDBusInterface* dbusInterface() const; |
1650 | + |
1651 | + bool serviceAvailable() const; |
1652 | + |
1653 | +Q_SIGNALS: |
1654 | + void serviceAvailableChanged(bool available); |
1655 | + |
1656 | +private Q_SLOTS: |
1657 | + void createInterface(); |
1658 | + void destroyInterface(); |
1659 | + |
1660 | +protected: |
1661 | + QString m_service; |
1662 | + QString m_path; |
1663 | + QString m_interface; |
1664 | + QDBusServiceWatcher* m_watcher; |
1665 | + QDBusInterface* m_dbusInterface; |
1666 | +}; |
1667 | + |
1668 | +#endif // ABSTRACTDBUSSERVICEMONITOR_H |
1669 | |
1670 | === removed file 'libunity-2d-private/src/abstractvisibilitybehavior.cpp' |
1671 | --- libunity-2d-private/src/abstractvisibilitybehavior.cpp 2011-06-11 11:33:52 +0000 |
1672 | +++ libunity-2d-private/src/abstractvisibilitybehavior.cpp 1970-01-01 00:00:00 +0000 |
1673 | @@ -1,59 +0,0 @@ |
1674 | -/* |
1675 | - * This file is part of unity-2d |
1676 | - * |
1677 | - * Copyright 2011 Canonical Ltd. |
1678 | - * |
1679 | - * Authors: |
1680 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
1681 | - * - Florian Boucault <florian.boucault@canonical.com> |
1682 | - * |
1683 | - * This program is free software; you can redistribute it and/or modify |
1684 | - * it under the terms of the GNU General Public License as published by |
1685 | - * the Free Software Foundation; version 3. |
1686 | - * |
1687 | - * This program is distributed in the hope that it will be useful, |
1688 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1689 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1690 | - * GNU General Public License for more details. |
1691 | - * |
1692 | - * You should have received a copy of the GNU General Public License |
1693 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1694 | - */ |
1695 | -// Self |
1696 | -#include "abstractvisibilitybehavior.h" |
1697 | - |
1698 | -// Local |
1699 | - |
1700 | -// libunity-2d |
1701 | - |
1702 | -// Qt |
1703 | -#include <QWidget> |
1704 | - |
1705 | -AbstractVisibilityBehavior::AbstractVisibilityBehavior(QWidget* panel) |
1706 | -: QObject(panel) |
1707 | -, m_panel(panel) |
1708 | -, m_visible(true) |
1709 | -{ |
1710 | -} |
1711 | - |
1712 | -AbstractVisibilityBehavior::~AbstractVisibilityBehavior() |
1713 | -{ |
1714 | -} |
1715 | - |
1716 | -bool AbstractVisibilityBehavior::visible() const |
1717 | -{ |
1718 | - return m_visible; |
1719 | -} |
1720 | - |
1721 | -QWidget* AbstractVisibilityBehavior::panel() const |
1722 | -{ |
1723 | - return m_panel; |
1724 | -} |
1725 | - |
1726 | -void AbstractVisibilityBehavior::setPanel(QWidget* panel) |
1727 | -{ |
1728 | - m_panel = panel; |
1729 | - Q_EMIT panelChanged(m_panel); |
1730 | -} |
1731 | - |
1732 | -#include "abstractvisibilitybehavior.moc" |
1733 | |
1734 | === removed file 'libunity-2d-private/src/abstractvisibilitybehavior.h' |
1735 | --- libunity-2d-private/src/abstractvisibilitybehavior.h 2011-06-11 11:33:52 +0000 |
1736 | +++ libunity-2d-private/src/abstractvisibilitybehavior.h 1970-01-01 00:00:00 +0000 |
1737 | @@ -1,63 +0,0 @@ |
1738 | -/* |
1739 | - * This file is part of unity-2d |
1740 | - * |
1741 | - * Copyright 2011 Canonical Ltd. |
1742 | - * |
1743 | - * Authors: |
1744 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
1745 | - * - Florian Boucault <florian.boucault@canonical.com> |
1746 | - * |
1747 | - * This program is free software; you can redistribute it and/or modify |
1748 | - * it under the terms of the GNU General Public License as published by |
1749 | - * the Free Software Foundation; version 3. |
1750 | - * |
1751 | - * This program is distributed in the hope that it will be useful, |
1752 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1753 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1754 | - * GNU General Public License for more details. |
1755 | - * |
1756 | - * You should have received a copy of the GNU General Public License |
1757 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1758 | - */ |
1759 | -#ifndef ABSTRACTVISIBILITYBEHAVIOR_H |
1760 | -#define ABSTRACTVISIBILITYBEHAVIOR_H |
1761 | - |
1762 | -// Local |
1763 | - |
1764 | -// Qt |
1765 | -#include <QObject> |
1766 | - |
1767 | -class QWidget; |
1768 | - |
1769 | -/** |
1770 | - * Base class for various visibility behaviors. |
1771 | - * |
1772 | - */ |
1773 | -class AbstractVisibilityBehavior : public QObject |
1774 | -{ |
1775 | - Q_OBJECT |
1776 | - |
1777 | - Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged) |
1778 | - Q_PROPERTY(QWidget* panel READ panel WRITE setPanel NOTIFY panelChanged) |
1779 | - |
1780 | -public: |
1781 | - AbstractVisibilityBehavior(QWidget* panel=0); |
1782 | - ~AbstractVisibilityBehavior(); |
1783 | - |
1784 | - // getters |
1785 | - bool visible() const; |
1786 | - QWidget* panel() const; |
1787 | - |
1788 | - // setters |
1789 | - void setPanel(QWidget* panel); |
1790 | - |
1791 | -Q_SIGNALS: |
1792 | - void visibleChanged(bool visible); |
1793 | - void panelChanged(QWidget* panel); |
1794 | - |
1795 | -protected: |
1796 | - QWidget* m_panel; |
1797 | - bool m_visible; |
1798 | -}; |
1799 | - |
1800 | -#endif /* ABSTRACTVISIBILITYBEHAVIOR_H */ |
1801 | |
1802 | === removed file 'libunity-2d-private/src/autohidebehavior.cpp' |
1803 | --- libunity-2d-private/src/autohidebehavior.cpp 2011-12-01 12:22:18 +0000 |
1804 | +++ libunity-2d-private/src/autohidebehavior.cpp 1970-01-01 00:00:00 +0000 |
1805 | @@ -1,143 +0,0 @@ |
1806 | -/* |
1807 | - * This file is part of unity-2d |
1808 | - * |
1809 | - * Copyright 2011 Canonical Ltd. |
1810 | - * |
1811 | - * Authors: |
1812 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
1813 | - * - Florian Boucault <florian.boucault@canonical.com> |
1814 | - * |
1815 | - * This program is free software; you can redistribute it and/or modify |
1816 | - * it under the terms of the GNU General Public License as published by |
1817 | - * the Free Software Foundation; version 3. |
1818 | - * |
1819 | - * This program is distributed in the hope that it will be useful, |
1820 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1821 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1822 | - * GNU General Public License for more details. |
1823 | - * |
1824 | - * You should have received a copy of the GNU General Public License |
1825 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1826 | - */ |
1827 | -// Self |
1828 | -#include "autohidebehavior.h" |
1829 | - |
1830 | -// Local |
1831 | -#include <edgehitdetector.h> |
1832 | - |
1833 | -// libunity-2d |
1834 | -#include <debug_p.h> |
1835 | - |
1836 | -// Qt |
1837 | -#include <QCursor> |
1838 | -#include <QTimer> |
1839 | -#include <QWidget> |
1840 | - |
1841 | -// libwnck |
1842 | -extern "C" { |
1843 | -#define WNCK_I_KNOW_THIS_IS_UNSTABLE |
1844 | -#include <libwnck/libwnck.h> |
1845 | -} |
1846 | - |
1847 | -static const int AUTOHIDE_TIMEOUT = 1000; |
1848 | - |
1849 | -#define GOBJECT_CALLBACK0(callbackName, slot) \ |
1850 | -static void \ |
1851 | -callbackName(GObject* src, QObject* dst) \ |
1852 | -{ \ |
1853 | - QMetaObject::invokeMethod(dst, slot); \ |
1854 | -} |
1855 | - |
1856 | -GOBJECT_CALLBACK0(showingDesktopChangedCB, "onShowingDesktopChanged"); |
1857 | - |
1858 | -AutoHideBehavior::AutoHideBehavior(QWidget* panel) |
1859 | -: AbstractVisibilityBehavior(panel) |
1860 | -, m_autohideTimer(new QTimer(this)) |
1861 | -, m_edgeHitDetector(0) |
1862 | -{ |
1863 | - m_autohideTimer->setSingleShot(true); |
1864 | - m_autohideTimer->setInterval(AUTOHIDE_TIMEOUT); |
1865 | - connect(m_autohideTimer, SIGNAL(timeout()), SLOT(hidePanel())); |
1866 | - |
1867 | - setPanel(panel); |
1868 | - |
1869 | - WnckScreen* screen = wnck_screen_get_default(); |
1870 | - g_signal_connect(G_OBJECT(screen), "showing_desktop_changed", G_CALLBACK(showingDesktopChangedCB), this); |
1871 | -} |
1872 | - |
1873 | -AutoHideBehavior::~AutoHideBehavior() |
1874 | -{ |
1875 | - WnckScreen* screen = wnck_screen_get_default(); |
1876 | - g_signal_handlers_disconnect_by_func(G_OBJECT(screen), gpointer(showingDesktopChangedCB), this); |
1877 | -} |
1878 | - |
1879 | -bool AutoHideBehavior::eventFilter(QObject*, QEvent* event) |
1880 | -{ |
1881 | - switch (event->type()) { |
1882 | - case QEvent::Enter: |
1883 | - m_autohideTimer->stop(); |
1884 | - m_visible = true; |
1885 | - Q_EMIT visibleChanged(m_visible); |
1886 | - break; |
1887 | - case QEvent::Leave: |
1888 | - m_autohideTimer->start(); |
1889 | - break; |
1890 | - default: |
1891 | - break; |
1892 | - } |
1893 | - return false; |
1894 | -} |
1895 | - |
1896 | -void AutoHideBehavior::hidePanel() |
1897 | -{ |
1898 | - m_visible = false; |
1899 | - Q_EMIT visibleChanged(m_visible); |
1900 | - createEdgeHitDetector(); |
1901 | -} |
1902 | - |
1903 | -void AutoHideBehavior::showPanel() |
1904 | -{ |
1905 | - // Delete the mouse area so that it does not prevent mouse events from |
1906 | - // reaching the panel |
1907 | - delete m_edgeHitDetector; |
1908 | - m_edgeHitDetector = 0; |
1909 | - m_autohideTimer->stop(); |
1910 | - m_visible = true; |
1911 | - Q_EMIT visibleChanged(m_visible); |
1912 | -} |
1913 | - |
1914 | -void AutoHideBehavior::onShowingDesktopChanged() |
1915 | -{ |
1916 | - WnckScreen* screen = wnck_screen_get_default(); |
1917 | - gboolean isShowingDesktop = wnck_screen_get_showing_desktop(screen); |
1918 | - if (isShowingDesktop) { |
1919 | - showPanel(); |
1920 | - m_autohideTimer->start(); |
1921 | - } else { |
1922 | - hidePanel(); |
1923 | - } |
1924 | -} |
1925 | - |
1926 | - |
1927 | -void AutoHideBehavior::createEdgeHitDetector() |
1928 | -{ |
1929 | - m_edgeHitDetector = new EdgeHitDetector(this); |
1930 | - connect(m_edgeHitDetector, SIGNAL(edgeHit()), SLOT(showPanel())); |
1931 | -} |
1932 | - |
1933 | - |
1934 | -void AutoHideBehavior::setPanel(QWidget *panel) |
1935 | -{ |
1936 | - if (m_panel != NULL) { |
1937 | - m_panel->removeEventFilter(this); |
1938 | - } |
1939 | - AbstractVisibilityBehavior::setPanel(panel); |
1940 | - if (m_panel != NULL) { |
1941 | - m_panel->installEventFilter(this); |
1942 | - if (!m_panel->geometry().contains(QCursor::pos())) { |
1943 | - m_autohideTimer->start(); |
1944 | - } |
1945 | - } |
1946 | -} |
1947 | - |
1948 | -#include "autohidebehavior.moc" |
1949 | |
1950 | === removed file 'libunity-2d-private/src/autohidebehavior.h' |
1951 | --- libunity-2d-private/src/autohidebehavior.h 2011-12-01 12:22:18 +0000 |
1952 | +++ libunity-2d-private/src/autohidebehavior.h 1970-01-01 00:00:00 +0000 |
1953 | @@ -1,69 +0,0 @@ |
1954 | -/* |
1955 | - * This file is part of unity-2d |
1956 | - * |
1957 | - * Copyright 2011 Canonical Ltd. |
1958 | - * |
1959 | - * Authors: |
1960 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
1961 | - * - Florian Boucault <florian.boucault@canonical.com> |
1962 | - * |
1963 | - * This program is free software; you can redistribute it and/or modify |
1964 | - * it under the terms of the GNU General Public License as published by |
1965 | - * the Free Software Foundation; version 3. |
1966 | - * |
1967 | - * This program is distributed in the hope that it will be useful, |
1968 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1969 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1970 | - * GNU General Public License for more details. |
1971 | - * |
1972 | - * You should have received a copy of the GNU General Public License |
1973 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1974 | - */ |
1975 | -#ifndef AUTOHIDEBEHAVIOR_H |
1976 | -#define AUTOHIDEBEHAVIOR_H |
1977 | - |
1978 | -// Local |
1979 | -#include <abstractvisibilitybehavior.h> |
1980 | - |
1981 | -// Qt |
1982 | -#include <QObject> |
1983 | - |
1984 | -class EdgeHitDetector; |
1985 | -class QTimer; |
1986 | -class QWidget; |
1987 | - |
1988 | -/** |
1989 | - * This class implements the classic autohide-on-timeout behavior |
1990 | - */ |
1991 | -class AutoHideBehavior : public AbstractVisibilityBehavior |
1992 | -{ |
1993 | - Q_OBJECT |
1994 | - |
1995 | - Q_PROPERTY(QWidget* panel READ panel WRITE setPanel NOTIFY panelChanged) |
1996 | - |
1997 | -public: |
1998 | - AutoHideBehavior(QWidget* panel=0); |
1999 | - ~AutoHideBehavior(); |
2000 | - |
2001 | - // setters |
2002 | - void setPanel(QWidget *panel); |
2003 | - |
2004 | -Q_SIGNALS: |
2005 | - void panelChanged(QWidget *panel); |
2006 | - |
2007 | -protected: |
2008 | - bool eventFilter(QObject*, QEvent*); |
2009 | - |
2010 | -private Q_SLOTS: |
2011 | - void hidePanel(); |
2012 | - void showPanel(); |
2013 | - void onShowingDesktopChanged(); |
2014 | - |
2015 | -private: |
2016 | - QTimer* m_autohideTimer; |
2017 | - EdgeHitDetector* m_edgeHitDetector; |
2018 | - |
2019 | - void createEdgeHitDetector(); |
2020 | -}; |
2021 | - |
2022 | -#endif /* AUTOHIDEBEHAVIOR_H */ |
2023 | |
2024 | === modified file 'libunity-2d-private/src/bfb.cpp' |
2025 | --- libunity-2d-private/src/bfb.cpp 2011-12-09 13:46:10 +0000 |
2026 | +++ libunity-2d-private/src/bfb.cpp 2012-02-09 02:13:26 +0000 |
2027 | @@ -21,17 +21,14 @@ |
2028 | #include "bfb.h" |
2029 | |
2030 | // libunity-2d |
2031 | -#include <dashclient.h> |
2032 | #include <debug_p.h> |
2033 | #include <unity2dtr.h> |
2034 | |
2035 | // Qt |
2036 | |
2037 | BfbItem::BfbItem() |
2038 | -: m_active(false) |
2039 | +: m_active(false), m_view(NULL) |
2040 | { |
2041 | - connect(DashClient::instance(), SIGNAL(activePageChanged(const QString&)), |
2042 | - SLOT(slotActivePageChanged(const QString&))); |
2043 | } |
2044 | |
2045 | BfbItem::~BfbItem() |
2046 | @@ -43,15 +40,6 @@ |
2047 | return m_active; |
2048 | } |
2049 | |
2050 | -void BfbItem::slotActivePageChanged(const QString& page) |
2051 | -{ |
2052 | - bool active = !page.isEmpty(); |
2053 | - if (m_active != active) { |
2054 | - m_active = active; |
2055 | - activeChanged(m_active); |
2056 | - } |
2057 | -} |
2058 | - |
2059 | bool BfbItem::running() const |
2060 | { |
2061 | return false; |
2062 | @@ -82,15 +70,42 @@ |
2063 | return false; |
2064 | } |
2065 | |
2066 | +QObject* BfbItem::dashView() const |
2067 | +{ |
2068 | + return m_view; |
2069 | +} |
2070 | + |
2071 | +void BfbItem::setDashView(QObject* view) |
2072 | +{ |
2073 | + if (m_view != NULL) { |
2074 | + disconnect(view); |
2075 | + } |
2076 | + m_view = view; |
2077 | + if (m_view != NULL) { |
2078 | + connect(view, SIGNAL(dashActiveChanged(bool)), this, SLOT(slotDashActiveChanged(bool))); |
2079 | + } |
2080 | +} |
2081 | + |
2082 | void BfbItem::activate() |
2083 | { |
2084 | - DashClient::instance()->setActivePage(m_active ? "" : "home"); |
2085 | + Q_ASSERT(m_view != NULL); |
2086 | + if (m_view != NULL) { |
2087 | + QMetaObject::invokeMethod(m_view, "toggleDash"); |
2088 | + } |
2089 | } |
2090 | |
2091 | void BfbItem::createMenuActions() |
2092 | { |
2093 | } |
2094 | |
2095 | +void BfbItem::slotDashActiveChanged(bool active) |
2096 | +{ |
2097 | + if (m_active != active) { |
2098 | + m_active = active; |
2099 | + Q_EMIT activeChanged(m_active); |
2100 | + } |
2101 | +} |
2102 | + |
2103 | //////////////////////////////////////////////////////////// |
2104 | BfbModel::BfbModel(QObject* parent) |
2105 | : QAbstractListModel(parent) |
2106 | @@ -117,4 +132,14 @@ |
2107 | return QVariant::fromValue(m_bfbItem); |
2108 | } |
2109 | |
2110 | +QObject* BfbModel::dashView() const |
2111 | +{ |
2112 | + return m_bfbItem->dashView(); |
2113 | +} |
2114 | + |
2115 | +void BfbModel::setDashView(QObject* view) |
2116 | +{ |
2117 | + m_bfbItem->setDashView(view); |
2118 | +} |
2119 | + |
2120 | #include <bfb.moc> |
2121 | |
2122 | === modified file 'libunity-2d-private/src/bfb.h' |
2123 | --- libunity-2d-private/src/bfb.h 2011-08-11 09:25:35 +0000 |
2124 | +++ libunity-2d-private/src/bfb.h 2012-02-09 02:13:26 +0000 |
2125 | @@ -42,16 +42,20 @@ |
2126 | virtual QString icon() const; |
2127 | virtual bool launching() const; |
2128 | |
2129 | + QObject* dashView() const; |
2130 | + void setDashView(QObject* view); |
2131 | + |
2132 | /* methods */ |
2133 | Q_INVOKABLE virtual void activate(); |
2134 | Q_INVOKABLE virtual void createMenuActions(); |
2135 | |
2136 | private Q_SLOTS: |
2137 | - void slotActivePageChanged(const QString&); |
2138 | + void slotDashActiveChanged(bool active); |
2139 | |
2140 | private: |
2141 | Q_DISABLE_COPY(BfbItem) |
2142 | bool m_active; |
2143 | + QObject* m_view; |
2144 | }; |
2145 | |
2146 | Q_DECLARE_METATYPE(BfbItem*) |
2147 | @@ -60,6 +64,7 @@ |
2148 | class BfbModel : public QAbstractListModel |
2149 | { |
2150 | Q_OBJECT |
2151 | + Q_PROPERTY(QObject* dashView READ dashView WRITE setDashView) |
2152 | public: |
2153 | BfbModel(QObject* parent = 0); |
2154 | ~BfbModel(); |
2155 | @@ -67,6 +72,9 @@ |
2156 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; |
2157 | int rowCount(const QModelIndex& parent = QModelIndex()) const; |
2158 | |
2159 | + QObject* dashView() const; |
2160 | + void setDashView(QObject* view); |
2161 | + |
2162 | private: |
2163 | Q_DISABLE_COPY(BfbModel) |
2164 | BfbItem* m_bfbItem; |
2165 | |
2166 | === removed file 'libunity-2d-private/src/edgehitdetector.cpp' |
2167 | --- libunity-2d-private/src/edgehitdetector.cpp 2011-11-29 11:46:34 +0000 |
2168 | +++ libunity-2d-private/src/edgehitdetector.cpp 1970-01-01 00:00:00 +0000 |
2169 | @@ -1,65 +0,0 @@ |
2170 | -/* |
2171 | - * This file is part of unity-2d |
2172 | - * |
2173 | - * Copyright 2011 Canonical Ltd. |
2174 | - * |
2175 | - * Authors: |
2176 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
2177 | - * |
2178 | - * License: GPL v3 |
2179 | - */ |
2180 | -// Self |
2181 | -#include "edgehitdetector.h" |
2182 | - |
2183 | -// Local |
2184 | - |
2185 | -// libunity-2d |
2186 | -#include <debug_p.h> |
2187 | - |
2188 | -// Qt |
2189 | -#include <QDesktopWidget> |
2190 | -#include <QTimer> |
2191 | - |
2192 | -static const int EDGE_HIT_DELAY = 500; |
2193 | - |
2194 | -EdgeHitDetector::EdgeHitDetector(QObject* parent) |
2195 | -: QObject(parent) |
2196 | -, m_mouseArea(new MouseArea(this)) |
2197 | -, m_updateTimer(new QTimer(this)) |
2198 | -, m_edgeHitTimer(new QTimer(this)) |
2199 | -{ |
2200 | - updateGeometryFromScreen(); |
2201 | - |
2202 | - // Use a timer to delay geometry updates because sometimes when |
2203 | - // QDesktopWidget emits its signals, immediatly asking for screen geometry |
2204 | - // yields wrong results. |
2205 | - m_updateTimer->setSingleShot(true); |
2206 | - m_updateTimer->setInterval(1000); |
2207 | - connect(m_updateTimer, SIGNAL(timeout()), SLOT(updateGeometryFromScreen())); |
2208 | - |
2209 | - QDesktopWidget* desktop = QApplication::desktop(); |
2210 | - connect(desktop, SIGNAL(resized(int)), m_updateTimer, SLOT(start())); |
2211 | - connect(desktop, SIGNAL(screenCountChanged(int)), m_updateTimer, SLOT(start())); |
2212 | - |
2213 | - m_edgeHitTimer->setInterval(EDGE_HIT_DELAY); |
2214 | - m_edgeHitTimer->setSingleShot(true); |
2215 | - connect(m_edgeHitTimer, SIGNAL(timeout()), SIGNAL(edgeHit())); |
2216 | - |
2217 | - connect(m_mouseArea, SIGNAL(entered()), m_edgeHitTimer, SLOT(start())); |
2218 | - connect(m_mouseArea, SIGNAL(exited()), m_edgeHitTimer, SLOT(stop())); |
2219 | -} |
2220 | - |
2221 | -void EdgeHitDetector::updateGeometryFromScreen() |
2222 | -{ |
2223 | - QPoint p = QApplication::isLeftToRight() ? |
2224 | - QPoint() : |
2225 | - QPoint(QApplication::desktop()->width() - 1, 0); |
2226 | - QRect rect = QApplication::desktop()->availableGeometry(p); |
2227 | - if (QApplication::isLeftToRight()) { |
2228 | - m_mouseArea->setGeometry(rect.left(), rect.top(), 1, rect.height()); |
2229 | - } else { |
2230 | - m_mouseArea->setGeometry(rect.right() - 1, rect.top(), 1, rect.height()); |
2231 | - } |
2232 | -} |
2233 | - |
2234 | -#include "edgehitdetector.moc" |
2235 | |
2236 | === removed file 'libunity-2d-private/src/edgehitdetector.h' |
2237 | --- libunity-2d-private/src/edgehitdetector.h 2011-06-11 11:33:52 +0000 |
2238 | +++ libunity-2d-private/src/edgehitdetector.h 1970-01-01 00:00:00 +0000 |
2239 | @@ -1,44 +0,0 @@ |
2240 | -/* |
2241 | - * This file is part of unity-2d |
2242 | - * |
2243 | - * Copyright 2011 Canonical Ltd. |
2244 | - * |
2245 | - * Authors: |
2246 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
2247 | - * |
2248 | - * License: GPL v3 |
2249 | - */ |
2250 | -#ifndef EDGEHITDETECTOR_H |
2251 | -#define EDGEHITDETECTOR_H |
2252 | - |
2253 | -// Local |
2254 | - |
2255 | -// libunity-2d |
2256 | -#include <mousearea.h> |
2257 | - |
2258 | -// Qt |
2259 | - |
2260 | -class QTimer; |
2261 | - |
2262 | -/** |
2263 | - * A mouse area which stays on the left edge of the leftmost screen |
2264 | - */ |
2265 | -class EdgeHitDetector : public QObject |
2266 | -{ |
2267 | -Q_OBJECT |
2268 | -public: |
2269 | - EdgeHitDetector(QObject* parent = 0); |
2270 | - |
2271 | -Q_SIGNALS: |
2272 | - void edgeHit(); |
2273 | - |
2274 | -private Q_SLOTS: |
2275 | - void updateGeometryFromScreen(); |
2276 | - |
2277 | -private: |
2278 | - MouseArea* m_mouseArea; |
2279 | - QTimer* m_updateTimer; |
2280 | - QTimer* m_edgeHitTimer; |
2281 | -}; |
2282 | - |
2283 | -#endif /* EDGEHITDETECTOR_H */ |
2284 | |
2285 | === removed file 'libunity-2d-private/src/forcevisiblebehavior.cpp' |
2286 | --- libunity-2d-private/src/forcevisiblebehavior.cpp 2011-06-11 11:33:52 +0000 |
2287 | +++ libunity-2d-private/src/forcevisiblebehavior.cpp 1970-01-01 00:00:00 +0000 |
2288 | @@ -1,36 +0,0 @@ |
2289 | -/* |
2290 | - * This file is part of unity-2d |
2291 | - * |
2292 | - * Copyright 2011 Canonical Ltd. |
2293 | - * |
2294 | - * Authors: |
2295 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
2296 | - * |
2297 | - * This program is free software; you can redistribute it and/or modify |
2298 | - * it under the terms of the GNU General Public License as published by |
2299 | - * the Free Software Foundation; version 3. |
2300 | - * |
2301 | - * This program is distributed in the hope that it will be useful, |
2302 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2303 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2304 | - * GNU General Public License for more details. |
2305 | - * |
2306 | - * You should have received a copy of the GNU General Public License |
2307 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2308 | - */ |
2309 | -// Self |
2310 | -#include "forcevisiblebehavior.h" |
2311 | - |
2312 | -// Local |
2313 | - |
2314 | -// libunity-2d |
2315 | - |
2316 | -// Qt |
2317 | -#include <QWidget> |
2318 | - |
2319 | -ForceVisibleBehavior::ForceVisibleBehavior(QWidget* panel) |
2320 | -: AbstractVisibilityBehavior(panel) |
2321 | -{ |
2322 | -} |
2323 | - |
2324 | -#include "forcevisiblebehavior.moc" |
2325 | |
2326 | === removed file 'libunity-2d-private/src/forcevisiblebehavior.h' |
2327 | --- libunity-2d-private/src/forcevisiblebehavior.h 2011-06-11 11:33:52 +0000 |
2328 | +++ libunity-2d-private/src/forcevisiblebehavior.h 1970-01-01 00:00:00 +0000 |
2329 | @@ -1,41 +0,0 @@ |
2330 | -/* |
2331 | - * This file is part of unity-2d |
2332 | - * |
2333 | - * Copyright 2011 Canonical Ltd. |
2334 | - * |
2335 | - * Authors: |
2336 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
2337 | - * |
2338 | - * This program is free software; you can redistribute it and/or modify |
2339 | - * it under the terms of the GNU General Public License as published by |
2340 | - * the Free Software Foundation; version 3. |
2341 | - * |
2342 | - * This program is distributed in the hope that it will be useful, |
2343 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2344 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2345 | - * GNU General Public License for more details. |
2346 | - * |
2347 | - * You should have received a copy of the GNU General Public License |
2348 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2349 | - */ |
2350 | -#ifndef FORCEVISIBLEBEHAVIOR_H |
2351 | -#define FORCEVISIBLEBEHAVIOR_H |
2352 | - |
2353 | -// Local |
2354 | -#include <abstractvisibilitybehavior.h> |
2355 | - |
2356 | -// Qt |
2357 | -#include <QObject> |
2358 | - |
2359 | -/** |
2360 | - * Behavior used when someone requested the launcher to be visible even if it |
2361 | - * is supposed to be hidden |
2362 | - */ |
2363 | -class ForceVisibleBehavior : public AbstractVisibilityBehavior |
2364 | -{ |
2365 | - Q_OBJECT |
2366 | -public: |
2367 | - ForceVisibleBehavior(QWidget* panel=0); |
2368 | -}; |
2369 | - |
2370 | -#endif /* FORCEVISIBLEBEHAVIOR_H */ |
2371 | |
2372 | === renamed file 'launcher/app/gesturehandler.cpp' => 'libunity-2d-private/src/gesturehandler.cpp' |
2373 | --- launcher/app/gesturehandler.cpp 2011-11-08 13:33:33 +0000 |
2374 | +++ libunity-2d-private/src/gesturehandler.cpp 2012-02-09 02:13:26 +0000 |
2375 | @@ -25,10 +25,10 @@ |
2376 | |
2377 | #include <debug_p.h> |
2378 | |
2379 | -GestureHandler::GestureHandler(Unity2dPanel* launcher, QObject *parent) |
2380 | +GestureHandler::GestureHandler(QObject *parent) |
2381 | : QObject(parent) |
2382 | , m_geisInstance(NULL) |
2383 | -, m_launcher(launcher) |
2384 | +, m_isDragging(false) |
2385 | { |
2386 | if (geisInitialize() != GEIS_STATUS_SUCCESS) { |
2387 | UQ_WARNING << "GEIS initialization failed: multitouch support disabled"; |
2388 | @@ -218,9 +218,10 @@ |
2389 | /* 4 fingers drag reveals the launcher progressively; if the drag goes far |
2390 | enough, the launcher is then locked in place and does not autohide anymore */ |
2391 | /* FIXME: only supports the launcher positioned on the left edge of the screen */ |
2392 | - m_launcher->setManualSliding(true); |
2393 | - m_dragDelta = m_launcher->delta() + attributes[GEIS_GESTURE_ATTRIBUTE_DELTA_X].float_val; |
2394 | - m_launcher->setDelta(m_dragDelta); |
2395 | + m_isDragging = true; |
2396 | + Q_EMIT isDraggingChanged(); |
2397 | + m_dragDelta = attributes[GEIS_GESTURE_ATTRIBUTE_DELTA_X].float_val; |
2398 | + Q_EMIT dragDeltaChanged(); |
2399 | } |
2400 | } |
2401 | |
2402 | @@ -262,18 +263,17 @@ |
2403 | m_pinchPreviousTimestamp = timestamp; |
2404 | } |
2405 | } else if (gestureName == GEIS_GESTURE_TYPE_DRAG4) { |
2406 | - /* FIXME: only supports the launcher positioned on the left edge of the screen */ |
2407 | m_dragDelta += attributes[GEIS_GESTURE_ATTRIBUTE_DELTA_X].float_val; |
2408 | - m_launcher->setDelta(m_dragDelta); |
2409 | + Q_EMIT dragDeltaChanged(); |
2410 | /* If the drag goes sufficiently above than the maximum delta then |
2411 | lock the launcher in place by reserving the area so that no windows |
2412 | - overlap it. |
2413 | + overlap it. TODO: move to QML. |
2414 | */ |
2415 | - if (m_dragDelta - m_launcher->delta() > 240) { |
2416 | - m_launcher->setUseStrut(true); |
2417 | - } else { |
2418 | - m_launcher->setUseStrut(false); |
2419 | - } |
2420 | +// if (m_dragDelta - m_launcher->delta() > 240) { |
2421 | +// m_launcher->setUseStrut(true); |
2422 | +// } else { |
2423 | +// m_launcher->setUseStrut(false); |
2424 | +// } |
2425 | } |
2426 | } |
2427 | |
2428 | @@ -284,8 +284,20 @@ |
2429 | |
2430 | if (gestureName == GEIS_GESTURE_TYPE_DRAG4) { |
2431 | m_dragDelta += attributes[GEIS_GESTURE_ATTRIBUTE_DELTA_X].float_val; |
2432 | - m_launcher->setDelta(m_dragDelta); |
2433 | - m_launcher->setManualSliding(false); |
2434 | + Q_EMIT dragDeltaChanged(); |
2435 | + m_isDragging = false; |
2436 | + Q_EMIT isDraggingChanged(); |
2437 | } |
2438 | } |
2439 | |
2440 | +double GestureHandler::dragDelta() const |
2441 | +{ |
2442 | + return m_dragDelta; |
2443 | +} |
2444 | + |
2445 | +bool GestureHandler::isDragging() const |
2446 | +{ |
2447 | + return m_isDragging; |
2448 | +} |
2449 | + |
2450 | +#include "gesturehandler.moc" |
2451 | |
2452 | === renamed file 'launcher/app/gesturehandler.h' => 'libunity-2d-private/src/gesturehandler.h' |
2453 | --- launcher/app/gesturehandler.h 2011-02-21 00:25:44 +0000 |
2454 | +++ libunity-2d-private/src/gesturehandler.h 2012-02-09 02:13:26 +0000 |
2455 | @@ -22,20 +22,29 @@ |
2456 | |
2457 | #include <QObject> |
2458 | #include <QHash> |
2459 | +#include <QMetaType> |
2460 | |
2461 | extern "C" { |
2462 | #include <geis/geis.h> |
2463 | } |
2464 | |
2465 | -#include "unity2dpanel.h" |
2466 | - |
2467 | class GestureHandler : public QObject |
2468 | { |
2469 | Q_OBJECT |
2470 | + Q_PROPERTY(double dragDelta READ dragDelta NOTIFY dragDeltaChanged) |
2471 | + Q_PROPERTY(bool isDragging READ isDragging NOTIFY isDraggingChanged) |
2472 | + |
2473 | public: |
2474 | - explicit GestureHandler(Unity2dPanel* launcher, QObject *parent = 0); |
2475 | + explicit GestureHandler(QObject *parent = 0); |
2476 | ~GestureHandler(); |
2477 | |
2478 | + double dragDelta() const; |
2479 | + bool isDragging() const; |
2480 | + |
2481 | +Q_SIGNALS: |
2482 | + void dragDeltaChanged(); |
2483 | + void isDraggingChanged(); |
2484 | + |
2485 | private Q_SLOTS: |
2486 | void geisEventDispatch(); |
2487 | |
2488 | @@ -60,7 +69,9 @@ |
2489 | float m_pinchPreviousRadius; |
2490 | int m_pinchPreviousTimestamp; |
2491 | float m_dragDelta; |
2492 | - Unity2dPanel* m_launcher; |
2493 | + bool m_isDragging; |
2494 | }; |
2495 | |
2496 | +Q_DECLARE_METATYPE(GestureHandler*) |
2497 | + |
2498 | #endif // GESTUREHANDLER_H |
2499 | |
2500 | === added file 'libunity-2d-private/src/inputshapemanager.cpp' |
2501 | --- libunity-2d-private/src/inputshapemanager.cpp 1970-01-01 00:00:00 +0000 |
2502 | +++ libunity-2d-private/src/inputshapemanager.cpp 2012-02-09 02:13:26 +0000 |
2503 | @@ -0,0 +1,105 @@ |
2504 | +/* |
2505 | + * This file is part of unity-2d |
2506 | + * |
2507 | + * Copyright 2012 Canonical Ltd. |
2508 | + * |
2509 | + * Authors: |
2510 | + * - Ugo Riboni <ugo.riboni@canonical.com> |
2511 | + * |
2512 | + * This program is free software; you can redistribute it and/or modify |
2513 | + * it under the terms of the GNU General Public License as published by |
2514 | + * the Free Software Foundation; version 3. |
2515 | + * |
2516 | + * This program is distributed in the hope that it will be useful, |
2517 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2518 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2519 | + * GNU General Public License for more details. |
2520 | + * |
2521 | + * You should have received a copy of the GNU General Public License |
2522 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2523 | + */ |
2524 | + |
2525 | +#include <QDebug> |
2526 | +#include <QRect> |
2527 | +#include <QX11Info> |
2528 | +#include <QRegion> |
2529 | + |
2530 | +#include "inputshapemanager.h" |
2531 | +#include "unity2ddeclarativeview.h" |
2532 | +#include "desktopinfo.h" |
2533 | + |
2534 | +// X11 |
2535 | +#include <X11/Xlib.h> |
2536 | +#include <X11/Xregion.h> |
2537 | +#include <X11/extensions/shape.h> |
2538 | + |
2539 | +InputShapeManager::InputShapeManager(QObject *parent) : |
2540 | + QObject(parent), |
2541 | + m_target(0) |
2542 | +{ |
2543 | +} |
2544 | + |
2545 | +void InputShapeManager::updateManagedShape() |
2546 | +{ |
2547 | + if (m_target == NULL || !m_target->isVisible()) { |
2548 | + return; |
2549 | + } |
2550 | + |
2551 | + QBitmap inputShape(m_target->width(), m_target->height()); |
2552 | + inputShape.fill(Qt::color0); |
2553 | + QPainter painter(&inputShape); |
2554 | + |
2555 | + Q_FOREACH(InputShapeRectangle* shape, m_shapes) { |
2556 | + if (shape->enabled()) { |
2557 | + painter.drawPixmap(shape->rectangle().x(), shape->rectangle().y(), |
2558 | + shape->shape()); |
2559 | + } |
2560 | + } |
2561 | + |
2562 | + XShapeCombineRegion(QX11Info::display(), m_target->effectiveWinId(), |
2563 | + DesktopInfo::instance()->isCompositingManagerRunning() ? ShapeInput : ShapeBounding, |
2564 | + 0, 0, QRegion(inputShape).handle(), ShapeSet); |
2565 | +} |
2566 | + |
2567 | +Unity2DDeclarativeView* InputShapeManager::target() const |
2568 | +{ |
2569 | + return m_target; |
2570 | +} |
2571 | + |
2572 | +void InputShapeManager::setTarget(Unity2DDeclarativeView *target) |
2573 | +{ |
2574 | + if (m_target != target) { |
2575 | + if (m_target != NULL) m_target->disconnect(this); |
2576 | + |
2577 | + //TODO: de-shape the current target view, if any, before shaping the new one. not used now |
2578 | + // as we never change the view anyway. |
2579 | + |
2580 | + m_target = target; |
2581 | + if (m_target != NULL) { |
2582 | + // due to the way xshape works we need to re-apply the shaping every time the target window |
2583 | + // is mapped again. |
2584 | + connect(m_target, SIGNAL(visibleChanged(bool)), SLOT(updateManagedShape())); |
2585 | + connect(m_target, SIGNAL(sceneResized(QSize)), SLOT(updateManagedShape())); |
2586 | + } |
2587 | + Q_EMIT targetChanged(); |
2588 | + updateManagedShape(); |
2589 | + } |
2590 | +} |
2591 | + |
2592 | +QDeclarativeListProperty<InputShapeRectangle> InputShapeManager::shapes() |
2593 | +{ |
2594 | + return QDeclarativeListProperty<InputShapeRectangle>(this, this, &InputShapeManager::appendShape); |
2595 | +} |
2596 | + |
2597 | +void InputShapeManager::appendShape(QDeclarativeListProperty<InputShapeRectangle> *list, InputShapeRectangle *shape) |
2598 | +{ |
2599 | + InputShapeManager* instance = qobject_cast<InputShapeManager*>(list->object); |
2600 | + if (instance != NULL) { |
2601 | + instance->m_shapes.append(shape); |
2602 | + instance->connect(shape, SIGNAL(shapeChanged()), SLOT(updateManagedShape())); |
2603 | + instance->connect(shape, SIGNAL(enabledChanged()), SLOT(updateManagedShape())); |
2604 | + instance->updateManagedShape(); |
2605 | + } |
2606 | +} |
2607 | + |
2608 | +#include "inputshapemanager.moc" |
2609 | |
2610 | === added file 'libunity-2d-private/src/inputshapemanager.h' |
2611 | --- libunity-2d-private/src/inputshapemanager.h 1970-01-01 00:00:00 +0000 |
2612 | +++ libunity-2d-private/src/inputshapemanager.h 2012-02-09 02:13:26 +0000 |
2613 | @@ -0,0 +1,59 @@ |
2614 | +/* |
2615 | + * This file is part of unity-2d |
2616 | + * |
2617 | + * Copyright 2012 Canonical Ltd. |
2618 | + * |
2619 | + * Authors: |
2620 | + * - Ugo Riboni <ugo.riboni@canonical.com> |
2621 | + * |
2622 | + * This program is free software; you can redistribute it and/or modify |
2623 | + * it under the terms of the GNU General Public License as published by |
2624 | + * the Free Software Foundation; version 3. |
2625 | + * |
2626 | + * This program is distributed in the hope that it will be useful, |
2627 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2628 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2629 | + * GNU General Public License for more details. |
2630 | + * |
2631 | + * You should have received a copy of the GNU General Public License |
2632 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2633 | + */ |
2634 | + |
2635 | +#ifndef INPUTSHAPEMANAGER_H |
2636 | +#define INPUTSHAPEMANAGER_H |
2637 | + |
2638 | +#include <QObject> |
2639 | +#include <QDeclarativeListProperty> |
2640 | + |
2641 | +#include "inputshaperectangle.h" |
2642 | + |
2643 | +class Unity2DDeclarativeView; |
2644 | + |
2645 | +class InputShapeManager : public QObject |
2646 | +{ |
2647 | + Q_OBJECT |
2648 | + Q_PROPERTY(Unity2DDeclarativeView* target READ target WRITE setTarget NOTIFY targetChanged) |
2649 | + Q_PROPERTY(QDeclarativeListProperty<InputShapeRectangle> shapes READ shapes) |
2650 | + Q_CLASSINFO("DefaultProperty", "shapes") |
2651 | + |
2652 | +public: |
2653 | + explicit InputShapeManager(QObject *parent = 0); |
2654 | + Unity2DDeclarativeView* target() const; |
2655 | + void setTarget(Unity2DDeclarativeView* target); |
2656 | + QDeclarativeListProperty<InputShapeRectangle> shapes(); |
2657 | + |
2658 | +Q_SIGNALS: |
2659 | + void targetChanged(); |
2660 | + |
2661 | +public Q_SLOTS: |
2662 | + void updateManagedShape(); |
2663 | + |
2664 | +protected: |
2665 | + static void appendShape(QDeclarativeListProperty<InputShapeRectangle> *property, InputShapeRectangle *value); |
2666 | + |
2667 | +private: |
2668 | + Unity2DDeclarativeView* m_target; |
2669 | + QList<InputShapeRectangle*> m_shapes; |
2670 | +}; |
2671 | + |
2672 | +#endif // INPUTSHAPEMANAGER_H |
2673 | |
2674 | === added file 'libunity-2d-private/src/inputshapemask.cpp' |
2675 | --- libunity-2d-private/src/inputshapemask.cpp 1970-01-01 00:00:00 +0000 |
2676 | +++ libunity-2d-private/src/inputshapemask.cpp 2012-02-09 02:13:26 +0000 |
2677 | @@ -0,0 +1,111 @@ |
2678 | +/* |
2679 | + * This file is part of unity-2d |
2680 | + * |
2681 | + * Copyright 2012 Canonical Ltd. |
2682 | + * |
2683 | + * Authors: |
2684 | + * - Ugo Riboni <ugo.riboni@canonical.com> |
2685 | + * |
2686 | + * This program is free software; you can redistribute it and/or modify |
2687 | + * it under the terms of the GNU General Public License as published by |
2688 | + * the Free Software Foundation; version 3. |
2689 | + * |
2690 | + * This program is distributed in the hope that it will be useful, |
2691 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2692 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2693 | + * GNU General Public License for more details. |
2694 | + * |
2695 | + * You should have received a copy of the GNU General Public License |
2696 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2697 | + */ |
2698 | + |
2699 | +#include "inputshapemask.h" |
2700 | +#include "config.h" |
2701 | + |
2702 | +#include <QBitmap> |
2703 | +#include <QDebug> |
2704 | + |
2705 | +InputShapeMask::InputShapeMask(QObject *parent) : |
2706 | + QObject(parent), |
2707 | + m_enabled(true) |
2708 | +{ |
2709 | +} |
2710 | + |
2711 | +void InputShapeMask::updateShape() |
2712 | +{ |
2713 | + QBitmap newShape; |
2714 | + |
2715 | + if (!m_source.isEmpty() && m_color.isValid()) { |
2716 | + QPixmap image; |
2717 | + QString path = unity2dDirectory() + "/" + m_source; |
2718 | + if (image.load(path)) { |
2719 | + newShape = image.createMaskFromColor(m_color.rgb(), Qt::MaskInColor); |
2720 | + } else { |
2721 | + qWarning() << "Failed to load input shape mask image from" << path; |
2722 | + } |
2723 | + } |
2724 | + |
2725 | + m_shape = newShape; |
2726 | + Q_EMIT shapeChanged(); |
2727 | +} |
2728 | + |
2729 | +QString InputShapeMask::source() const |
2730 | +{ |
2731 | + return m_source; |
2732 | +} |
2733 | + |
2734 | +QColor InputShapeMask::color() const |
2735 | +{ |
2736 | + return m_color; |
2737 | +} |
2738 | + |
2739 | +QPoint InputShapeMask::position() const |
2740 | +{ |
2741 | + return m_position; |
2742 | +} |
2743 | + |
2744 | +bool InputShapeMask::enabled() const |
2745 | +{ |
2746 | + return m_enabled; |
2747 | +} |
2748 | + |
2749 | +QBitmap InputShapeMask::shape() const |
2750 | +{ |
2751 | + return m_shape; |
2752 | +} |
2753 | + |
2754 | +void InputShapeMask::setSource(const QString &source) |
2755 | +{ |
2756 | + if (m_source != source) { |
2757 | + m_source = source; |
2758 | + Q_EMIT sourceChanged(m_source); |
2759 | + updateShape(); |
2760 | + } |
2761 | +} |
2762 | + |
2763 | +void InputShapeMask::setColor(const QColor &color) |
2764 | +{ |
2765 | + if (m_color != color) { |
2766 | + m_color = color; |
2767 | + Q_EMIT colorChanged(m_color); |
2768 | + updateShape(); |
2769 | + } |
2770 | +} |
2771 | + |
2772 | +void InputShapeMask::setPosition(const QPoint &position) |
2773 | +{ |
2774 | + if (m_position != position) { |
2775 | + m_position = position; |
2776 | + Q_EMIT positionChanged(); |
2777 | + } |
2778 | +} |
2779 | + |
2780 | +void InputShapeMask::setEnabled(bool enabled) |
2781 | +{ |
2782 | + if (m_enabled != enabled) { |
2783 | + m_enabled = enabled; |
2784 | + Q_EMIT enabledChanged(); |
2785 | + } |
2786 | +} |
2787 | + |
2788 | +#include "inputshapemask.moc" |
2789 | |
2790 | === added file 'libunity-2d-private/src/inputshapemask.h' |
2791 | --- libunity-2d-private/src/inputshapemask.h 1970-01-01 00:00:00 +0000 |
2792 | +++ libunity-2d-private/src/inputshapemask.h 2012-02-09 02:13:26 +0000 |
2793 | @@ -0,0 +1,71 @@ |
2794 | +/* |
2795 | + * This file is part of unity-2d |
2796 | + * |
2797 | + * Copyright 2012 Canonical Ltd. |
2798 | + * |
2799 | + * Authors: |
2800 | + * - Ugo Riboni <ugo.riboni@canonical.com> |
2801 | + * |
2802 | + * This program is free software; you can redistribute it and/or modify |
2803 | + * it under the terms of the GNU General Public License as published by |
2804 | + * the Free Software Foundation; version 3. |
2805 | + * |
2806 | + * This program is distributed in the hope that it will be useful, |
2807 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2808 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2809 | + * GNU General Public License for more details. |
2810 | + * |
2811 | + * You should have received a copy of the GNU General Public License |
2812 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2813 | + */ |
2814 | + |
2815 | +#ifndef INPUTSHAPEMASK_H |
2816 | +#define INPUTSHAPEMASK_H |
2817 | + |
2818 | +#include <QObject> |
2819 | +#include <QColor> |
2820 | +#include <QPoint> |
2821 | +#include <QBitmap> |
2822 | + |
2823 | +class InputShapeMask : public QObject |
2824 | +{ |
2825 | + Q_OBJECT |
2826 | + Q_PROPERTY(QString source READ source WRITE setSource NOTIFY sourceChanged) |
2827 | + Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) |
2828 | + Q_PROPERTY(QPoint position READ position WRITE setPosition NOTIFY positionChanged) |
2829 | + Q_PROPERTY(QBitmap shape READ shape NOTIFY shapeChanged) |
2830 | + Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) |
2831 | + |
2832 | +public: |
2833 | + explicit InputShapeMask(QObject *parent = 0); |
2834 | + |
2835 | + QString source() const; |
2836 | + QColor color() const; |
2837 | + QPoint position() const; |
2838 | + bool enabled() const; |
2839 | + QBitmap shape() const; |
2840 | + |
2841 | + void setSource(const QString& source); |
2842 | + void setColor(const QColor& color); |
2843 | + void setPosition(const QPoint& position); |
2844 | + void setEnabled(bool enabled); |
2845 | + |
2846 | +Q_SIGNALS: |
2847 | + void sourceChanged(const QString& source); |
2848 | + void colorChanged(const QColor& color); |
2849 | + void enabledChanged(); |
2850 | + void shapeChanged(); |
2851 | + void positionChanged(); |
2852 | + |
2853 | +protected: |
2854 | + void updateShape(); |
2855 | + |
2856 | +private: |
2857 | + QString m_source; |
2858 | + QColor m_color; |
2859 | + QPoint m_position; |
2860 | + bool m_enabled; |
2861 | + QBitmap m_shape; |
2862 | +}; |
2863 | + |
2864 | +#endif // INPUTSHAPEMASK_H |
2865 | |
2866 | === added file 'libunity-2d-private/src/inputshaperectangle.cpp' |
2867 | --- libunity-2d-private/src/inputshaperectangle.cpp 1970-01-01 00:00:00 +0000 |
2868 | +++ libunity-2d-private/src/inputshaperectangle.cpp 2012-02-09 02:13:26 +0000 |
2869 | @@ -0,0 +1,126 @@ |
2870 | +/* |
2871 | + * This file is part of unity-2d |
2872 | + * |
2873 | + * Copyright 2012 Canonical Ltd. |
2874 | + * |
2875 | + * Authors: |
2876 | + * - Ugo Riboni <ugo.riboni@canonical.com> |
2877 | + * |
2878 | + * This program is free software; you can redistribute it and/or modify |
2879 | + * it under the terms of the GNU General Public License as published by |
2880 | + * the Free Software Foundation; version 3. |
2881 | + * |
2882 | + * This program is distributed in the hope that it will be useful, |
2883 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2884 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2885 | + * GNU General Public License for more details. |
2886 | + * |
2887 | + * You should have received a copy of the GNU General Public License |
2888 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
2889 | + */ |
2890 | + |
2891 | +#include "inputshaperectangle.h" |
2892 | +#include "inputshapemask.h" |
2893 | + |
2894 | +#include <QBitmap> |
2895 | +#include <QPainter> |
2896 | +#include <QPainterPath> |
2897 | +#include <QDebug> |
2898 | +#include <QRect> |
2899 | + |
2900 | +InputShapeRectangle::InputShapeRectangle(QObject *parent) : |
2901 | + QObject(parent), |
2902 | + m_enabled(true), |
2903 | + m_mirrorHorizontally(false) |
2904 | +{ |
2905 | +} |
2906 | + |
2907 | +void InputShapeRectangle::updateShape() |
2908 | +{ |
2909 | + QBitmap newShape(m_rectangle.width(), m_rectangle.height()); |
2910 | + newShape.fill(Qt::color1); |
2911 | + |
2912 | + if (!m_rectangle.isEmpty() && m_masks.count() > 0) { |
2913 | + QPainter painter(&newShape); |
2914 | + painter.setBackgroundMode(Qt::OpaqueMode); |
2915 | + |
2916 | + Q_FOREACH (InputShapeMask* mask, m_masks) { |
2917 | + if (mask->enabled()) { |
2918 | + painter.drawPixmap(mask->position(), mask->shape()); |
2919 | + } |
2920 | + } |
2921 | + } |
2922 | + |
2923 | + if (m_mirrorHorizontally) { |
2924 | + newShape = QBitmap::fromImage(newShape.toImage().mirrored(true, false)); |
2925 | + } |
2926 | + |
2927 | + m_shape = newShape; |
2928 | + Q_EMIT shapeChanged(); |
2929 | +} |
2930 | + |
2931 | +QRect InputShapeRectangle::rectangle() const |
2932 | +{ |
2933 | + return m_rectangle; |
2934 | +} |
2935 | + |
2936 | +void InputShapeRectangle::setRectangle(QRect rectangle) |
2937 | +{ |
2938 | + if (rectangle != m_rectangle) { |
2939 | + m_rectangle = rectangle; |
2940 | + updateShape(); |
2941 | + Q_EMIT rectangleChanged(); |
2942 | + } |
2943 | +} |
2944 | + |
2945 | +bool InputShapeRectangle::enabled() const |
2946 | +{ |
2947 | + return m_enabled; |
2948 | +} |
2949 | + |
2950 | +void InputShapeRectangle::setEnabled(bool enabled) |
2951 | +{ |
2952 | + if (enabled != m_enabled) { |
2953 | + m_enabled = enabled; |
2954 | + Q_EMIT enabledChanged(); |
2955 | + |
2956 | + } |
2957 | +} |
2958 | + |
2959 | +QBitmap InputShapeRectangle::shape() const |
2960 | +{ |
2961 | + return m_shape; |
2962 | +} |
2963 | + |
2964 | +QDeclarativeListProperty<InputShapeMask> InputShapeRectangle::masks() |
2965 | +{ |
2966 | + return QDeclarativeListProperty<InputShapeMask>(this, this, &InputShapeRectangle::appendMask); |
2967 | +} |
2968 | + |
2969 | +bool InputShapeRectangle::mirrorHorizontally() const |
2970 | +{ |
2971 | + return m_mirrorHorizontally; |
2972 | +} |
2973 | + |
2974 | +void InputShapeRectangle::setMirrorHorizontally(bool mirror) |
2975 | +{ |
2976 | + if (mirror != m_mirrorHorizontally) { |
2977 | + m_mirrorHorizontally = mirror; |
2978 | + updateShape(); |
2979 | + Q_EMIT mirrorHorizontallyChanged(m_mirrorHorizontally); |
2980 | + } |
2981 | +} |
2982 | + |
2983 | +void InputShapeRectangle::appendMask(QDeclarativeListProperty<InputShapeMask> *list, InputShapeMask *mask) |
2984 | +{ |
2985 | + InputShapeRectangle* instance = qobject_cast<InputShapeRectangle*>(list->object); |
2986 | + if (instance != NULL) { |
2987 | + instance->m_masks.append(mask); |
2988 | + instance->connect(mask, SIGNAL(enabledChanged()), SLOT(updateShape())); |
2989 | + instance->connect(mask, SIGNAL(shapeChanged()), SLOT(updateShape())); |
2990 | + instance->connect(mask, SIGNAL(positionChanged()), SLOT(updateShape())); |
2991 | + instance->updateShape(); |
2992 | + } |
2993 | +} |
2994 | + |
2995 | +#include "inputshaperectangle.moc" |
2996 | |
2997 | === added file 'libunity-2d-private/src/inputshaperectangle.h' |
2998 | --- libunity-2d-private/src/inputshaperectangle.h 1970-01-01 00:00:00 +0000 |
2999 | +++ libunity-2d-private/src/inputshaperectangle.h 2012-02-09 02:13:26 +0000 |
3000 | @@ -0,0 +1,75 @@ |
3001 | +/* |
3002 | + * This file is part of unity-2d |
3003 | + * |
3004 | + * Copyright 2012 Canonical Ltd. |
3005 | + * |
3006 | + * Authors: |
3007 | + * - Ugo Riboni <ugo.riboni@canonical.com> |
3008 | + * |
3009 | + * This program is free software; you can redistribute it and/or modify |
3010 | + * it under the terms of the GNU General Public License as published by |
3011 | + * the Free Software Foundation; version 3. |
3012 | + * |
3013 | + * This program is distributed in the hope that it will be useful, |
3014 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3015 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3016 | + * GNU General Public License for more details. |
3017 | + * |
3018 | + * You should have received a copy of the GNU General Public License |
3019 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3020 | + */ |
3021 | + |
3022 | +#ifndef INPUTSHAPERECTANGLE_H |
3023 | +#define INPUTSHAPERECTANGLE_H |
3024 | + |
3025 | +#include <QObject> |
3026 | +#include <QRect> |
3027 | +#include <QBitmap> |
3028 | +#include <QDeclarativeListProperty> |
3029 | +#include <QList> |
3030 | + |
3031 | +class InputShapeMask; |
3032 | + |
3033 | +class InputShapeRectangle : public QObject |
3034 | +{ |
3035 | + Q_OBJECT |
3036 | + Q_PROPERTY(QRect rectangle READ rectangle WRITE setRectangle NOTIFY rectangleChanged) |
3037 | + Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) |
3038 | + Q_PROPERTY(bool mirrorHorizontally READ mirrorHorizontally WRITE setMirrorHorizontally NOTIFY mirrorHorizontallyChanged) |
3039 | + Q_PROPERTY(QBitmap shape READ shape NOTIFY shapeChanged) |
3040 | + Q_PROPERTY(QDeclarativeListProperty<InputShapeMask> masks READ masks) |
3041 | + Q_CLASSINFO("DefaultProperty", "masks") |
3042 | + |
3043 | +public: |
3044 | + explicit InputShapeRectangle(QObject *parent = 0); |
3045 | + |
3046 | + QRect rectangle() const; |
3047 | + void setRectangle(QRect rectangle); |
3048 | + bool enabled() const; |
3049 | + void setEnabled(bool enabled); |
3050 | + QBitmap shape() const; |
3051 | + QDeclarativeListProperty<InputShapeMask> masks(); |
3052 | + bool mirrorHorizontally() const; |
3053 | + void setMirrorHorizontally(bool mirror); |
3054 | + |
3055 | +protected: |
3056 | + static void appendMask(QDeclarativeListProperty<InputShapeMask> *list, InputShapeMask *mask); |
3057 | + |
3058 | +protected Q_SLOTS: |
3059 | + void updateShape(); |
3060 | + |
3061 | +Q_SIGNALS: |
3062 | + void rectangleChanged(); |
3063 | + void enabledChanged(); |
3064 | + void shapeChanged(); |
3065 | + void mirrorHorizontallyChanged(bool mirrorHorizontally); |
3066 | + |
3067 | +private: |
3068 | + QRect m_rectangle; |
3069 | + bool m_enabled; |
3070 | + bool m_mirrorHorizontally; |
3071 | + QBitmap m_shape; |
3072 | + QList<InputShapeMask*> m_masks; |
3073 | +}; |
3074 | + |
3075 | +#endif // INPUTSHAPERECTANGLE_H |
3076 | |
3077 | === removed file 'libunity-2d-private/src/intellihidebehavior.cpp' |
3078 | --- libunity-2d-private/src/intellihidebehavior.cpp 2012-01-17 14:31:19 +0000 |
3079 | +++ libunity-2d-private/src/intellihidebehavior.cpp 1970-01-01 00:00:00 +0000 |
3080 | @@ -1,256 +0,0 @@ |
3081 | -/* |
3082 | - * This file is part of unity-2d |
3083 | - * |
3084 | - * Copyright 2011 Canonical Ltd. |
3085 | - * |
3086 | - * Authors: |
3087 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
3088 | - * - Florian Boucault <florian.boucault@canonical.com> |
3089 | - * |
3090 | - * License: GPL v3 |
3091 | - */ |
3092 | -// Self |
3093 | -#include "intellihidebehavior.h" |
3094 | - |
3095 | -// Local |
3096 | -#include "unity2dpanel.h" |
3097 | - |
3098 | -// libunity-2d |
3099 | -#include <debug_p.h> |
3100 | -#include <edgehitdetector.h> |
3101 | - |
3102 | -// Qt |
3103 | -#include <QCursor> |
3104 | -#include <QEvent> |
3105 | -#include <QTimer> |
3106 | -#include <QWidget> |
3107 | -#include <QDesktopWidget> |
3108 | - |
3109 | -// libwnck |
3110 | -extern "C" { |
3111 | -#define WNCK_I_KNOW_THIS_IS_UNSTABLE |
3112 | -#include <libwnck/libwnck.h> |
3113 | -} |
3114 | - |
3115 | -static const int AUTOHIDE_TIMEOUT = 1000; |
3116 | - |
3117 | -// Handy macros to declare GObject callbacks. The 'n' in CALLBACKn refers to |
3118 | -// the number of dummy arguments the callback returns |
3119 | -#define GOBJECT_CALLBACK0(callbackName, slot) \ |
3120 | -static void \ |
3121 | -callbackName(GObject* src, QObject* dst) \ |
3122 | -{ \ |
3123 | - QMetaObject::invokeMethod(dst, slot); \ |
3124 | -} |
3125 | - |
3126 | -#define GOBJECT_CALLBACK1(callbackName, slot) \ |
3127 | -static void \ |
3128 | -callbackName(GObject* src, void* dummy1, QObject* dst) \ |
3129 | -{ \ |
3130 | - QMetaObject::invokeMethod(dst, slot); \ |
3131 | -} |
3132 | - |
3133 | -#define GOBJECT_CALLBACK2(callbackName, slot) \ |
3134 | -static void \ |
3135 | -callbackName(GObject* src, void* dummy1, void* dummy2, QObject* dst) \ |
3136 | -{ \ |
3137 | - QMetaObject::invokeMethod(dst, slot); \ |
3138 | -} |
3139 | - |
3140 | -// Screen callbacks |
3141 | -GOBJECT_CALLBACK1(activeWindowChangedCB, "updateActiveWindowConnections"); |
3142 | -GOBJECT_CALLBACK1(activeWorkspaceChangedCB, "updateVisibility"); |
3143 | - |
3144 | -// Window callbacks |
3145 | -GOBJECT_CALLBACK2(stateChangedCB, "updateVisibility"); |
3146 | -GOBJECT_CALLBACK0(geometryChangedCB, "updateVisibility"); |
3147 | -GOBJECT_CALLBACK0(workspaceChangedCB, "updateVisibility"); |
3148 | - |
3149 | -IntelliHideBehavior::IntelliHideBehavior(QWidget* panel) |
3150 | -: AbstractVisibilityBehavior(panel) |
3151 | -, m_updateVisibilityTimer(new QTimer(this)) |
3152 | -, m_edgeHitDetector(0) |
3153 | -, m_activeWindow(0) |
3154 | -{ |
3155 | - m_updateVisibilityTimer->setSingleShot(true); |
3156 | - m_updateVisibilityTimer->setInterval(AUTOHIDE_TIMEOUT); |
3157 | - connect(m_updateVisibilityTimer, SIGNAL(timeout()), SLOT(updateVisibility())); |
3158 | - |
3159 | - setPanel(panel); |
3160 | - |
3161 | - WnckScreen* screen = wnck_screen_get_default(); |
3162 | - g_signal_connect(G_OBJECT(screen), "active-window-changed", G_CALLBACK(activeWindowChangedCB), this); |
3163 | - g_signal_connect(G_OBJECT(screen), "active-workspace-changed", G_CALLBACK(activeWorkspaceChangedCB), this); |
3164 | - |
3165 | - updateActiveWindowConnections(); |
3166 | -} |
3167 | - |
3168 | -IntelliHideBehavior::~IntelliHideBehavior() |
3169 | -{ |
3170 | - disconnectFromGSignals(); |
3171 | - WnckScreen* screen = wnck_screen_get_default(); |
3172 | - g_signal_handlers_disconnect_by_func(G_OBJECT(screen), gpointer(activeWindowChangedCB), this); |
3173 | - g_signal_handlers_disconnect_by_func(G_OBJECT(screen), gpointer(activeWorkspaceChangedCB), this); |
3174 | -} |
3175 | - |
3176 | -void IntelliHideBehavior::disconnectFromGSignals() |
3177 | -{ |
3178 | - if (m_activeWindow) { |
3179 | - g_signal_handlers_disconnect_by_func(m_activeWindow, gpointer(stateChangedCB), this); |
3180 | - g_signal_handlers_disconnect_by_func(m_activeWindow, gpointer(geometryChangedCB), this); |
3181 | - g_signal_handlers_disconnect_by_func(m_activeWindow, gpointer(workspaceChangedCB), this); |
3182 | - } |
3183 | -} |
3184 | - |
3185 | -void IntelliHideBehavior::updateActiveWindowConnections() |
3186 | -{ |
3187 | - WnckScreen* screen = wnck_screen_get_default(); |
3188 | - |
3189 | - disconnectFromGSignals(); |
3190 | - m_activeWindow = 0; |
3191 | - |
3192 | - WnckWindow* window = wnck_screen_get_active_window(screen); |
3193 | - if (window) { |
3194 | - m_activeWindow = window; |
3195 | - g_signal_connect(G_OBJECT(window), "state-changed", G_CALLBACK(stateChangedCB), this); |
3196 | - g_signal_connect(G_OBJECT(window), "geometry-changed", G_CALLBACK(geometryChangedCB), this); |
3197 | - g_signal_connect(G_OBJECT(window), "workspace-changed", G_CALLBACK(workspaceChangedCB), this); |
3198 | - } |
3199 | - |
3200 | - gboolean isShowingDesktop = wnck_screen_get_showing_desktop(screen); |
3201 | - if (isShowingDesktop) { |
3202 | - showPanel(); |
3203 | - } else { |
3204 | - updateVisibility(); |
3205 | - } |
3206 | -} |
3207 | - |
3208 | -void IntelliHideBehavior::updateVisibility() |
3209 | -{ |
3210 | - if (m_panel == NULL) { |
3211 | - return; |
3212 | - } |
3213 | - if (isMouseForcingVisibility()) { |
3214 | - return; |
3215 | - } |
3216 | - int launcherPid = getpid(); |
3217 | - |
3218 | - // Compute launcherRect, adjust "left" to the position where the launcher |
3219 | - // is fully visible. |
3220 | - QRect launcherRect = m_panel->geometry(); |
3221 | - // FIXME: the following code assumes that the launcher is on the left edge |
3222 | - // of the screen |
3223 | - if (QApplication::isLeftToRight()) { |
3224 | - launcherRect.moveLeft(0); |
3225 | - } else { |
3226 | - QDesktopWidget* desktop = QApplication::desktop(); |
3227 | - const QRect screen = desktop->screenGeometry(m_panel); |
3228 | - launcherRect.moveRight(screen.right()); |
3229 | - } |
3230 | - |
3231 | - WnckScreen* screen = wnck_screen_get_default(); |
3232 | - WnckWorkspace* workspace = wnck_screen_get_active_workspace(screen); |
3233 | - |
3234 | - // Check whether a window is crossing our launcher rect |
3235 | - bool crossWindow = false; |
3236 | - GList* list = wnck_screen_get_windows(screen); |
3237 | - for (; list; list = g_list_next(list)) { |
3238 | - WnckWindow* window = WNCK_WINDOW(list->data); |
3239 | - if (wnck_window_is_on_workspace(window, workspace) && wnck_window_get_pid(window) != launcherPid) { |
3240 | - WnckWindowType type = wnck_window_get_window_type(window); |
3241 | - |
3242 | - // Only take into account typical application windows |
3243 | - if (type != WNCK_WINDOW_NORMAL && |
3244 | - type != WNCK_WINDOW_DIALOG && |
3245 | - type != WNCK_WINDOW_TOOLBAR && |
3246 | - type != WNCK_WINDOW_MENU && |
3247 | - type != WNCK_WINDOW_UTILITY) { |
3248 | - continue; |
3249 | - } |
3250 | - |
3251 | - WnckWindowState state = wnck_window_get_state(window); |
3252 | - |
3253 | - // Skip hidden (==minimized and other states) windows |
3254 | - if (state & WNCK_WINDOW_STATE_HIDDEN) { |
3255 | - continue; |
3256 | - } |
3257 | - |
3258 | - // Check the window rect |
3259 | - int x, y, width, height; |
3260 | - wnck_window_get_geometry(window, &x, &y, &width, &height); |
3261 | - QRect rect(x, y, width, height); |
3262 | - if (rect.intersects(launcherRect)) { |
3263 | - crossWindow = true; |
3264 | - break; |
3265 | - } |
3266 | - } |
3267 | - } |
3268 | - |
3269 | - if (crossWindow) { |
3270 | - hidePanel(); |
3271 | - } else { |
3272 | - showPanel(); |
3273 | - } |
3274 | -} |
3275 | - |
3276 | -bool IntelliHideBehavior::eventFilter(QObject* object, QEvent* event) |
3277 | -{ |
3278 | - switch (event->type()) { |
3279 | - case QEvent::Enter: |
3280 | - m_updateVisibilityTimer->stop(); |
3281 | - break; |
3282 | - case QEvent::Leave: |
3283 | - m_updateVisibilityTimer->start(); |
3284 | - break; |
3285 | - default: |
3286 | - break; |
3287 | - } |
3288 | - return false; |
3289 | -} |
3290 | - |
3291 | -bool IntelliHideBehavior::isMouseForcingVisibility() const |
3292 | -{ |
3293 | - // We check the cursor position ourself because using QWidget::underMouse() |
3294 | - // is unreliable. It causes LP bug #740280 |
3295 | - return m_panel != NULL && m_panel->geometry().contains(QCursor::pos()); |
3296 | -} |
3297 | - |
3298 | -void IntelliHideBehavior::hidePanel() |
3299 | -{ |
3300 | - if (m_visible) { |
3301 | - m_visible = false; |
3302 | - Q_EMIT visibleChanged(m_visible); |
3303 | - createEdgeHitDetector(); |
3304 | - } |
3305 | -} |
3306 | - |
3307 | -void IntelliHideBehavior::showPanel() |
3308 | -{ |
3309 | - if (!m_visible) { |
3310 | - // Delete the edge hit detector so that it does not prevent mouse events |
3311 | - // from reaching the panel |
3312 | - delete m_edgeHitDetector; |
3313 | - m_edgeHitDetector = 0; |
3314 | - m_visible = true; |
3315 | - Q_EMIT visibleChanged(m_visible); |
3316 | - } |
3317 | -} |
3318 | - |
3319 | -void IntelliHideBehavior::createEdgeHitDetector() |
3320 | -{ |
3321 | - m_edgeHitDetector = new EdgeHitDetector(this); |
3322 | - connect(m_edgeHitDetector, SIGNAL(edgeHit()), SLOT(showPanel())); |
3323 | -} |
3324 | - |
3325 | -void IntelliHideBehavior::setPanel(QWidget *panel) |
3326 | -{ |
3327 | - if (m_panel != NULL) { |
3328 | - m_panel->removeEventFilter(this); |
3329 | - } |
3330 | - AbstractVisibilityBehavior::setPanel(panel); |
3331 | - if (m_panel != NULL) { |
3332 | - m_panel->installEventFilter(this); |
3333 | - } |
3334 | -} |
3335 | - |
3336 | -#include "intellihidebehavior.moc" |
3337 | |
3338 | === removed file 'libunity-2d-private/src/intellihidebehavior.h' |
3339 | --- libunity-2d-private/src/intellihidebehavior.h 2011-06-11 11:33:52 +0000 |
3340 | +++ libunity-2d-private/src/intellihidebehavior.h 1970-01-01 00:00:00 +0000 |
3341 | @@ -1,75 +0,0 @@ |
3342 | -/* |
3343 | - * This file is part of unity-2d |
3344 | - * |
3345 | - * Copyright 2011 Canonical Ltd. |
3346 | - * |
3347 | - * Authors: |
3348 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
3349 | - * - Florian Boucault <florian.boucault@canonical.com> |
3350 | - * |
3351 | - * License: GPL v3 |
3352 | - */ |
3353 | -#ifndef INTELLIHIDEBEHAVIOR_H |
3354 | -#define INTELLIHIDEBEHAVIOR_H |
3355 | - |
3356 | -// Local |
3357 | -#include <abstractvisibilitybehavior.h> |
3358 | - |
3359 | -// Qt |
3360 | -#include <QObject> |
3361 | - |
3362 | -struct _WnckWindow; |
3363 | - |
3364 | -class QTimer; |
3365 | - |
3366 | -class QWidget; |
3367 | -class EdgeHitDetector; |
3368 | - |
3369 | -/** |
3370 | - * This class implements the Intellihide behavior of the launcher |
3371 | - */ |
3372 | -class IntelliHideBehavior : public AbstractVisibilityBehavior |
3373 | -{ |
3374 | - Q_OBJECT |
3375 | - |
3376 | - Q_PROPERTY(QWidget* panel READ panel WRITE setPanel NOTIFY panelChanged) |
3377 | - |
3378 | -public: |
3379 | - IntelliHideBehavior(QWidget* panel=0); |
3380 | - ~IntelliHideBehavior(); |
3381 | - |
3382 | - // setters |
3383 | - void setPanel(QWidget *panel); |
3384 | - |
3385 | -Q_SIGNALS: |
3386 | - void panelChanged(QWidget *panel); |
3387 | - |
3388 | -protected: |
3389 | - bool eventFilter(QObject*, QEvent*); |
3390 | - |
3391 | -private Q_SLOTS: |
3392 | - void updateVisibility(); |
3393 | - void updateActiveWindowConnections(); |
3394 | - void showPanel(); |
3395 | - void hidePanel(); |
3396 | - |
3397 | -private: |
3398 | - Q_DISABLE_COPY(IntelliHideBehavior); |
3399 | - |
3400 | - enum PanelVisibility { |
3401 | - VisiblePanel, |
3402 | - HiddenPanel |
3403 | - }; |
3404 | - QTimer* m_updateVisibilityTimer; |
3405 | - EdgeHitDetector* m_edgeHitDetector; |
3406 | - |
3407 | - struct _WnckWindow* m_activeWindow; |
3408 | - |
3409 | - void disconnectFromGSignals(); |
3410 | - |
3411 | - bool isMouseForcingVisibility() const; |
3412 | - |
3413 | - void createEdgeHitDetector(); |
3414 | -}; |
3415 | - |
3416 | -#endif /* INTELLIHIDEBEHAVIOR_H */ |
3417 | |
3418 | === modified file 'libunity-2d-private/src/launcherclient.cpp' |
3419 | --- libunity-2d-private/src/launcherclient.cpp 2011-12-11 16:36:28 +0000 |
3420 | +++ libunity-2d-private/src/launcherclient.cpp 2012-02-09 02:13:26 +0000 |
3421 | @@ -21,54 +21,6 @@ |
3422 | // Self |
3423 | #include "launcherclient.h" |
3424 | |
3425 | -// Qt |
3426 | -#include <QDBusConnection> |
3427 | -#include <QDBusMessage> |
3428 | -#include <QDBusPendingCall> |
3429 | - |
3430 | -static const char* LAUNCHER_DBUS_SERVICE = "com.canonical.Unity2d.Launcher"; |
3431 | -static const char* LAUNCHER_DBUS_OBJECT_PATH = "/Launcher"; |
3432 | -static const char* LAUNCHER_DBUS_INTERFACE = "com.canonical.Unity2d.Launcher"; |
3433 | - |
3434 | const int LauncherClient::MaximumWidth = 65; |
3435 | |
3436 | -struct LauncherClientPrivate |
3437 | -{ |
3438 | - LauncherClient* q; |
3439 | - |
3440 | - void asyncDBusCall(const QString& methodName) |
3441 | - { |
3442 | - /* The constructor for QDBusInterface potentially does synchronous |
3443 | - introspection calls. In contrast, this is really asynchronous. |
3444 | - See rationale at https://bugs.launchpad.net/unity-2d/+bug/738025. */ |
3445 | - QDBusMessage call = QDBusMessage::createMethodCall(LAUNCHER_DBUS_SERVICE, |
3446 | - LAUNCHER_DBUS_OBJECT_PATH, |
3447 | - LAUNCHER_DBUS_INTERFACE, |
3448 | - methodName); |
3449 | - QDBusConnection::sessionBus().asyncCall(call); |
3450 | - } |
3451 | -}; |
3452 | - |
3453 | -LauncherClient::LauncherClient(QObject* parent) |
3454 | -: QObject(parent) |
3455 | -, d(new LauncherClientPrivate) |
3456 | -{ |
3457 | - d->q = this; |
3458 | -} |
3459 | - |
3460 | -LauncherClient::~LauncherClient() |
3461 | -{ |
3462 | - delete d; |
3463 | -} |
3464 | - |
3465 | -void LauncherClient::beginForceVisible() |
3466 | -{ |
3467 | - d->asyncDBusCall("BeginForceVisible"); |
3468 | -} |
3469 | - |
3470 | -void LauncherClient::endForceVisible() |
3471 | -{ |
3472 | - d->asyncDBusCall("EndForceVisible"); |
3473 | -} |
3474 | - |
3475 | #include "launcherclient.moc" |
3476 | |
3477 | === modified file 'libunity-2d-private/src/launcherclient.h' |
3478 | --- libunity-2d-private/src/launcherclient.h 2011-03-22 11:30:53 +0000 |
3479 | +++ libunity-2d-private/src/launcherclient.h 2012-02-09 02:13:26 +0000 |
3480 | @@ -26,26 +26,13 @@ |
3481 | // Qt |
3482 | #include <QObject> |
3483 | |
3484 | -struct LauncherClientPrivate; |
3485 | /** |
3486 | * Makes it easy for unity-2d components to communicate with unity-2d-launcher |
3487 | */ |
3488 | -class LauncherClient : public QObject |
3489 | +class LauncherClient |
3490 | { |
3491 | - Q_OBJECT |
3492 | public: |
3493 | - // The amount of pixels used by the launcher on the left edge when it is |
3494 | - // fully visible. |
3495 | static const int MaximumWidth; |
3496 | - |
3497 | - LauncherClient(QObject* parent = 0); |
3498 | - ~LauncherClient(); |
3499 | - |
3500 | - void beginForceVisible(); |
3501 | - void endForceVisible(); |
3502 | - |
3503 | -private: |
3504 | - LauncherClientPrivate* const d; |
3505 | }; |
3506 | |
3507 | #endif /* LAUNCHERCLIENT_H */ |
3508 | |
3509 | === removed file 'libunity-2d-private/src/mousearea.cpp' |
3510 | --- libunity-2d-private/src/mousearea.cpp 2011-06-11 10:50:03 +0000 |
3511 | +++ libunity-2d-private/src/mousearea.cpp 1970-01-01 00:00:00 +0000 |
3512 | @@ -1,117 +0,0 @@ |
3513 | -/* |
3514 | - * This file is part of unity-2d |
3515 | - * |
3516 | - * Copyright 2011 Canonical Ltd. |
3517 | - * |
3518 | - * Authors: |
3519 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
3520 | - * |
3521 | - * This program is free software; you can redistribute it and/or modify |
3522 | - * it under the terms of the GNU General Public License as published |
3523 | - * by the Free Software Foundation; version 3. |
3524 | - * |
3525 | - * This program is distributed in the hope that it will be useful, |
3526 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3527 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3528 | - * GNU General Public License for more details. |
3529 | - * |
3530 | - * You should have received a copy of the GNU General Public License |
3531 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3532 | - */ |
3533 | -// Self |
3534 | -#include "mousearea.h" |
3535 | - |
3536 | -// Local |
3537 | -#include <debug_p.h> |
3538 | - |
3539 | -// Qt |
3540 | -#include <QX11Info> |
3541 | - |
3542 | -// X11 |
3543 | -#include <X11/Xlib.h> |
3544 | - |
3545 | -struct MouseAreaPrivate |
3546 | -{ |
3547 | - Window m_window; |
3548 | - QRect m_geometry; |
3549 | - bool m_containsMouse; |
3550 | -}; |
3551 | - |
3552 | -MouseArea::MouseArea(QObject* parent) |
3553 | -: QObject(parent) |
3554 | -, d(new MouseAreaPrivate) |
3555 | -{ |
3556 | - Unity2dApplication* application = Unity2dApplication::instance(); |
3557 | - if (application == NULL) { |
3558 | - /* This can happen for example when using qmlviewer */ |
3559 | - UQ_WARNING << "The application is not an Unity2dApplication." |
3560 | - "MouseArea disabled."; |
3561 | - } else { |
3562 | - application->installX11EventFilter(this); |
3563 | - } |
3564 | - |
3565 | - d->m_containsMouse = false; |
3566 | - |
3567 | - XSetWindowAttributes attributes; |
3568 | - attributes.override_redirect = True; |
3569 | - attributes.event_mask = EnterWindowMask | LeaveWindowMask; |
3570 | - unsigned long attributesMask = CWOverrideRedirect | CWEventMask; |
3571 | - |
3572 | - d->m_geometry = QRect(0, 0, 1, 1); |
3573 | - |
3574 | - d->m_window = XCreateWindow(QX11Info::display(), QX11Info::appRootWindow(), |
3575 | - 0, 0, 1, 1, // geometry |
3576 | - 0, // border_width |
3577 | - 0, // depth |
3578 | - InputOnly, // class |
3579 | - CopyFromParent, // visual |
3580 | - attributesMask, |
3581 | - &attributes); |
3582 | - |
3583 | - XMapWindow(QX11Info::display(), d->m_window); |
3584 | -} |
3585 | - |
3586 | -MouseArea::~MouseArea() |
3587 | -{ |
3588 | - XDestroyWindow(QX11Info::display(), d->m_window); |
3589 | - delete d; |
3590 | -} |
3591 | - |
3592 | -QRect MouseArea::geometry() const |
3593 | -{ |
3594 | - return d->m_geometry; |
3595 | -} |
3596 | - |
3597 | -void MouseArea::setGeometry(const QRect& rect) |
3598 | -{ |
3599 | - setGeometry(rect.x(), rect.y(), rect.width(), rect.height()); |
3600 | -} |
3601 | - |
3602 | -void MouseArea::setGeometry(int x, int y, int width, int height) |
3603 | -{ |
3604 | - d->m_geometry = QRect(x, y, width, height); |
3605 | - XMoveResizeWindow(QX11Info::display(), d->m_window, x, y, width, height); |
3606 | -} |
3607 | - |
3608 | -bool MouseArea::x11EventFilter(XEvent* _event) |
3609 | -{ |
3610 | - if (_event->type == EnterNotify || _event->type == LeaveNotify) { |
3611 | - XCrossingEvent* event = (XCrossingEvent*)(_event); |
3612 | - if (event->window == d->m_window) { |
3613 | - d->m_containsMouse = event->type == EnterNotify; |
3614 | - if (d->m_containsMouse) { |
3615 | - entered(); |
3616 | - } else { |
3617 | - exited(); |
3618 | - } |
3619 | - } |
3620 | - } |
3621 | - return false; |
3622 | -} |
3623 | - |
3624 | -bool MouseArea::containsMouse() const |
3625 | -{ |
3626 | - return d->m_containsMouse; |
3627 | -} |
3628 | - |
3629 | -#include "mousearea.moc" |
3630 | |
3631 | === removed file 'libunity-2d-private/src/mousearea.h' |
3632 | --- libunity-2d-private/src/mousearea.h 2011-02-15 18:18:13 +0000 |
3633 | +++ libunity-2d-private/src/mousearea.h 1970-01-01 00:00:00 +0000 |
3634 | @@ -1,60 +0,0 @@ |
3635 | -/* |
3636 | - * This file is part of unity-2d |
3637 | - * |
3638 | - * Copyright 2011 Canonical Ltd. |
3639 | - * |
3640 | - * Authors: |
3641 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
3642 | - * |
3643 | - * This program is free software; you can redistribute it and/or modify |
3644 | - * it under the terms of the GNU General Public License as published |
3645 | - * by the Free Software Foundation; version 3. |
3646 | - * |
3647 | - * This program is distributed in the hope that it will be useful, |
3648 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3649 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3650 | - * GNU General Public License for more details. |
3651 | - * |
3652 | - * You should have received a copy of the GNU General Public License |
3653 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3654 | - */ |
3655 | -#ifndef MOUSEAREA_H |
3656 | -#define MOUSEAREA_H |
3657 | - |
3658 | -// Local |
3659 | -#include <unity2dapplication.h> |
3660 | - |
3661 | -// Qt |
3662 | -#include <QObject> |
3663 | -#include <QRect> |
3664 | - |
3665 | -struct MouseAreaPrivate; |
3666 | -/** |
3667 | - * A class to help detecting when the mouse cursor enters an area. |
3668 | - * Quite similar to QML MouseArea item. |
3669 | - */ |
3670 | -class MouseArea : public QObject, protected AbstractX11EventFilter |
3671 | -{ |
3672 | -Q_OBJECT |
3673 | -public: |
3674 | - MouseArea(QObject* parent = 0); |
3675 | - ~MouseArea(); |
3676 | - |
3677 | - QRect geometry() const; |
3678 | - void setGeometry(int x, int y, int width, int height); |
3679 | - void setGeometry(const QRect&); |
3680 | - |
3681 | - bool containsMouse() const; |
3682 | - |
3683 | -Q_SIGNALS: |
3684 | - void entered(); |
3685 | - void exited(); |
3686 | - |
3687 | -protected: |
3688 | - bool x11EventFilter(XEvent*); |
3689 | - |
3690 | -private: |
3691 | - MouseAreaPrivate* const d; |
3692 | -}; |
3693 | - |
3694 | -#endif /* MOUSEAREA_H */ |
3695 | |
3696 | === added file 'libunity-2d-private/src/spreadmonitor.cpp' |
3697 | --- libunity-2d-private/src/spreadmonitor.cpp 1970-01-01 00:00:00 +0000 |
3698 | +++ libunity-2d-private/src/spreadmonitor.cpp 2012-02-09 02:13:26 +0000 |
3699 | @@ -0,0 +1,61 @@ |
3700 | +/* |
3701 | + * Copyright (C) 2011 Canonical, Ltd. |
3702 | + * |
3703 | + * Authors: |
3704 | + * Ugo Riboni <ugo.riboni@canonical.com> |
3705 | + * |
3706 | + * This program is free software; you can redistribute it and/or modify |
3707 | + * it under the terms of the GNU General Public License as published by |
3708 | + * the Free Software Foundation; version 3. |
3709 | + * |
3710 | + * This program is distributed in the hope that it will be useful, |
3711 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3712 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3713 | + * GNU General Public License for more details. |
3714 | + * |
3715 | + * You should have received a copy of the GNU General Public License |
3716 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3717 | + */ |
3718 | + |
3719 | +// local |
3720 | +#include "abstractdbusservicemonitor.h" |
3721 | +#include "spreadmonitor.h" |
3722 | + |
3723 | +// QT |
3724 | +#include <QDBusConnection> |
3725 | +#include <QDBusConnectionInterface> |
3726 | +#include <QDBusReply> |
3727 | + |
3728 | +SpreadMonitor::SpreadMonitor(QObject *parent) |
3729 | + : AbstractDBusServiceMonitor("com.canonical.Unity2d.Spread", "/Spread", |
3730 | + "com.canonical.Unity2d.Spread", parent) |
3731 | +{ |
3732 | + connect(this, SIGNAL(serviceAvailableChanged(bool)), SLOT(onServiceAvailableChanged(bool))); |
3733 | + |
3734 | + if (serviceAvailable()) { |
3735 | + onServiceAvailableChanged(true); |
3736 | + } |
3737 | +} |
3738 | + |
3739 | +void SpreadMonitor::onServiceAvailableChanged(bool available) |
3740 | +{ |
3741 | + if (available) { |
3742 | + connect(dbusInterface(), SIGNAL(IsShownChanged(bool)), SIGNAL(shownChanged(bool))); |
3743 | + |
3744 | + Q_EMIT shownChanged(shown()); |
3745 | + } else { |
3746 | + Q_EMIT shownChanged(false); |
3747 | + } |
3748 | +} |
3749 | + |
3750 | +bool SpreadMonitor::shown() const |
3751 | +{ |
3752 | + if (dbusInterface() == 0) { |
3753 | + return false; |
3754 | + } else { |
3755 | + QDBusReply<bool> result = dbusInterface()->call("IsShown"); |
3756 | + return result.isValid() && result.value() == true; |
3757 | + } |
3758 | +} |
3759 | + |
3760 | +#include "spreadmonitor.moc" |
3761 | |
3762 | === added file 'libunity-2d-private/src/spreadmonitor.h' |
3763 | --- libunity-2d-private/src/spreadmonitor.h 1970-01-01 00:00:00 +0000 |
3764 | +++ libunity-2d-private/src/spreadmonitor.h 2012-02-09 02:13:26 +0000 |
3765 | @@ -0,0 +1,48 @@ |
3766 | +/* |
3767 | + * Copyright (C) 2011 Canonical, Ltd. |
3768 | + * |
3769 | + * Authors: |
3770 | + * Ugo Riboni <ugo.riboni@canonical.com> |
3771 | + * |
3772 | + * This program is free software; you can redistribute it and/or modify |
3773 | + * it under the terms of the GNU General Public License as published by |
3774 | + * the Free Software Foundation; version 3. |
3775 | + * |
3776 | + * This program is distributed in the hope that it will be useful, |
3777 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3778 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3779 | + * GNU General Public License for more details. |
3780 | + * |
3781 | + * You should have received a copy of the GNU General Public License |
3782 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3783 | + */ |
3784 | + |
3785 | +#ifndef SPREADMONITOR_H |
3786 | +#define SPREADMONITOR_H |
3787 | + |
3788 | +// QT |
3789 | +#include <QObject> |
3790 | +#include <QMetaType> |
3791 | + |
3792 | +// local |
3793 | +#include "abstractdbusservicemonitor.h" |
3794 | + |
3795 | +class SpreadMonitor : public AbstractDBusServiceMonitor |
3796 | +{ |
3797 | + Q_OBJECT |
3798 | + Q_PROPERTY(bool shown READ shown NOTIFY shownChanged) |
3799 | + |
3800 | +public: |
3801 | + explicit SpreadMonitor(QObject *parent = 0); |
3802 | + bool shown() const; |
3803 | + |
3804 | +protected Q_SLOTS: |
3805 | + void onServiceAvailableChanged(bool available); |
3806 | + |
3807 | +Q_SIGNALS: |
3808 | + void shownChanged(bool visible); |
3809 | +}; |
3810 | + |
3811 | +Q_DECLARE_METATYPE(SpreadMonitor*) |
3812 | + |
3813 | +#endif // SPREADMONITOR_H |
3814 | |
3815 | === added file 'libunity-2d-private/src/strutmanager.cpp' |
3816 | --- libunity-2d-private/src/strutmanager.cpp 1970-01-01 00:00:00 +0000 |
3817 | +++ libunity-2d-private/src/strutmanager.cpp 2012-02-09 02:13:26 +0000 |
3818 | @@ -0,0 +1,191 @@ |
3819 | +/* |
3820 | + * This file is part of unity-2d |
3821 | + * |
3822 | + * Copyright 2010, 2012 Canonical Ltd. |
3823 | + * |
3824 | + * Authors: |
3825 | + * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
3826 | + * - Albert Astals Cid <albert.astals@canonical.com> |
3827 | + * |
3828 | + * This program is free software; you can redistribute it and/or modify |
3829 | + * it under the terms of the GNU General Public License as published |
3830 | + * by the Free Software Foundation; version 3. |
3831 | + * |
3832 | + * This program is distributed in the hope that it will be useful, |
3833 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3834 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3835 | + * GNU General Public License for more details. |
3836 | + * |
3837 | + * You should have received a copy of the GNU General Public License |
3838 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
3839 | + */ |
3840 | + |
3841 | +// Self |
3842 | +#include "strutmanager.h" |
3843 | + |
3844 | +// Qt |
3845 | +#include <QApplication> |
3846 | +#include <QDesktopWidget> |
3847 | +#include <QX11Info> |
3848 | + |
3849 | +// X |
3850 | +#include <X11/Xlib.h> |
3851 | +#include <X11/Xatom.h> |
3852 | + |
3853 | +static void setStrut(ulong* struts, WId effectiveWinId) |
3854 | +{ |
3855 | + static Atom atom = XInternAtom(QX11Info::display(), "_NET_WM_STRUT_PARTIAL", False); |
3856 | + XChangeProperty(QX11Info::display(), effectiveWinId, atom, |
3857 | + XA_CARDINAL, 32, PropModeReplace, |
3858 | + (unsigned char *) struts, 12); |
3859 | +} |
3860 | + |
3861 | +StrutManager::StrutManager() |
3862 | + : m_enabled(true), |
3863 | + m_widget(NULL), |
3864 | + m_edge(Unity2dPanel::TopEdge), |
3865 | + m_width(-1), |
3866 | + m_height(-1) |
3867 | +{ |
3868 | +} |
3869 | + |
3870 | +StrutManager::~StrutManager() |
3871 | +{ |
3872 | + if (m_enabled) { |
3873 | + releaseStrut(); |
3874 | + } |
3875 | +} |
3876 | + |
3877 | +bool StrutManager::enabled() const |
3878 | +{ |
3879 | + return m_enabled; |
3880 | +} |
3881 | + |
3882 | +void StrutManager::setEnabled(bool value) |
3883 | +{ |
3884 | + if (m_enabled != value) { |
3885 | + if (value) { |
3886 | + reserveStrut(); |
3887 | + } else { |
3888 | + releaseStrut(); |
3889 | + } |
3890 | + m_enabled = value; |
3891 | + Q_EMIT enabledChanged(value); |
3892 | + } |
3893 | +} |
3894 | + |
3895 | +QObject *StrutManager::widget() const |
3896 | +{ |
3897 | + return m_widget; |
3898 | +} |
3899 | + |
3900 | +void StrutManager::setWidget(QObject *widget) |
3901 | +{ |
3902 | + m_widget = qobject_cast<QWidget*>(widget); |
3903 | + Q_ASSERT(m_widget != NULL); |
3904 | +} |
3905 | + |
3906 | +Unity2dPanel::Edge StrutManager::edge() const |
3907 | +{ |
3908 | + return m_edge; |
3909 | +} |
3910 | + |
3911 | +void StrutManager::setEdge(Unity2dPanel::Edge edge) |
3912 | +{ |
3913 | + m_edge = edge; |
3914 | + updateStrut(); |
3915 | +} |
3916 | + |
3917 | +int StrutManager::width() const |
3918 | +{ |
3919 | + return m_width; |
3920 | +} |
3921 | + |
3922 | +void StrutManager::setWidth(int width) |
3923 | +{ |
3924 | + m_width = width; |
3925 | +} |
3926 | + |
3927 | +int StrutManager::realWidth() const |
3928 | +{ |
3929 | + if (m_widget == NULL) |
3930 | + return m_width; |
3931 | + |
3932 | + if (m_width == -1) |
3933 | + return m_widget->width(); |
3934 | + |
3935 | + return m_width; |
3936 | +} |
3937 | + |
3938 | +int StrutManager::height() const |
3939 | +{ |
3940 | + return m_height; |
3941 | +} |
3942 | + |
3943 | +void StrutManager::setHeight(int height) |
3944 | +{ |
3945 | + m_height = height; |
3946 | +} |
3947 | + |
3948 | +int StrutManager::realHeight() const |
3949 | +{ |
3950 | + if (m_widget == NULL) |
3951 | + return m_height; |
3952 | + |
3953 | + if (m_height == -1) |
3954 | + return m_widget->height(); |
3955 | + |
3956 | + return m_height; |
3957 | +} |
3958 | + |
3959 | +void StrutManager::updateStrut() |
3960 | +{ |
3961 | + if (m_enabled) { |
3962 | + reserveStrut(); |
3963 | + } |
3964 | +} |
3965 | + |
3966 | + |
3967 | +void StrutManager::reserveStrut() |
3968 | +{ |
3969 | + if (m_widget == NULL) |
3970 | + return; |
3971 | + |
3972 | + QDesktopWidget* desktop = QApplication::desktop(); |
3973 | + const QRect screen = desktop->screenGeometry(m_widget); |
3974 | + const QRect available = desktop->availableGeometry(m_widget); |
3975 | + |
3976 | + ulong struts[12] = {}; |
3977 | + switch (m_edge) { |
3978 | + case Unity2dPanel::LeftEdge: |
3979 | + if (QApplication::isLeftToRight()) { |
3980 | + struts[0] = realWidth(); |
3981 | + struts[4] = available.top(); |
3982 | + struts[5] = available.y() + available.height(); |
3983 | + } else { |
3984 | + struts[1] = realWidth(); |
3985 | + struts[6] = available.top(); |
3986 | + struts[7] = available.y() + available.height(); |
3987 | + } |
3988 | + break; |
3989 | + case Unity2dPanel::TopEdge: |
3990 | + struts[2] = realHeight(); |
3991 | + struts[8] = screen.left(); |
3992 | + struts[9] = screen.x() + screen.width(); |
3993 | + break; |
3994 | + } |
3995 | + |
3996 | + setStrut(struts, m_widget->effectiveWinId()); |
3997 | +} |
3998 | + |
3999 | +void StrutManager::releaseStrut() |
4000 | +{ |
4001 | + if (m_widget == NULL) |
4002 | + return; |
4003 | + |
4004 | + ulong struts[12]; |
4005 | + memset(struts, 0, sizeof struts); |
4006 | + setStrut(struts, m_widget->effectiveWinId()); |
4007 | +} |
4008 | + |
4009 | +#include "strutmanager.moc" |
4010 | |
4011 | === added file 'libunity-2d-private/src/strutmanager.h' |
4012 | --- libunity-2d-private/src/strutmanager.h 1970-01-01 00:00:00 +0000 |
4013 | +++ libunity-2d-private/src/strutmanager.h 2012-02-09 02:13:26 +0000 |
4014 | @@ -0,0 +1,92 @@ |
4015 | +/* |
4016 | + * This file is part of unity-2d |
4017 | + * |
4018 | + * Copyright 2010, 2012 Canonical Ltd. |
4019 | + * |
4020 | + * Authors: |
4021 | + * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
4022 | + * - Albert Astals Cid <albert.astals@canonical.com> |
4023 | + * |
4024 | + * This program is free software; you can redistribute it and/or modify |
4025 | + * it under the terms of the GNU General Public License as published |
4026 | + * by the Free Software Foundation; version 3. |
4027 | + * |
4028 | + * This program is distributed in the hope that it will be useful, |
4029 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4030 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4031 | + * GNU General Public License for more details. |
4032 | + * |
4033 | + * You should have received a copy of the GNU General Public License |
4034 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4035 | + */ |
4036 | + |
4037 | +#ifndef STRUTMANAGER_H |
4038 | +#define STRUTMANAGER_H |
4039 | + |
4040 | +// Unity 2D |
4041 | +#include "unity2dpanel.h" |
4042 | + |
4043 | +class StrutManager : public QObject |
4044 | +{ |
4045 | + Q_OBJECT |
4046 | + Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) |
4047 | + Q_PROPERTY(QObject* widget READ widget WRITE setWidget) |
4048 | + Q_PROPERTY(Unity2dPanel::Edge edge READ edge WRITE setEdge) |
4049 | + Q_PROPERTY(int width READ width WRITE setWidth) |
4050 | + Q_PROPERTY(int height READ height WRITE setHeight) |
4051 | + |
4052 | +public: |
4053 | + StrutManager(); |
4054 | + ~StrutManager(); |
4055 | + |
4056 | + bool enabled() const; |
4057 | + void setEnabled(bool value); |
4058 | + |
4059 | + // QObject due to QML constraints |
4060 | + QObject *widget() const; |
4061 | + void setWidget(QObject *widget); |
4062 | + |
4063 | + Unity2dPanel::Edge edge() const; |
4064 | + void setEdge(Unity2dPanel::Edge edge); |
4065 | + |
4066 | + /** |
4067 | + * Returns the width set to the strut manager |
4068 | + * If is -1 (the default value) will use the width of the widget given in setWidget |
4069 | + */ |
4070 | + int width() const; |
4071 | + void setWidth(int width); |
4072 | + /** |
4073 | + * Returns the actual width in use by the strut manager |
4074 | + * It is either width() or m_widget->width() |
4075 | + */ |
4076 | + int realWidth() const; |
4077 | + |
4078 | + /** |
4079 | + * Returns the height set to the strut manager |
4080 | + * If is -1 (the default value) will use the height of the widget given in setWidget |
4081 | + */ |
4082 | + int height() const; |
4083 | + void setHeight(int height); |
4084 | + /** |
4085 | + * Returns the actual height in use by the strut manager |
4086 | + * It is either width() or m_widget->width() |
4087 | + */ |
4088 | + int realHeight() const; |
4089 | + |
4090 | + Q_INVOKABLE void updateStrut(); |
4091 | + |
4092 | +Q_SIGNALS: |
4093 | + void enabledChanged(bool enabled); |
4094 | + |
4095 | +private: |
4096 | + void reserveStrut(); |
4097 | + void releaseStrut(); |
4098 | + |
4099 | + bool m_enabled; |
4100 | + QWidget *m_widget; |
4101 | + Unity2dPanel::Edge m_edge; |
4102 | + int m_width; |
4103 | + int m_height; |
4104 | +}; |
4105 | + |
4106 | +#endif /* STRUTMANAGER_H */ |
4107 | \ No newline at end of file |
4108 | |
4109 | === modified file 'libunity-2d-private/src/unity2dpanel.cpp' |
4110 | --- libunity-2d-private/src/unity2dpanel.cpp 2012-02-03 18:05:42 +0000 |
4111 | +++ libunity-2d-private/src/unity2dpanel.cpp 2012-02-09 02:13:26 +0000 |
4112 | @@ -21,6 +21,7 @@ |
4113 | |
4114 | // Self |
4115 | #include "unity2dpanel.h" |
4116 | +#include "strutmanager.h" |
4117 | #include <debug_p.h> |
4118 | #include <indicatorsmanager.h> |
4119 | |
4120 | @@ -32,10 +33,6 @@ |
4121 | #include <QHBoxLayout> |
4122 | #include <QX11Info> |
4123 | |
4124 | -// X |
4125 | -#include <X11/Xlib.h> |
4126 | -#include <X11/Xatom.h> |
4127 | - |
4128 | // unity-2d |
4129 | #include "screeninfo.h" |
4130 | |
4131 | @@ -47,57 +44,11 @@ |
4132 | Unity2dPanel::Edge m_edge; |
4133 | mutable IndicatorsManager* m_indicatorsManager; |
4134 | QHBoxLayout* m_layout; |
4135 | - QPropertyAnimation* m_slideInAnimation; |
4136 | - QPropertyAnimation* m_slideOutAnimation; |
4137 | - bool m_useStrut; |
4138 | int m_delta; |
4139 | bool m_manualSliding; |
4140 | + StrutManager m_strutManager; |
4141 | ScreenInfo* m_screenInfo; |
4142 | |
4143 | - void setStrut(ulong* struts) |
4144 | - { |
4145 | - static Atom atom = XInternAtom(QX11Info::display(), "_NET_WM_STRUT_PARTIAL", False); |
4146 | - XChangeProperty(QX11Info::display(), q->effectiveWinId(), atom, |
4147 | - XA_CARDINAL, 32, PropModeReplace, |
4148 | - (unsigned char *) struts, 12); |
4149 | - } |
4150 | - |
4151 | - void reserveStrut() |
4152 | - { |
4153 | - QDesktopWidget* desktop = QApplication::desktop(); |
4154 | - const QRect screen = desktop->screenGeometry(q); |
4155 | - const QRect available = desktop->availableGeometry(q); |
4156 | - |
4157 | - ulong struts[12] = {}; |
4158 | - switch (m_edge) { |
4159 | - case Unity2dPanel::LeftEdge: |
4160 | - if (QApplication::isLeftToRight()) { |
4161 | - struts[0] = q->width(); |
4162 | - struts[4] = available.top(); |
4163 | - struts[5] = available.y() + available.height(); |
4164 | - } else { |
4165 | - struts[1] = q->width(); |
4166 | - struts[6] = available.top(); |
4167 | - struts[7] = available.y() + available.height(); |
4168 | - } |
4169 | - break; |
4170 | - case Unity2dPanel::TopEdge: |
4171 | - struts[2] = q->height(); |
4172 | - struts[8] = screen.left(); |
4173 | - struts[9] = screen.x() + screen.width(); |
4174 | - break; |
4175 | - } |
4176 | - |
4177 | - setStrut(struts); |
4178 | - } |
4179 | - |
4180 | - void releaseStrut() |
4181 | - { |
4182 | - ulong struts[12]; |
4183 | - memset(struts, 0, sizeof struts); |
4184 | - setStrut(struts); |
4185 | - } |
4186 | - |
4187 | void updateGeometry() |
4188 | { |
4189 | const QRect screen = m_screenInfo->geometry(); |
4190 | @@ -139,9 +90,7 @@ |
4191 | |
4192 | void updateEdge() |
4193 | { |
4194 | - if (m_useStrut) { |
4195 | - reserveStrut(); |
4196 | - } |
4197 | + m_strutManager.updateStrut(); |
4198 | updateGeometry(); |
4199 | updateLayoutDirection(); |
4200 | } |
4201 | @@ -151,10 +100,11 @@ |
4202 | : QWidget(parent) |
4203 | , d(new Unity2dPanelPrivate) |
4204 | { |
4205 | + d->m_strutManager.setWidget(this); |
4206 | + d->m_strutManager.setEdge(Unity2dPanel::TopEdge); |
4207 | d->q = this; |
4208 | d->m_edge = Unity2dPanel::TopEdge; |
4209 | d->m_indicatorsManager = 0; |
4210 | - d->m_useStrut = true; |
4211 | d->m_delta = 0; |
4212 | d->m_manualSliding = false; |
4213 | d->m_layout = new QHBoxLayout(this); |
4214 | @@ -168,18 +118,6 @@ |
4215 | d->m_screenInfo = new ScreenInfo(this, this); |
4216 | } |
4217 | |
4218 | - d->m_slideInAnimation = new QPropertyAnimation(this); |
4219 | - d->m_slideInAnimation->setTargetObject(this); |
4220 | - d->m_slideInAnimation->setPropertyName("delta"); |
4221 | - d->m_slideInAnimation->setDuration(SLIDE_DURATION); |
4222 | - d->m_slideInAnimation->setEndValue(0); |
4223 | - |
4224 | - d->m_slideOutAnimation = new QPropertyAnimation(this); |
4225 | - d->m_slideOutAnimation->setTargetObject(this); |
4226 | - d->m_slideOutAnimation->setPropertyName("delta"); |
4227 | - d->m_slideOutAnimation->setDuration(SLIDE_DURATION); |
4228 | - d->m_slideOutAnimation->setEndValue(-panelSize()); |
4229 | - |
4230 | setAttribute(Qt::WA_X11NetWmWindowTypeDock); |
4231 | setAttribute(Qt::WA_Hover); |
4232 | |
4233 | @@ -190,19 +128,18 @@ |
4234 | } |
4235 | |
4236 | connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), SLOT(slotWorkAreaResized(int))); |
4237 | + connect(&d->m_strutManager, SIGNAL(enabledChanged(bool)), SIGNAL(useStrutChanged(bool))); |
4238 | } |
4239 | |
4240 | Unity2dPanel::~Unity2dPanel() |
4241 | { |
4242 | - if (d->m_useStrut) { |
4243 | - d->releaseStrut(); |
4244 | - } |
4245 | delete d; |
4246 | } |
4247 | |
4248 | void Unity2dPanel::setEdge(Unity2dPanel::Edge edge) |
4249 | { |
4250 | d->m_edge = edge; |
4251 | + d->m_strutManager.setEdge(edge); |
4252 | if (isVisible()) { |
4253 | d->updateEdge(); |
4254 | } |
4255 | @@ -237,13 +174,6 @@ |
4256 | { |
4257 | QWidget::showEvent(event); |
4258 | d->updateEdge(); |
4259 | - d->m_slideOutAnimation->setEndValue(-panelSize()); |
4260 | -} |
4261 | - |
4262 | -void Unity2dPanel::resizeEvent(QResizeEvent* event) |
4263 | -{ |
4264 | - QWidget::resizeEvent(event); |
4265 | - d->m_slideOutAnimation->setEndValue(-panelSize()); |
4266 | } |
4267 | |
4268 | void Unity2dPanel::slotWorkAreaResized(int screen) |
4269 | @@ -273,20 +203,12 @@ |
4270 | |
4271 | bool Unity2dPanel::useStrut() const |
4272 | { |
4273 | - return d->m_useStrut; |
4274 | + return d->m_strutManager.enabled(); |
4275 | } |
4276 | |
4277 | void Unity2dPanel::setUseStrut(bool value) |
4278 | { |
4279 | - if (d->m_useStrut != value) { |
4280 | - if (value) { |
4281 | - d->reserveStrut(); |
4282 | - } else { |
4283 | - d->releaseStrut(); |
4284 | - } |
4285 | - d->m_useStrut = value; |
4286 | - Q_EMIT useStrutChanged(value); |
4287 | - } |
4288 | + d->m_strutManager.setEnabled(value); |
4289 | } |
4290 | |
4291 | int Unity2dPanel::delta() const |
4292 | @@ -309,24 +231,6 @@ |
4293 | return (d->m_edge == Unity2dPanel::TopEdge) ? height() : width(); |
4294 | } |
4295 | |
4296 | -void Unity2dPanel::slideIn() |
4297 | -{ |
4298 | - d->m_slideOutAnimation->stop(); |
4299 | - if (d->m_slideInAnimation->state() != QAbstractAnimation::Running) { |
4300 | - d->m_slideInAnimation->setStartValue(d->m_delta); |
4301 | - d->m_slideInAnimation->start(); |
4302 | - } |
4303 | -} |
4304 | - |
4305 | -void Unity2dPanel::slideOut() |
4306 | -{ |
4307 | - d->m_slideInAnimation->stop(); |
4308 | - if (d->m_slideOutAnimation->state() != QAbstractAnimation::Running) { |
4309 | - d->m_slideOutAnimation->setStartValue(d->m_delta); |
4310 | - d->m_slideOutAnimation->start(); |
4311 | - } |
4312 | -} |
4313 | - |
4314 | bool Unity2dPanel::manualSliding() const |
4315 | { |
4316 | return d->m_manualSliding; |
4317 | @@ -336,10 +240,6 @@ |
4318 | { |
4319 | if (d->m_manualSliding != manualSliding) { |
4320 | d->m_manualSliding = manualSliding; |
4321 | - if (manualSliding) { |
4322 | - d->m_slideInAnimation->stop(); |
4323 | - d->m_slideOutAnimation->stop(); |
4324 | - } |
4325 | Q_EMIT manualSlidingChanged(d->m_manualSliding); |
4326 | } |
4327 | } |
4328 | |
4329 | === modified file 'libunity-2d-private/src/unity2dpanel.h' |
4330 | --- libunity-2d-private/src/unity2dpanel.h 2012-02-01 16:00:48 +0000 |
4331 | +++ libunity-2d-private/src/unity2dpanel.h 2012-02-09 02:13:26 +0000 |
4332 | @@ -47,6 +47,7 @@ |
4333 | */ |
4334 | Q_PROPERTY(int manualSliding READ manualSliding WRITE setManualSliding NOTIFY manualSlidingChanged) |
4335 | Q_PROPERTY(bool useStrut READ useStrut WRITE setUseStrut NOTIFY useStrutChanged) |
4336 | + Q_ENUMS(Edge) |
4337 | |
4338 | public: |
4339 | enum Edge { |
4340 | @@ -89,17 +90,12 @@ |
4341 | |
4342 | QString id() const; |
4343 | |
4344 | -public Q_SLOTS: |
4345 | - void slideIn(); |
4346 | - void slideOut(); |
4347 | - |
4348 | Q_SIGNALS: |
4349 | void manualSlidingChanged(bool); |
4350 | void useStrutChanged(bool); |
4351 | |
4352 | protected: |
4353 | virtual void showEvent(QShowEvent*); |
4354 | - virtual void resizeEvent(QResizeEvent*); |
4355 | virtual void paintEvent(QPaintEvent*); |
4356 | |
4357 | private Q_SLOTS: |
4358 | |
4359 | === added file 'libunity-2d-private/src/windowsintersectmonitor.cpp' |
4360 | --- libunity-2d-private/src/windowsintersectmonitor.cpp 1970-01-01 00:00:00 +0000 |
4361 | +++ libunity-2d-private/src/windowsintersectmonitor.cpp 2012-02-09 02:13:26 +0000 |
4362 | @@ -0,0 +1,183 @@ |
4363 | +/* |
4364 | + * This file is part of unity-2d |
4365 | + * |
4366 | + * Copyright 2011 Canonical Ltd. |
4367 | + * |
4368 | + * Authors: |
4369 | + * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
4370 | + * - Florian Boucault <florian.boucault@canonical.com> |
4371 | + * - Ugo Riboni <ugo.riboni@canonical.com> |
4372 | + * |
4373 | + * License: GPL v3 |
4374 | + */ |
4375 | + |
4376 | +// Self |
4377 | +#include "windowsintersectmonitor.h" |
4378 | + |
4379 | +// libunity-2d |
4380 | +#include <debug_p.h> |
4381 | + |
4382 | +// Qt |
4383 | +#include <QCursor> |
4384 | +#include <QEvent> |
4385 | +#include <QTimer> |
4386 | +#include <QWidget> |
4387 | +#include <QDesktopWidget> |
4388 | + |
4389 | +// libwnck |
4390 | +extern "C" { |
4391 | +#include <libwnck/libwnck.h> |
4392 | +} |
4393 | + |
4394 | +// Handy macros to declare GObject callbacks. The 'n' in CALLBACKn refers to |
4395 | +// the number of dummy arguments the callback returns |
4396 | +#define GOBJECT_CALLBACK0(callbackName, slot) \ |
4397 | +static void \ |
4398 | +callbackName(GObject* src, QObject* dst) \ |
4399 | +{ \ |
4400 | + QMetaObject::invokeMethod(dst, slot); \ |
4401 | +} |
4402 | + |
4403 | +#define GOBJECT_CALLBACK1(callbackName, slot) \ |
4404 | +static void \ |
4405 | +callbackName(GObject* src, void* dummy1, QObject* dst) \ |
4406 | +{ \ |
4407 | + QMetaObject::invokeMethod(dst, slot); \ |
4408 | +} |
4409 | + |
4410 | +#define GOBJECT_CALLBACK2(callbackName, slot) \ |
4411 | +static void \ |
4412 | +callbackName(GObject* src, void* dummy1, void* dummy2, QObject* dst) \ |
4413 | +{ \ |
4414 | + QMetaObject::invokeMethod(dst, slot); \ |
4415 | +} |
4416 | + |
4417 | +// Screen callbacks |
4418 | +GOBJECT_CALLBACK1(activeWindowChangedCB, "updateActiveWindowConnections"); |
4419 | +GOBJECT_CALLBACK1(activeWorkspaceChangedCB, "updateIntersect"); |
4420 | +GOBJECT_CALLBACK0(showingDesktopChangedCB, "updateIntersect"); |
4421 | + |
4422 | +// Window callbacks |
4423 | +GOBJECT_CALLBACK2(stateChangedCB, "updateIntersect"); |
4424 | +GOBJECT_CALLBACK0(geometryChangedCB, "updateIntersect"); |
4425 | +GOBJECT_CALLBACK0(workspaceChangedCB, "updateIntersect"); |
4426 | + |
4427 | +WindowsIntersectMonitor::WindowsIntersectMonitor() |
4428 | + : QObject() |
4429 | + , m_activeWindow(0) |
4430 | +{ |
4431 | + WnckScreen* screen = wnck_screen_get_default(); |
4432 | + g_signal_connect(G_OBJECT(screen), "active-window-changed", G_CALLBACK(activeWindowChangedCB), this); |
4433 | + g_signal_connect(G_OBJECT(screen), "active-workspace-changed", G_CALLBACK(activeWorkspaceChangedCB), this); |
4434 | + g_signal_connect(G_OBJECT(screen), "showing-desktop-changed", G_CALLBACK(showingDesktopChangedCB), this); |
4435 | + |
4436 | + updateActiveWindowConnections(); |
4437 | +} |
4438 | + |
4439 | +WindowsIntersectMonitor::~WindowsIntersectMonitor() |
4440 | +{ |
4441 | + disconnectFromGSignals(); |
4442 | + WnckScreen* screen = wnck_screen_get_default(); |
4443 | + g_signal_handlers_disconnect_by_func(G_OBJECT(screen), gpointer(activeWindowChangedCB), this); |
4444 | + g_signal_handlers_disconnect_by_func(G_OBJECT(screen), gpointer(activeWorkspaceChangedCB), this); |
4445 | + g_signal_handlers_disconnect_by_func(G_OBJECT(screen), gpointer(showingDesktopChangedCB), this); |
4446 | +} |
4447 | + |
4448 | +void WindowsIntersectMonitor::disconnectFromGSignals() |
4449 | +{ |
4450 | + if (m_activeWindow) { |
4451 | + g_signal_handlers_disconnect_by_func(m_activeWindow, gpointer(stateChangedCB), this); |
4452 | + g_signal_handlers_disconnect_by_func(m_activeWindow, gpointer(geometryChangedCB), this); |
4453 | + g_signal_handlers_disconnect_by_func(m_activeWindow, gpointer(workspaceChangedCB), this); |
4454 | + } |
4455 | +} |
4456 | + |
4457 | +void WindowsIntersectMonitor::updateActiveWindowConnections() |
4458 | +{ |
4459 | + WnckScreen* screen = wnck_screen_get_default(); |
4460 | + |
4461 | + disconnectFromGSignals(); |
4462 | + m_activeWindow = 0; |
4463 | + |
4464 | + WnckWindow* window = wnck_screen_get_active_window(screen); |
4465 | + if (window) { |
4466 | + m_activeWindow = window; |
4467 | + g_signal_connect(G_OBJECT(window), "state-changed", G_CALLBACK(stateChangedCB), this); |
4468 | + g_signal_connect(G_OBJECT(window), "geometry-changed", G_CALLBACK(geometryChangedCB), this); |
4469 | + g_signal_connect(G_OBJECT(window), "workspace-changed", G_CALLBACK(workspaceChangedCB), this); |
4470 | + } |
4471 | + |
4472 | + updateIntersect(); |
4473 | +} |
4474 | + |
4475 | +void WindowsIntersectMonitor::updateIntersect() |
4476 | +{ |
4477 | + int thisProcessPid = getpid(); |
4478 | + |
4479 | + WnckScreen* screen = wnck_screen_get_default(); |
4480 | + WnckWorkspace* workspace = wnck_screen_get_active_workspace(screen); |
4481 | + |
4482 | + // Check whether a window is crossing our rect |
4483 | + bool crossWindow = false; |
4484 | + if (!wnck_screen_get_showing_desktop(screen)) { |
4485 | + GList* list = wnck_screen_get_windows(screen); |
4486 | + for (; list; list = g_list_next(list)) { |
4487 | + WnckWindow* window = WNCK_WINDOW(list->data); |
4488 | + if (wnck_window_is_on_workspace(window, workspace) && |
4489 | + wnck_window_get_pid(window) != thisProcessPid) { |
4490 | + WnckWindowType type = wnck_window_get_window_type(window); |
4491 | + |
4492 | + // Only take into account typical application windows |
4493 | + if (type != WNCK_WINDOW_NORMAL && |
4494 | + type != WNCK_WINDOW_DIALOG && |
4495 | + type != WNCK_WINDOW_TOOLBAR && |
4496 | + type != WNCK_WINDOW_MENU && |
4497 | + type != WNCK_WINDOW_UTILITY) { |
4498 | + continue; |
4499 | + } |
4500 | + |
4501 | + WnckWindowState state = wnck_window_get_state(window); |
4502 | + |
4503 | + // Skip hidden (==minimized and other states) windows |
4504 | + if (state & WNCK_WINDOW_STATE_HIDDEN) { |
4505 | + continue; |
4506 | + } |
4507 | + |
4508 | + // Check the window rect |
4509 | + int x, y, width, height; |
4510 | + wnck_window_get_geometry(window, &x, &y, &width, &height); |
4511 | + QRectF rect(x, y, width, height); |
4512 | + if (rect.intersects(m_monitoredArea)) { |
4513 | + crossWindow = true; |
4514 | + break; |
4515 | + } |
4516 | + } |
4517 | + } |
4518 | + } |
4519 | + |
4520 | + if (crossWindow != m_intersects) { |
4521 | + m_intersects = crossWindow; |
4522 | + Q_EMIT intersectsChanged(); |
4523 | + } |
4524 | +} |
4525 | + |
4526 | +QRectF WindowsIntersectMonitor::monitoredArea() const |
4527 | +{ |
4528 | + return m_monitoredArea; |
4529 | +} |
4530 | + |
4531 | +void WindowsIntersectMonitor::setMonitoredArea(const QRectF& monitoredArea) |
4532 | +{ |
4533 | + if (m_monitoredArea != monitoredArea) { |
4534 | + m_monitoredArea = monitoredArea; |
4535 | + Q_EMIT monitoredAreaChanged(); |
4536 | + updateIntersect(); |
4537 | + } |
4538 | +} |
4539 | + |
4540 | +bool WindowsIntersectMonitor::intersects() const |
4541 | +{ |
4542 | + return m_intersects; |
4543 | +} |
4544 | + |
4545 | +#include "windowsintersectmonitor.moc" |
4546 | |
4547 | === added file 'libunity-2d-private/src/windowsintersectmonitor.h' |
4548 | --- libunity-2d-private/src/windowsintersectmonitor.h 1970-01-01 00:00:00 +0000 |
4549 | +++ libunity-2d-private/src/windowsintersectmonitor.h 2012-02-09 02:13:26 +0000 |
4550 | @@ -0,0 +1,55 @@ |
4551 | +/* |
4552 | + * This file is part of unity-2d |
4553 | + * |
4554 | + * Copyright 2011 Canonical Ltd. |
4555 | + * |
4556 | + * Authors: |
4557 | + * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
4558 | + * - Florian Boucault <florian.boucault@canonical.com> |
4559 | + * - Ugo Riboni <ugo.riboni@canonical.com> |
4560 | + * |
4561 | + * License: GPL v3 |
4562 | + */ |
4563 | +#ifndef WINDOWSINTERSECTMONITOR_H |
4564 | +#define WINDOWSINTERSECTMONITOR_H |
4565 | + |
4566 | +// Qt |
4567 | +#include <QObject> |
4568 | +#include <QRectF> |
4569 | + |
4570 | +struct _WnckWindow; |
4571 | + |
4572 | +class WindowsIntersectMonitor : public QObject |
4573 | +{ |
4574 | + Q_OBJECT |
4575 | + |
4576 | + Q_PROPERTY(QRectF monitoredArea READ monitoredArea WRITE setMonitoredArea |
4577 | + NOTIFY monitoredAreaChanged) |
4578 | + Q_PROPERTY(bool intersects READ intersects NOTIFY intersectsChanged) |
4579 | + |
4580 | +public: |
4581 | + WindowsIntersectMonitor(); |
4582 | + ~WindowsIntersectMonitor(); |
4583 | + |
4584 | + QRectF monitoredArea() const; |
4585 | + void setMonitoredArea(const QRectF& monitoredArea); |
4586 | + bool intersects() const; |
4587 | + |
4588 | +Q_SIGNALS: |
4589 | + void monitoredAreaChanged(); |
4590 | + void intersectsChanged(); |
4591 | + |
4592 | +private Q_SLOTS: |
4593 | + void updateIntersect(); |
4594 | + void updateActiveWindowConnections(); |
4595 | + |
4596 | +private: |
4597 | + Q_DISABLE_COPY(WindowsIntersectMonitor); |
4598 | + void disconnectFromGSignals(); |
4599 | + |
4600 | + struct _WnckWindow* m_activeWindow; |
4601 | + QRectF m_monitoredArea; |
4602 | + bool m_intersects; |
4603 | +}; |
4604 | + |
4605 | +#endif /* WINDOWSINTERSECTMONITOR_H */ |
4606 | |
4607 | === modified file 'libunity-2d-private/tests/CMakeLists.txt' |
4608 | --- libunity-2d-private/tests/CMakeLists.txt 2011-12-07 12:46:10 +0000 |
4609 | +++ libunity-2d-private/tests/CMakeLists.txt 2012-02-09 02:13:26 +0000 |
4610 | @@ -83,10 +83,3 @@ |
4611 | # COMMAND /bin/sh gnomesessionclienttest.sh |
4612 | # ) |
4613 | |
4614 | -# mouseareademo |
4615 | -add_executable(mouseareademo |
4616 | - mouseareademo.cpp |
4617 | - ) |
4618 | -target_link_libraries(mouseareademo |
4619 | - unity-2d-private |
4620 | - ) |
4621 | |
4622 | === removed file 'libunity-2d-private/tests/mouseareademo.cpp' |
4623 | --- libunity-2d-private/tests/mouseareademo.cpp 2011-07-18 14:36:34 +0000 |
4624 | +++ libunity-2d-private/tests/mouseareademo.cpp 1970-01-01 00:00:00 +0000 |
4625 | @@ -1,48 +0,0 @@ |
4626 | -/* |
4627 | - * This file is part of unity-2d |
4628 | - * |
4629 | - * Copyright 2011 Canonical Ltd. |
4630 | - * |
4631 | - * Authors: |
4632 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
4633 | - * |
4634 | - * This program is free software; you can redistribute it and/or modify |
4635 | - * it under the terms of the GNU General Public License as published |
4636 | - * by the Free Software Foundation; version 3. |
4637 | - * |
4638 | - * This program is distributed in the hope that it will be useful, |
4639 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4640 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4641 | - * GNU General Public License for more details. |
4642 | - * |
4643 | - * You should have received a copy of the GNU General Public License |
4644 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4645 | - */ |
4646 | - |
4647 | -// Local |
4648 | -#include <mousearea.h> |
4649 | -#include <unity2dapplication.h> |
4650 | - |
4651 | -// Qt |
4652 | -#include <QLabel> |
4653 | -#include <QVBoxLayout> |
4654 | - |
4655 | -int main(int argc, char** argv) |
4656 | -{ |
4657 | - Unity2dApplication::earlySetup(argc, argv); |
4658 | - Unity2dApplication app(argc, argv); |
4659 | - QWidget window; |
4660 | - QLabel* enteredLabel = new QLabel("Entered"); |
4661 | - QVBoxLayout* layout = new QVBoxLayout(&window); |
4662 | - layout->addWidget(enteredLabel); |
4663 | - |
4664 | - MouseArea* area = new MouseArea(&window); |
4665 | - area->setGeometry(QRect(10, 10, 200, 100)); |
4666 | - QObject::connect(area, SIGNAL(entered()), enteredLabel, SLOT(show())); |
4667 | - QObject::connect(area, SIGNAL(exited()), enteredLabel, SLOT(hide())); |
4668 | - |
4669 | - enteredLabel->setVisible(area->containsMouse()); |
4670 | - |
4671 | - window.show(); |
4672 | - return app.exec(); |
4673 | -} |
4674 | |
4675 | === modified file 'panel/applets/CMakeLists.txt' |
4676 | --- panel/applets/CMakeLists.txt 2011-08-29 00:47:24 +0000 |
4677 | +++ panel/applets/CMakeLists.txt 2012-02-09 02:13:26 +0000 |
4678 | @@ -1,5 +1,4 @@ |
4679 | add_subdirectory(separator) |
4680 | -add_subdirectory(homebutton) |
4681 | add_subdirectory(appname) |
4682 | add_subdirectory(legacytray) |
4683 | add_subdirectory(indicator) |
4684 | |
4685 | === removed directory 'panel/applets/homebutton' |
4686 | === removed file 'panel/applets/homebutton/CMakeLists.txt' |
4687 | --- panel/applets/homebutton/CMakeLists.txt 2011-11-09 21:28:49 +0000 |
4688 | +++ panel/applets/homebutton/CMakeLists.txt 1970-01-01 00:00:00 +0000 |
4689 | @@ -1,33 +0,0 @@ |
4690 | -project(panelplugin-homebutton) |
4691 | - |
4692 | -# Sources |
4693 | -set(homebutton_SRCS |
4694 | - homebuttonapplet.cpp |
4695 | - homebutton.cpp |
4696 | - plugin.cpp |
4697 | - ) |
4698 | - |
4699 | -# Build |
4700 | -include_directories( |
4701 | - ${CMAKE_CURRENT_SOURCE_DIR} |
4702 | - ${CMAKE_CURRENT_BINARY_DIR} |
4703 | - ${libunity-2d-private_SOURCE_DIR}/src |
4704 | - ) |
4705 | - |
4706 | -qt4_automoc(${homebutton_SRCS}) |
4707 | -add_library(panelplugin-homebutton SHARED ${homebutton_SRCS}) |
4708 | -set_target_properties(panelplugin-homebutton PROPERTIES |
4709 | - LIBRARY_OUTPUT_DIRECTORY ".." |
4710 | - VERSION 0 |
4711 | - SOVERSION 0.0 |
4712 | - ) |
4713 | - |
4714 | -target_link_libraries(panelplugin-homebutton |
4715 | - ${QT_QTGUI_LIBRARIES} |
4716 | - ${QT_QTCORE_LIBRARIES} |
4717 | - unity-2d-private |
4718 | - ) |
4719 | - |
4720 | -install(TARGETS panelplugin-homebutton |
4721 | - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/unity-2d/plugins/panel |
4722 | - ) |
4723 | |
4724 | === removed file 'panel/applets/homebutton/homebutton.cpp' |
4725 | --- panel/applets/homebutton/homebutton.cpp 2011-08-22 10:47:51 +0000 |
4726 | +++ panel/applets/homebutton/homebutton.cpp 1970-01-01 00:00:00 +0000 |
4727 | @@ -1,63 +0,0 @@ |
4728 | -/* |
4729 | - * This file is part of unity-2d |
4730 | - * |
4731 | - * Copyright 2011 Canonical Ltd. |
4732 | - * |
4733 | - * Authors: |
4734 | - * - Alberto Mardegan <mardy@users.sourceforge.net> |
4735 | - * |
4736 | - * This program is free software; you can redistribute it and/or modify |
4737 | - * it under the terms of the GNU General Public License as published by |
4738 | - * the Free Software Foundation; version 3. |
4739 | - * |
4740 | - * This program is distributed in the hope that it will be useful, |
4741 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4742 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4743 | - * GNU General Public License for more details. |
4744 | - * |
4745 | - * You should have received a copy of the GNU General Public License |
4746 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4747 | - */ |
4748 | - |
4749 | -// Self |
4750 | -#include "homebutton.h" |
4751 | - |
4752 | -// Local |
4753 | -#include <debug_p.h> |
4754 | - |
4755 | -// Qt |
4756 | -#include <QApplication> |
4757 | - |
4758 | -HomeButton::HomeButton(QWidget *parent) |
4759 | -: QToolButton(parent) |
4760 | -{ |
4761 | - setAutoRaise(true); |
4762 | - setIconSize(QSize(24, 24)); |
4763 | - QString themeIconName = QIcon::hasThemeIcon("start-here") ? "start-here" : "distributor-logo"; |
4764 | - setIcon(QIcon::fromTheme(themeIconName)); |
4765 | - setCheckable(true); |
4766 | - |
4767 | - setStyleSheet( |
4768 | - "QToolButton { border: none; margin: 0; padding: 0; width: 61 }" |
4769 | - "QToolButton:checked, QToolButton:pressed {" |
4770 | - " padding-top: 1px;" |
4771 | - " padding-left: 1px;" |
4772 | - " padding-right: -1px;" |
4773 | - " padding-bottom: -1px;" |
4774 | - "}" |
4775 | - ); |
4776 | -} |
4777 | - |
4778 | -void HomeButton::mousePressEvent(QMouseEvent *event) |
4779 | -{ |
4780 | - if (lastClickTime.isValid() && |
4781 | - lastClickTime.elapsed() < QApplication::doubleClickInterval()) { |
4782 | - /* ignore this click */ |
4783 | - return; |
4784 | - } |
4785 | - |
4786 | - QToolButton::mousePressEvent(event); |
4787 | - lastClickTime.restart(); |
4788 | -} |
4789 | - |
4790 | -#include "homebutton.moc" |
4791 | |
4792 | === removed file 'panel/applets/homebutton/homebutton.h' |
4793 | --- panel/applets/homebutton/homebutton.h 2011-08-22 09:17:03 +0000 |
4794 | +++ panel/applets/homebutton/homebutton.h 1970-01-01 00:00:00 +0000 |
4795 | @@ -1,43 +0,0 @@ |
4796 | -/* |
4797 | - * This file is part of unity-2d |
4798 | - * |
4799 | - * Copyright 2011 Canonical Ltd. |
4800 | - * |
4801 | - * Authors: |
4802 | - * - Alberto Mardegan <mardy@users.sourceforge.net> |
4803 | - * |
4804 | - * This program is free software; you can redistribute it and/or modify |
4805 | - * it under the terms of the GNU General Public License as published by |
4806 | - * the Free Software Foundation; version 3. |
4807 | - * |
4808 | - * This program is distributed in the hope that it will be useful, |
4809 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4810 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4811 | - * GNU General Public License for more details. |
4812 | - * |
4813 | - * You should have received a copy of the GNU General Public License |
4814 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4815 | - */ |
4816 | - |
4817 | -#ifndef HOMEBUTTON_H |
4818 | -#define HOMEBUTTON_H |
4819 | - |
4820 | -// Qt |
4821 | -#include <QTime> |
4822 | -#include <QToolButton> |
4823 | - |
4824 | -class HomeButton : public QToolButton |
4825 | -{ |
4826 | -Q_OBJECT |
4827 | -public: |
4828 | - HomeButton(QWidget *parent = 0); |
4829 | - |
4830 | -protected: |
4831 | - void mousePressEvent(QMouseEvent*); |
4832 | - |
4833 | -private: |
4834 | - Q_DISABLE_COPY(HomeButton) |
4835 | - QTime lastClickTime; |
4836 | -}; |
4837 | - |
4838 | -#endif /* HOMEBUTTON_H */ |
4839 | |
4840 | === removed file 'panel/applets/homebutton/homebuttonapplet.cpp' |
4841 | --- panel/applets/homebutton/homebuttonapplet.cpp 2011-08-22 09:17:03 +0000 |
4842 | +++ panel/applets/homebutton/homebuttonapplet.cpp 1970-01-01 00:00:00 +0000 |
4843 | @@ -1,112 +0,0 @@ |
4844 | -/* |
4845 | - * This file is part of unity-2d |
4846 | - * |
4847 | - * Copyright 2010 Canonical Ltd. |
4848 | - * |
4849 | - * Authors: |
4850 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
4851 | - * |
4852 | - * This program is free software; you can redistribute it and/or modify |
4853 | - * it under the terms of the GNU General Public License as published by |
4854 | - * the Free Software Foundation; version 3. |
4855 | - * |
4856 | - * This program is distributed in the hope that it will be useful, |
4857 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4858 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4859 | - * GNU General Public License for more details. |
4860 | - * |
4861 | - * You should have received a copy of the GNU General Public License |
4862 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4863 | - */ |
4864 | - |
4865 | -// Self |
4866 | -#include "homebuttonapplet.h" |
4867 | - |
4868 | -// Local |
4869 | -#include <debug_p.h> |
4870 | - |
4871 | -// libunity-2d |
4872 | -#include <launcherclient.h> |
4873 | - |
4874 | -// Qt |
4875 | -#include <QHBoxLayout> |
4876 | -#include <QDBusInterface> |
4877 | -#include <QDBusServiceWatcher> |
4878 | -#include <QDBusConnectionInterface> |
4879 | - |
4880 | -static const char* DBUS_SERVICE = "com.canonical.Unity2d.Dash"; |
4881 | -static const char* DBUS_PATH = "/Dash"; |
4882 | -static const char* DBUS_IFACE = "com.canonical.Unity2d.Dash"; |
4883 | - |
4884 | -HomeButtonApplet::HomeButtonApplet(Unity2dPanel* panel) |
4885 | -: Unity2d::PanelApplet(panel) |
4886 | -, m_button(new HomeButton) |
4887 | -, m_dashInterface(NULL) |
4888 | -, m_launcherClient(new LauncherClient(this)) |
4889 | -{ |
4890 | - connect(m_button, SIGNAL(clicked()), SLOT(toggleDash())); |
4891 | - |
4892 | - QHBoxLayout* layout = new QHBoxLayout(this); |
4893 | - layout->setMargin(0); |
4894 | - layout->addWidget(m_button); |
4895 | - |
4896 | - /* Check if the dash is already up and running by asking the bus instead of |
4897 | - trying to create an instance of the interface. Creating an instance |
4898 | - will cause DBUS to activate the dash and we don't want this to happen, especially |
4899 | - during startup where the dash is started with a delay. */ |
4900 | - QDBusConnectionInterface* sessionBusIFace = QDBusConnection::sessionBus().interface(); |
4901 | - QDBusReply<bool> reply = sessionBusIFace->isServiceRegistered(DBUS_SERVICE); |
4902 | - if (reply.isValid() && reply.value() == true) { |
4903 | - connectToDash(); |
4904 | - } else { |
4905 | - /* If the dash is not running, setup a notification so that we can |
4906 | - connect to it later when it comes up */ |
4907 | - QDBusServiceWatcher* serviceWatcher = new QDBusServiceWatcher(DBUS_SERVICE, QDBusConnection::sessionBus(), |
4908 | - QDBusServiceWatcher::WatchForRegistration, this); |
4909 | - connect(serviceWatcher, SIGNAL(serviceRegistered(QString)), SLOT(connectToDash())); |
4910 | - } |
4911 | -} |
4912 | - |
4913 | -void HomeButtonApplet::connectToDash() |
4914 | -{ |
4915 | - if (m_dashInterface != NULL) { |
4916 | - return; |
4917 | - } |
4918 | - |
4919 | - m_dashInterface = new QDBusInterface(DBUS_SERVICE, DBUS_PATH, DBUS_IFACE, |
4920 | - QDBusConnection::sessionBus(), this); |
4921 | - m_button->connect(m_dashInterface, SIGNAL(activeChanged(bool)), SLOT(setChecked(bool))); |
4922 | - |
4923 | - /* Immediately update the home button with the current state of the dash */ |
4924 | - m_button->setChecked(m_dashInterface->property("active").toBool()); |
4925 | -} |
4926 | - |
4927 | -void HomeButtonApplet::toggleDash() |
4928 | -{ |
4929 | - if (m_dashInterface == NULL || !m_dashInterface->isValid()) { |
4930 | - connectToDash(); |
4931 | - } |
4932 | - |
4933 | - bool dashActive = m_dashInterface->property("active").toBool(); |
4934 | - |
4935 | - if (dashActive) { |
4936 | - m_dashInterface->setProperty("active", false); |
4937 | - } else { |
4938 | - /* Call com.canonical.Unity2d.Dash.activateHome (will set com.canonical.Unity2d.Dash.active to true */ |
4939 | - m_dashInterface->call(QDBus::Block, "activateHome"); |
4940 | - } |
4941 | -} |
4942 | - |
4943 | -void HomeButtonApplet::enterEvent(QEvent* event) |
4944 | -{ |
4945 | - QWidget::enterEvent(event); |
4946 | - m_launcherClient->beginForceVisible(); |
4947 | -} |
4948 | - |
4949 | -void HomeButtonApplet::leaveEvent(QEvent* event) |
4950 | -{ |
4951 | - QWidget::leaveEvent(event); |
4952 | - m_launcherClient->endForceVisible(); |
4953 | -} |
4954 | - |
4955 | -#include "homebuttonapplet.moc" |
4956 | |
4957 | === removed file 'panel/applets/homebutton/homebuttonapplet.h' |
4958 | --- panel/applets/homebutton/homebuttonapplet.h 2011-08-22 09:17:03 +0000 |
4959 | +++ panel/applets/homebutton/homebuttonapplet.h 1970-01-01 00:00:00 +0000 |
4960 | @@ -1,55 +0,0 @@ |
4961 | -/* |
4962 | - * This file is part of unity-2d |
4963 | - * |
4964 | - * Copyright 2010 Canonical Ltd. |
4965 | - * |
4966 | - * Authors: |
4967 | - * - Aurélien Gâteau <aurelien.gateau@canonical.com> |
4968 | - * |
4969 | - * This program is free software; you can redistribute it and/or modify |
4970 | - * it under the terms of the GNU General Public License as published by |
4971 | - * the Free Software Foundation; version 3. |
4972 | - * |
4973 | - * This program is distributed in the hope that it will be useful, |
4974 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
4975 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4976 | - * GNU General Public License for more details. |
4977 | - * |
4978 | - * You should have received a copy of the GNU General Public License |
4979 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
4980 | - */ |
4981 | - |
4982 | -#ifndef HOMEBUTTONAPPLET_H |
4983 | -#define HOMEBUTTONAPPLET_H |
4984 | - |
4985 | -// Local |
4986 | -#include "homebutton.h" |
4987 | - |
4988 | -// Unity-2d |
4989 | -#include <panelapplet.h> |
4990 | - |
4991 | -class QDBusInterface; |
4992 | -class LauncherClient; |
4993 | - |
4994 | -class HomeButtonApplet : public Unity2d::PanelApplet |
4995 | -{ |
4996 | -Q_OBJECT |
4997 | -public: |
4998 | - HomeButtonApplet(Unity2dPanel* panel); |
4999 | - |
5000 | -protected: |
The diff has been truncated for viewing.