From 217cc2f40e717b65c6b05c3801dea00d3b6ee817 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 14 Jan 2017 18:01:03 +0530 Subject: [PATCH] More robust blink control based on window focus state --- kitty/boss.py | 6 +----- kitty/char_grid.py | 5 +---- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/kitty/boss.py b/kitty/boss.py index 3314edd8e..897864f35 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -293,10 +293,6 @@ class Boss(Thread): if w is not None: yield w w.focus_changed(focused) - if focused: - self.start_cursor_blink() - else: - self.stop_cursor_blinking() def display_scrollback(self, data): if self.opts.scrollback_in_new_tab: @@ -405,7 +401,7 @@ class Boss(Thread): rd = render_data.get(active) if rd is not None: draw_cursor = True - if self.cursor_blinking and self.opts.cursor_blink_interval > 0: + if self.cursor_blinking and self.opts.cursor_blink_interval > 0 and self.window_is_focused: now = monotonic() - self.cursor_blink_zero_time t = int(now * 1000) d = int(self.opts.cursor_blink_interval * 1000) diff --git a/kitty/char_grid.py b/kitty/char_grid.py index 473122f0f..f312485da 100644 --- a/kitty/char_grid.py +++ b/kitty/char_grid.py @@ -481,8 +481,5 @@ class CharGrid: glUniform4f(ul('color'), col[0], col[1], col[2], alpha) glUniform2f(ul('xpos'), left, right) glUniform2f(ul('ypos'), top, bottom) - if is_focused: - glDrawArrays(GL_TRIANGLE_FAN, 0, 4) - else: - glDrawArrays(GL_LINE_LOOP, 0, 4) + glDrawArrays(GL_TRIANGLE_FAN if is_focused else GL_LINE_LOOP, 0, 4) glDisable(GL_BLEND)