Skip to content

Commit

Permalink
Fix visual bell getting stuck on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
kchibisov committed Nov 11, 2023
1 parent 2f097da commit 21b60a8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 1 addition & 3 deletions alacritty/src/display/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
9 changes: 8 additions & 1 deletion alacritty/src/window_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 by-passes alacritty's _frame_ throttling, thus
// mark 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.
Expand Down Expand Up @@ -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, .. })
{
Expand Down

0 comments on commit 21b60a8

Please sign in to comment.