Restructure output zoom.
A quick clean-up of zoom to prepare for the other patches in this series.
diff --git a/src/shell.c b/src/shell.c
index 104b6f7..8cd2129 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1637,6 +1637,7 @@
struct weston_seat *ws = (struct weston_seat *) seat;
struct weston_compositor *compositor = ws->compositor;
struct weston_output *output;
+ float maximum_level;
wl_list_for_each(output, &compositor->output_list, link) {
if (pixman_region32_contains_point(&output->region,
@@ -1644,15 +1645,17 @@
wl_fixed_to_double(seat->pointer->y),
NULL)) {
output->zoom.active = 1;
- output->zoom.level += output->zoom.increment * -value;
+ output->zoom.level += output->zoom.increment * value;
- if (output->zoom.level >= 1.0) {
+ if (output->zoom.level <= 0.0) {
output->zoom.active = 0;
- output->zoom.level = 1.0;
+ output->zoom.level = 0.0;
}
- if (output->zoom.level < output->zoom.increment)
- output->zoom.level = output->zoom.increment;
+ maximum_level = 1 - output->zoom.increment;
+
+ if (output->zoom.level > maximum_level)
+ output->zoom.level = maximum_level;
weston_output_update_zoom(output,
seat->pointer->x,