The function declaration had different parameter types than the function definition. The compiler did not warn about that, because wl_fixed_t used to be typedef'd to int32_t, so with that substitution they were equal.
Fix the declaration and definition to match. Also, convert wl_fixed_t directly into floats, to avoid truncation. Signed-off-by: Pekka Paalanen <[email protected]> --- src/compositor.c | 14 +++++++------- src/compositor.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/compositor.c b/src/compositor.c index 797ab99..882e081 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -2755,24 +2755,24 @@ weston_text_cursor_position_notify(struct weston_surface *surface, WL_EXPORT void weston_output_update_zoom(struct weston_output *output, - wl_fixed_t fx, - wl_fixed_t fy, + wl_fixed_t x, + wl_fixed_t y, uint32_t type) { - int32_t x, y; + float global_x, global_y; float trans_min, trans_max; if (output->zoom.level >= 1.0) return; - x = wl_fixed_to_int(fx); - y = wl_fixed_to_int(fy); + global_x = wl_fixed_to_double(x); + global_y = wl_fixed_to_double(y); output->zoom.trans_x = - (((float)(x - output->x) / output->current->width) * + (((global_x - output->x) / output->current->width) * (output->zoom.level * 2)) - output->zoom.level; output->zoom.trans_y = - (((float)(y - output->y) / output->current->height) * + (((global_y - output->y) / output->current->height) * (output->zoom.level * 2)) - output->zoom.level; if (type == ZOOM_TEXT_CURSOR) { diff --git a/src/compositor.h b/src/compositor.h index 836f10a..21899d4 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -632,7 +632,7 @@ void weston_compositor_shutdown(struct weston_compositor *ec); void weston_output_update_zoom(struct weston_output *output, - int x, int y, uint32_t type); + wl_fixed_t x, wl_fixed_t y, uint32_t type); void weston_text_cursor_position_notify(struct weston_surface *surface, int x, int y); void -- 1.7.3.4 _______________________________________________ wayland-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/wayland-devel
