Commit 8f7d5fb2 authored by Carlos Garnacho's avatar Carlos Garnacho

gesturerotate: Just return a double in get_angle_delta()

Whether the gesture is active or recognized should be checked before in
callers, or just not used naively.
parent d05a9f9a
......@@ -93,8 +93,8 @@ drawing_area_draw (GtkWidget *widget,
cairo_save (cr);
if (gtk_gesture_rotate_get_angle_delta (GTK_GESTURE_ROTATE (rotate), &angle))
cairo_matrix_rotate (&matrix, angle);
angle = gtk_gesture_rotate_get_angle_delta (GTK_GESTURE_ROTATE (rotate));
cairo_matrix_rotate (&matrix, angle);
if (gtk_gesture_zoom_get_scale_delta (GTK_GESTURE_ZOOM (zoom), &scale))
cairo_matrix_scale (&matrix, scale, scale);
......
......@@ -196,19 +196,16 @@ gtk_gesture_rotate_new (GtkWidget *widget)
/**
* gtk_gesture_rotate_get_angle_delta:
* @gesture: a #GtkGestureRotate
* @delta: (out) (transfer none): angle delta
*
* If @gesture is active, this function returns %TRUE and fills
* in @delta with the angle difference in radians since the
* gesture was first recognized.
* If @gesture is active, this function returns the angle difference
* in radians since the gesture was first recognized.
*
* Returns: %TRUE if @controller is recognizing a rotate gesture
* Returns: the angle delta in radians
*
* Since: 3.14
**/
gboolean
gtk_gesture_rotate_get_angle_delta (GtkGestureRotate *gesture,
gdouble *delta)
gdouble
gtk_gesture_rotate_get_angle_delta (GtkGestureRotate *gesture)
{
GtkGestureRotatePrivate *priv;
gdouble angle;
......@@ -216,12 +213,9 @@ gtk_gesture_rotate_get_angle_delta (GtkGestureRotate *gesture,
g_return_val_if_fail (GTK_IS_GESTURE_ROTATE (gesture), FALSE);
if (!_gtk_gesture_rotate_get_angle (gesture, &angle))
return FALSE;
return 0;
priv = gtk_gesture_rotate_get_instance_private (gesture);
if (delta)
*delta = angle - priv->initial_angle;
return TRUE;
return angle - priv->initial_angle;
}
......@@ -46,8 +46,7 @@ GDK_AVAILABLE_IN_3_14
GtkGesture * gtk_gesture_rotate_new (GtkWidget *widget);
GDK_AVAILABLE_IN_3_14
gboolean gtk_gesture_rotate_get_angle_delta (GtkGestureRotate *gesture,
gdouble *delta);
gdouble gtk_gesture_rotate_get_angle_delta (GtkGestureRotate *gesture);
G_END_DECLS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment