swc

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

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

pointer: Add x and y to motion handler callback

Diffstat:
Mlibswc/compositor.c | 12+++++++-----
Mlibswc/pointer.c | 2+-
Mlibswc/pointer.h | 3++-
3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/libswc/compositor.c b/libswc/compositor.c @@ -88,7 +88,8 @@ struct view struct wl_list link; }; -static bool handle_motion(struct swc_pointer * pointer, uint32_t time); +static bool handle_motion(struct swc_pointer * pointer, 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 = { @@ -755,7 +756,8 @@ 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 * pointer, uint32_t time, + wl_fixed_t fx, wl_fixed_t fy) { struct view * view; struct swc_surface * surface = NULL; @@ -763,8 +765,8 @@ bool handle_motion(struct swc_pointer * pointer, uint32_t time) wl_list_for_each(view, &compositor.views, link) { - x = wl_fixed_to_int(pointer->x); - y = wl_fixed_to_int(pointer->y); + x = wl_fixed_to_int(fx); + y = wl_fixed_to_int(fy); if (swc_rectangle_contains_point(&view->base.geometry, x, y) && pixman_region32_contains_point(&view->surface->state.input, @@ -776,7 +778,7 @@ bool handle_motion(struct swc_pointer * pointer, uint32_t time) } } - swc_pointer_set_focus(pointer, surface); + swc_pointer_set_focus(swc.seat->pointer, surface); return false; } diff --git a/libswc/pointer.c b/libswc/pointer.c @@ -355,7 +355,7 @@ 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->handler->motion(pointer, 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,7 +35,8 @@ struct swc_pointer; struct swc_pointer_handler { - bool (* motion)(struct swc_pointer * pointer, uint32_t time); + bool (* motion)(struct swc_pointer * pointer, uint32_t time, + wl_fixed_t x, wl_fixed_t y); bool (* button)(struct swc_pointer * pointer, uint32_t time, uint32_t button, uint32_t state); bool (* axis)(struct swc_pointer * pointer, uint32_t time,