1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-27 02:25:28 +03:00

wayland: set_cursor: use exactly the caller-provided serial

Don't fallback to some other serial.

In a new version of SCTK, it looks like the serial we pass should
be the serial from the time we entered the surface, rather than
the latest serial that we have.

In practice, this commit uses None for the serial which seems to
have better results, but may come back to haunt us until we upgrade
to the latest SCTK.

refs: https://github.com/wez/wezterm/issues/3334#issuecomment-1515141539
This commit is contained in:
Wez Furlong 2023-04-19 10:55:47 -07:00
parent 048e8dd1ba
commit e204f8ba49
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387

View File

@ -341,21 +341,18 @@ impl PointerDispatcher {
} }
pub fn set_cursor(&self, names: &[&str], serial: Option<u32>) { pub fn set_cursor(&self, names: &[&str], serial: Option<u32>) {
let inner = self.inner.lock().unwrap();
let serial = serial.unwrap_or(inner.serial);
if names.is_empty() { if names.is_empty() {
(*self.auto_pointer).set_cursor(0, None, 0, 0); (*self.auto_pointer).set_cursor(0, None, 0, 0);
} else { } else {
let mut errors = vec![]; let mut errors = vec![];
for name in names { for name in names {
match self.auto_pointer.set_cursor(name, Some(serial)) { match self.auto_pointer.set_cursor(name, serial) {
Ok(_) => return, Ok(_) => return,
Err(err) => errors.push(format!("Unable to set cursor to {name}: {err:#}")), Err(err) => errors.push(format!("Unable to set cursor to {name}: {err:#}")),
} }
} }
if let Err(err) = self.auto_pointer.set_cursor("default", Some(serial)) { if let Err(err) = self.auto_pointer.set_cursor("default", serial) {
errors.push(format!("Unable to set cursor to 'default': {err:#}")); errors.push(format!("Unable to set cursor to 'default': {err:#}"));
} }