Compile with -Wfloat-conversion
This means we'll get warnings whenever a floating point value looses precision, e.g. gets implicitly casted to an integer. It also warns when implicitly casting double's to float's, which arguably is less of a problem, but there are no warning for just float/double to int. This would have caught https://gitlab.gnome.org/GNOME/mutter/-/issues/3530. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3822>
This commit is contained in:

committed by
Sebastian Wick

parent
d5bc883712
commit
422ee4515d
@ -216,11 +216,13 @@ notify_relative_motion_in_impl (GTask *task)
|
||||
event->time_us = g_get_monotonic_time ();
|
||||
|
||||
meta_seat_impl_notify_relative_motion_in_impl (seat,
|
||||
virtual_evdev->impl_state->device,
|
||||
event->time_us,
|
||||
event->x, event->y,
|
||||
event->x, event->y,
|
||||
NULL);
|
||||
virtual_evdev->impl_state->device,
|
||||
event->time_us,
|
||||
(float) event->x,
|
||||
(float) event->y,
|
||||
(float) event->x,
|
||||
(float) event->y,
|
||||
NULL);
|
||||
g_task_return_boolean (task, TRUE);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
@ -262,10 +264,11 @@ notify_absolute_motion_in_impl (GTask *task)
|
||||
event->time_us = g_get_monotonic_time ();
|
||||
|
||||
meta_seat_impl_notify_absolute_motion_in_impl (seat,
|
||||
virtual_evdev->impl_state->device,
|
||||
event->time_us,
|
||||
event->x, event->y,
|
||||
NULL);
|
||||
virtual_evdev->impl_state->device,
|
||||
event->time_us,
|
||||
(float) event->x,
|
||||
(float) event->y,
|
||||
NULL);
|
||||
g_task_return_boolean (task, TRUE);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
@ -788,8 +791,8 @@ notify_touch_down_in_impl (GTask *task)
|
||||
if (!touch_state)
|
||||
goto out;
|
||||
|
||||
touch_state->coords.x = event->x;
|
||||
touch_state->coords.y = event->y;
|
||||
touch_state->coords.x = (float) event->x;
|
||||
touch_state->coords.y = (float) event->y;
|
||||
|
||||
meta_seat_impl_notify_touch_event_in_impl (seat,
|
||||
virtual_evdev->impl_state->device,
|
||||
@ -848,8 +851,8 @@ notify_touch_motion_in_impl (GTask *task)
|
||||
if (!touch_state)
|
||||
goto out;
|
||||
|
||||
touch_state->coords.x = event->x;
|
||||
touch_state->coords.y = event->y;
|
||||
touch_state->coords.x = (float) event->x;
|
||||
touch_state->coords.y = (float) event->y;
|
||||
|
||||
meta_seat_impl_notify_touch_event_in_impl (seat,
|
||||
virtual_evdev->impl_state->device,
|
||||
|
Reference in New Issue
Block a user