On X11, try alternative cursor icon names as well
This should cover more icons.
This commit is contained in:
parent
0994b5ceb8
commit
e9210555c1
3 changed files with 18 additions and 4 deletions
|
|
@ -11,6 +11,7 @@ Unreleased` header.
|
||||||
|
|
||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
|
- On X11, check common alternative cursor names when loading cursor.
|
||||||
- On Windows, fix so `drag_window` and `drag_resize_window` can be called from another thread.
|
- On Windows, fix so `drag_window` and `drag_resize_window` can be called from another thread.
|
||||||
|
|
||||||
# 0.29.3
|
# 0.29.3
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ cfg_aliases = "0.1.1"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bitflags = "2"
|
bitflags = "2"
|
||||||
cursor-icon = "1.0.0"
|
cursor-icon = "1.1.0"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
mint = { version = "0.5.6", optional = true }
|
mint = { version = "0.5.6", optional = true }
|
||||||
once_cell = "1.12"
|
once_cell = "1.12"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
use std::ffi::CString;
|
use std::ffi::CString;
|
||||||
|
use std::iter;
|
||||||
|
|
||||||
use x11rb::connection::Connection;
|
use x11rb::connection::Connection;
|
||||||
|
|
||||||
|
|
@ -56,10 +57,22 @@ impl XConnection {
|
||||||
None => return self.create_empty_cursor(),
|
None => return self.create_empty_cursor(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let name = CString::new(cursor.name()).unwrap();
|
let mut xcursor = 0;
|
||||||
unsafe {
|
for &name in iter::once(&cursor.name()).chain(cursor.alt_names().iter()) {
|
||||||
(self.xcursor.XcursorLibraryLoadCursor)(self.display, name.as_ptr() as *const c_char)
|
let name = CString::new(name).unwrap();
|
||||||
|
xcursor = unsafe {
|
||||||
|
(self.xcursor.XcursorLibraryLoadCursor)(
|
||||||
|
self.display,
|
||||||
|
name.as_ptr() as *const c_char,
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
|
if xcursor != 0 {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xcursor
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_cursor(&self, window: xproto::Window, cursor: ffi::Cursor) -> Result<(), X11Error> {
|
fn update_cursor(&self, window: xproto::Window, cursor: ffi::Cursor) -> Result<(), X11Error> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue