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>
This commit is contained in:
committed by
Daniel Stone
parent
2ccd9a2d62
commit
f9318d1452
@@ -589,9 +589,7 @@ exposay_transition_active(struct desktop_shell *shell)
|
||||
if (pointer) {
|
||||
weston_pointer_start_grab(pointer,
|
||||
&shell->exposay.grab_ptr);
|
||||
weston_pointer_set_focus(pointer, NULL,
|
||||
pointer->x,
|
||||
pointer->y);
|
||||
weston_pointer_clear_focus(pointer);
|
||||
}
|
||||
wl_list_for_each(shell_output, &shell->output_list, link) {
|
||||
enum exposay_layout_state state;
|
||||
|
||||
@@ -3218,9 +3218,7 @@ popup_grab_focus(struct weston_pointer_grab *grab)
|
||||
wl_resource_get_client(view->surface->resource) == client) {
|
||||
weston_pointer_set_focus(pointer, view, sx, sy);
|
||||
} else {
|
||||
weston_pointer_set_focus(pointer, NULL,
|
||||
wl_fixed_from_int(0),
|
||||
wl_fixed_from_int(0));
|
||||
weston_pointer_clear_focus(pointer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user