From 8e379df24f9cc0d44ca970b0321b90fbfff08c84 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 12 Sep 2017 14:46:44 +0530 Subject: [PATCH] Ensure the visual bell is cleared UI thread must wakeup after visual bell duration --- kitty/window.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/kitty/window.py b/kitty/window.py index 14a9ae9df..09512e75c 100644 --- a/kitty/window.py +++ b/kitty/window.py @@ -37,6 +37,10 @@ window_counter = count() next(window_counter) +def clear_visual_bell(): + pass + + class Window: def __init__(self, tab, child, opts, args): @@ -117,8 +121,12 @@ class Window: print('Failed to write to child %d as it does not exist' % self.id, file=sys.stderr) def bell(self): - get_boss().request_attention() + boss = get_boss() + boss.request_attention() glfw_post_empty_event() + if self.opts.visual_bell_duration > 0: + # ensure that the UI thread wakes up and clears the visual bell + boss.ui_timers.add(self.opts.visual_bell_duration + 0.01, clear_visual_bell) def use_utf8(self, on): get_boss().child_monitor.set_iutf8(self.window_id, on)