Merge lp:~aacid/unity-2d/fix_4finger_dash_toggle into lp:unity-2d

Proposed by Albert Astals Cid
Status: Merged
Approved by: Gerry Boland
Approved revision: 1060
Merged at revision: 1064
Proposed branch: lp:~aacid/unity-2d/fix_4finger_dash_toggle
Merge into: lp:unity-2d
Diff against target: 122 lines (+31/-18)
4 files modified
libunity-2d-private/src/gesturehandler.cpp (+15/-18)
libunity-2d-private/src/gesturehandler.h (+5/-0)
shell/Shell.qml (+1/-0)
tests/manual-tests/dash.txt (+10/-0)
To merge this branch: bzr merge lp:~aacid/unity-2d/fix_4finger_dash_toggle
Reviewer Review Type Date Requested Status
Gerry Boland (community) Approve
Paweł Stołowski Pending
Review via email: mp+101549@code.launchpad.net

Commit message

Fix "Four finger tap does not open the Dash" by using inprocess method calls instead of dbus calls

Description of the change

Do not use dbus when we can use inprocess method calls

To post a comment you must log in.
1059. By Albert Astals Cid

Manual test

1060. By Albert Astals Cid

it's 4 finger tap we are testing

Revision history for this message
Gerry Boland (gerboland) wrote :

Looks great, thank you

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libunity-2d-private/src/gesturehandler.cpp'
2--- libunity-2d-private/src/gesturehandler.cpp 2012-02-10 16:28:48 +0000
3+++ libunity-2d-private/src/gesturehandler.cpp 2012-04-11 13:49:18 +0000
4@@ -29,6 +29,7 @@
5 : QObject(parent)
6 , m_geisInstance(NULL)
7 , m_isDragging(false)
8+, m_dashManager(NULL)
9 {
10 if (geisInitialize() != GEIS_STATUS_SUCCESS) {
11 UQ_WARNING << "GEIS initialization failed: multitouch support disabled";
12@@ -117,23 +118,6 @@
13 &m_gestureFuncs, this);
14 }
15
16-
17-static void toggleDash()
18-{
19- /* A 4 fingers tap will either:
20- - show the home page of the dash if the dash is closed
21- - close the dash, if the dash is opened
22- */
23- QDBusInterface dashInterface("com.canonical.Unity2d.Dash", "/Dash", "com.canonical.Unity2d.Dash");
24- bool dashActive = dashInterface.property("active").toBool();
25-
26- if (dashActive) {
27- dashInterface.setProperty("active", false);
28- } else {
29- dashInterface.call(QDBus::Block, "activateHome");
30- }
31-}
32-
33 /* FIXME: zooming in/out in the spread should have 3 levels:
34 1) showing all windows of the focused application in the current workspace
35 2) showing all windows in the current workspace
36@@ -232,7 +216,10 @@
37
38 if (gestureName == GEIS_GESTURE_TYPE_TAP4) {
39 /* 4 fingers tap toggles the dash on and off */
40- toggleDash();
41+ Q_ASSERT(m_dashManager != NULL);
42+ if (m_dashManager != NULL) {
43+ QMetaObject::invokeMethod(m_dashManager, "toggleDashRequested");
44+ }
45 } else if (gestureName == GEIS_GESTURE_TYPE_PINCH3) {
46 /* Continuing a 3 fingers pinch inwards/outwards shows/hides the workspace switcher. */
47 int timestamp = attributes[GEIS_GESTURE_ATTRIBUTE_TIMESTAMP].integer_val;
48@@ -291,4 +278,14 @@
49 return m_isDragging;
50 }
51
52+QObject *GestureHandler::dashManager() const
53+{
54+ return m_dashManager;
55+}
56+
57+void GestureHandler::setDashManager(QObject *dashManager)
58+{
59+ m_dashManager = dashManager;
60+}
61+
62 #include "gesturehandler.moc"
63
64=== modified file 'libunity-2d-private/src/gesturehandler.h'
65--- libunity-2d-private/src/gesturehandler.h 2011-11-14 18:40:49 +0000
66+++ libunity-2d-private/src/gesturehandler.h 2012-04-11 13:49:18 +0000
67@@ -33,6 +33,7 @@
68 Q_OBJECT
69 Q_PROPERTY(double dragDelta READ dragDelta NOTIFY dragDeltaChanged)
70 Q_PROPERTY(bool isDragging READ isDragging NOTIFY isDraggingChanged)
71+ Q_PROPERTY(QObject *dashManager READ dashManager WRITE setDashManager)
72
73 public:
74 explicit GestureHandler(QObject *parent = 0);
75@@ -41,6 +42,9 @@
76 double dragDelta() const;
77 bool isDragging() const;
78
79+ QObject *dashManager() const;
80+ void setDashManager(QObject *dashManager);
81+
82 Q_SIGNALS:
83 void dragDeltaChanged();
84 void isDraggingChanged();
85@@ -70,6 +74,7 @@
86 int m_pinchPreviousTimestamp;
87 float m_dragDelta;
88 bool m_isDragging;
89+ QObject *m_dashManager;
90 };
91
92 Q_DECLARE_METATYPE(GestureHandler*)
93
94=== modified file 'shell/Shell.qml'
95--- shell/Shell.qml 2012-04-06 15:16:39 +0000
96+++ shell/Shell.qml 2012-04-11 13:49:18 +0000
97@@ -58,6 +58,7 @@
98
99 GestureHandler {
100 id: gestureHandler
101+ dashManager: shellManager
102 }
103
104 onDashLoaderChanged: {
105
106=== modified file 'tests/manual-tests/dash.txt'
107--- tests/manual-tests/dash.txt 2012-04-04 09:08:15 +0000
108+++ tests/manual-tests/dash.txt 2012-04-11 13:49:18 +0000
109@@ -125,3 +125,13 @@
110 # * Verify the results have the cover of the song/album and not the ? icon
111
112 -----
113+
114+ # Test case objectives:
115+ # * Verify the 4 finger tap gesture toggles the dash
116+ # Pre-conditions
117+ # * None
118+ # Test steps
119+ # * Use the 4 finger tap gesture to open the dash
120+ # * Use the 4 finger tap gesture to close the dash
121+
122+-----

Subscribers

People subscribed via source and target branches