From 738e180295f3e395e4c3ea740e3ef80ef7334b9b Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sat, 9 Apr 2022 06:48:29 -0700 Subject: [PATCH] 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 ``` --- term/src/terminalstate/performer.rs | 2 +- window/src/os/x11/cursor.rs | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/term/src/terminalstate/performer.rs b/term/src/terminalstate/performer.rs index 697cbdfa7..f9dfdc149 100644 --- a/term/src/terminalstate/performer.rs +++ b/term/src/terminalstate/performer.rs @@ -391,7 +391,7 @@ impl<'a> Performer<'a> { } } - ControlCode::Null => {}, + ControlCode::Null => {} _ => log::warn!("unhandled ControlCode {:?}", control), } diff --git a/window/src/os/x11/cursor.rs b/window/src/os/x11/cursor.rs index 79c460c97..8182bc0a8 100644 --- a/window/src/os/x11/cursor.rs +++ b/window/src/os/x11/cursor.rs @@ -36,8 +36,13 @@ pub struct CursorInfo { fn icon_path() -> Vec { let path = match std::env::var_os("XCURSOR_PATH") { - Some(path) => path, + Some(path) => { + log::trace!("Using $XCURSOR_PATH icon path: {:?}", path); + path + } None => { + log::trace!("Constructing default icon path because $XCURSOR_PATH is not set"); + fn add_icons_dir(path: &OsStr, dest: &mut Vec) { for entry in std::env::split_paths(path) { dest.push(entry.join("icons")); @@ -46,8 +51,10 @@ fn icon_path() -> Vec { fn xdg_location(name: &str, def: &str, dest: &mut Vec) { if let Some(var) = std::env::var_os(name) { + log::trace!("Using ${} location {:?}", name, var); add_icons_dir(&var, dest); } else { + log::trace!("Using {} because ${} is not set", def, name); add_icons_dir(OsStr::new(def), dest); } } @@ -160,6 +167,7 @@ impl CursorInfo { } } let icon_path = icon_path(); + log::trace!("icon_path is {:?}", icon_path); Self { cursors: HashMap::new(), @@ -303,6 +311,7 @@ impl CursorInfo { for dir in &self.icon_path { for name in names { 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) { match self.parse_cursor_file(conn, file) { Ok(cursor_id) => { @@ -314,6 +323,7 @@ impl CursorInfo { }, ); + log::trace!("{:?} resolved to {:?}", cursor, candidate); return Some(cursor_id); } Err(err) => log::error!("{:#}", err), @@ -334,6 +344,7 @@ impl CursorInfo { MouseCursor::SizeUpDown => xcb_util::cursor::SB_V_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(); xcb::create_glyph_cursor(