data-device: Don't make a weston_coord with no valid space

We already only conditionally use base.offset when an icon exists. We
should also avoid trying to create a coordinate with a NULL icon, as it
will fire an assert().

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
Derek Foreman 2023-06-28 13:55:10 -05:00
parent 14220a5f80
commit 815a560dd4

View file

@ -968,6 +968,7 @@ weston_pointer_start_drag(struct weston_pointer *pointer,
icon->committed_private = drag;
weston_surface_set_label_func(icon,
pointer_drag_surface_get_label);
drag->base.offset = weston_coord_surface(0, 0, icon);
} else {
drag->base.icon = NULL;
}
@ -986,7 +987,6 @@ weston_pointer_start_drag(struct weston_pointer *pointer,
if (keyboard)
weston_keyboard_start_grab(keyboard, &drag->base.keyboard_grab);
drag->base.offset = weston_coord_surface(0, 0, icon);
return 0;
}
@ -1032,6 +1032,7 @@ weston_touch_start_drag(struct weston_touch *touch,
icon->committed_private = drag;
weston_surface_set_label_func(icon,
touch_drag_surface_get_label);
drag->base.offset = weston_coord_surface(0, 0, icon);
} else {
drag->base.icon = NULL;
}
@ -1051,7 +1052,6 @@ weston_touch_start_drag(struct weston_touch *touch,
drag_grab_touch_focus(drag);
drag->base.offset = weston_coord_surface(0, 0, icon);
return 0;
}