forked from AuroraMiddleware/gtk
gesturestylus: Only add histroy element if translation succeeded
Instead of always doing it and then undoing it if the translation does not succeed.
This commit is contained in:
parent
e336fe2bf8
commit
71efa96ef2
@ -344,24 +344,22 @@ gtk_gesture_stylus_get_backlog (GtkGestureStylus *gesture,
|
|||||||
controller_widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
|
controller_widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
|
||||||
for (i = 0; i < n_coords; i++)
|
for (i = 0; i < n_coords; i++)
|
||||||
{
|
{
|
||||||
GdkTimeCoord *time_coord = &history[i];
|
const GdkTimeCoord *time_coord = &history[i];
|
||||||
graphene_point_t p;
|
graphene_point_t p;
|
||||||
|
|
||||||
g_array_append_val (backlog_array, *time_coord);
|
|
||||||
time_coord = &g_array_index (backlog_array, GdkTimeCoord, backlog_array->len - 1);
|
|
||||||
if (gtk_widget_compute_point (event_widget, controller_widget,
|
if (gtk_widget_compute_point (event_widget, controller_widget,
|
||||||
&GRAPHENE_POINT_INIT (time_coord->axes[GDK_AXIS_X] - surf_x,
|
&GRAPHENE_POINT_INIT (time_coord->axes[GDK_AXIS_X] - surf_x,
|
||||||
time_coord->axes[GDK_AXIS_Y] - surf_y),
|
time_coord->axes[GDK_AXIS_Y] - surf_y),
|
||||||
&p))
|
&p))
|
||||||
{
|
{
|
||||||
time_coord->axes[GDK_AXIS_X] = p.x;
|
GdkTimeCoord translated_coord = *time_coord;
|
||||||
time_coord->axes[GDK_AXIS_Y] = p.y;
|
|
||||||
|
translated_coord.axes[GDK_AXIS_X] = p.x;
|
||||||
|
translated_coord.axes[GDK_AXIS_Y] = p.y;
|
||||||
|
|
||||||
|
g_array_append_val (backlog_array, translated_coord);
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
|
||||||
g_array_set_size (backlog_array, backlog_array->len - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*n_elems = backlog_array->len;
|
*n_elems = backlog_array->len;
|
||||||
*backlog = (GdkTimeCoord *) g_array_free (backlog_array, FALSE);
|
*backlog = (GdkTimeCoord *) g_array_free (backlog_array, FALSE);
|
||||||
|
Loading…
Reference in New Issue
Block a user