Skip to content

Commit

Permalink
cursor: Add missing Send + Sync bound on callback
Browse files Browse the repository at this point in the history
This had broken the API by making `CursorTheme` not `Send`/`Sync`, as it
had been before.
  • Loading branch information
ids1024 committed May 31, 2024
1 parent 9be8a62 commit 7669047
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
10 changes: 10 additions & 0 deletions wayland-cursor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

## Unreleased

## 0.31.3 -- 2024-05-30

#### Bugfixes
- Add `Send + Sync` bounds to fallback callback

## 0.31.2 -- 2024-05-30

### Additions
- Add `set_fallback` method

## 0.31.1 -- 2024-01-29

- Dropped `nix` dependency in favor or `rustix`
Expand Down
2 changes: 1 addition & 1 deletion wayland-cursor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wayland-cursor"
version = "0.31.2"
version = "0.31.3"
documentation = "https://docs.rs/wayland-cursor/"
repository = "https://github.com/smithay/wayland-rs"
authors = ["Elinor Berger <[email protected]>"]
Expand Down
6 changes: 3 additions & 3 deletions wayland-cursor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ pub struct CursorTheme {
fallback: Option<FallBack>,
}

type FallBackInner = Box<dyn Fn(&str, u32) -> Option<Cow<'static, [u8]>>>;
type FallBackInner = Box<dyn Fn(&str, u32) -> Option<Cow<'static, [u8]>> + Send + Sync>;

struct FallBack(FallBackInner);

impl FallBack {
fn new<F>(fallback: F) -> Self
where
F: Fn(&str, u32) -> Option<Cow<'static, [u8]>> + 'static,
F: Fn(&str, u32) -> Option<Cow<'static, [u8]>> + Send + Sync + 'static,
{
Self(Box::new(fallback))
}
Expand Down Expand Up @@ -232,7 +232,7 @@ impl CursorTheme {
/// ```
pub fn set_fallback<F>(&mut self, fallback: F)
where
F: Fn(&str, u32) -> Option<Cow<'static, [u8]>> + 'static,
F: Fn(&str, u32) -> Option<Cow<'static, [u8]>> + Send + Sync + 'static,
{
self.fallback = Some(FallBack::new(fallback))
}
Expand Down

0 comments on commit 7669047

Please sign in to comment.