zoom: Call weston_output_activate_zoom() appropriately
authorDerek Foreman <derekf@osg.samsung.com>
Thu, 23 Jul 2015 19:55:13 +0000 (14:55 -0500)
committerBryce Harrington <bryce@osg.samsung.com>
Thu, 30 Jul 2015 02:47:31 +0000 (19:47 -0700)
No longer call weston_output_update_zoom() when trying to zoom out
on an unzoomed output.

Add an assert() to make sure update_zoom is never called without an
active zoom.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
desktop-shell/shell.c
src/zoom.c

index 9e3701fc425eac4e4513497963718329392f2962..48bee343539a934d6c6119d696ec49be6bffd0b1 100644 (file)
@@ -4804,7 +4804,10 @@ do_zoom(struct weston_seat *seat, uint32_t time, uint32_t key, uint32_t axis,
                                output->zoom.level = 0.0;
                        else if (output->zoom.level > output->zoom.max_level)
                                output->zoom.level = output->zoom.max_level;
-                       else if (!output->zoom.active) {
+
+                       if (!output->zoom.active) {
+                               if (output->zoom.level <= 0.0)
+                                       continue;
                                weston_output_activate_zoom(output);
                        }
 
index 6305427c8643198db129dd1e216a10c9319c66f1..18fc7cac68283c237d6d5f9a83bc976f2902a66c 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "config.h"
 
+#include <assert.h>
 #include <stdlib.h>
 #include <stdbool.h>
 
@@ -135,6 +136,8 @@ weston_output_update_zoom(struct weston_output *output)
 {
        struct weston_seat *seat = weston_zoom_pick_seat(output->compositor);
 
+       assert(output->zoom.active);
+
        output->zoom.current.x = seat->pointer->x;
        output->zoom.current.y = seat->pointer->y;