mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-05-05 00:37:59 +02:00
libweston: check focus surface before enabling pointer constraint
Check if surface matches before enabling pointer constraint. If not match, no constraint enabled. Otherwise, assertion would failed in confined_pointer_grab_pointer_motion() and weston would crash. This fixes crashes reported in GitLab issues #185 and #670. Closes: https://gitlab.freedesktop.org/wayland/weston/-/issues/185 Closes: https://gitlab.freedesktop.org/wayland/weston/-/issues/670 Signed-off-by: Ruitang Wang <Ruitang.Wang@amd.com>
This commit is contained in:
parent
df40e3b93a
commit
c23ea4ba8d
1 changed files with 8 additions and 0 deletions
|
|
@ -4628,6 +4628,14 @@ enable_pointer_constraint(struct weston_pointer_constraint *constraint,
|
|||
struct weston_view *view)
|
||||
{
|
||||
assert(constraint->view == NULL);
|
||||
|
||||
if (!constraint->pointer->focus ||
|
||||
constraint->pointer->focus->surface != constraint->surface) {
|
||||
weston_log("WARNING: Not enabling constraint because "
|
||||
"pointer focus doesn't match\n");
|
||||
return;
|
||||
}
|
||||
|
||||
constraint->view = view;
|
||||
pointer_constraint_notify_activated(constraint);
|
||||
weston_pointer_start_grab(constraint->pointer, &constraint->grab);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue