From 9b68af06086a53872dfdae7619bf49b95a79c656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 22 May 2012 12:55:18 -0400 Subject: [PATCH] shell: Add back mod+pageup/down keybindings for zoom This way we can use zoom without a scrollwheel/touchpad. --- src/shell.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/shell.c b/src/shell.c index 8cd21291..f8110d14 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1637,15 +1637,24 @@ zoom_binding(struct wl_seat *seat, uint32_t time, struct weston_seat *ws = (struct weston_seat *) seat; struct weston_compositor *compositor = ws->compositor; struct weston_output *output; - float maximum_level; + float maximum_level, increment; wl_list_for_each(output, &compositor->output_list, link) { if (pixman_region32_contains_point(&output->region, wl_fixed_to_double(seat->pointer->x), wl_fixed_to_double(seat->pointer->y), NULL)) { + if (key == KEY_PAGEUP && value) + increment = output->zoom.increment; + else if (key == KEY_PAGEDOWN && value) + increment = -output->zoom.increment; + else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL) + increment = output->zoom.increment * value; + else + increment = 0; + output->zoom.active = 1; - output->zoom.level += output->zoom.increment * value; + output->zoom.level += increment; if (output->zoom.level <= 0.0) { output->zoom.active = 0; @@ -2579,6 +2588,10 @@ shell_add_bindings(struct weston_compositor *ec, struct desktop_shell *shell) /* configurable bindings */ mod = shell->binding_modifier; + weston_compositor_add_binding(ec, KEY_PAGEUP, 0, 0, mod, + zoom_binding, NULL); + weston_compositor_add_binding(ec, KEY_PAGEDOWN, 0, 0, mod, + zoom_binding, NULL); weston_compositor_add_binding(ec, 0, BTN_LEFT, 0, mod, move_binding, shell); weston_compositor_add_binding(ec, 0, BTN_MIDDLE, 0, mod,