commit 7a8cb26e28fae1af7250bdd9e81136b786838e66
parent 43dc1b4d53e5a5d592dbfede0f5a355a22b715b4
Author: Michael Forney <mforney@mforney.org>
Date: Wed, 22 Jan 2014 16:19:52 -0800
pointer: Separate cursor updating to cursor_update
Diffstat:
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/libswc/pointer.c b/libswc/pointer.c
@@ -151,6 +151,13 @@ static void handle_view_event(struct wl_listener * listener, void * data)
}
}
+static inline void update_cursor(struct swc_pointer * pointer)
+{
+ swc_view_move(&pointer->cursor.view,
+ wl_fixed_to_int(pointer->x) - pointer->cursor.hotspot.x,
+ wl_fixed_to_int(pointer->y) - pointer->cursor.hotspot.y);
+}
+
bool swc_pointer_initialize(struct swc_pointer * pointer)
{
struct wld_buffer * buffer;
@@ -254,9 +261,7 @@ static void set_cursor(struct wl_client * client,
swc_surface_set_view(surface, &pointer->cursor.view);
wl_resource_add_destroy_listener(surface->resource,
&pointer->cursor.destroy_listener);
- swc_view_move(&pointer->cursor.view,
- wl_fixed_to_int(pointer->x) - hotspot_x,
- wl_fixed_to_int(pointer->y) - hotspot_y);
+ update_cursor(pointer);
}
}
@@ -336,8 +341,6 @@ void swc_pointer_handle_relative_motion
surface_x, surface_y);
}
- swc_view_move(&pointer->cursor.view,
- wl_fixed_to_int(pointer->x) - pointer->cursor.hotspot.x,
- wl_fixed_to_int(pointer->y) - pointer->cursor.hotspot.y);
+ update_cursor(pointer);
}