gtkgesture: Preserve accuracy when translating events
gtk_widget_translate_coordinates() uses int argument and thus cuts off any decimal parts. This can leads to reduces accuracy when e.g. measuring the distance of a drag. GTK4 is not affected as the translations is done differently.
This commit is contained in:
parent
1b38fcad64
commit
d89447d68e
@ -504,8 +504,11 @@ _update_widget_coordinates (GtkGesture *gesture,
|
||||
|
||||
gtk_widget_translate_coordinates (event_widget, widget,
|
||||
event_x, event_y, &x, &y);
|
||||
data->widget_x = x;
|
||||
data->widget_y = y;
|
||||
/* gtk_widget_translate() loses the fractional part so we need to
|
||||
* add it back to not lose accuracy */
|
||||
data->widget_x = x + (event_x - (int)event_x);
|
||||
data->widget_y = y + (event_y - (int)event_y);
|
||||
|
||||
}
|
||||
|
||||
static GtkEventSequenceState
|
||||
|
Loading…
Reference in New Issue
Block a user