1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2025-04-21 18:02:37 -04:00

Fix visual bell getting stuck on macOS

Fixes #7325.
This commit is contained in:
Kirill Chibisov 2023-11-13 17:10:47 +04:00 committed by GitHub
parent dc46d41ff9
commit bd2dfa7a55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View file

@ -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();
}

View file

@ -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, .. })
{