diff options
author | Daniel Stone <daniel@fooishbar.org> | 2012-05-30 16:31:59 +0100 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-05-31 15:45:20 -0400 |
commit | 0c1e46eb18ab48c48ce29464deb4ce5e23130c2b (patch) | |
tree | 7805c48c8b6c29d22e7e6b6a99cc8b1c7b248fcc | |
parent | 325fc2d53a6885119c505c928c41b2744edada36 (diff) |
Use wl_fixed_t for axis bindings
In preparation for axis values being wl_fixed_t in the protocol as well.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
-rw-r--r-- | src/compositor.c | 2 | ||||
-rw-r--r-- | src/compositor.h | 2 | ||||
-rw-r--r-- | src/shell.c | 11 | ||||
-rw-r--r-- | src/util.c | 2 |
4 files changed, 9 insertions, 8 deletions
diff --git a/src/compositor.c b/src/compositor.c index faa0619..037c2c0 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -1722,7 +1722,7 @@ notify_axis(struct wl_seat *seat, uint32_t time, uint32_t axis, if (value) weston_compositor_run_axis_binding(compositor, ws, time, axis, - wl_fixed_to_int(value)); + value); else return; diff --git a/src/compositor.h b/src/compositor.h index b0cca43..45ebedd 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -549,7 +549,7 @@ weston_compositor_add_button_binding(struct weston_compositor *compositor, typedef void (*weston_axis_binding_handler_t)(struct wl_seat *seat, uint32_t time, uint32_t axis, - int32_t value, void *data); + wl_fixed_t value, void *data); struct weston_binding * weston_compositor_add_axis_binding(struct weston_compositor *compositor, uint32_t axis, diff --git a/src/shell.c b/src/shell.c index fc7f48f..40e84b6 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1617,7 +1617,7 @@ resize_binding(struct wl_seat *seat, uint32_t time, uint32_t button, void *data) static void surface_opacity_binding(struct wl_seat *seat, uint32_t time, uint32_t axis, - int32_t value, void *data) + wl_fixed_t value, void *data) { float step = 0.05; struct shell_surface *shsurf; @@ -1639,7 +1639,7 @@ surface_opacity_binding(struct wl_seat *seat, uint32_t time, uint32_t axis, break; } - surface->alpha += value * step; + surface->alpha += wl_fixed_to_double(value) * step; if (surface->alpha > 1.0) surface->alpha = 1.0; @@ -1652,7 +1652,7 @@ surface_opacity_binding(struct wl_seat *seat, uint32_t time, uint32_t axis, static void do_zoom(struct wl_seat *seat, uint32_t time, uint32_t key, uint32_t axis, - int32_t value) + wl_fixed_t value) { struct weston_seat *ws = (struct weston_seat *) seat; struct weston_compositor *compositor = ws->compositor; @@ -1669,7 +1669,8 @@ do_zoom(struct wl_seat *seat, uint32_t time, uint32_t key, uint32_t axis, else if (key == KEY_PAGEDOWN) increment = -output->zoom.increment; else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL) - increment = output->zoom.increment * value; + increment = output->zoom.increment * + wl_fixed_to_double(value); else increment = 0; @@ -1696,7 +1697,7 @@ do_zoom(struct wl_seat *seat, uint32_t time, uint32_t key, uint32_t axis, static void zoom_axis_binding(struct wl_seat *seat, uint32_t time, uint32_t axis, - int32_t value, void *data) + wl_fixed_t value, void *data) { do_zoom(seat, time, 0, axis, value); } @@ -405,7 +405,7 @@ WL_EXPORT void weston_compositor_run_axis_binding(struct weston_compositor *compositor, struct weston_seat *seat, uint32_t time, uint32_t axis, - int32_t value) + wl_fixed_t value) { struct weston_binding *b; |