After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 689061 - Some fixes and API additions for ClutterPanAction
Some fixes and API additions for ClutterPanAction
Status: RESOLVED FIXED
Product: clutter
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: clutter-maint
clutter-maint
Depends on:
Blocks: 689062
 
 
Reported: 2012-11-26 04:59 UTC by Jasper St. Pierre (not reading bugmail)
Modified: 2012-11-30 23:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
pan-action, zoom-action: Use the right accumulator (2.26 KB, patch)
2012-11-26 04:59 UTC, Jasper St. Pierre (not reading bugmail)
needs-work Details | Review
pan-action: Add a simple convenience function to retrieve delta/coords (6.03 KB, patch)
2012-11-26 04:59 UTC, Jasper St. Pierre (not reading bugmail)
accepted-commit_now Details | Review
pan-action, zoom-action: Fix documentation for signals (1.83 KB, patch)
2012-11-26 20:31 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review
pan-action: Add a simple convenience function to retrieve delta/coords (8.28 KB, patch)
2012-11-26 20:31 UTC, Jasper St. Pierre (not reading bugmail)
none Details | Review
pan-action: Add a simple convenience function to retrieve delta/coords (8.39 KB, patch)
2012-11-29 21:56 UTC, Jasper St. Pierre (not reading bugmail)
committed Details | Review

Description Jasper St. Pierre (not reading bugmail) 2012-11-26 04:59:18 UTC
I ran into these when trying to port gnome-shell to stop using custom
swipe scrolling code.
Comment 1 Jasper St. Pierre (not reading bugmail) 2012-11-26 04:59:20 UTC
Created attachment 229873 [details] [review]
pan-action, zoom-action: Use the right accumulator

The documentation said that you should return TRUE to mark
that the action was handled, but the code did the reverse.
Comment 2 Jasper St. Pierre (not reading bugmail) 2012-11-26 04:59:22 UTC
Created attachment 229874 [details] [review]
pan-action: Add a simple convenience function to retrieve delta/coords

This is a simple helper designed to ease the implementation of alternate
implementations of the "pan" signal handler.
Comment 3 Emanuele Aina 2012-11-26 17:35:41 UTC
Review of attachment 229873 [details] [review]:

::: clutter/clutter-pan-action.c
@@ -523,3 @@
    * the :interpolate property was set to %TRUE.
    *
-   * Return value: TRUE if the pan action has been handled by one of

The continue accumulator is fine as it is also used by GestureAction, RotateAction and ZoomAction, we just need to change the documentation.
Would you fix the ClutterZoomAction::zoom documentation too?
Comment 4 Emmanuele Bassi (:ebassi) 2012-11-26 17:42:08 UTC
Review of attachment 229874 [details] [review]:

I'm a bit worried about the naming override - but I guess it works well enough, given the intent.

you also need to add the new symbols to clutter.symbols and the clutter-sections.txt for the API reference.
Comment 5 Jasper St. Pierre (not reading bugmail) 2012-11-26 20:31:08 UTC
Created attachment 229943 [details] [review]
pan-action, zoom-action: Fix documentation for signals

The documentation said that you should return TRUE to mark
that the action was handled, but the code did the reverse.
Change the documentation to reflect what all the other gestures
do.
Comment 6 Jasper St. Pierre (not reading bugmail) 2012-11-26 20:31:17 UTC
Created attachment 229944 [details] [review]
pan-action: Add a simple convenience function to retrieve delta/coords

This is a simple helper designed to ease the implementation of alternate
implementations of the "pan" signal handler.
Comment 7 Emanuele Aina 2012-11-28 17:19:22 UTC
Review of attachment 229943 [details] [review]:

Looks good to me. Maybe remove the extra space at the beginning of the second line in both comments before pushing if ebassi agrees?
Comment 8 Emmanuele Bassi (:ebassi) 2012-11-28 17:24:27 UTC
Review of attachment 229943 [details] [review]:

looks good to me; the space is fine - we usually indent the Return value: annotation.
Comment 9 Emanuele Aina 2012-11-28 17:37:49 UTC
Review of attachment 229944 [details] [review]:

::: clutter/clutter-pan-action.c
@@ +829,3 @@
+ * clutter_pan_action_get_motion_delta:
+ * @self: A #ClutterPanAction
+ * @device: currently unused, set to 0

s/device/point and not really unused, it's the point index.
TBH I wouldn't expose that and internally assume 0 by now. This could prove useful in case we want to make ClutterPanAction respond on two fingers gestures by calling clutter_gesture_action_set_n_touch_points() and return the delta of the averaged coords.

