Merge lp:~fboucault/unity-2d/fix_geis_gesture_names into lp:unity-2d/3.0

Proposed by Florian Boucault
Status: Merged
Approved by: Florian Boucault
Approved revision: 447
Merged at revision: 469
Proposed branch: lp:~fboucault/unity-2d/fix_geis_gesture_names
Merge into: lp:unity-2d/3.0
Diff against target: 58 lines (+6/-9)
1 file modified
launcher/app/gesturehandler.cpp (+6/-9)
To merge this branch: bzr merge lp:~fboucault/unity-2d/fix_geis_gesture_names
Reviewer Review Type Date Requested Status
Olivier Tilloy (community) Approve
Review via email: mp+53131@code.launchpad.net

Description of the change

[touch] Fixed multitouch gestures handling that broke due to an API change in utouch-geis.

Since an unknown new version of utouch-geis, that has landed in Ubuntu Natty, geis gestures's GEIS_GESTURE_ATTRIBUTE_GESTURE_NAME has changed slightly to include the number of fingers. Example:

Before: "Tap"
After: "Tap,touch=4"

To post a comment you must log in.
Revision history for this message
Olivier Tilloy (osomon) wrote :

My testing abilities are limited because I’m not running Natty natively on my macbook yet, therefore the trackpad doesn’t work in a virtual machine. So I’ll take your word for it that it fixes touch support on Natty.

However I did as many sanity checks as possible on your changes, and they look sane and complete. The code compiles both on Maverick and Natty, but it (silently) breaks touch support on Maverick: this change should *not* be backported to Maverick, unless the corresponding version of libutouch-geis is backported too.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'launcher/app/gesturehandler.cpp'
--- launcher/app/gesturehandler.cpp 2011-03-04 10:23:26 +0000
+++ launcher/app/gesturehandler.cpp 2011-03-12 15:20:00 +0000
@@ -193,9 +193,8 @@
193 QHash<QString, GeisGestureAttr> attributes)193 QHash<QString, GeisGestureAttr> attributes)
194{194{
195 QString gestureName = attributes[GEIS_GESTURE_ATTRIBUTE_GESTURE_NAME].string_val;195 QString gestureName = attributes[GEIS_GESTURE_ATTRIBUTE_GESTURE_NAME].string_val;
196 int touches = attributes[GEIS_GESTURE_ATTRIBUTE_TOUCHES].integer_val;
197196
198 if (gestureName == GEIS_GESTURE_PINCH && touches == 3) {197 if (gestureName == GEIS_GESTURE_TYPE_PINCH3) {
199 /* 3 fingers pinch inwards shows the workspace switcher (zoom out showing all workspaces)198 /* 3 fingers pinch inwards shows the workspace switcher (zoom out showing all workspaces)
200 3 fingers pinch outwards (also called 'spread' by designers) hides the workspace switcher (zoom in a workspace)199 3 fingers pinch outwards (also called 'spread' by designers) hides the workspace switcher (zoom in a workspace)
201 */200 */
@@ -208,7 +207,7 @@
208207
209 m_pinchPreviousRadius = attributes[GEIS_GESTURE_ATTRIBUTE_RADIUS].float_val;208 m_pinchPreviousRadius = attributes[GEIS_GESTURE_ATTRIBUTE_RADIUS].float_val;
210 m_pinchPreviousTimestamp = attributes[GEIS_GESTURE_ATTRIBUTE_TIMESTAMP].integer_val;209 m_pinchPreviousTimestamp = attributes[GEIS_GESTURE_ATTRIBUTE_TIMESTAMP].integer_val;
211 } else if (gestureName == GEIS_GESTURE_DRAG && touches == 4) {210 } else if (gestureName == GEIS_GESTURE_TYPE_DRAG4) {
212 /* 4 fingers drag reveals the launcher progressively; if the drag goes far211 /* 4 fingers drag reveals the launcher progressively; if the drag goes far
213 enough, the launcher is then locked in place and does not autohide anymore */212 enough, the launcher is then locked in place and does not autohide anymore */
214 /* FIXME: only supports the launcher positioned on the left edge of the screen */213 /* FIXME: only supports the launcher positioned on the left edge of the screen */
@@ -222,12 +221,11 @@
222 QHash<QString, GeisGestureAttr> attributes)221 QHash<QString, GeisGestureAttr> attributes)
223{222{
224 QString gestureName = attributes[GEIS_GESTURE_ATTRIBUTE_GESTURE_NAME].string_val;223 QString gestureName = attributes[GEIS_GESTURE_ATTRIBUTE_GESTURE_NAME].string_val;
225 int touches = attributes[GEIS_GESTURE_ATTRIBUTE_TOUCHES].integer_val;
226224
227 if (gestureName == GEIS_GESTURE_TAP && touches == 4) {225 if (gestureName == GEIS_GESTURE_TYPE_TAP4) {
228 /* 4 fingers tap toggles the dash on and off */226 /* 4 fingers tap toggles the dash on and off */
229 toggleDash();227 toggleDash();
230 } else if (gestureName == GEIS_GESTURE_PINCH && touches == 3) {228 } else if (gestureName == GEIS_GESTURE_TYPE_PINCH3) {
231 /* Continuing a 3 fingers pinch inwards/outwards shows/hides the workspace switcher. */229 /* Continuing a 3 fingers pinch inwards/outwards shows/hides the workspace switcher. */
232 int timestamp = attributes[GEIS_GESTURE_ATTRIBUTE_TIMESTAMP].integer_val;230 int timestamp = attributes[GEIS_GESTURE_ATTRIBUTE_TIMESTAMP].integer_val;
233 float radius = attributes[GEIS_GESTURE_ATTRIBUTE_RADIUS].float_val;231 float radius = attributes[GEIS_GESTURE_ATTRIBUTE_RADIUS].float_val;
@@ -256,7 +254,7 @@
256 m_pinchPreviousRadius = radius;254 m_pinchPreviousRadius = radius;
257 m_pinchPreviousTimestamp = timestamp;255 m_pinchPreviousTimestamp = timestamp;
258 }256 }
259 } else if (gestureName == GEIS_GESTURE_DRAG && touches == 4) {257 } else if (gestureName == GEIS_GESTURE_TYPE_DRAG4) {
260 /* FIXME: only supports the launcher positioned on the left edge of the screen */258 /* FIXME: only supports the launcher positioned on the left edge of the screen */
261 m_dragDelta += attributes[GEIS_GESTURE_ATTRIBUTE_DELTA_X].float_val;259 m_dragDelta += attributes[GEIS_GESTURE_ATTRIBUTE_DELTA_X].float_val;
262 m_launcher->setDelta(m_dragDelta);260 m_launcher->setDelta(m_dragDelta);
@@ -276,9 +274,8 @@
276 QHash<QString, GeisGestureAttr> attributes)274 QHash<QString, GeisGestureAttr> attributes)
277{275{
278 QString gestureName = attributes[GEIS_GESTURE_ATTRIBUTE_GESTURE_NAME].string_val;276 QString gestureName = attributes[GEIS_GESTURE_ATTRIBUTE_GESTURE_NAME].string_val;
279 int touches = attributes[GEIS_GESTURE_ATTRIBUTE_TOUCHES].integer_val;
280277
281 if (gestureName == GEIS_GESTURE_DRAG && touches == 4) {278 if (gestureName == GEIS_GESTURE_TYPE_DRAG4) {
282 m_dragDelta += attributes[GEIS_GESTURE_ATTRIBUTE_DELTA_X].float_val;279 m_dragDelta += attributes[GEIS_GESTURE_ATTRIBUTE_DELTA_X].float_val;
283 m_launcher->setDelta(m_dragDelta);280 m_launcher->setDelta(m_dragDelta);
284 m_launcher->setManualSliding(false);281 m_launcher->setManualSliding(false);

Subscribers

People subscribed via source and target branches