Skip to content

Commit

Permalink
wayland.pointer_constraints: Remove constraints in the destructor
Browse files Browse the repository at this point in the history
  • Loading branch information
PolyMeilex committed Oct 24, 2024
1 parent 2cee41c commit dc2645d
Showing 1 changed file with 28 additions and 6 deletions.
34 changes: 28 additions & 6 deletions src/wayland/pointer_constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -482,12 +482,23 @@ where
}
});
}
zwp_confined_pointer_v1::Request::Destroy => {
remove_constraint(&data.surface, pointer);
}
zwp_confined_pointer_v1::Request::Destroy => {}
_ => unreachable!(),
}
}

fn destroyed(
_state: &mut D,
_client: wayland_backend::server::ClientId,
_resource: &ZwpConfinedPointerV1,
data: &PointerConstraintUserData<D>,
) {
let Some(pointer) = &data.pointer else {
return;
};

remove_constraint(&data.surface, pointer);
}
}

impl<D> Dispatch<ZwpLockedPointerV1, PointerConstraintUserData<D>, D> for PointerConstraintsState
Expand Down Expand Up @@ -524,12 +535,23 @@ where
}
});
}
zwp_locked_pointer_v1::Request::Destroy => {
remove_constraint(&data.surface, pointer);
}
zwp_locked_pointer_v1::Request::Destroy => {}
_ => unreachable!(),
}
}

fn destroyed(
_state: &mut D,
_client: wayland_backend::server::ClientId,
_resource: &ZwpLockedPointerV1,
data: &PointerConstraintUserData<D>,
) {
let Some(pointer) = &data.pointer else {
return;
};

remove_constraint(&data.surface, pointer);
}
}

#[allow(missing_docs)]
Expand Down

0 comments on commit dc2645d

Please sign in to comment.