@@ +879,3 @@
+ * clutter_pan_action_get_motion_coords:
+ * @self: A #ClutterPanAction
+ * @device: currently unused, set to 0

The same applies here.

::: clutter/clutter.symbols
@@ +1062,3 @@
 clutter_pan_action_get_deceleration
+clutter_pan_action_get_motion_delta
+clutter_pan_action_get_motion_coords

This should be alphabetically ordered, or at least try to be. :)
Comment 10 Emanuele Aina 2012-11-28 17:37:49 UTC
Review of attachment 229944 [details] [review]:

::: clutter/clutter-pan-action.c
@@ +829,3 @@
+ * clutter_pan_action_get_motion_delta:
+ * @self: A #ClutterPanAction
+ * @device: currently unused, set to 0

s/device/point and not really unused, it's the point index.
TBH I wouldn't expose that and internally assume 0 by now. This could prove useful in case we want to make ClutterPanAction respond on two fingers gestures by calling clutter_gesture_action_set_n_touch_points() and return the delta of the averaged coords.

@@ +879,3 @@
+ * clutter_pan_action_get_motion_coords:
+ * @self: A #ClutterPanAction
+ * @device: currently unused, set to 0

The same applies here.

::: clutter/clutter.symbols
@@ +1062,3 @@
 clutter_pan_action_get_deceleration
+clutter_pan_action_get_motion_delta
+clutter_pan_action_get_motion_coords

This should be alphabetically ordered, or at least try to be. :)
Comment 11 Jasper St. Pierre (not reading bugmail) 2012-11-28 17:47:30 UTC
I copied the documentation and whatever else from ClutterGestureAction. I didn't add it in the first patch I don't think, but ebassi said that if it has the same method name, it should have the same signature. Hence why I calculate distance and all that, too.

I figured that when people did the point renaming, it'd be renamed then, otherwise  we'll have an intermediate spot where "point" itself as "device", which looks wrong, even if it's technically correct.
Comment 12 Emmanuele Bassi (:ebassi) 2012-11-28 18:03:46 UTC
(In reply to comment #10)
> Review of attachment 229944 [details] [review]:
> 
> ::: clutter/clutter-pan-action.c
> @@ +829,3 @@
> + * clutter_pan_action_get_motion_delta:
> + * @self: A #ClutterPanAction
> + * @device: currently unused, set to 0
> 
> s/device/point and not really unused, it's the point index.
> TBH I wouldn't expose that and internally assume 0 by now. This could prove
> useful in case we want to make ClutterPanAction respond on two fingers gestures
> by calling clutter_gesture_action_set_n_touch_points() and return the delta of
> the averaged coords.

the whole point of the exercise is to have the exact same signature (i.e. an override) as ClutterGestureAction.get_motion_delta() without having to make *that* a virtual function. we have three option, here:

  • make get_motion_delta() and get_motion_coords() two virtual functions in Clutter.GestureAction, have a default implementation in the base class, and an overridden one in Clutter.PanAction that takes into account the action's state;

  • make get_motion_delta() and get_motion_coords() in Clutter.PanAction behave exactly like Clutter.GestureAction, including their signature and return value, but document that the @point argument is currently ignored, like we used to do for the GestureAction methods before we had multi-touch point support;

  • add two new functions in Clutter.PanAction, with different names;

there's also the fourth (secret) option of having gesture states [ "idle", "tracking", "interpolating" ] as a (private) property on GestureAction, and let the sub-classes set the state, so that Clutter.GestureAction.get_motion_* can check the state and do the computation in the base class without requiring a virtual function.

this is getting far too complicated for a convenience function.
Comment 13 Jasper St. Pierre (not reading bugmail) 2012-11-29 21:56:13 UTC
Comment on attachment 229943 [details] [review]
pan-action, zoom-action: Fix documentation for signals

Attachment 229943 [details] pushed as 90a2401 - pan-action, zoom-action: Fix documentation for signals
Comment 14 Jasper St. Pierre (not reading bugmail) 2012-11-29 21:56:23 UTC
Created attachment 230241 [details] [review]
pan-action: Add a simple convenience function to retrieve delta/coords

This is a simple helper designed to ease the implementation of alternate
implementations of the "pan" signal handler.
Comment 15 Emmanuele Bassi (:ebassi) 2012-11-30 23:02:30 UTC
Review of attachment 230241 [details] [review]:

looks good
Comment 16 Jasper St. Pierre (not reading bugmail) 2012-11-30 23:03:15 UTC
Attachment 230241 [details] pushed as 75b521d - pan-action: Add a simple convenience function to retrieve delta/coords