diff --git a/wayland-cursor/src/lib.rs b/wayland-cursor/src/lib.rs index ff6ae747273..6f133459c3c 100644 --- a/wayland-cursor/src/lib.rs +++ b/wayland-cursor/src/lib.rs @@ -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 { + 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.