diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2023-10-26 17:29:28 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2023-10-29 10:45:24 +0400 |
| commit | 5e543b8dc6fa18142ce60fa8700e268ca59ad886 (patch) | |
| tree | 60f79830da2dbfbf673127a9be4a8d8f57c3a6b2 /src | |
| parent | 0e0764ef37b3182c98fb63a1c3b180e223e3f943 (diff) | |
| download | niri-5e543b8dc6fa18142ce60fa8700e268ca59ad886.tar.gz niri-5e543b8dc6fa18142ce60fa8700e268ca59ad886.tar.bz2 niri-5e543b8dc6fa18142ce60fa8700e268ca59ad886.zip | |
Move cursor surface alive check to refresh()
Diffstat (limited to 'src')
| -rw-r--r-- | src/niri.rs | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/niri.rs b/src/niri.rs index 9265153b..3b0563e7 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -263,6 +263,7 @@ impl State { // These should be called periodically, before flushing the clients. self.niri.layout.refresh(); + self.niri.check_cursor_image_surface_alive(); self.niri.refresh_pointer_outputs(); self.niri.popups.cleanup(); self.update_focus(); @@ -1082,21 +1083,16 @@ impl Niri { let (default_buffer, default_hotspot) = self.default_cursor.get(renderer, output_scale_int); let default_hotspot = default_hotspot.to_logical(output_scale_int); - let hotspot = if let CursorImageStatus::Surface(surface) = &mut self.cursor_image { - if surface.alive() { - with_states(surface, |states| { - states - .data_map - .get::<Mutex<CursorImageAttributes>>() - .unwrap() - .lock() - .unwrap() - .hotspot - }) - } else { - self.cursor_image = CursorImageStatus::default_named(); - default_hotspot - } + let hotspot = if let CursorImageStatus::Surface(surface) = &self.cursor_image { + with_states(surface, |states| { + states + .data_map + .get::<Mutex<CursorImageAttributes>>() + .unwrap() + .lock() + .unwrap() + .hotspot + }) } else { default_hotspot }; @@ -1139,6 +1135,14 @@ impl Niri { pointer_elements } + pub fn check_cursor_image_surface_alive(&mut self) { + if let CursorImageStatus::Surface(surface) = &self.cursor_image { + if !surface.alive() { + self.cursor_image = CursorImageStatus::default_named(); + } + } + } + pub fn refresh_pointer_outputs(&self) { let _span = tracy_client::span!("Niri::refresh_pointer_outputs"); |
