Ensure the visual bell is cleared

UI thread must wakeup after visual bell duration
This commit is contained in:
Kovid Goyal 2017-09-12 14:46:44 +05:30
parent ccf5391b45
commit 8e379df24f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -37,6 +37,10 @@ window_counter = count()
next(window_counter) next(window_counter)
def clear_visual_bell():
pass
class Window: class Window:
def __init__(self, tab, child, opts, args): 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) print('Failed to write to child %d as it does not exist' % self.id, file=sys.stderr)
def bell(self): def bell(self):
get_boss().request_attention() boss = get_boss()
boss.request_attention()
glfw_post_empty_event() 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): def use_utf8(self, on):
get_boss().child_monitor.set_iutf8(self.window_id, on) get_boss().child_monitor.set_iutf8(self.window_id, on)