Merge pull request #56 from mrshiposha/fix/xcursor-theme
Use XCURSOR_THEME
This commit is contained in:
commit
80dc8770c5
1 changed files with 6 additions and 1 deletions
|
|
@ -28,6 +28,7 @@ use {
|
||||||
time::Duration,
|
time::Duration,
|
||||||
},
|
},
|
||||||
thiserror::Error,
|
thiserror::Error,
|
||||||
|
uapi::Bytes,
|
||||||
};
|
};
|
||||||
|
|
||||||
const XCURSOR_MAGIC: u32 = 0x72756358;
|
const XCURSOR_MAGIC: u32 = 0x72756358;
|
||||||
|
|
@ -35,6 +36,7 @@ const XCURSOR_IMAGE_TYPE: u32 = 0xfffd0002;
|
||||||
const XCURSOR_PATH_DEFAULT: &[u8] =
|
const XCURSOR_PATH_DEFAULT: &[u8] =
|
||||||
b"~/.icons:/usr/share/icons:/usr/share/pixmaps:/usr/X11R6/lib/X11/icons";
|
b"~/.icons:/usr/share/icons:/usr/share/pixmaps:/usr/X11R6/lib/X11/icons";
|
||||||
const XCURSOR_PATH: &str = "XCURSOR_PATH";
|
const XCURSOR_PATH: &str = "XCURSOR_PATH";
|
||||||
|
const XCURSOR_THEME: &str = "XCURSOR_THEME";
|
||||||
const HOME: &str = "HOME";
|
const HOME: &str = "HOME";
|
||||||
|
|
||||||
const HEADER_SIZE: u32 = 16;
|
const HEADER_SIZE: u32 = 16;
|
||||||
|
|
@ -92,8 +94,11 @@ impl ServerCursors {
|
||||||
if sizes.is_empty() || scales.is_empty() {
|
if sizes.is_empty() || scales.is_empty() {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
let xcursor_theme = env::var_os(XCURSOR_THEME);
|
||||||
|
let theme = xcursor_theme.as_ref().map(|theme| BStr::new(theme.bytes()));
|
||||||
|
|
||||||
let load =
|
let load =
|
||||||
|name: &str| ServerCursorTemplate::load(name, None, &scales, &sizes, &paths, ctx);
|
|name: &str| ServerCursorTemplate::load(name, theme, &scales, &sizes, &paths, ctx);
|
||||||
Ok(Some(Self {
|
Ok(Some(Self {
|
||||||
default: load("left_ptr")?,
|
default: load("left_ptr")?,
|
||||||
pointer: load("hand2")?,
|
pointer: load("hand2")?,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue