diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2012-05-22 12:55:18 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-05-22 12:58:47 -0400 |
commit | 9b68af06086a53872dfdae7619bf49b95a79c656 (patch) | |
tree | c97f10019bdad50cc7ff1173466e071a2819de72 /src | |
parent | 850ca42b9bee7868c64ffccf1b89ba3fe4c71a4a (diff) |
shell: Add back mod+pageup/down keybindings for zoom
This way we can use zoom without a scrollwheel/touchpad.
Diffstat (limited to 'src')
-rw-r--r-- | src/shell.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/shell.c b/src/shell.c index 8cd2129..f8110d1 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, |