Merge lp:~fboucault/unity-2d/remove_unused_dash_dbus_props into lp:unity-2d

Proposed by Florian Boucault
Status: Superseded
Proposed branch: lp:~fboucault/unity-2d/remove_unused_dash_dbus_props
Merge into: lp:unity-2d
Diff against target: 10515 lines (+3823/-3732)
144 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/dashclient.cpp (+0/-56)
libunity-2d-private/src/dashclient.h (+0/-13)
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/dash.xml (+0/-18)
shell/app/dashdbus.cpp (+68/-0)
shell/app/dashdbus.h (+56/-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 (+98/-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/remove_unused_dash_dbus_props
Reviewer Review Type Date Requested Status
Albert Astals Cid Pending
Review via email: mp+92188@code.launchpad.net

Description of the change

Removed DashClient.activePage() getter, setActivePage() setter and activePageChanged signal
Removed DashDBus.activateHome()
Removed DashDBus.activateLens()
Removed DashDBus.activeLens property and activeLensChanged signal

To post a comment you must log in.
993. By Florian Boucault

Reverted removal of dash's D-Bus properties, methods and signals.

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:47:19 +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:47:19 +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:47:19 +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:47:19 +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:47:19 +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:47:19 +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:47:19 +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'
1226Binary 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:47:19 +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:47:19 +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:47:19 +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:47:19 +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:47:19 +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:47:19 +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:47:19 +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:47:19 +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:47:19 +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=== modified file 'libunity-2d-private/src/dashclient.cpp'
2167--- libunity-2d-private/src/dashclient.cpp 2012-02-07 14:22:30 +0000
2168+++ libunity-2d-private/src/dashclient.cpp 2012-02-09 02:47:19 +0000
2169@@ -87,8 +87,6 @@
2170 QDBusConnection::sessionBus(), this);
2171 connect(m_dashDbusIface, SIGNAL(activeChanged(bool)),
2172 SLOT(slotDashActiveChanged(bool)));
2173- connect(m_dashDbusIface, SIGNAL(activeLensChanged(const QString&)),
2174- SLOT(slotDashActiveLensChanged(const QString&)));
2175
2176 QVariant value = m_dashDbusIface->property("active");
2177 if (value.isValid()) {
2178@@ -96,14 +94,6 @@
2179 } else {
2180 UQ_WARNING << "Fetching Dash.active property failed";
2181 }
2182- value = m_dashDbusIface->property("activeLens");
2183- if (value.isValid()) {
2184- m_dashActiveLens = value.toString();
2185- } else {
2186- UQ_WARNING << "Fetching Dash.activeLens property failed";
2187- }
2188-
2189- updateActivePage();
2190 }
2191
2192 DashClient* DashClient::instance()
2193@@ -116,19 +106,10 @@
2194 {
2195 if (m_dashActive != value) {
2196 m_dashActive = value;
2197- updateActivePage();
2198 }
2199 Q_EMIT activeChanged(value);
2200 }
2201
2202-void DashClient::slotDashActiveLensChanged(const QString& lens)
2203-{
2204- if (m_dashActiveLens != lens) {
2205- m_dashActiveLens = lens;
2206- updateActivePage();
2207- }
2208-}
2209-
2210 bool DashClient::active() const
2211 {
2212 return m_dashActive;
2213@@ -147,43 +128,6 @@
2214 }
2215 }
2216
2217-QString DashClient::activePage() const
2218-{
2219- return m_activePage;
2220-}
2221-
2222-void DashClient::setActivePage(const QString& page, const QString& lensId)
2223-{
2224- if (m_activePage == page) {
2225- return;
2226- }
2227- if (page.isEmpty()) {
2228- setActive(false);
2229- return;
2230- }
2231- // Use a separate QDBusInterface so that the dash is started if it is not
2232- // already running
2233- QDBusInterface iface(DASH_DBUS_SERVICE, DASH_DBUS_PATH, DASH_DBUS_INTERFACE);
2234- if (page == "home") {
2235- iface.asyncCall("activateHome");
2236- } else {
2237- iface.asyncCall("activateLens", lensId);
2238- }
2239-}
2240-
2241-void DashClient::updateActivePage()
2242-{
2243- QString activePage;
2244- if (m_dashActive) {
2245- activePage = m_dashActiveLens.isEmpty() ? "home" : m_dashActiveLens;
2246- }
2247-
2248- if (m_activePage != activePage) {
2249- m_activePage = activePage;
2250- activePageChanged(m_activePage);
2251- }
2252-}
2253-
2254 QSize DashClient::minimumSizeForDesktop()
2255 {
2256 return QSize(DASH_MIN_SCREEN_WIDTH, DASH_MIN_SCREEN_HEIGHT);
2257
2258=== modified file 'libunity-2d-private/src/dashclient.h'
2259--- libunity-2d-private/src/dashclient.h 2012-02-07 14:22:30 +0000
2260+++ libunity-2d-private/src/dashclient.h 2012-02-09 02:47:19 +0000
2261@@ -44,36 +44,23 @@
2262 bool active() const;
2263 void setActive(bool active);
2264
2265- /**
2266- * Returns the active page. This is either:
2267- * - The lens id of the active lens
2268- * - "home" if the home is visible
2269- * - "" if the dash is not visible
2270- */
2271- QString activePage() const;
2272 bool alwaysFullScreen() const;
2273- void setActivePage(const QString& page, const QString& lensId=QString());
2274 static QSize minimumSizeForDesktop();
2275
2276 Q_SIGNALS:
2277 void activeChanged(bool);
2278- void activePageChanged(const QString&);
2279 void alwaysFullScreenChanged();
2280
2281 private Q_SLOTS:
2282 void connectToDash();
2283 void slotDashActiveChanged(bool);
2284- void slotDashActiveLensChanged(const QString&);
2285 void updateAlwaysFullScreen();
2286
2287 private:
2288 DashClient(QObject* parent = 0);
2289- void updateActivePage();
2290
2291 QDBusInterface* m_dashDbusIface;
2292 bool m_dashActive;
2293- QString m_dashActiveLens;
2294- QString m_activePage;
2295 bool m_alwaysFullScreen;
2296 };
2297
2298
2299=== removed file 'libunity-2d-private/src/edgehitdetector.cpp'
2300--- libunity-2d-private/src/edgehitdetector.cpp 2011-11-29 11:46:34 +0000
2301+++ libunity-2d-private/src/edgehitdetector.cpp 1970-01-01 00:00:00 +0000
2302@@ -1,65 +0,0 @@
2303-/*
2304- * This file is part of unity-2d
2305- *
2306- * Copyright 2011 Canonical Ltd.
2307- *
2308- * Authors:
2309- * - Aurélien Gâteau <aurelien.gateau@canonical.com>
2310- *
2311- * License: GPL v3
2312- */
2313-// Self
2314-#include "edgehitdetector.h"
2315-
2316-// Local
2317-
2318-// libunity-2d
2319-#include <debug_p.h>
2320-
2321-// Qt
2322-#include <QDesktopWidget>
2323-#include <QTimer>
2324-
2325-static const int EDGE_HIT_DELAY = 500;
2326-
2327-EdgeHitDetector::EdgeHitDetector(QObject* parent)
2328-: QObject(parent)
2329-, m_mouseArea(new MouseArea(this))
2330-, m_updateTimer(new QTimer(this))
2331-, m_edgeHitTimer(new QTimer(this))
2332-{
2333- updateGeometryFromScreen();
2334-
2335- // Use a timer to delay geometry updates because sometimes when
2336- // QDesktopWidget emits its signals, immediatly asking for screen geometry
2337- // yields wrong results.
2338- m_updateTimer->setSingleShot(true);
2339- m_updateTimer->setInterval(1000);
2340- connect(m_updateTimer, SIGNAL(timeout()), SLOT(updateGeometryFromScreen()));
2341-
2342- QDesktopWidget* desktop = QApplication::desktop();
2343- connect(desktop, SIGNAL(resized(int)), m_updateTimer, SLOT(start()));
2344- connect(desktop, SIGNAL(screenCountChanged(int)), m_updateTimer, SLOT(start()));
2345-
2346- m_edgeHitTimer->setInterval(EDGE_HIT_DELAY);
2347- m_edgeHitTimer->setSingleShot(true);
2348- connect(m_edgeHitTimer, SIGNAL(timeout()), SIGNAL(edgeHit()));
2349-
2350- connect(m_mouseArea, SIGNAL(entered()), m_edgeHitTimer, SLOT(start()));
2351- connect(m_mouseArea, SIGNAL(exited()), m_edgeHitTimer, SLOT(stop()));
2352-}
2353-
2354-void EdgeHitDetector::updateGeometryFromScreen()
2355-{
2356- QPoint p = QApplication::isLeftToRight() ?
2357- QPoint() :
2358- QPoint(QApplication::desktop()->width() - 1, 0);
2359- QRect rect = QApplication::desktop()->availableGeometry(p);
2360- if (QApplication::isLeftToRight()) {
2361- m_mouseArea->setGeometry(rect.left(), rect.top(), 1, rect.height());
2362- } else {
2363- m_mouseArea->setGeometry(rect.right() - 1, rect.top(), 1, rect.height());
2364- }
2365-}
2366-
2367-#include "edgehitdetector.moc"
2368
2369=== removed file 'libunity-2d-private/src/edgehitdetector.h'
2370--- libunity-2d-private/src/edgehitdetector.h 2011-06-11 11:33:52 +0000
2371+++ libunity-2d-private/src/edgehitdetector.h 1970-01-01 00:00:00 +0000
2372@@ -1,44 +0,0 @@
2373-/*
2374- * This file is part of unity-2d
2375- *
2376- * Copyright 2011 Canonical Ltd.
2377- *
2378- * Authors:
2379- * - Aurélien Gâteau <aurelien.gateau@canonical.com>
2380- *
2381- * License: GPL v3
2382- */
2383-#ifndef EDGEHITDETECTOR_H
2384-#define EDGEHITDETECTOR_H
2385-
2386-// Local
2387-
2388-// libunity-2d
2389-#include <mousearea.h>
2390-
2391-// Qt
2392-
2393-class QTimer;
2394-
2395-/**
2396- * A mouse area which stays on the left edge of the leftmost screen
2397- */
2398-class EdgeHitDetector : public QObject
2399-{
2400-Q_OBJECT
2401-public:
2402- EdgeHitDetector(QObject* parent = 0);
2403-
2404-Q_SIGNALS:
2405- void edgeHit();
2406-
2407-private Q_SLOTS:
2408- void updateGeometryFromScreen();
2409-
2410-private:
2411- MouseArea* m_mouseArea;
2412- QTimer* m_updateTimer;
2413- QTimer* m_edgeHitTimer;
2414-};
2415-
2416-#endif /* EDGEHITDETECTOR_H */
2417
2418=== removed file 'libunity-2d-private/src/forcevisiblebehavior.cpp'
2419--- libunity-2d-private/src/forcevisiblebehavior.cpp 2011-06-11 11:33:52 +0000
2420+++ libunity-2d-private/src/forcevisiblebehavior.cpp 1970-01-01 00:00:00 +0000
2421@@ -1,36 +0,0 @@
2422-/*
2423- * This file is part of unity-2d
2424- *
2425- * Copyright 2011 Canonical Ltd.
2426- *
2427- * Authors:
2428- * - Aurélien Gâteau <aurelien.gateau@canonical.com>
2429- *
2430- * This program is free software; you can redistribute it and/or modify
2431- * it under the terms of the GNU General Public License as published by
2432- * the Free Software Foundation; version 3.
2433- *
2434- * This program is distributed in the hope that it will be useful,
2435- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2436- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2437- * GNU General Public License for more details.
2438- *
2439- * You should have received a copy of the GNU General Public License
2440- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2441- */
2442-// Self
2443-#include "forcevisiblebehavior.h"
2444-
2445-// Local
2446-
2447-// libunity-2d
2448-
2449-// Qt
2450-#include <QWidget>
2451-
2452-ForceVisibleBehavior::ForceVisibleBehavior(QWidget* panel)
2453-: AbstractVisibilityBehavior(panel)
2454-{
2455-}
2456-
2457-#include "forcevisiblebehavior.moc"
2458
2459=== removed file 'libunity-2d-private/src/forcevisiblebehavior.h'
2460--- libunity-2d-private/src/forcevisiblebehavior.h 2011-06-11 11:33:52 +0000
2461+++ libunity-2d-private/src/forcevisiblebehavior.h 1970-01-01 00:00:00 +0000
2462@@ -1,41 +0,0 @@
2463-/*
2464- * This file is part of unity-2d
2465- *
2466- * Copyright 2011 Canonical Ltd.
2467- *
2468- * Authors:
2469- * - Aurélien Gâteau <aurelien.gateau@canonical.com>
2470- *
2471- * This program is free software; you can redistribute it and/or modify
2472- * it under the terms of the GNU General Public License as published by
2473- * the Free Software Foundation; version 3.
2474- *
2475- * This program is distributed in the hope that it will be useful,
2476- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2477- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2478- * GNU General Public License for more details.
2479- *
2480- * You should have received a copy of the GNU General Public License
2481- * along with this program. If not, see <http://www.gnu.org/licenses/>.
2482- */
2483-#ifndef FORCEVISIBLEBEHAVIOR_H
2484-#define FORCEVISIBLEBEHAVIOR_H
2485-
2486-// Local
2487-#include <abstractvisibilitybehavior.h>
2488-
2489-// Qt
2490-#include <QObject>
2491-
2492-/**
2493- * Behavior used when someone requested the launcher to be visible even if it
2494- * is supposed to be hidden
2495- */
2496-class ForceVisibleBehavior : public AbstractVisibilityBehavior
2497-{
2498- Q_OBJECT
2499-public:
2500- ForceVisibleBehavior(QWidget* panel=0);
2501-};
2502-
2503-#endif /* FORCEVISIBLEBEHAVIOR_H */
2504
2505=== renamed file 'launcher/app/gesturehandler.cpp' => 'libunity-2d-private/src/gesturehandler.cpp'
2506--- launcher/app/gesturehandler.cpp 2011-11-08 13:33:33 +0000
2507+++ libunity-2d-private/src/gesturehandler.cpp 2012-02-09 02:47:19 +0000
2508@@ -25,10 +25,10 @@
2509
2510 #include <debug_p.h>
2511
2512-GestureHandler::GestureHandler(Unity2dPanel* launcher, QObject *parent)
2513+GestureHandler::GestureHandler(QObject *parent)
2514 : QObject(parent)
2515 , m_geisInstance(NULL)
2516-, m_launcher(launcher)
2517+, m_isDragging(false)
2518 {
2519 if (geisInitialize() != GEIS_STATUS_SUCCESS) {
2520 UQ_WARNING << "GEIS initialization failed: multitouch support disabled";
2521@@ -218,9 +218,10 @@
2522 /* 4 fingers drag reveals the launcher progressively; if the drag goes far
2523 enough, the launcher is then locked in place and does not autohide anymore */
2524 /* FIXME: only supports the launcher positioned on the left edge of the screen */
2525- m_launcher->setManualSliding(true);
2526- m_dragDelta = m_launcher->delta() + attributes[GEIS_GESTURE_ATTRIBUTE_DELTA_X].float_val;
2527- m_launcher->setDelta(m_dragDelta);
2528+ m_isDragging = true;
2529+ Q_EMIT isDraggingChanged();
2530+ m_dragDelta = attributes[GEIS_GESTURE_ATTRIBUTE_DELTA_X].float_val;
2531+ Q_EMIT dragDeltaChanged();
2532 }
2533 }
2534
2535@@ -262,18 +263,17 @@
2536 m_pinchPreviousTimestamp = timestamp;
2537 }
2538 } else if (gestureName == GEIS_GESTURE_TYPE_DRAG4) {
2539- /* FIXME: only supports the launcher positioned on the left edge of the screen */
2540 m_dragDelta += attributes[GEIS_GESTURE_ATTRIBUTE_DELTA_X].float_val;
2541- m_launcher->setDelta(m_dragDelta);
2542+ Q_EMIT dragDeltaChanged();
2543 /* If the drag goes sufficiently above than the maximum delta then
2544 lock the launcher in place by reserving the area so that no windows
2545- overlap it.
2546+ overlap it. TODO: move to QML.
2547 */
2548- if (m_dragDelta - m_launcher->delta() > 240) {
2549- m_launcher->setUseStrut(true);
2550- } else {
2551- m_launcher->setUseStrut(false);
2552- }
2553+// if (m_dragDelta - m_launcher->delta() > 240) {
2554+// m_launcher->setUseStrut(true);
2555+// } else {
2556+// m_launcher->setUseStrut(false);
2557+// }
2558 }
2559 }
2560
2561@@ -284,8 +284,20 @@
2562
2563 if (gestureName == GEIS_GESTURE_TYPE_DRAG4) {
2564 m_dragDelta += attributes[GEIS_GESTURE_ATTRIBUTE_DELTA_X].float_val;
2565- m_launcher->setDelta(m_dragDelta);
2566- m_launcher->setManualSliding(false);
2567+ Q_EMIT dragDeltaChanged();
2568+ m_isDragging = false;
2569+ Q_EMIT isDraggingChanged();
2570 }
2571 }
2572
2573+double GestureHandler::dragDelta() const
2574+{
2575+ return m_dragDelta;
2576+}
2577+
2578+bool GestureHandler::isDragging() const
2579+{
2580+ return m_isDragging;
2581+}
2582+
2583+#include "gesturehandler.moc"
2584
2585=== renamed file 'launcher/app/gesturehandler.h' => 'libunity-2d-private/src/gesturehandler.h'
2586--- launcher/app/gesturehandler.h 2011-02-21 00:25:44 +0000
2587+++ libunity-2d-private/src/gesturehandler.h 2012-02-09 02:47:19 +0000
2588@@ -22,20 +22,29 @@
2589
2590 #include <QObject>
2591 #include <QHash>
2592+#include <QMetaType>
2593
2594 extern "C" {
2595 #include <geis/geis.h>
2596 }
2597
2598-#include "unity2dpanel.h"
2599-
2600 class GestureHandler : public QObject
2601 {
2602 Q_OBJECT
2603+ Q_PROPERTY(double dragDelta READ dragDelta NOTIFY dragDeltaChanged)
2604+ Q_PROPERTY(bool isDragging READ isDragging NOTIFY isDraggingChanged)
2605+
2606 public:
2607- explicit GestureHandler(Unity2dPanel* launcher, QObject *parent = 0);
2608+ explicit GestureHandler(QObject *parent = 0);
2609 ~GestureHandler();
2610
2611+ double dragDelta() const;
2612+ bool isDragging() const;
2613+
2614+Q_SIGNALS:
2615+ void dragDeltaChanged();
2616+ void isDraggingChanged();
2617+
2618 private Q_SLOTS:
2619 void geisEventDispatch();
2620
2621@@ -60,7 +69,9 @@
2622 float m_pinchPreviousRadius;
2623 int m_pinchPreviousTimestamp;
2624 float m_dragDelta;
2625- Unity2dPanel* m_launcher;
2626+ bool m_isDragging;
2627 };
2628
2629+Q_DECLARE_METATYPE(GestureHandler*)
2630+
2631 #endif // GESTUREHANDLER_H
2632
2633=== added file 'libunity-2d-private/src/inputshapemanager.cpp'
2634--- libunity-2d-private/src/inputshapemanager.cpp 1970-01-01 00:00:00 +0000
2635+++ libunity-2d-private/src/inputshapemanager.cpp 2012-02-09 02:47:19 +0000
2636@@ -0,0 +1,105 @@
2637+/*
2638+ * This file is part of unity-2d
2639+ *
2640+ * Copyright 2012 Canonical Ltd.
2641+ *
2642+ * Authors:
2643+ * - Ugo Riboni <ugo.riboni@canonical.com>
2644+ *
2645+ * This program is free software; you can redistribute it and/or modify
2646+ * it under the terms of the GNU General Public License as published by
2647+ * the Free Software Foundation; version 3.
2648+ *
2649+ * This program is distributed in the hope that it will be useful,
2650+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2651+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2652+ * GNU General Public License for more details.
2653+ *
2654+ * You should have received a copy of the GNU General Public License
2655+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2656+ */
2657+
2658+#include <QDebug>
2659+#include <QRect>
2660+#include <QX11Info>
2661+#include <QRegion>
2662+
2663+#include "inputshapemanager.h"
2664+#include "unity2ddeclarativeview.h"
2665+#include "desktopinfo.h"
2666+
2667+// X11
2668+#include <X11/Xlib.h>
2669+#include <X11/Xregion.h>
2670+#include <X11/extensions/shape.h>
2671+
2672+InputShapeManager::InputShapeManager(QObject *parent) :
2673+ QObject(parent),
2674+ m_target(0)
2675+{
2676+}
2677+
2678+void InputShapeManager::updateManagedShape()
2679+{
2680+ if (m_target == NULL || !m_target->isVisible()) {
2681+ return;
2682+ }
2683+
2684+ QBitmap inputShape(m_target->width(), m_target->height());
2685+ inputShape.fill(Qt::color0);
2686+ QPainter painter(&inputShape);
2687+
2688+ Q_FOREACH(InputShapeRectangle* shape, m_shapes) {
2689+ if (shape->enabled()) {
2690+ painter.drawPixmap(shape->rectangle().x(), shape->rectangle().y(),
2691+ shape->shape());
2692+ }
2693+ }
2694+
2695+ XShapeCombineRegion(QX11Info::display(), m_target->effectiveWinId(),
2696+ DesktopInfo::instance()->isCompositingManagerRunning() ? ShapeInput : ShapeBounding,
2697+ 0, 0, QRegion(inputShape).handle(), ShapeSet);
2698+}
2699+
2700+Unity2DDeclarativeView* InputShapeManager::target() const
2701+{
2702+ return m_target;
2703+}
2704+
2705+void InputShapeManager::setTarget(Unity2DDeclarativeView *target)
2706+{
2707+ if (m_target != target) {
2708+ if (m_target != NULL) m_target->disconnect(this);
2709+
2710+ //TODO: de-shape the current target view, if any, before shaping the new one. not used now
2711+ // as we never change the view anyway.
2712+
2713+ m_target = target;
2714+ if (m_target != NULL) {
2715+ // due to the way xshape works we need to re-apply the shaping every time the target window
2716+ // is mapped again.
2717+ connect(m_target, SIGNAL(visibleChanged(bool)), SLOT(updateManagedShape()));
2718+ connect(m_target, SIGNAL(sceneResized(QSize)), SLOT(updateManagedShape()));
2719+ }
2720+ Q_EMIT targetChanged();
2721+ updateManagedShape();
2722+ }
2723+}
2724+
2725+QDeclarativeListProperty<InputShapeRectangle> InputShapeManager::shapes()
2726+{
2727+ return QDeclarativeListProperty<InputShapeRectangle>(this, this, &InputShapeManager::appendShape);
2728+}
2729+
2730+void InputShapeManager::appendShape(QDeclarativeListProperty<InputShapeRectangle> *list, InputShapeRectangle *shape)
2731+{
2732+ InputShapeManager* instance = qobject_cast<InputShapeManager*>(list->object);
2733+ if (instance != NULL) {
2734+ instance->m_shapes.append(shape);
2735+ instance->connect(shape, SIGNAL(shapeChanged()), SLOT(updateManagedShape()));
2736+ instance->connect(shape, SIGNAL(enabledChanged()), SLOT(updateManagedShape()));
2737+ instance->updateManagedShape();
2738+ }
2739+}
2740+
2741+#include "inputshapemanager.moc"
2742
2743=== added file 'libunity-2d-private/src/inputshapemanager.h'
2744--- libunity-2d-private/src/inputshapemanager.h 1970-01-01 00:00:00 +0000
2745+++ libunity-2d-private/src/inputshapemanager.h 2012-02-09 02:47:19 +0000
2746@@ -0,0 +1,59 @@
2747+/*
2748+ * This file is part of unity-2d
2749+ *
2750+ * Copyright 2012 Canonical Ltd.
2751+ *
2752+ * Authors:
2753+ * - Ugo Riboni <ugo.riboni@canonical.com>
2754+ *
2755+ * This program is free software; you can redistribute it and/or modify
2756+ * it under the terms of the GNU General Public License as published by
2757+ * the Free Software Foundation; version 3.
2758+ *
2759+ * This program is distributed in the hope that it will be useful,
2760+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2761+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2762+ * GNU General Public License for more details.
2763+ *
2764+ * You should have received a copy of the GNU General Public License
2765+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2766+ */
2767+
2768+#ifndef INPUTSHAPEMANAGER_H
2769+#define INPUTSHAPEMANAGER_H
2770+
2771+#include <QObject>
2772+#include <QDeclarativeListProperty>
2773+
2774+#include "inputshaperectangle.h"
2775+
2776+class Unity2DDeclarativeView;
2777+
2778+class InputShapeManager : public QObject
2779+{
2780+ Q_OBJECT
2781+ Q_PROPERTY(Unity2DDeclarativeView* target READ target WRITE setTarget NOTIFY targetChanged)
2782+ Q_PROPERTY(QDeclarativeListProperty<InputShapeRectangle> shapes READ shapes)
2783+ Q_CLASSINFO("DefaultProperty", "shapes")
2784+
2785+public:
2786+ explicit InputShapeManager(QObject *parent = 0);
2787+ Unity2DDeclarativeView* target() const;
2788+ void setTarget(Unity2DDeclarativeView* target);
2789+ QDeclarativeListProperty<InputShapeRectangle> shapes();
2790+
2791+Q_SIGNALS:
2792+ void targetChanged();
2793+
2794+public Q_SLOTS:
2795+ void updateManagedShape();
2796+
2797+protected:
2798+ static void appendShape(QDeclarativeListProperty<InputShapeRectangle> *property, InputShapeRectangle *value);
2799+
2800+private:
2801+ Unity2DDeclarativeView* m_target;
2802+ QList<InputShapeRectangle*> m_shapes;
2803+};
2804+
2805+#endif // INPUTSHAPEMANAGER_H
2806
2807=== added file 'libunity-2d-private/src/inputshapemask.cpp'
2808--- libunity-2d-private/src/inputshapemask.cpp 1970-01-01 00:00:00 +0000
2809+++ libunity-2d-private/src/inputshapemask.cpp 2012-02-09 02:47:19 +0000
2810@@ -0,0 +1,111 @@
2811+/*
2812+ * This file is part of unity-2d
2813+ *
2814+ * Copyright 2012 Canonical Ltd.
2815+ *
2816+ * Authors:
2817+ * - Ugo Riboni <ugo.riboni@canonical.com>
2818+ *
2819+ * This program is free software; you can redistribute it and/or modify
2820+ * it under the terms of the GNU General Public License as published by
2821+ * the Free Software Foundation; version 3.
2822+ *
2823+ * This program is distributed in the hope that it will be useful,
2824+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2825+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2826+ * GNU General Public License for more details.
2827+ *
2828+ * You should have received a copy of the GNU General Public License
2829+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2830+ */
2831+
2832+#include "inputshapemask.h"
2833+#include "config.h"
2834+
2835+#include <QBitmap>
2836+#include <QDebug>
2837+
2838+InputShapeMask::InputShapeMask(QObject *parent) :
2839+ QObject(parent),
2840+ m_enabled(true)
2841+{
2842+}
2843+
2844+void InputShapeMask::updateShape()
2845+{
2846+ QBitmap newShape;
2847+
2848+ if (!m_source.isEmpty() && m_color.isValid()) {
2849+ QPixmap image;
2850+ QString path = unity2dDirectory() + "/" + m_source;
2851+ if (image.load(path)) {
2852+ newShape = image.createMaskFromColor(m_color.rgb(), Qt::MaskInColor);
2853+ } else {
2854+ qWarning() << "Failed to load input shape mask image from" << path;
2855+ }
2856+ }
2857+
2858+ m_shape = newShape;
2859+ Q_EMIT shapeChanged();
2860+}
2861+
2862+QString InputShapeMask::source() const
2863+{
2864+ return m_source;
2865+}
2866+
2867+QColor InputShapeMask::color() const
2868+{
2869+ return m_color;
2870+}
2871+
2872+QPoint InputShapeMask::position() const
2873+{
2874+ return m_position;
2875+}
2876+
2877+bool InputShapeMask::enabled() const
2878+{
2879+ return m_enabled;
2880+}
2881+
2882+QBitmap InputShapeMask::shape() const
2883+{
2884+ return m_shape;
2885+}
2886+
2887+void InputShapeMask::setSource(const QString &source)
2888+{
2889+ if (m_source != source) {
2890+ m_source = source;
2891+ Q_EMIT sourceChanged(m_source);
2892+ updateShape();
2893+ }
2894+}
2895+
2896+void InputShapeMask::setColor(const QColor &color)
2897+{
2898+ if (m_color != color) {
2899+ m_color = color;
2900+ Q_EMIT colorChanged(m_color);
2901+ updateShape();
2902+ }
2903+}
2904+
2905+void InputShapeMask::setPosition(const QPoint &position)
2906+{
2907+ if (m_position != position) {
2908+ m_position = position;
2909+ Q_EMIT positionChanged();
2910+ }
2911+}
2912+
2913+void InputShapeMask::setEnabled(bool enabled)
2914+{
2915+ if (m_enabled != enabled) {
2916+ m_enabled = enabled;
2917+ Q_EMIT enabledChanged();
2918+ }
2919+}
2920+
2921+#include "inputshapemask.moc"
2922
2923=== added file 'libunity-2d-private/src/inputshapemask.h'
2924--- libunity-2d-private/src/inputshapemask.h 1970-01-01 00:00:00 +0000
2925+++ libunity-2d-private/src/inputshapemask.h 2012-02-09 02:47:19 +0000
2926@@ -0,0 +1,71 @@
2927+/*
2928+ * This file is part of unity-2d
2929+ *
2930+ * Copyright 2012 Canonical Ltd.
2931+ *
2932+ * Authors:
2933+ * - Ugo Riboni <ugo.riboni@canonical.com>
2934+ *
2935+ * This program is free software; you can redistribute it and/or modify
2936+ * it under the terms of the GNU General Public License as published by
2937+ * the Free Software Foundation; version 3.
2938+ *
2939+ * This program is distributed in the hope that it will be useful,
2940+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2941+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2942+ * GNU General Public License for more details.
2943+ *
2944+ * You should have received a copy of the GNU General Public License
2945+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2946+ */
2947+
2948+#ifndef INPUTSHAPEMASK_H
2949+#define INPUTSHAPEMASK_H
2950+
2951+#include <QObject>
2952+#include <QColor>
2953+#include <QPoint>
2954+#include <QBitmap>
2955+
2956+class InputShapeMask : public QObject
2957+{
2958+ Q_OBJECT
2959+ Q_PROPERTY(QString source READ source WRITE setSource NOTIFY sourceChanged)
2960+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
2961+ Q_PROPERTY(QPoint position READ position WRITE setPosition NOTIFY positionChanged)
2962+ Q_PROPERTY(QBitmap shape READ shape NOTIFY shapeChanged)
2963+ Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
2964+
2965+public:
2966+ explicit InputShapeMask(QObject *parent = 0);
2967+
2968+ QString source() const;
2969+ QColor color() const;
2970+ QPoint position() const;
2971+ bool enabled() const;
2972+ QBitmap shape() const;
2973+
2974+ void setSource(const QString& source);
2975+ void setColor(const QColor& color);
2976+ void setPosition(const QPoint& position);
2977+ void setEnabled(bool enabled);
2978+
2979+Q_SIGNALS:
2980+ void sourceChanged(const QString& source);
2981+ void colorChanged(const QColor& color);
2982+ void enabledChanged();
2983+ void shapeChanged();
2984+ void positionChanged();
2985+
2986+protected:
2987+ void updateShape();
2988+
2989+private:
2990+ QString m_source;
2991+ QColor m_color;
2992+ QPoint m_position;
2993+ bool m_enabled;
2994+ QBitmap m_shape;
2995+};
2996+
2997+#endif // INPUTSHAPEMASK_H
2998
2999=== added file 'libunity-2d-private/src/inputshaperectangle.cpp'
3000--- libunity-2d-private/src/inputshaperectangle.cpp 1970-01-01 00:00:00 +0000
3001+++ libunity-2d-private/src/inputshaperectangle.cpp 2012-02-09 02:47:19 +0000
3002@@ -0,0 +1,126 @@
3003+/*
3004+ * This file is part of unity-2d
3005+ *
3006+ * Copyright 2012 Canonical Ltd.
3007+ *
3008+ * Authors:
3009+ * - Ugo Riboni <ugo.riboni@canonical.com>
3010+ *
3011+ * This program is free software; you can redistribute it and/or modify
3012+ * it under the terms of the GNU General Public License as published by
3013+ * the Free Software Foundation; version 3.
3014+ *
3015+ * This program is distributed in the hope that it will be useful,
3016+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3017+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3018+ * GNU General Public License for more details.
3019+ *
3020+ * You should have received a copy of the GNU General Public License
3021+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3022+ */
3023+
3024+#include "inputshaperectangle.h"
3025+#include "inputshapemask.h"
3026+
3027+#include <QBitmap>
3028+#include <QPainter>
3029+#include <QPainterPath>
3030+#include <QDebug>
3031+#include <QRect>
3032+
3033+InputShapeRectangle::InputShapeRectangle(QObject *parent) :
3034+ QObject(parent),
3035+ m_enabled(true),
3036+ m_mirrorHorizontally(false)
3037+{
3038+}
3039+
3040+void InputShapeRectangle::updateShape()
3041+{
3042+ QBitmap newShape(m_rectangle.width(), m_rectangle.height());
3043+ newShape.fill(Qt::color1);
3044+
3045+ if (!m_rectangle.isEmpty() && m_masks.count() > 0) {
3046+ QPainter painter(&newShape);
3047+ painter.setBackgroundMode(Qt::OpaqueMode);
3048+
3049+ Q_FOREACH (InputShapeMask* mask, m_masks) {
3050+ if (mask->enabled()) {
3051+ painter.drawPixmap(mask->position(), mask->shape());
3052+ }
3053+ }
3054+ }
3055+
3056+ if (m_mirrorHorizontally) {
3057+ newShape = QBitmap::fromImage(newShape.toImage().mirrored(true, false));
3058+ }
3059+
3060+ m_shape = newShape;
3061+ Q_EMIT shapeChanged();
3062+}
3063+
3064+QRect InputShapeRectangle::rectangle() const
3065+{
3066+ return m_rectangle;
3067+}
3068+
3069+void InputShapeRectangle::setRectangle(QRect rectangle)
3070+{
3071+ if (rectangle != m_rectangle) {
3072+ m_rectangle = rectangle;
3073+ updateShape();
3074+ Q_EMIT rectangleChanged();
3075+ }
3076+}
3077+
3078+bool InputShapeRectangle::enabled() const
3079+{
3080+ return m_enabled;
3081+}
3082+
3083+void InputShapeRectangle::setEnabled(bool enabled)
3084+{
3085+ if (enabled != m_enabled) {
3086+ m_enabled = enabled;
3087+ Q_EMIT enabledChanged();
3088+
3089+ }
3090+}
3091+
3092+QBitmap InputShapeRectangle::shape() const
3093+{
3094+ return m_shape;
3095+}
3096+
3097+QDeclarativeListProperty<InputShapeMask> InputShapeRectangle::masks()
3098+{
3099+ return QDeclarativeListProperty<InputShapeMask>(this, this, &InputShapeRectangle::appendMask);
3100+}
3101+
3102+bool InputShapeRectangle::mirrorHorizontally() const
3103+{
3104+ return m_mirrorHorizontally;
3105+}
3106+
3107+void InputShapeRectangle::setMirrorHorizontally(bool mirror)
3108+{
3109+ if (mirror != m_mirrorHorizontally) {
3110+ m_mirrorHorizontally = mirror;
3111+ updateShape();
3112+ Q_EMIT mirrorHorizontallyChanged(m_mirrorHorizontally);
3113+ }
3114+}
3115+
3116+void InputShapeRectangle::appendMask(QDeclarativeListProperty<InputShapeMask> *list, InputShapeMask *mask)
3117+{
3118+ InputShapeRectangle* instance = qobject_cast<InputShapeRectangle*>(list->object);
3119+ if (instance != NULL) {
3120+ instance->m_masks.append(mask);
3121+ instance->connect(mask, SIGNAL(enabledChanged()), SLOT(updateShape()));
3122+ instance->connect(mask, SIGNAL(shapeChanged()), SLOT(updateShape()));
3123+ instance->connect(mask, SIGNAL(positionChanged()), SLOT(updateShape()));
3124+ instance->updateShape();
3125+ }
3126+}
3127+
3128+#include "inputshaperectangle.moc"
3129
3130=== added file 'libunity-2d-private/src/inputshaperectangle.h'
3131--- libunity-2d-private/src/inputshaperectangle.h 1970-01-01 00:00:00 +0000
3132+++ libunity-2d-private/src/inputshaperectangle.h 2012-02-09 02:47:19 +0000
3133@@ -0,0 +1,75 @@
3134+/*
3135+ * This file is part of unity-2d
3136+ *
3137+ * Copyright 2012 Canonical Ltd.
3138+ *
3139+ * Authors:
3140+ * - Ugo Riboni <ugo.riboni@canonical.com>
3141+ *
3142+ * This program is free software; you can redistribute it and/or modify
3143+ * it under the terms of the GNU General Public License as published by
3144+ * the Free Software Foundation; version 3.
3145+ *
3146+ * This program is distributed in the hope that it will be useful,
3147+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3148+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3149+ * GNU General Public License for more details.
3150+ *
3151+ * You should have received a copy of the GNU General Public License
3152+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3153+ */
3154+
3155+#ifndef INPUTSHAPERECTANGLE_H
3156+#define INPUTSHAPERECTANGLE_H
3157+
3158+#include <QObject>
3159+#include <QRect>
3160+#include <QBitmap>
3161+#include <QDeclarativeListProperty>
3162+#include <QList>
3163+
3164+class InputShapeMask;
3165+
3166+class InputShapeRectangle : public QObject
3167+{
3168+ Q_OBJECT
3169+ Q_PROPERTY(QRect rectangle READ rectangle WRITE setRectangle NOTIFY rectangleChanged)
3170+ Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
3171+ Q_PROPERTY(bool mirrorHorizontally READ mirrorHorizontally WRITE setMirrorHorizontally NOTIFY mirrorHorizontallyChanged)
3172+ Q_PROPERTY(QBitmap shape READ shape NOTIFY shapeChanged)
3173+ Q_PROPERTY(QDeclarativeListProperty<InputShapeMask> masks READ masks)
3174+ Q_CLASSINFO("DefaultProperty", "masks")
3175+
3176+public:
3177+ explicit InputShapeRectangle(QObject *parent = 0);
3178+
3179+ QRect rectangle() const;
3180+ void setRectangle(QRect rectangle);
3181+ bool enabled() const;
3182+ void setEnabled(bool enabled);
3183+ QBitmap shape() const;
3184+ QDeclarativeListProperty<InputShapeMask> masks();
3185+ bool mirrorHorizontally() const;
3186+ void setMirrorHorizontally(bool mirror);
3187+
3188+protected:
3189+ static void appendMask(QDeclarativeListProperty<InputShapeMask> *list, InputShapeMask *mask);
3190+
3191+protected Q_SLOTS:
3192+ void updateShape();
3193+
3194+Q_SIGNALS:
3195+ void rectangleChanged();
3196+ void enabledChanged();
3197+ void shapeChanged();
3198+ void mirrorHorizontallyChanged(bool mirrorHorizontally);
3199+
3200+private:
3201+ QRect m_rectangle;
3202+ bool m_enabled;
3203+ bool m_mirrorHorizontally;
3204+ QBitmap m_shape;
3205+ QList<InputShapeMask*> m_masks;
3206+};
3207+
3208+#endif // INPUTSHAPERECTANGLE_H
3209
3210=== removed file 'libunity-2d-private/src/intellihidebehavior.cpp'
3211--- libunity-2d-private/src/intellihidebehavior.cpp 2012-01-17 14:31:19 +0000
3212+++ libunity-2d-private/src/intellihidebehavior.cpp 1970-01-01 00:00:00 +0000
3213@@ -1,256 +0,0 @@
3214-/*
3215- * This file is part of unity-2d
3216- *
3217- * Copyright 2011 Canonical Ltd.
3218- *
3219- * Authors:
3220- * - Aurélien Gâteau <aurelien.gateau@canonical.com>
3221- * - Florian Boucault <florian.boucault@canonical.com>
3222- *
3223- * License: GPL v3
3224- */
3225-// Self
3226-#include "intellihidebehavior.h"
3227-
3228-// Local
3229-#include "unity2dpanel.h"
3230-
3231-// libunity-2d
3232-#include <debug_p.h>
3233-#include <edgehitdetector.h>
3234-
3235-// Qt
3236-#include <QCursor>
3237-#include <QEvent>
3238-#include <QTimer>
3239-#include <QWidget>
3240-#include <QDesktopWidget>
3241-
3242-// libwnck
3243-extern "C" {
3244-#define WNCK_I_KNOW_THIS_IS_UNSTABLE
3245-#include <libwnck/libwnck.h>
3246-}
3247-
3248-static const int AUTOHIDE_TIMEOUT = 1000;
3249-
3250-// Handy macros to declare GObject callbacks. The 'n' in CALLBACKn refers to
3251-// the number of dummy arguments the callback returns
3252-#define GOBJECT_CALLBACK0(callbackName, slot) \
3253-static void \
3254-callbackName(GObject* src, QObject* dst) \
3255-{ \
3256- QMetaObject::invokeMethod(dst, slot); \
3257-}
3258-
3259-#define GOBJECT_CALLBACK1(callbackName, slot) \
3260-static void \
3261-callbackName(GObject* src, void* dummy1, QObject* dst) \
3262-{ \
3263- QMetaObject::invokeMethod(dst, slot); \
3264-}
3265-
3266-#define GOBJECT_CALLBACK2(callbackName, slot) \
3267-static void \
3268-callbackName(GObject* src, void* dummy1, void* dummy2, QObject* dst) \
3269-{ \
3270- QMetaObject::invokeMethod(dst, slot); \
3271-}
3272-
3273-// Screen callbacks
3274-GOBJECT_CALLBACK1(activeWindowChangedCB, "updateActiveWindowConnections");
3275-GOBJECT_CALLBACK1(activeWorkspaceChangedCB, "updateVisibility");
3276-
3277-// Window callbacks
3278-GOBJECT_CALLBACK2(stateChangedCB, "updateVisibility");
3279-GOBJECT_CALLBACK0(geometryChangedCB, "updateVisibility");
3280-GOBJECT_CALLBACK0(workspaceChangedCB, "updateVisibility");
3281-
3282-IntelliHideBehavior::IntelliHideBehavior(QWidget* panel)
3283-: AbstractVisibilityBehavior(panel)
3284-, m_updateVisibilityTimer(new QTimer(this))
3285-, m_edgeHitDetector(0)
3286-, m_activeWindow(0)
3287-{
3288- m_updateVisibilityTimer->setSingleShot(true);
3289- m_updateVisibilityTimer->setInterval(AUTOHIDE_TIMEOUT);
3290- connect(m_updateVisibilityTimer, SIGNAL(timeout()), SLOT(updateVisibility()));
3291-
3292- setPanel(panel);
3293-
3294- WnckScreen* screen = wnck_screen_get_default();
3295- g_signal_connect(G_OBJECT(screen), "active-window-changed", G_CALLBACK(activeWindowChangedCB), this);
3296- g_signal_connect(G_OBJECT(screen), "active-workspace-changed", G_CALLBACK(activeWorkspaceChangedCB), this);
3297-
3298- updateActiveWindowConnections();
3299-}
3300-
3301-IntelliHideBehavior::~IntelliHideBehavior()
3302-{
3303- disconnectFromGSignals();
3304- WnckScreen* screen = wnck_screen_get_default();
3305- g_signal_handlers_disconnect_by_func(G_OBJECT(screen), gpointer(activeWindowChangedCB), this);
3306- g_signal_handlers_disconnect_by_func(G_OBJECT(screen), gpointer(activeWorkspaceChangedCB), this);
3307-}
3308-
3309-void IntelliHideBehavior::disconnectFromGSignals()
3310-{
3311- if (m_activeWindow) {
3312- g_signal_handlers_disconnect_by_func(m_activeWindow, gpointer(stateChangedCB), this);
3313- g_signal_handlers_disconnect_by_func(m_activeWindow, gpointer(geometryChangedCB), this);
3314- g_signal_handlers_disconnect_by_func(m_activeWindow, gpointer(workspaceChangedCB), this);
3315- }
3316-}
3317-
3318-void IntelliHideBehavior::updateActiveWindowConnections()
3319-{
3320- WnckScreen* screen = wnck_screen_get_default();
3321-
3322- disconnectFromGSignals();
3323- m_activeWindow = 0;
3324-
3325- WnckWindow* window = wnck_screen_get_active_window(screen);
3326- if (window) {
3327- m_activeWindow = window;
3328- g_signal_connect(G_OBJECT(window), "state-changed", G_CALLBACK(stateChangedCB), this);
3329- g_signal_connect(G_OBJECT(window), "geometry-changed", G_CALLBACK(geometryChangedCB), this);
3330- g_signal_connect(G_OBJECT(window), "workspace-changed", G_CALLBACK(workspaceChangedCB), this);
3331- }
3332-
3333- gboolean isShowingDesktop = wnck_screen_get_showing_desktop(screen);
3334- if (isShowingDesktop) {
3335- showPanel();
3336- } else {
3337- updateVisibility();
3338- }
3339-}
3340-
3341-void IntelliHideBehavior::updateVisibility()
3342-{
3343- if (m_panel == NULL) {
3344- return;
3345- }
3346- if (isMouseForcingVisibility()) {
3347- return;
3348- }
3349- int launcherPid = getpid();
3350-
3351- // Compute launcherRect, adjust "left" to the position where the launcher
3352- // is fully visible.
3353- QRect launcherRect = m_panel->geometry();
3354- // FIXME: the following code assumes that the launcher is on the left edge
3355- // of the screen
3356- if (QApplication::isLeftToRight()) {
3357- launcherRect.moveLeft(0);
3358- } else {
3359- QDesktopWidget* desktop = QApplication::desktop();
3360- const QRect screen = desktop->screenGeometry(m_panel);
3361- launcherRect.moveRight(screen.right());
3362- }
3363-
3364- WnckScreen* screen = wnck_screen_get_default();
3365- WnckWorkspace* workspace = wnck_screen_get_active_workspace(screen);
3366-
3367- // Check whether a window is crossing our launcher rect
3368- bool crossWindow = false;
3369- GList* list = wnck_screen_get_windows(screen);
3370- for (; list; list = g_list_next(list)) {
3371- WnckWindow* window = WNCK_WINDOW(list->data);
3372- if (wnck_window_is_on_workspace(window, workspace) && wnck_window_get_pid(window) != launcherPid) {
3373- WnckWindowType type = wnck_window_get_window_type(window);
3374-
3375- // Only take into account typical application windows
3376- if (type != WNCK_WINDOW_NORMAL &&
3377- type != WNCK_WINDOW_DIALOG &&
3378- type != WNCK_WINDOW_TOOLBAR &&
3379- type != WNCK_WINDOW_MENU &&
3380- type != WNCK_WINDOW_UTILITY) {
3381- continue;
3382- }
3383-
3384- WnckWindowState state = wnck_window_get_state(window);
3385-
3386- // Skip hidden (==minimized and other states) windows
3387- if (state & WNCK_WINDOW_STATE_HIDDEN) {
3388- continue;
3389- }
3390-
3391- // Check the window rect
3392- int x, y, width, height;
3393- wnck_window_get_geometry(window, &x, &y, &width, &height);
3394- QRect rect(x, y, width, height);
3395- if (rect.intersects(launcherRect)) {
3396- crossWindow = true;
3397- break;
3398- }
3399- }
3400- }
3401-
3402- if (crossWindow) {
3403- hidePanel();
3404- } else {
3405- showPanel();
3406- }
3407-}
3408-
3409-bool IntelliHideBehavior::eventFilter(QObject* object, QEvent* event)
3410-{
3411- switch (event->type()) {
3412- case QEvent::Enter:
3413- m_updateVisibilityTimer->stop();
3414- break;
3415- case QEvent::Leave:
3416- m_updateVisibilityTimer->start();
3417- break;
3418- default:
3419- break;
3420- }
3421- return false;
3422-}
3423-
3424-bool IntelliHideBehavior::isMouseForcingVisibility() const
3425-{
3426- // We check the cursor position ourself because using QWidget::underMouse()
3427- // is unreliable. It causes LP bug #740280
3428- return m_panel != NULL && m_panel->geometry().contains(QCursor::pos());
3429-}
3430-
3431-void IntelliHideBehavior::hidePanel()
3432-{
3433- if (m_visible) {
3434- m_visible = false;
3435- Q_EMIT visibleChanged(m_visible);
3436- createEdgeHitDetector();
3437- }
3438-}
3439-
3440-void IntelliHideBehavior::showPanel()
3441-{
3442- if (!m_visible) {
3443- // Delete the edge hit detector so that it does not prevent mouse events
3444- // from reaching the panel
3445- delete m_edgeHitDetector;
3446- m_edgeHitDetector = 0;
3447- m_visible = true;
3448- Q_EMIT visibleChanged(m_visible);
3449- }
3450-}
3451-
3452-void IntelliHideBehavior::createEdgeHitDetector()
3453-{
3454- m_edgeHitDetector = new EdgeHitDetector(this);
3455- connect(m_edgeHitDetector, SIGNAL(edgeHit()), SLOT(showPanel()));
3456-}
3457-
3458-void IntelliHideBehavior::setPanel(QWidget *panel)
3459-{
3460- if (m_panel != NULL) {
3461- m_panel->removeEventFilter(this);
3462- }
3463- AbstractVisibilityBehavior::setPanel(panel);
3464- if (m_panel != NULL) {
3465- m_panel->installEventFilter(this);
3466- }
3467-}
3468-
3469-#include "intellihidebehavior.moc"
3470
3471=== removed file 'libunity-2d-private/src/intellihidebehavior.h'
3472--- libunity-2d-private/src/intellihidebehavior.h 2011-06-11 11:33:52 +0000
3473+++ libunity-2d-private/src/intellihidebehavior.h 1970-01-01 00:00:00 +0000
3474@@ -1,75 +0,0 @@
3475-/*
3476- * This file is part of unity-2d
3477- *
3478- * Copyright 2011 Canonical Ltd.
3479- *
3480- * Authors:
3481- * - Aurélien Gâteau <aurelien.gateau@canonical.com>
3482- * - Florian Boucault <florian.boucault@canonical.com>
3483- *
3484- * License: GPL v3
3485- */
3486-#ifndef INTELLIHIDEBEHAVIOR_H
3487-#define INTELLIHIDEBEHAVIOR_H
3488-
3489-// Local
3490-#include <abstractvisibilitybehavior.h>
3491-
3492-// Qt
3493-#include <QObject>
3494-
3495-struct _WnckWindow;
3496-
3497-class QTimer;
3498-
3499-class QWidget;
3500-class EdgeHitDetector;
3501-
3502-/**
3503- * This class implements the Intellihide behavior of the launcher
3504- */
3505-class IntelliHideBehavior : public AbstractVisibilityBehavior
3506-{
3507- Q_OBJECT
3508-
3509- Q_PROPERTY(QWidget* panel READ panel WRITE setPanel NOTIFY panelChanged)
3510-
3511-public:
3512- IntelliHideBehavior(QWidget* panel=0);
3513- ~IntelliHideBehavior();
3514-
3515- // setters
3516- void setPanel(QWidget *panel);
3517-
3518-Q_SIGNALS:
3519- void panelChanged(QWidget *panel);
3520-
3521-protected:
3522- bool eventFilter(QObject*, QEvent*);
3523-
3524-private Q_SLOTS:
3525- void updateVisibility();
3526- void updateActiveWindowConnections();
3527- void showPanel();
3528- void hidePanel();
3529-
3530-private:
3531- Q_DISABLE_COPY(IntelliHideBehavior);
3532-
3533- enum PanelVisibility {
3534- VisiblePanel,
3535- HiddenPanel
3536- };
3537- QTimer* m_updateVisibilityTimer;
3538- EdgeHitDetector* m_edgeHitDetector;
3539-
3540- struct _WnckWindow* m_activeWindow;
3541-
3542- void disconnectFromGSignals();
3543-
3544- bool isMouseForcingVisibility() const;
3545-
3546- void createEdgeHitDetector();
3547-};
3548-
3549-#endif /* INTELLIHIDEBEHAVIOR_H */
3550
3551=== modified file 'libunity-2d-private/src/launcherclient.cpp'
3552--- libunity-2d-private/src/launcherclient.cpp 2011-12-11 16:36:28 +0000
3553+++ libunity-2d-private/src/launcherclient.cpp 2012-02-09 02:47:19 +0000
3554@@ -21,54 +21,6 @@
3555 // Self
3556 #include "launcherclient.h"
3557
3558-// Qt
3559-#include <QDBusConnection>
3560-#include <QDBusMessage>
3561-#include <QDBusPendingCall>
3562-
3563-static const char* LAUNCHER_DBUS_SERVICE = "com.canonical.Unity2d.Launcher";
3564-static const char* LAUNCHER_DBUS_OBJECT_PATH = "/Launcher";
3565-static const char* LAUNCHER_DBUS_INTERFACE = "com.canonical.Unity2d.Launcher";
3566-
3567 const int LauncherClient::MaximumWidth = 65;
3568
3569-struct LauncherClientPrivate
3570-{
3571- LauncherClient* q;
3572-
3573- void asyncDBusCall(const QString& methodName)
3574- {
3575- /* The constructor for QDBusInterface potentially does synchronous
3576- introspection calls. In contrast, this is really asynchronous.
3577- See rationale at https://bugs.launchpad.net/unity-2d/+bug/738025. */
3578- QDBusMessage call = QDBusMessage::createMethodCall(LAUNCHER_DBUS_SERVICE,
3579- LAUNCHER_DBUS_OBJECT_PATH,
3580- LAUNCHER_DBUS_INTERFACE,
3581- methodName);
3582- QDBusConnection::sessionBus().asyncCall(call);
3583- }
3584-};
3585-
3586-LauncherClient::LauncherClient(QObject* parent)
3587-: QObject(parent)
3588-, d(new LauncherClientPrivate)
3589-{
3590- d->q = this;
3591-}
3592-
3593-LauncherClient::~LauncherClient()
3594-{
3595- delete d;
3596-}
3597-
3598-void LauncherClient::beginForceVisible()
3599-{
3600- d->asyncDBusCall("BeginForceVisible");
3601-}
3602-
3603-void LauncherClient::endForceVisible()
3604-{
3605- d->asyncDBusCall("EndForceVisible");
3606-}
3607-
3608 #include "launcherclient.moc"
3609
3610=== modified file 'libunity-2d-private/src/launcherclient.h'
3611--- libunity-2d-private/src/launcherclient.h 2011-03-22 11:30:53 +0000
3612+++ libunity-2d-private/src/launcherclient.h 2012-02-09 02:47:19 +0000
3613@@ -26,26 +26,13 @@
3614 // Qt
3615 #include <QObject>
3616
3617-struct LauncherClientPrivate;
3618 /**
3619 * Makes it easy for unity-2d components to communicate with unity-2d-launcher
3620 */
3621-class LauncherClient : public QObject
3622+class LauncherClient
3623 {
3624- Q_OBJECT
3625 public:
3626- // The amount of pixels used by the launcher on the left edge when it is
3627- // fully visible.
3628 static const int MaximumWidth;
3629-
3630- LauncherClient(QObject* parent = 0);
3631- ~LauncherClient();
3632-
3633- void beginForceVisible();
3634- void endForceVisible();
3635-
3636-private:
3637- LauncherClientPrivate* const d;
3638 };
3639
3640 #endif /* LAUNCHERCLIENT_H */
3641
3642=== removed file 'libunity-2d-private/src/mousearea.cpp'
3643--- libunity-2d-private/src/mousearea.cpp 2011-06-11 10:50:03 +0000
3644+++ libunity-2d-private/src/mousearea.cpp 1970-01-01 00:00:00 +0000
3645@@ -1,117 +0,0 @@
3646-/*
3647- * This file is part of unity-2d
3648- *
3649- * Copyright 2011 Canonical Ltd.
3650- *
3651- * Authors:
3652- * - Aurélien Gâteau <aurelien.gateau@canonical.com>
3653- *
3654- * This program is free software; you can redistribute it and/or modify
3655- * it under the terms of the GNU General Public License as published
3656- * by the Free Software Foundation; version 3.
3657- *
3658- * This program is distributed in the hope that it will be useful,
3659- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3660- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3661- * GNU General Public License for more details.
3662- *
3663- * You should have received a copy of the GNU General Public License
3664- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3665- */
3666-// Self
3667-#include "mousearea.h"
3668-
3669-// Local
3670-#include <debug_p.h>
3671-
3672-// Qt
3673-#include <QX11Info>
3674-
3675-// X11
3676-#include <X11/Xlib.h>
3677-
3678-struct MouseAreaPrivate
3679-{
3680- Window m_window;
3681- QRect m_geometry;
3682- bool m_containsMouse;
3683-};
3684-
3685-MouseArea::MouseArea(QObject* parent)
3686-: QObject(parent)
3687-, d(new MouseAreaPrivate)
3688-{
3689- Unity2dApplication* application = Unity2dApplication::instance();
3690- if (application == NULL) {
3691- /* This can happen for example when using qmlviewer */
3692- UQ_WARNING << "The application is not an Unity2dApplication."
3693- "MouseArea disabled.";
3694- } else {
3695- application->installX11EventFilter(this);
3696- }
3697-
3698- d->m_containsMouse = false;
3699-
3700- XSetWindowAttributes attributes;
3701- attributes.override_redirect = True;
3702- attributes.event_mask = EnterWindowMask | LeaveWindowMask;
3703- unsigned long attributesMask = CWOverrideRedirect | CWEventMask;
3704-
3705- d->m_geometry = QRect(0, 0, 1, 1);
3706-
3707- d->m_window = XCreateWindow(QX11Info::display(), QX11Info::appRootWindow(),
3708- 0, 0, 1, 1, // geometry
3709- 0, // border_width
3710- 0, // depth
3711- InputOnly, // class
3712- CopyFromParent, // visual
3713- attributesMask,
3714- &attributes);
3715-
3716- XMapWindow(QX11Info::display(), d->m_window);
3717-}
3718-
3719-MouseArea::~MouseArea()
3720-{
3721- XDestroyWindow(QX11Info::display(), d->m_window);
3722- delete d;
3723-}
3724-
3725-QRect MouseArea::geometry() const
3726-{
3727- return d->m_geometry;
3728-}
3729-
3730-void MouseArea::setGeometry(const QRect& rect)
3731-{
3732- setGeometry(rect.x(), rect.y(), rect.width(), rect.height());
3733-}
3734-
3735-void MouseArea::setGeometry(int x, int y, int width, int height)
3736-{
3737- d->m_geometry = QRect(x, y, width, height);
3738- XMoveResizeWindow(QX11Info::display(), d->m_window, x, y, width, height);
3739-}
3740-
3741-bool MouseArea::x11EventFilter(XEvent* _event)
3742-{
3743- if (_event->type == EnterNotify || _event->type == LeaveNotify) {
3744- XCrossingEvent* event = (XCrossingEvent*)(_event);
3745- if (event->window == d->m_window) {
3746- d->m_containsMouse = event->type == EnterNotify;
3747- if (d->m_containsMouse) {
3748- entered();
3749- } else {
3750- exited();
3751- }
3752- }
3753- }
3754- return false;
3755-}
3756-
3757-bool MouseArea::containsMouse() const
3758-{
3759- return d->m_containsMouse;
3760-}
3761-
3762-#include "mousearea.moc"
3763
3764=== removed file 'libunity-2d-private/src/mousearea.h'
3765--- libunity-2d-private/src/mousearea.h 2011-02-15 18:18:13 +0000
3766+++ libunity-2d-private/src/mousearea.h 1970-01-01 00:00:00 +0000
3767@@ -1,60 +0,0 @@
3768-/*
3769- * This file is part of unity-2d
3770- *
3771- * Copyright 2011 Canonical Ltd.
3772- *
3773- * Authors:
3774- * - Aurélien Gâteau <aurelien.gateau@canonical.com>
3775- *
3776- * This program is free software; you can redistribute it and/or modify
3777- * it under the terms of the GNU General Public License as published
3778- * by the Free Software Foundation; version 3.
3779- *
3780- * This program is distributed in the hope that it will be useful,
3781- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3782- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3783- * GNU General Public License for more details.
3784- *
3785- * You should have received a copy of the GNU General Public License
3786- * along with this program. If not, see <http://www.gnu.org/licenses/>.
3787- */
3788-#ifndef MOUSEAREA_H
3789-#define MOUSEAREA_H
3790-
3791-// Local
3792-#include <unity2dapplication.h>
3793-
3794-// Qt
3795-#include <QObject>
3796-#include <QRect>
3797-
3798-struct MouseAreaPrivate;
3799-/**
3800- * A class to help detecting when the mouse cursor enters an area.
3801- * Quite similar to QML MouseArea item.
3802- */
3803-class MouseArea : public QObject, protected AbstractX11EventFilter
3804-{
3805-Q_OBJECT
3806-public:
3807- MouseArea(QObject* parent = 0);
3808- ~MouseArea();
3809-
3810- QRect geometry() const;
3811- void setGeometry(int x, int y, int width, int height);
3812- void setGeometry(const QRect&);
3813-
3814- bool containsMouse() const;
3815-
3816-Q_SIGNALS:
3817- void entered();
3818- void exited();
3819-
3820-protected:
3821- bool x11EventFilter(XEvent*);
3822-
3823-private:
3824- MouseAreaPrivate* const d;
3825-};
3826-
3827-#endif /* MOUSEAREA_H */
3828
3829=== added file 'libunity-2d-private/src/spreadmonitor.cpp'
3830--- libunity-2d-private/src/spreadmonitor.cpp 1970-01-01 00:00:00 +0000
3831+++ libunity-2d-private/src/spreadmonitor.cpp 2012-02-09 02:47:19 +0000
3832@@ -0,0 +1,61 @@
3833+/*
3834+ * Copyright (C) 2011 Canonical, Ltd.
3835+ *
3836+ * Authors:
3837+ * Ugo Riboni <ugo.riboni@canonical.com>
3838+ *
3839+ * This program is free software; you can redistribute it and/or modify
3840+ * it under the terms of the GNU General Public License as published by
3841+ * the Free Software Foundation; version 3.
3842+ *
3843+ * This program is distributed in the hope that it will be useful,
3844+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3845+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3846+ * GNU General Public License for more details.
3847+ *
3848+ * You should have received a copy of the GNU General Public License
3849+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3850+ */
3851+
3852+// local
3853+#include "abstractdbusservicemonitor.h"
3854+#include "spreadmonitor.h"
3855+
3856+// QT
3857+#include <QDBusConnection>
3858+#include <QDBusConnectionInterface>
3859+#include <QDBusReply>
3860+
3861+SpreadMonitor::SpreadMonitor(QObject *parent)
3862+ : AbstractDBusServiceMonitor("com.canonical.Unity2d.Spread", "/Spread",
3863+ "com.canonical.Unity2d.Spread", parent)
3864+{
3865+ connect(this, SIGNAL(serviceAvailableChanged(bool)), SLOT(onServiceAvailableChanged(bool)));
3866+
3867+ if (serviceAvailable()) {
3868+ onServiceAvailableChanged(true);
3869+ }
3870+}
3871+
3872+void SpreadMonitor::onServiceAvailableChanged(bool available)
3873+{
3874+ if (available) {
3875+ connect(dbusInterface(), SIGNAL(IsShownChanged(bool)), SIGNAL(shownChanged(bool)));
3876+
3877+ Q_EMIT shownChanged(shown());
3878+ } else {
3879+ Q_EMIT shownChanged(false);
3880+ }
3881+}
3882+
3883+bool SpreadMonitor::shown() const
3884+{
3885+ if (dbusInterface() == 0) {
3886+ return false;
3887+ } else {
3888+ QDBusReply<bool> result = dbusInterface()->call("IsShown");
3889+ return result.isValid() && result.value() == true;
3890+ }
3891+}
3892+
3893+#include "spreadmonitor.moc"
3894
3895=== added file 'libunity-2d-private/src/spreadmonitor.h'
3896--- libunity-2d-private/src/spreadmonitor.h 1970-01-01 00:00:00 +0000
3897+++ libunity-2d-private/src/spreadmonitor.h 2012-02-09 02:47:19 +0000
3898@@ -0,0 +1,48 @@
3899+/*
3900+ * Copyright (C) 2011 Canonical, Ltd.
3901+ *
3902+ * Authors:
3903+ * Ugo Riboni <ugo.riboni@canonical.com>
3904+ *
3905+ * This program is free software; you can redistribute it and/or modify
3906+ * it under the terms of the GNU General Public License as published by
3907+ * the Free Software Foundation; version 3.
3908+ *
3909+ * This program is distributed in the hope that it will be useful,
3910+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3911+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3912+ * GNU General Public License for more details.
3913+ *
3914+ * You should have received a copy of the GNU General Public License
3915+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3916+ */
3917+
3918+#ifndef SPREADMONITOR_H
3919+#define SPREADMONITOR_H
3920+
3921+// QT
3922+#include <QObject>
3923+#include <QMetaType>
3924+
3925+// local
3926+#include "abstractdbusservicemonitor.h"
3927+
3928+class SpreadMonitor : public AbstractDBusServiceMonitor
3929+{
3930+ Q_OBJECT
3931+ Q_PROPERTY(bool shown READ shown NOTIFY shownChanged)
3932+
3933+public:
3934+ explicit SpreadMonitor(QObject *parent = 0);
3935+ bool shown() const;
3936+
3937+protected Q_SLOTS:
3938+ void onServiceAvailableChanged(bool available);
3939+
3940+Q_SIGNALS:
3941+ void shownChanged(bool visible);
3942+};
3943+
3944+Q_DECLARE_METATYPE(SpreadMonitor*)
3945+
3946+#endif // SPREADMONITOR_H
3947
3948=== added file 'libunity-2d-private/src/strutmanager.cpp'
3949--- libunity-2d-private/src/strutmanager.cpp 1970-01-01 00:00:00 +0000
3950+++ libunity-2d-private/src/strutmanager.cpp 2012-02-09 02:47:19 +0000
3951@@ -0,0 +1,191 @@
3952+/*
3953+ * This file is part of unity-2d
3954+ *
3955+ * Copyright 2010, 2012 Canonical Ltd.
3956+ *
3957+ * Authors:
3958+ * - Aurélien Gâteau <aurelien.gateau@canonical.com>
3959+ * - Albert Astals Cid <albert.astals@canonical.com>
3960+ *
3961+ * This program is free software; you can redistribute it and/or modify
3962+ * it under the terms of the GNU General Public License as published
3963+ * by the Free Software Foundation; version 3.
3964+ *
3965+ * This program is distributed in the hope that it will be useful,
3966+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3967+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3968+ * GNU General Public License for more details.
3969+ *
3970+ * You should have received a copy of the GNU General Public License
3971+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3972+ */
3973+
3974+// Self
3975+#include "strutmanager.h"
3976+
3977+// Qt
3978+#include <QApplication>
3979+#include <QDesktopWidget>
3980+#include <QX11Info>
3981+
3982+// X
3983+#include <X11/Xlib.h>
3984+#include <X11/Xatom.h>
3985+
3986+static void setStrut(ulong* struts, WId effectiveWinId)
3987+{
3988+ static Atom atom = XInternAtom(QX11Info::display(), "_NET_WM_STRUT_PARTIAL", False);
3989+ XChangeProperty(QX11Info::display(), effectiveWinId, atom,
3990+ XA_CARDINAL, 32, PropModeReplace,
3991+ (unsigned char *) struts, 12);
3992+}
3993+
3994+StrutManager::StrutManager()
3995+ : m_enabled(true),
3996+ m_widget(NULL),
3997+ m_edge(Unity2dPanel::TopEdge),
3998+ m_width(-1),
3999+ m_height(-1)
4000+{
4001+}
4002+
4003+StrutManager::~StrutManager()
4004+{
4005+ if (m_enabled) {
4006+ releaseStrut();
4007+ }
4008+}
4009+
4010+bool StrutManager::enabled() const
4011+{
4012+ return m_enabled;
4013+}
4014+
4015+void StrutManager::setEnabled(bool value)
4016+{
4017+ if (m_enabled != value) {
4018+ if (value) {
4019+ reserveStrut();
4020+ } else {
4021+ releaseStrut();
4022+ }
4023+ m_enabled = value;
4024+ Q_EMIT enabledChanged(value);
4025+ }
4026+}
4027+
4028+QObject *StrutManager::widget() const
4029+{
4030+ return m_widget;
4031+}
4032+
4033+void StrutManager::setWidget(QObject *widget)
4034+{
4035+ m_widget = qobject_cast<QWidget*>(widget);
4036+ Q_ASSERT(m_widget != NULL);
4037+}
4038+
4039+Unity2dPanel::Edge StrutManager::edge() const
4040+{
4041+ return m_edge;
4042+}
4043+
4044+void StrutManager::setEdge(Unity2dPanel::Edge edge)
4045+{
4046+ m_edge = edge;
4047+ updateStrut();
4048+}
4049+
4050+int StrutManager::width() const
4051+{
4052+ return m_width;
4053+}
4054+
4055+void StrutManager::setWidth(int width)
4056+{
4057+ m_width = width;
4058+}
4059+
4060+int StrutManager::realWidth() const
4061+{
4062+ if (m_widget == NULL)
4063+ return m_width;
4064+
4065+ if (m_width == -1)
4066+ return m_widget->width();
4067+
4068+ return m_width;
4069+}
4070+
4071+int StrutManager::height() const
4072+{
4073+ return m_height;
4074+}
4075+
4076+void StrutManager::setHeight(int height)
4077+{
4078+ m_height = height;
4079+}
4080+
4081+int StrutManager::realHeight() const
4082+{
4083+ if (m_widget == NULL)
4084+ return m_height;
4085+
4086+ if (m_height == -1)
4087+ return m_widget->height();
4088+
4089+ return m_height;
4090+}
4091+
4092+void StrutManager::updateStrut()
4093+{
4094+ if (m_enabled) {
4095+ reserveStrut();
4096+ }
4097+}
4098+
4099+
4100+void StrutManager::reserveStrut()
4101+{
4102+ if (m_widget == NULL)
4103+ return;
4104+
4105+ QDesktopWidget* desktop = QApplication::desktop();
4106+ const QRect screen = desktop->screenGeometry(m_widget);
4107+ const QRect available = desktop->availableGeometry(m_widget);
4108+
4109+ ulong struts[12] = {};
4110+ switch (m_edge) {
4111+ case Unity2dPanel::LeftEdge:
4112+ if (QApplication::isLeftToRight()) {
4113+ struts[0] = realWidth();
4114+ struts[4] = available.top();
4115+ struts[5] = available.y() + available.height();
4116+ } else {
4117+ struts[1] = realWidth();
4118+ struts[6] = available.top();
4119+ struts[7] = available.y() + available.height();
4120+ }
4121+ break;
4122+ case Unity2dPanel::TopEdge:
4123+ struts[2] = realHeight();
4124+ struts[8] = screen.left();
4125+ struts[9] = screen.x() + screen.width();
4126+ break;
4127+ }
4128+
4129+ setStrut(struts, m_widget->effectiveWinId());
4130+}
4131+
4132+void StrutManager::releaseStrut()
4133+{
4134+ if (m_widget == NULL)
4135+ return;
4136+
4137+ ulong struts[12];
4138+ memset(struts, 0, sizeof struts);
4139+ setStrut(struts, m_widget->effectiveWinId());
4140+}
4141+
4142+#include "strutmanager.moc"
4143
4144=== added file 'libunity-2d-private/src/strutmanager.h'
4145--- libunity-2d-private/src/strutmanager.h 1970-01-01 00:00:00 +0000
4146+++ libunity-2d-private/src/strutmanager.h 2012-02-09 02:47:19 +0000
4147@@ -0,0 +1,92 @@
4148+/*
4149+ * This file is part of unity-2d
4150+ *
4151+ * Copyright 2010, 2012 Canonical Ltd.
4152+ *
4153+ * Authors:
4154+ * - Aurélien Gâteau <aurelien.gateau@canonical.com>
4155+ * - Albert Astals Cid <albert.astals@canonical.com>
4156+ *
4157+ * This program is free software; you can redistribute it and/or modify
4158+ * it under the terms of the GNU General Public License as published
4159+ * by the Free Software Foundation; version 3.
4160+ *
4161+ * This program is distributed in the hope that it will be useful,
4162+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
4163+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4164+ * GNU General Public License for more details.
4165+ *
4166+ * You should have received a copy of the GNU General Public License
4167+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
4168+ */
4169+
4170+#ifndef STRUTMANAGER_H
4171+#define STRUTMANAGER_H
4172+
4173+// Unity 2D
4174+#include "unity2dpanel.h"
4175+
4176+class StrutManager : public QObject
4177+{
4178+ Q_OBJECT
4179+ Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
4180+ Q_PROPERTY(QObject* widget READ widget WRITE setWidget)
4181+ Q_PROPERTY(Unity2dPanel::Edge edge READ edge WRITE setEdge)
4182+ Q_PROPERTY(int width READ width WRITE setWidth)
4183+ Q_PROPERTY(int height READ height WRITE setHeight)
4184+
4185+public:
4186+ StrutManager();
4187+ ~StrutManager();
4188+
4189+ bool enabled() const;
4190+ void setEnabled(bool value);
4191+
4192+ // QObject due to QML constraints
4193+ QObject *widget() const;
4194+ void setWidget(QObject *widget);
4195+
4196+ Unity2dPanel::Edge edge() const;
4197+ void setEdge(Unity2dPanel::Edge edge);
4198+
4199+ /**
4200+ * Returns the width set to the strut manager
4201+ * If is -1 (the default value) will use the width of the widget given in setWidget
4202+ */
4203+ int width() const;
4204+ void setWidth(int width);
4205+ /**
4206+ * Returns the actual width in use by the strut manager
4207+ * It is either width() or m_widget->width()
4208+ */
4209+ int realWidth() const;
4210+
4211+ /**
4212+ * Returns the height set to the strut manager
4213+ * If is -1 (the default value) will use the height of the widget given in setWidget
4214+ */
4215+ int height() const;
4216+ void setHeight(int height);
4217+ /**
4218+ * Returns the actual height in use by the strut manager
4219+ * It is either width() or m_widget->width()
4220+ */
4221+ int realHeight() const;
4222+
4223+ Q_INVOKABLE void updateStrut();
4224+
4225+Q_SIGNALS:
4226+ void enabledChanged(bool enabled);
4227+
4228+private:
4229+ void reserveStrut();
4230+ void releaseStrut();
4231+
4232+ bool m_enabled;
4233+ QWidget *m_widget;
4234+ Unity2dPanel::Edge m_edge;
4235+ int m_width;
4236+ int m_height;
4237+};
4238+
4239+#endif /* STRUTMANAGER_H */
4240\ No newline at end of file
4241
4242=== modified file 'libunity-2d-private/src/unity2dpanel.cpp'
4243--- libunity-2d-private/src/unity2dpanel.cpp 2012-02-03 18:05:42 +0000
4244+++ libunity-2d-private/src/unity2dpanel.cpp 2012-02-09 02:47:19 +0000
4245@@ -21,6 +21,7 @@
4246
4247 // Self
4248 #include "unity2dpanel.h"
4249+#include "strutmanager.h"
4250 #include <debug_p.h>
4251 #include <indicatorsmanager.h>
4252
4253@@ -32,10 +33,6 @@
4254 #include <QHBoxLayout>
4255 #include <QX11Info>
4256
4257-// X
4258-#include <X11/Xlib.h>
4259-#include <X11/Xatom.h>
4260-
4261 // unity-2d
4262 #include "screeninfo.h"
4263
4264@@ -47,57 +44,11 @@
4265 Unity2dPanel::Edge m_edge;
4266 mutable IndicatorsManager* m_indicatorsManager;
4267 QHBoxLayout* m_layout;
4268- QPropertyAnimation* m_slideInAnimation;
4269- QPropertyAnimation* m_slideOutAnimation;
4270- bool m_useStrut;
4271 int m_delta;
4272 bool m_manualSliding;
4273+ StrutManager m_strutManager;
4274 ScreenInfo* m_screenInfo;
4275
4276- void setStrut(ulong* struts)
4277- {
4278- static Atom atom = XInternAtom(QX11Info::display(), "_NET_WM_STRUT_PARTIAL", False);
4279- XChangeProperty(QX11Info::display(), q->effectiveWinId(), atom,
4280- XA_CARDINAL, 32, PropModeReplace,
4281- (unsigned char *) struts, 12);
4282- }
4283-
4284- void reserveStrut()
4285- {
4286- QDesktopWidget* desktop = QApplication::desktop();
4287- const QRect screen = desktop->screenGeometry(q);
4288- const QRect available = desktop->availableGeometry(q);
4289-
4290- ulong struts[12] = {};
4291- switch (m_edge) {
4292- case Unity2dPanel::LeftEdge:
4293- if (QApplication::isLeftToRight()) {
4294- struts[0] = q->width();
4295- struts[4] = available.top();
4296- struts[5] = available.y() + available.height();
4297- } else {
4298- struts[1] = q->width();
4299- struts[6] = available.top();
4300- struts[7] = available.y() + available.height();
4301- }
4302- break;
4303- case Unity2dPanel::TopEdge:
4304- struts[2] = q->height();
4305- struts[8] = screen.left();
4306- struts[9] = screen.x() + screen.width();
4307- break;
4308- }
4309-
4310- setStrut(struts);
4311- }
4312-
4313- void releaseStrut()
4314- {
4315- ulong struts[12];
4316- memset(struts, 0, sizeof struts);
4317- setStrut(struts);
4318- }
4319-
4320 void updateGeometry()
4321 {
4322 const QRect screen = m_screenInfo->geometry();
4323@@ -139,9 +90,7 @@
4324
4325 void updateEdge()
4326 {
4327- if (m_useStrut) {
4328- reserveStrut();
4329- }
4330+ m_strutManager.updateStrut();
4331 updateGeometry();
4332 updateLayoutDirection();
4333 }
4334@@ -151,10 +100,11 @@
4335 : QWidget(parent)
4336 , d(new Unity2dPanelPrivate)
4337 {
4338+ d->m_strutManager.setWidget(this);
4339+ d->m_strutManager.setEdge(Unity2dPanel::TopEdge);
4340 d->q = this;
4341 d->m_edge = Unity2dPanel::TopEdge;
4342 d->m_indicatorsManager = 0;
4343- d->m_useStrut = true;
4344 d->m_delta = 0;
4345 d->m_manualSliding = false;
4346 d->m_layout = new QHBoxLayout(this);
4347@@ -168,18 +118,6 @@
4348 d->m_screenInfo = new ScreenInfo(this, this);
4349 }
4350
4351- d->m_slideInAnimation = new QPropertyAnimation(this);
4352- d->m_slideInAnimation->setTargetObject(this);
4353- d->m_slideInAnimation->setPropertyName("delta");
4354- d->m_slideInAnimation->setDuration(SLIDE_DURATION);
4355- d->m_slideInAnimation->setEndValue(0);
4356-
4357- d->m_slideOutAnimation = new QPropertyAnimation(this);
4358- d->m_slideOutAnimation->setTargetObject(this);
4359- d->m_slideOutAnimation->setPropertyName("delta");
4360- d->m_slideOutAnimation->setDuration(SLIDE_DURATION);
4361- d->m_slideOutAnimation->setEndValue(-panelSize());
4362-
4363 setAttribute(Qt::WA_X11NetWmWindowTypeDock);
4364 setAttribute(Qt::WA_Hover);
4365
4366@@ -190,19 +128,18 @@
4367 }
4368
4369 connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), SLOT(slotWorkAreaResized(int)));
4370+ connect(&d->m_strutManager, SIGNAL(enabledChanged(bool)), SIGNAL(useStrutChanged(bool)));
4371 }
4372
4373 Unity2dPanel::~Unity2dPanel()
4374 {
4375- if (d->m_useStrut) {
4376- d->releaseStrut();
4377- }
4378 delete d;
4379 }
4380
4381 void Unity2dPanel::setEdge(Unity2dPanel::Edge edge)
4382 {
4383 d->m_edge = edge;
4384+ d->m_strutManager.setEdge(edge);
4385 if (isVisible()) {
4386 d->updateEdge();
4387 }
4388@@ -237,13 +174,6 @@
4389 {
4390 QWidget::showEvent(event);
4391 d->updateEdge();
4392- d->m_slideOutAnimation->setEndValue(-panelSize());
4393-}
4394-
4395-void Unity2dPanel::resizeEvent(QResizeEvent* event)
4396-{
4397- QWidget::resizeEvent(event);
4398- d->m_slideOutAnimation->setEndValue(-panelSize());
4399 }
4400
4401 void Unity2dPanel::slotWorkAreaResized(int screen)
4402@@ -273,20 +203,12 @@
4403
4404 bool Unity2dPanel::useStrut() const
4405 {
4406- return d->m_useStrut;
4407+ return d->m_strutManager.enabled();
4408 }
4409
4410 void Unity2dPanel::setUseStrut(bool value)
4411 {
4412- if (d->m_useStrut != value) {
4413- if (value) {
4414- d->reserveStrut();
4415- } else {
4416- d->releaseStrut();
4417- }
4418- d->m_useStrut = value;
4419- Q_EMIT useStrutChanged(value);
4420- }
4421+ d->m_strutManager.setEnabled(value);
4422 }
4423
4424 int Unity2dPanel::delta() const
4425@@ -309,24 +231,6 @@
4426 return (d->m_edge == Unity2dPanel::TopEdge) ? height() : width();
4427 }
4428
4429-void Unity2dPanel::slideIn()
4430-{
4431- d->m_slideOutAnimation->stop();
4432- if (d->m_slideInAnimation->state() != QAbstractAnimation::Running) {
4433- d->m_slideInAnimation->setStartValue(d->m_delta);
4434- d->m_slideInAnimation->start();
4435- }
4436-}
4437-
4438-void Unity2dPanel::slideOut()
4439-{
4440- d->m_slideInAnimation->stop();
4441- if (d->m_slideOutAnimation->state() != QAbstractAnimation::Running) {
4442- d->m_slideOutAnimation->setStartValue(d->m_delta);
4443- d->m_slideOutAnimation->start();
4444- }
4445-}
4446-
4447 bool Unity2dPanel::manualSliding() const
4448 {
4449 return d->m_manualSliding;
4450@@ -336,10 +240,6 @@
4451 {
4452 if (d->m_manualSliding != manualSliding) {
4453 d->m_manualSliding = manualSliding;
4454- if (manualSliding) {
4455- d->m_slideInAnimation->stop();
4456- d->m_slideOutAnimation->stop();
4457- }
4458 Q_EMIT manualSlidingChanged(d->m_manualSliding);
4459 }
4460 }
4461
4462=== modified file 'libunity-2d-private/src/unity2dpanel.h'
4463--- libunity-2d-private/src/unity2dpanel.h 2012-02-01 16:00:48 +0000
4464+++ libunity-2d-private/src/unity2dpanel.h 2012-02-09 02:47:19 +0000
4465@@ -47,6 +47,7 @@
4466 */
4467 Q_PROPERTY(int manualSliding READ manualSliding WRITE setManualSliding NOTIFY manualSlidingChanged)
4468 Q_PROPERTY(bool useStrut READ useStrut WRITE setUseStrut NOTIFY useStrutChanged)
4469+ Q_ENUMS(Edge)
4470
4471 public:
4472 enum Edge {
4473@@ -89,17 +90,12 @@
4474
4475 QString id() const;
4476
4477-public Q_SLOTS:
4478- void slideIn();
4479- void slideOut();
4480-
4481 Q_SIGNALS:
4482 void manualSlidingChanged(bool);
4483 void useStrutChanged(bool);
4484
4485 protected:
4486 virtual void showEvent(QShowEvent*);
4487- virtual void resizeEvent(QResizeEvent*);
4488 virtual void paintEvent(QPaintEvent*);
4489
4490 private Q_SLOTS:
4491
4492=== added file 'libunity-2d-private/src/windowsintersectmonitor.cpp'
4493--- libunity-2d-private/src/windowsintersectmonitor.cpp 1970-01-01 00:00:00 +0000
4494+++ libunity-2d-private/src/windowsintersectmonitor.cpp 2012-02-09 02:47:19 +0000
4495@@ -0,0 +1,183 @@
4496+/*
4497+ * This file is part of unity-2d
4498+ *
4499+ * Copyright 2011 Canonical Ltd.
4500+ *
4501+ * Authors:
4502+ * - Aurélien Gâteau <aurelien.gateau@canonical.com>
4503+ * - Florian Boucault <florian.boucault@canonical.com>
4504+ * - Ugo Riboni <ugo.riboni@canonical.com>
4505+ *
4506+ * License: GPL v3
4507+ */
4508+
4509+// Self
4510+#include "windowsintersectmonitor.h"
4511+
4512+// libunity-2d
4513+#include <debug_p.h>
4514+
4515+// Qt
4516+#include <QCursor>
4517+#include <QEvent>
4518+#include <QTimer>
4519+#include <QWidget>
4520+#include <QDesktopWidget>
4521+
4522+// libwnck
4523+extern "C" {
4524+#include <libwnck/libwnck.h>
4525+}
4526+
4527+// Handy macros to declare GObject callbacks. The 'n' in CALLBACKn refers to
4528+// the number of dummy arguments the callback returns
4529+#define GOBJECT_CALLBACK0(callbackName, slot) \
4530+static void \
4531+callbackName(GObject* src, QObject* dst) \
4532+{ \
4533+ QMetaObject::invokeMethod(dst, slot); \
4534+}
4535+
4536+#define GOBJECT_CALLBACK1(callbackName, slot) \
4537+static void \
4538+callbackName(GObject* src, void* dummy1, QObject* dst) \
4539+{ \
4540+ QMetaObject::invokeMethod(dst, slot); \
4541+}
4542+
4543+#define GOBJECT_CALLBACK2(callbackName, slot) \
4544+static void \
4545+callbackName(GObject* src, void* dummy1, void* dummy2, QObject* dst) \
4546+{ \
4547+ QMetaObject::invokeMethod(dst, slot); \
4548+}
4549+
4550+// Screen callbacks
4551+GOBJECT_CALLBACK1(activeWindowChangedCB, "updateActiveWindowConnections");
4552+GOBJECT_CALLBACK1(activeWorkspaceChangedCB, "updateIntersect");
4553+GOBJECT_CALLBACK0(showingDesktopChangedCB, "updateIntersect");
4554+
4555+// Window callbacks
4556+GOBJECT_CALLBACK2(stateChangedCB, "updateIntersect");
4557+GOBJECT_CALLBACK0(geometryChangedCB, "updateIntersect");
4558+GOBJECT_CALLBACK0(workspaceChangedCB, "updateIntersect");
4559+
4560+WindowsIntersectMonitor::WindowsIntersectMonitor()
4561+ : QObject()
4562+ , m_activeWindow(0)
4563+{
4564+ WnckScreen* screen = wnck_screen_get_default();
4565+ g_signal_connect(G_OBJECT(screen), "active-window-changed", G_CALLBACK(activeWindowChangedCB), this);
4566+ g_signal_connect(G_OBJECT(screen), "active-workspace-changed", G_CALLBACK(activeWorkspaceChangedCB), this);
4567+ g_signal_connect(G_OBJECT(screen), "showing-desktop-changed", G_CALLBACK(showingDesktopChangedCB), this);
4568+
4569+ updateActiveWindowConnections();
4570+}
4571+
4572+WindowsIntersectMonitor::~WindowsIntersectMonitor()
4573+{
4574+ disconnectFromGSignals();
4575+ WnckScreen* screen = wnck_screen_get_default();
4576+ g_signal_handlers_disconnect_by_func(G_OBJECT(screen), gpointer(activeWindowChangedCB), this);
4577+ g_signal_handlers_disconnect_by_func(G_OBJECT(screen), gpointer(activeWorkspaceChangedCB), this);
4578+ g_signal_handlers_disconnect_by_func(G_OBJECT(screen), gpointer(showingDesktopChangedCB), this);
4579+}
4580+
4581+void WindowsIntersectMonitor::disconnectFromGSignals()
4582+{
4583+ if (m_activeWindow) {
4584+ g_signal_handlers_disconnect_by_func(m_activeWindow, gpointer(stateChangedCB), this);
4585+ g_signal_handlers_disconnect_by_func(m_activeWindow, gpointer(geometryChangedCB), this);
4586+ g_signal_handlers_disconnect_by_func(m_activeWindow, gpointer(workspaceChangedCB), this);
4587+ }
4588+}
4589+
4590+void WindowsIntersectMonitor::updateActiveWindowConnections()
4591+{
4592+ WnckScreen* screen = wnck_screen_get_default();
4593+
4594+ disconnectFromGSignals();
4595+ m_activeWindow = 0;
4596+
4597+ WnckWindow* window = wnck_screen_get_active_window(screen);
4598+ if (window) {
4599+ m_activeWindow = window;
4600+ g_signal_connect(G_OBJECT(window), "state-changed", G_CALLBACK(stateChangedCB), this);
4601+ g_signal_connect(G_OBJECT(window), "geometry-changed", G_CALLBACK(geometryChangedCB), this);
4602+ g_signal_connect(G_OBJECT(window), "workspace-changed", G_CALLBACK(workspaceChangedCB), this);
4603+ }
4604+
4605+ updateIntersect();
4606+}
4607+
4608+void WindowsIntersectMonitor::updateIntersect()
4609+{
4610+ int thisProcessPid = getpid();
4611+
4612+ WnckScreen* screen = wnck_screen_get_default();
4613+ WnckWorkspace* workspace = wnck_screen_get_active_workspace(screen);
4614+
4615+ // Check whether a window is crossing our rect
4616+ bool crossWindow = false;
4617+ if (!wnck_screen_get_showing_desktop(screen)) {
4618+ GList* list = wnck_screen_get_windows(screen);
4619+ for (; list; list = g_list_next(list)) {
4620+ WnckWindow* window = WNCK_WINDOW(list->data);
4621+ if (wnck_window_is_on_workspace(window, workspace) &&
4622+ wnck_window_get_pid(window) != thisProcessPid) {
4623+ WnckWindowType type = wnck_window_get_window_type(window);
4624+
4625+ // Only take into account typical application windows
4626+ if (type != WNCK_WINDOW_NORMAL &&
4627+ type != WNCK_WINDOW_DIALOG &&
4628+ type != WNCK_WINDOW_TOOLBAR &&
4629+ type != WNCK_WINDOW_MENU &&
4630+ type != WNCK_WINDOW_UTILITY) {
4631+ continue;
4632+ }
4633+
4634+ WnckWindowState state = wnck_window_get_state(window);
4635+
4636+ // Skip hidden (==minimized and other states) windows
4637+ if (state & WNCK_WINDOW_STATE_HIDDEN) {
4638+ continue;
4639+ }
4640+
4641+ // Check the window rect
4642+ int x, y, width, height;
4643+ wnck_window_get_geometry(window, &x, &y, &width, &height);
4644+ QRectF rect(x, y, width, height);
4645+ if (rect.intersects(m_monitoredArea)) {
4646+ crossWindow = true;
4647+ break;
4648+ }
4649+ }
4650+ }
4651+ }
4652+
4653+ if (crossWindow != m_intersects) {
4654+ m_intersects = crossWindow;
4655+ Q_EMIT intersectsChanged();
4656+ }
4657+}
4658+
4659+QRectF WindowsIntersectMonitor::monitoredArea() const
4660+{
4661+ return m_monitoredArea;
4662+}
4663+
4664+void WindowsIntersectMonitor::setMonitoredArea(const QRectF& monitoredArea)
4665+{
4666+ if (m_monitoredArea != monitoredArea) {
4667+ m_monitoredArea = monitoredArea;
4668+ Q_EMIT monitoredAreaChanged();
4669+ updateIntersect();
4670+ }
4671+}
4672+
4673+bool WindowsIntersectMonitor::intersects() const
4674+{
4675+ return m_intersects;
4676+}
4677+
4678+#include "windowsintersectmonitor.moc"
4679
4680=== added file 'libunity-2d-private/src/windowsintersectmonitor.h'
4681--- libunity-2d-private/src/windowsintersectmonitor.h 1970-01-01 00:00:00 +0000
4682+++ libunity-2d-private/src/windowsintersectmonitor.h 2012-02-09 02:47:19 +0000
4683@@ -0,0 +1,55 @@
4684+/*
4685+ * This file is part of unity-2d
4686+ *
4687+ * Copyright 2011 Canonical Ltd.
4688+ *
4689+ * Authors:
4690+ * - Aurélien Gâteau <aurelien.gateau@canonical.com>
4691+ * - Florian Boucault <florian.boucault@canonical.com>
4692+ * - Ugo Riboni <ugo.riboni@canonical.com>
4693+ *
4694+ * License: GPL v3
4695+ */
4696+#ifndef WINDOWSINTERSECTMONITOR_H
4697+#define WINDOWSINTERSECTMONITOR_H
4698+
4699+// Qt
4700+#include <QObject>
4701+#include <QRectF>
4702+
4703+struct _WnckWindow;
4704+
4705+class WindowsIntersectMonitor : public QObject
4706+{
4707+ Q_OBJECT
4708+
4709+ Q_PROPERTY(QRectF monitoredArea READ monitoredArea WRITE setMonitoredArea
4710+ NOTIFY monitoredAreaChanged)
4711+ Q_PROPERTY(bool intersects READ intersects NOTIFY intersectsChanged)
4712+
4713+public:
4714+ WindowsIntersectMonitor();
4715+ ~WindowsIntersectMonitor();
4716+
4717+ QRectF monitoredArea() const;
4718+ void setMonitoredArea(const QRectF& monitoredArea);
4719+ bool intersects() const;
4720+
4721+Q_SIGNALS:
4722+ void monitoredAreaChanged();
4723+ void intersectsChanged();
4724+
4725+private Q_SLOTS:
4726+ void updateIntersect();
4727+ void updateActiveWindowConnections();
4728+
4729+private:
4730+ Q_DISABLE_COPY(WindowsIntersectMonitor);
4731+ void disconnectFromGSignals();
4732+
4733+ struct _WnckWindow* m_activeWindow;
4734+ QRectF m_monitoredArea;
4735+ bool m_intersects;
4736+};
4737+
4738+#endif /* WINDOWSINTERSECTMONITOR_H */
4739
4740=== modified file 'libunity-2d-private/tests/CMakeLists.txt'
4741--- libunity-2d-private/tests/CMakeLists.txt 2011-12-07 12:46:10 +0000
4742+++ libunity-2d-private/tests/CMakeLists.txt 2012-02-09 02:47:19 +0000
4743@@ -83,10 +83,3 @@
4744 # COMMAND /bin/sh gnomesessionclienttest.sh
4745 # )
4746
4747-# mouseareademo
4748-add_executable(mouseareademo
4749- mouseareademo.cpp
4750- )
4751-target_link_libraries(mouseareademo
4752- unity-2d-private
4753- )
4754
4755=== removed file 'libunity-2d-private/tests/mouseareademo.cpp'
4756--- libunity-2d-private/tests/mouseareademo.cpp 2011-07-18 14:36:34 +0000
4757+++ libunity-2d-private/tests/mouseareademo.cpp 1970-01-01 00:00:00 +0000
4758@@ -1,48 +0,0 @@
4759-/*
4760- * This file is part of unity-2d
4761- *
4762- * Copyright 2011 Canonical Ltd.
4763- *
4764- * Authors:
4765- * - Aurélien Gâteau <aurelien.gateau@canonical.com>
4766- *
4767- * This program is free software; you can redistribute it and/or modify
4768- * it under the terms of the GNU General Public License as published
4769- * by the Free Software Foundation; version 3.
4770- *
4771- * This program is distributed in the hope that it will be useful,
4772- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4773- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4774- * GNU General Public License for more details.
4775- *
4776- * You should have received a copy of the GNU General Public License
4777- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4778- */
4779-
4780-// Local
4781-#include <mousearea.h>
4782-#include <unity2dapplication.h>
4783-
4784-// Qt
4785-#include <QLabel>
4786-#include <QVBoxLayout>
4787-
4788-int main(int argc, char** argv)
4789-{
4790- Unity2dApplication::earlySetup(argc, argv);
4791- Unity2dApplication app(argc, argv);
4792- QWidget window;
4793- QLabel* enteredLabel = new QLabel("Entered");
4794- QVBoxLayout* layout = new QVBoxLayout(&window);
4795- layout->addWidget(enteredLabel);
4796-
4797- MouseArea* area = new MouseArea(&window);
4798- area->setGeometry(QRect(10, 10, 200, 100));
4799- QObject::connect(area, SIGNAL(entered()), enteredLabel, SLOT(show()));
4800- QObject::connect(area, SIGNAL(exited()), enteredLabel, SLOT(hide()));
4801-
4802- enteredLabel->setVisible(area->containsMouse());
4803-
4804- window.show();
4805- return app.exec();
4806-}
4807
4808=== modified file 'panel/applets/CMakeLists.txt'
4809--- panel/applets/CMakeLists.txt 2011-08-29 00:47:24 +0000
4810+++ panel/applets/CMakeLists.txt 2012-02-09 02:47:19 +0000
4811@@ -1,5 +1,4 @@
4812 add_subdirectory(separator)
4813-add_subdirectory(homebutton)
4814 add_subdirectory(appname)
4815 add_subdirectory(legacytray)
4816 add_subdirectory(indicator)
4817
4818=== removed directory 'panel/applets/homebutton'
4819=== removed file 'panel/applets/homebutton/CMakeLists.txt'
4820--- panel/applets/homebutton/CMakeLists.txt 2011-11-09 21:28:49 +0000
4821+++ panel/applets/homebutton/CMakeLists.txt 1970-01-01 00:00:00 +0000
4822@@ -1,33 +0,0 @@
4823-project(panelplugin-homebutton)
4824-
4825-# Sources
4826-set(homebutton_SRCS
4827- homebuttonapplet.cpp
4828- homebutton.cpp
4829- plugin.cpp
4830- )
4831-
4832-# Build
4833-include_directories(
4834- ${CMAKE_CURRENT_SOURCE_DIR}
4835- ${CMAKE_CURRENT_BINARY_DIR}
4836- ${libunity-2d-private_SOURCE_DIR}/src
4837- )
4838-
4839-qt4_automoc(${homebutton_SRCS})
4840-add_library(panelplugin-homebutton SHARED ${homebutton_SRCS})
4841-set_target_properties(panelplugin-homebutton PROPERTIES
4842- LIBRARY_OUTPUT_DIRECTORY ".."
4843- VERSION 0
4844- SOVERSION 0.0
4845- )
4846-
4847-target_link_libraries(panelplugin-homebutton
4848- ${QT_QTGUI_LIBRARIES}
4849- ${QT_QTCORE_LIBRARIES}
4850- unity-2d-private
4851- )
4852-
4853-install(TARGETS panelplugin-homebutton
4854- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/unity-2d/plugins/panel
4855- )
4856
4857=== removed file 'panel/applets/homebutton/homebutton.cpp'
4858--- panel/applets/homebutton/homebutton.cpp 2011-08-22 10:47:51 +0000
4859+++ panel/applets/homebutton/homebutton.cpp 1970-01-01 00:00:00 +0000
4860@@ -1,63 +0,0 @@
4861-/*
4862- * This file is part of unity-2d
4863- *
4864- * Copyright 2011 Canonical Ltd.
4865- *
4866- * Authors:
4867- * - Alberto Mardegan <mardy@users.sourceforge.net>
4868- *
4869- * This program is free software; you can redistribute it and/or modify
4870- * it under the terms of the GNU General Public License as published by
4871- * the Free Software Foundation; version 3.
4872- *
4873- * This program is distributed in the hope that it will be useful,
4874- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4875- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4876- * GNU General Public License for more details.
4877- *
4878- * You should have received a copy of the GNU General Public License
4879- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4880- */
4881-
4882-// Self
4883-#include "homebutton.h"
4884-
4885-// Local
4886-#include <debug_p.h>
4887-
4888-// Qt
4889-#include <QApplication>
4890-
4891-HomeButton::HomeButton(QWidget *parent)
4892-: QToolButton(parent)
4893-{
4894- setAutoRaise(true);
4895- setIconSize(QSize(24, 24));
4896- QString themeIconName = QIcon::hasThemeIcon("start-here") ? "start-here" : "distributor-logo";
4897- setIcon(QIcon::fromTheme(themeIconName));
4898- setCheckable(true);
4899-
4900- setStyleSheet(
4901- "QToolButton { border: none; margin: 0; padding: 0; width: 61 }"
4902- "QToolButton:checked, QToolButton:pressed {"
4903- " padding-top: 1px;"
4904- " padding-left: 1px;"
4905- " padding-right: -1px;"
4906- " padding-bottom: -1px;"
4907- "}"
4908- );
4909-}
4910-
4911-void HomeButton::mousePressEvent(QMouseEvent *event)
4912-{
4913- if (lastClickTime.isValid() &&
4914- lastClickTime.elapsed() < QApplication::doubleClickInterval()) {
4915- /* ignore this click */
4916- return;
4917- }
4918-
4919- QToolButton::mousePressEvent(event);
4920- lastClickTime.restart();
4921-}
4922-
4923-#include "homebutton.moc"
4924
4925=== removed file 'panel/applets/homebutton/homebutton.h'
4926--- panel/applets/homebutton/homebutton.h 2011-08-22 09:17:03 +0000
4927+++ panel/applets/homebutton/homebutton.h 1970-01-01 00:00:00 +0000
4928@@ -1,43 +0,0 @@
4929-/*
4930- * This file is part of unity-2d
4931- *
4932- * Copyright 2011 Canonical Ltd.
4933- *
4934- * Authors:
4935- * - Alberto Mardegan <mardy@users.sourceforge.net>
4936- *
4937- * This program is free software; you can redistribute it and/or modify
4938- * it under the terms of the GNU General Public License as published by
4939- * the Free Software Foundation; version 3.
4940- *
4941- * This program is distributed in the hope that it will be useful,
4942- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4943- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4944- * GNU General Public License for more details.
4945- *
4946- * You should have received a copy of the GNU General Public License
4947- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4948- */
4949-
4950-#ifndef HOMEBUTTON_H
4951-#define HOMEBUTTON_H
4952-
4953-// Qt
4954-#include <QTime>
4955-#include <QToolButton>
4956-
4957-class HomeButton : public QToolButton
4958-{
4959-Q_OBJECT
4960-public:
4961- HomeButton(QWidget *parent = 0);
4962-
4963-protected:
4964- void mousePressEvent(QMouseEvent*);
4965-
4966-private:
4967- Q_DISABLE_COPY(HomeButton)
4968- QTime lastClickTime;
4969-};
4970-
4971-#endif /* HOMEBUTTON_H */
4972
4973=== removed file 'panel/applets/homebutton/homebuttonapplet.cpp'
4974--- panel/applets/homebutton/homebuttonapplet.cpp 2011-08-22 09:17:03 +0000
4975+++ panel/applets/homebutton/homebuttonapplet.cpp 1970-01-01 00:00:00 +0000
4976@@ -1,112 +0,0 @@
4977-/*
4978- * This file is part of unity-2d
4979- *
4980- * Copyright 2010 Canonical Ltd.
4981- *
4982- * Authors:
4983- * - Aurélien Gâteau <aurelien.gateau@canonical.com>
4984- *
4985- * This program is free software; you can redistribute it and/or modify
4986- * it under the terms of the GNU General Public License as published by
4987- * the Free Software Foundation; version 3.
4988- *
4989- * This program is distributed in the hope that it will be useful,
4990- * but WITHOUT ANY WARRANTY; without even the implied warranty of
4991- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4992- * GNU General Public License for more details.
4993- *
4994- * You should have received a copy of the GNU General Public License
4995- * along with this program. If not, see <http://www.gnu.org/licenses/>.
4996- */
4997-
4998-// Self
4999-#include "homebuttonapplet.h"
5000-
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches