mirror of
https://github.com/wez/wezterm.git
synced 2024-12-02 11:03:49 +03:00
x11/wayland: add tracing to xcursor loading code
Makes it easier to understand what is happening when debugging xcursor issues: ``` WEZTERM_LOG=window::os::x11::cursor=trace,info wezterm ```
This commit is contained in:
parent
bbead38f82
commit
738e180295
@ -391,7 +391,7 @@ impl<'a> Performer<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlCode::Null => {},
|
ControlCode::Null => {}
|
||||||
|
|
||||||
_ => log::warn!("unhandled ControlCode {:?}", control),
|
_ => log::warn!("unhandled ControlCode {:?}", control),
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,13 @@ pub struct CursorInfo {
|
|||||||
|
|
||||||
fn icon_path() -> Vec<PathBuf> {
|
fn icon_path() -> Vec<PathBuf> {
|
||||||
let path = match std::env::var_os("XCURSOR_PATH") {
|
let path = match std::env::var_os("XCURSOR_PATH") {
|
||||||
Some(path) => path,
|
Some(path) => {
|
||||||
|
log::trace!("Using $XCURSOR_PATH icon path: {:?}", path);
|
||||||
|
path
|
||||||
|
}
|
||||||
None => {
|
None => {
|
||||||
|
log::trace!("Constructing default icon path because $XCURSOR_PATH is not set");
|
||||||
|
|
||||||
fn add_icons_dir(path: &OsStr, dest: &mut Vec<PathBuf>) {
|
fn add_icons_dir(path: &OsStr, dest: &mut Vec<PathBuf>) {
|
||||||
for entry in std::env::split_paths(path) {
|
for entry in std::env::split_paths(path) {
|
||||||
dest.push(entry.join("icons"));
|
dest.push(entry.join("icons"));
|
||||||
@ -46,8 +51,10 @@ fn icon_path() -> Vec<PathBuf> {
|
|||||||
|
|
||||||
fn xdg_location(name: &str, def: &str, dest: &mut Vec<PathBuf>) {
|
fn xdg_location(name: &str, def: &str, dest: &mut Vec<PathBuf>) {
|
||||||
if let Some(var) = std::env::var_os(name) {
|
if let Some(var) = std::env::var_os(name) {
|
||||||
|
log::trace!("Using ${} location {:?}", name, var);
|
||||||
add_icons_dir(&var, dest);
|
add_icons_dir(&var, dest);
|
||||||
} else {
|
} else {
|
||||||
|
log::trace!("Using {} because ${} is not set", def, name);
|
||||||
add_icons_dir(OsStr::new(def), dest);
|
add_icons_dir(OsStr::new(def), dest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -160,6 +167,7 @@ impl CursorInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
let icon_path = icon_path();
|
let icon_path = icon_path();
|
||||||
|
log::trace!("icon_path is {:?}", icon_path);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
cursors: HashMap::new(),
|
cursors: HashMap::new(),
|
||||||
@ -303,6 +311,7 @@ impl CursorInfo {
|
|||||||
for dir in &self.icon_path {
|
for dir in &self.icon_path {
|
||||||
for name in names {
|
for name in names {
|
||||||
let candidate = dir.join(theme).join("cursors").join(name);
|
let candidate = dir.join(theme).join("cursors").join(name);
|
||||||
|
log::trace!("candidate for {:?} is {:?}", cursor, candidate);
|
||||||
if let Ok(file) = std::fs::File::open(&candidate) {
|
if let Ok(file) = std::fs::File::open(&candidate) {
|
||||||
match self.parse_cursor_file(conn, file) {
|
match self.parse_cursor_file(conn, file) {
|
||||||
Ok(cursor_id) => {
|
Ok(cursor_id) => {
|
||||||
@ -314,6 +323,7 @@ impl CursorInfo {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
log::trace!("{:?} resolved to {:?}", cursor, candidate);
|
||||||
return Some(cursor_id);
|
return Some(cursor_id);
|
||||||
}
|
}
|
||||||
Err(err) => log::error!("{:#}", err),
|
Err(err) => log::error!("{:#}", err),
|
||||||
@ -334,6 +344,7 @@ impl CursorInfo {
|
|||||||
MouseCursor::SizeUpDown => xcb_util::cursor::SB_V_DOUBLE_ARROW,
|
MouseCursor::SizeUpDown => xcb_util::cursor::SB_V_DOUBLE_ARROW,
|
||||||
MouseCursor::SizeLeftRight => xcb_util::cursor::SB_H_DOUBLE_ARROW,
|
MouseCursor::SizeLeftRight => xcb_util::cursor::SB_H_DOUBLE_ARROW,
|
||||||
};
|
};
|
||||||
|
log::trace!("loading X11 basic cursor {} for {:?}", id_no, cursor);
|
||||||
|
|
||||||
let cursor_id: xcb::ffi::xcb_cursor_t = conn.generate_id();
|
let cursor_id: xcb::ffi::xcb_cursor_t = conn.generate_id();
|
||||||
xcb::create_glyph_cursor(
|
xcb::create_glyph_cursor(
|
||||||
|
Loading…
Reference in New Issue
Block a user