<br><br><div class="gmail_quote">On Mon, Jun 4, 2012 at 8:49 AM, Pekka Paalanen <span dir="ltr"><<a href="mailto:ppaalanen@gmail.com" target="_blank">ppaalanen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The function declaration had different parameter types than the function<br>
definition. The compiler did not warn about that, because wl_fixed_t<br>
used to be typedef'd to int32_t, so with that substitution they were<br>
equal.<br>
<br>
Fix the declaration and definition to match.<br>
<br>
Also, convert wl_fixed_t directly into floats, to avoid truncation.<br>
<br>
Signed-off-by: Pekka Paalanen <<a href="mailto:ppaalanen@gmail.com">ppaalanen@gmail.com</a>><br>
---<br>
src/compositor.c | 14 +++++++-------<br>
src/compositor.h | 2 +-<br>
2 files changed, 8 insertions(+), 8 deletions(-)<br>
<br>
diff --git a/src/compositor.c b/src/compositor.c<br>
index 797ab99..882e081 100644<br>
--- a/src/compositor.c<br>
+++ b/src/compositor.c<br>
@@ -2755,24 +2755,24 @@ weston_text_cursor_position_notify(struct weston_surface *surface,<br>
<br>
WL_EXPORT void<br>
weston_output_update_zoom(struct weston_output *output,<br>
- wl_fixed_t fx,<br>
- wl_fixed_t fy,<br>
+ wl_fixed_t x,<br>
+ wl_fixed_t y,<br>
uint32_t type)<br>
{<br>
- int32_t x, y;<br>
+ float global_x, global_y;<br>
float trans_min, trans_max;<br>
<br>
if (output->zoom.level >= 1.0)<br>
return;<br>
<br>
- x = wl_fixed_to_int(fx);<br>
- y = wl_fixed_to_int(fy);<br>
+ global_x = wl_fixed_to_double(x);<br>
+ global_y = wl_fixed_to_double(y);<br>
<br>
output->zoom.trans_x =<br>
- (((float)(x - output->x) / output->current->width) *<br>
+ (((global_x - output->x) / output->current->width) *<br>
(output->zoom.level * 2)) - output->zoom.level;<br>
output->zoom.trans_y =<br>
- (((float)(y - output->y) / output->current->height) *<br>
+ (((global_y - output->y) / output->current->height) *<br>
(output->zoom.level * 2)) - output->zoom.level;<br>
<br>
if (type == ZOOM_TEXT_CURSOR) {<br>
diff --git a/src/compositor.h b/src/compositor.h<br>
index 836f10a..21899d4 100644<br>
--- a/src/compositor.h<br>
+++ b/src/compositor.h<br>
@@ -632,7 +632,7 @@ void<br>
weston_compositor_shutdown(struct weston_compositor *ec);<br>
void<br>
weston_output_update_zoom(struct weston_output *output,<br>
- int x, int y, uint32_t type);<br>
+ wl_fixed_t x, wl_fixed_t y, uint32_t type);<br>
void<br>
weston_text_cursor_position_notify(struct weston_surface *surface, int x, int y);<br>
void<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.3.4<br><br></font></span></blockquote><div><br>Hi Pekka, thanks for your attention here. The first part of this patch fixes a problem I wasn't sure about, where the zoomed position 'jumps around' a bit. It's most noticeable while zoomed in a significant amount and typing into a rotated weston-terminal. The latter part has already been fixed by <a href="http://cgit.freedesktop.org/wayland/weston/commit/?id=ae71220fc9fbb9b43af4fcf8f3f57305ffcd9110">http://cgit.freedesktop.org/wayland/weston/commit/?id=ae71220fc9fbb9b43af4fcf8f3f57305ffcd9110</a><br>
<br><br>Thanks,<br><br>Scott<br></div></div><br>