summaryrefslogtreecommitdiff
path: root/src/compositor.c
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2015-05-11 15:40:11 -0500
committerDaniel Stone <daniels@collabora.com>2015-08-06 16:28:30 +0100
commitf9318d145262444e2b671b40122fec9cab39b609 (patch)
treeb0595e3f5de23db355dea0c5c567cb65183df631 /src/compositor.c
parent2ccd9a2d6247d26975a8a846e9eb7a283c84a1ba (diff)
downloadweston-f9318d145262444e2b671b40122fec9cab39b609.tar.gz
input: add a weston_pointer_clear_focus() helper function
Valgrind has shown that in at least one place (default_grab_pointer_focus) we're testing uninitialized values coming out of weston_compositor_pick_view. This is happening when default_grab_pointer_focus is called when there is nothing on the view list, and during the first repaint when only the black surface with no input region exists. This patch adds a function to clear pointer focus and also set the sx,sy co-ordinates to a sentinel value we shouldn't compute with. Assertions are added to make sure any time pointer focus is set to NULL these values are used. weston_compositor_pick_view() now returns these values too. Now the values are always initialized, even when no view exists, and they're initialized in such a way that actually doing computation with them should fail in an obvious way, but we can compare them safely for equality. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
Diffstat (limited to 'src/compositor.c')
-rw-r--r--src/compositor.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/compositor.c b/src/compositor.c
index 00b09a67..e27f44e9 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1716,6 +1716,8 @@ weston_compositor_pick_view(struct weston_compositor *compositor,
return view;
}
+ *vx = wl_fixed_from_int(-1000000);
+ *vy = wl_fixed_from_int(-1000000);
return NULL;
}
@@ -1760,10 +1762,7 @@ weston_view_unmap(struct weston_view *view)
if (keyboard && keyboard->focus == view->surface)
weston_keyboard_set_focus(keyboard, NULL);
if (pointer && pointer->focus == view)
- weston_pointer_set_focus(pointer,
- NULL,
- wl_fixed_from_int(0),
- wl_fixed_from_int(0));
+ weston_pointer_clear_focus(pointer);
if (touch && touch->focus == view)
weston_touch_set_focus(touch, NULL);
}