swc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/swc
Log | Files | Refs | README | LICENSE

commit 77ec52d6d277b3e608bc58e7b5242a561a6ad5e4
parent 9e121d6261b0dd21c95a590a143bcf0b96b2eefb
Author: Michael Forney <mforney@mforney.org>
Date:   Sun, 16 Feb 2014 15:36:45 -0800

pointer: Pass handler rather than pointer to handler callbacks

Diffstat:
Mlibswc/compositor.c | 6+++---
Mlibswc/compositor.h | 2+-
Mlibswc/pointer.c | 7++++---
Mlibswc/pointer.h | 8++++----
4 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/libswc/compositor.c b/libswc/compositor.c @@ -88,11 +88,11 @@ struct view struct wl_list link; }; -static bool handle_motion(struct swc_pointer * pointer, uint32_t time, +static bool handle_motion(struct swc_pointer_handler * handler, uint32_t time, wl_fixed_t x, wl_fixed_t y); static void perform_update(void * data); -static const struct swc_pointer_handler pointer_handler = { +static struct swc_pointer_handler pointer_handler = { .motion = &handle_motion }; @@ -756,7 +756,7 @@ static void perform_update(void * data) compositor.updating = false; } -bool handle_motion(struct swc_pointer * pointer, uint32_t time, +bool handle_motion(struct swc_pointer_handler * handler, uint32_t time, wl_fixed_t fx, wl_fixed_t fy) { struct view * view; diff --git a/libswc/compositor.h b/libswc/compositor.h @@ -30,7 +30,7 @@ struct swc_surface; struct swc_compositor { - const struct swc_pointer_handler * pointer_handler; + struct swc_pointer_handler * pointer_handler; }; bool swc_compositor_initialize(); diff --git a/libswc/pointer.c b/libswc/pointer.c @@ -325,7 +325,7 @@ void swc_pointer_handle_button(struct swc_pointer * pointer, uint32_t time, uint32_t button, uint32_t state) { if ((!pointer->handler || !pointer->handler->button - || !pointer->handler->button(pointer, time, button, state)) + || !pointer->handler->button(pointer->handler, time, button, state)) && pointer->focus.resource) { struct wl_client * client @@ -342,7 +342,7 @@ void swc_pointer_handle_axis(struct swc_pointer * pointer, uint32_t time, uint32_t axis, wl_fixed_t amount) { if ((!pointer->handler || !pointer->handler->axis - || !pointer->handler->axis(pointer, time, axis, amount)) + || !pointer->handler->axis(pointer->handler, time, axis, amount)) && pointer->focus.resource) { wl_pointer_send_axis(pointer->focus.resource, time, axis, amount); @@ -355,7 +355,8 @@ void swc_pointer_handle_relative_motion clip_position(pointer, pointer->x + dx, pointer->y + dy); if ((!pointer->handler || !pointer->handler->motion - || !pointer->handler->motion(pointer, time, pointer->x, pointer->y)) + || !pointer->handler->motion(pointer->handler, time, + pointer->x, pointer->y)) && pointer->focus.resource) { wl_fixed_t surface_x, surface_y; diff --git a/libswc/pointer.h b/libswc/pointer.h @@ -35,11 +35,11 @@ struct swc_pointer; struct swc_pointer_handler { - bool (* motion)(struct swc_pointer * pointer, uint32_t time, + bool (* motion)(struct swc_pointer_handler * handler, uint32_t time, wl_fixed_t x, wl_fixed_t y); - bool (* button)(struct swc_pointer * pointer, uint32_t time, + bool (* button)(struct swc_pointer_handler * handler, uint32_t time, uint32_t button, uint32_t state); - bool (* axis)(struct swc_pointer * pointer, uint32_t time, + bool (* axis)(struct swc_pointer_handler * handler, uint32_t time, enum wl_pointer_axis axis, wl_fixed_t amount); }; @@ -65,7 +65,7 @@ struct swc_pointer } hotspot; } cursor; - const struct swc_pointer_handler * handler; + struct swc_pointer_handler * handler; wl_fixed_t x, y; pixman_region32_t region;