[PATCH weston 2/6] zoom: Call weston_output_activate_zoom() appropriately

Derek Foreman derekf at osg.samsung.com
Fri Jan 9 10:45:15 PST 2015


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 at osg.samsung.com>
---
 desktop-shell/shell.c | 5 ++++-
 src/zoom.c            | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index a7514f7..a55eb7f 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -4693,7 +4693,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);
 			}
 
diff --git a/src/zoom.c b/src/zoom.c
index 2e1f9fa..2728fbe 100644
--- a/src/zoom.c
+++ b/src/zoom.c
@@ -22,6 +22,7 @@
 
 #include "config.h"
 
+#include <assert.h>
 #include <stdlib.h>
 #include <stdbool.h>
 
@@ -177,6 +178,7 @@ weston_output_update_zoom(struct weston_output *output)
 	wl_fixed_t x = seat->pointer->x;
 	wl_fixed_t y = seat->pointer->y;
 
+	assert(output->zoom.active);
 	zoom_area_center_from_pointer(output, &x, &y);
 
 	if (wl_list_empty(&output->zoom.animation_xy.link)) {
-- 
2.1.4



More information about the wayland-devel mailing list