Skip to content

Commit

Permalink
wayland.pointer_constraints: Remove constraints in the destructor (#1568
Browse files Browse the repository at this point in the history
)
  • Loading branch information
PolyMeilex authored Oct 25, 2024
1 parent de5ad9e commit 6ccbe9d
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_server::backend::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_server::backend::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 6ccbe9d

Please sign in to comment.