aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2023-11-13 17:10:47 +0400
committerGitHub <noreply@github.com>2023-11-13 17:10:47 +0400
commitbd2dfa7a5586d418e7dae5aac3aa904668feadf1 (patch)
treec089fb5221e4b9267f6d3200bca732c4b37cc1d7
parentdc46d41ff945d7158d9bb1638afc124cf650fa61 (diff)
downloadalacritty-bd2dfa7a5586d418e7dae5aac3aa904668feadf1.tar.gz
alacritty-bd2dfa7a5586d418e7dae5aac3aa904668feadf1.zip
Fix visual bell getting stuck on macOS
Fixes #7325.
-rw-r--r--alacritty/src/display/window.rs4
-rw-r--r--alacritty/src/window_context.rs9
2 files changed, 9 insertions, 4 deletions
diff --git a/alacritty/src/display/window.rs b/alacritty/src/display/window.rs
index f5128e75..7dc6375e 100644
--- a/alacritty/src/display/window.rs
+++ b/alacritty/src/display/window.rs
@@ -235,9 +235,7 @@ impl Window {
#[inline]
pub fn request_redraw(&mut self) {
- // No need to request a frame when we don't have one. The next `Frame` event will check the
- // `dirty` flag on the display and submit a redraw request.
- if self.has_frame && !self.requested_redraw {
+ if !self.requested_redraw {
self.requested_redraw = true;
self.window.request_redraw();
}
diff --git a/alacritty/src/window_context.rs b/alacritty/src/window_context.rs
index 329e7ef8..c5b00085 100644
--- a/alacritty/src/window_context.rs
+++ b/alacritty/src/window_context.rs
@@ -380,7 +380,13 @@ impl WindowContext {
// Request immediate re-draw if visual bell animation is not finished yet.
if !self.display.visual_bell.completed() {
- self.display.window.request_redraw();
+ // We can get an OS redraw which bypasses alacritty's frame throttling, thus
+ // marking the window as dirty when we don't have frame yet.
+ if self.display.window.has_frame {
+ self.display.window.request_redraw();
+ } else {
+ self.dirty = true;
+ }
}
// Redraw the window.
@@ -481,6 +487,7 @@ impl WindowContext {
// Don't call `request_redraw` when event is `RedrawRequested` since the `dirty` flag
// represents the current frame, but redraw is for the next frame.
if self.dirty
+ && self.display.window.has_frame
&& !self.occluded
&& !matches!(event, WinitEvent::WindowEvent { event: WindowEvent::RedrawRequested, .. })
{