Skip to content

Commit

Permalink
feat: load cursor from data
Browse files Browse the repository at this point in the history
Log:
  • Loading branch information
Decodetalkers committed Dec 7, 2023
1 parent fdd88c4 commit 48331ef
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions wayland-cursor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ impl CursorTheme {
}
}

/// Allow load cursor from data, this allow program to set a fallback image, it finally cannot
/// find any usable cursor
pub fn load_cursor_from_data(&mut self, name: &str, size: u32, data: &[u8]) -> Option<Cursor> {
let conn = Connection::from_backend(self.backend.upgrade()?);
let images = xparser::parse_xcursor(data)?;
Some(Cursor::new(&conn, name, self, &images, size))
}

/// This function loads a cursor, parses it and pushes the images onto the shm pool.
///
/// Keep in mind that if the cursor is already loaded, the function will make a duplicate.
Expand Down

0 comments on commit 48331ef

Please sign in to comment.