diff --git a/CHANGELOG.md b/CHANGELOG.md index c40e8b14..aa6091d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed +- No longer renders to macos and x11 windows that are fully occluded / not directly visible - The `--help` output was reworked with a new colorful syntax - OSC 52 is now disabled on unfocused windows - `SpawnNewInstance` no longer inherits initial `--command` diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs index 54bb239e..3beb5d1e 100644 --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -192,6 +192,7 @@ pub struct ActionContext<'a, N, T> { pub search_state: &'a mut SearchState, pub font_size: &'a mut Size, pub dirty: &'a mut bool, + pub occluded: &'a mut bool, pub preserve_title: bool, #[cfg(not(windows))] pub master_fd: RawFd, @@ -1201,6 +1202,9 @@ impl input::Processor> { self.ctx.update_cursor_blinking(); self.on_focus_change(is_focused); }, + WindowEvent::Occluded(occluded) => { + *self.ctx.occluded = occluded; + }, WindowEvent::DroppedFile(path) => { let path: String = path.to_string_lossy().into(); self.ctx.write_to_pty((path + " ").into_bytes()); @@ -1229,7 +1233,6 @@ impl input::Processor> { | WindowEvent::ThemeChanged(_) | WindowEvent::HoveredFile(_) | WindowEvent::Touch(_) - | WindowEvent::Occluded(_) | WindowEvent::Moved(_) => (), } }, diff --git a/alacritty/src/window_context.rs b/alacritty/src/window_context.rs index 1dd620a4..e75f118d 100644 --- a/alacritty/src/window_context.rs +++ b/alacritty/src/window_context.rs @@ -52,6 +52,7 @@ pub struct WindowContext { font_size: Size, mouse: Mouse, dirty: bool, + occluded: bool, preserve_title: bool, #[cfg(not(windows))] master_fd: RawFd, @@ -161,6 +162,7 @@ impl WindowContext { modifiers: Default::default(), mouse: Default::default(), dirty: Default::default(), + occluded: Default::default(), }) } @@ -276,6 +278,7 @@ impl WindowContext { display: &mut self.display, mouse: &mut self.mouse, dirty: &mut self.dirty, + occluded: &mut self.occluded, terminal: &mut terminal, #[cfg(not(windows))] master_fd: self.master_fd, @@ -324,7 +327,7 @@ impl WindowContext { return; } - if self.dirty { + if self.dirty && !self.occluded { // Force the display to process any pending display update. self.display.process_renderer_update();