Skip to content

Commit

Permalink
Check alternative cursor names when loading cursor
Browse files Browse the repository at this point in the history
Some themes don't have all the cursors specified as in w3c
specification, thus try to check for alternative names as well.
  • Loading branch information
kchibisov authored and YaLTeR committed Nov 2, 2023
1 parent 889d062 commit 6a81d8f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions src/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,17 @@ impl CursorManager {
.or_insert_with_key(|(icon, scale)| {
let size = self.size as i32 * scale;
let mut cursor = Self::load_xcursor(&self.theme, icon.name(), size);

// Check alternative names to account for non-compliant themes.
if cursor.is_err() {
for name in icon.alt_names() {
cursor = Self::load_xcursor(&self.theme, name, size);
if cursor.is_ok() {
break;
}
}
}

if let Err(err) = &cursor {
warn!("error loading xcursor {}@{size}: {err:?}", icon.name());
}
Expand Down

0 comments on commit 6a81d8f

Please sign in to comment.