Move cursor timer to renderer

This commit is contained in:
Mitchell Hashimoto
2022-11-05 19:18:22 -07:00
parent e2d8ffc3c1
commit aa98e3ca3a
6 changed files with 68 additions and 36 deletions

View File

@@ -441,6 +441,11 @@ pub fn setFocus(self: *OpenGL, focus: bool) !void {
self.focused = focus;
}
/// Called to toggle the blink state of the cursor
pub fn blinkCursor(self: *OpenGL) void {
self.cursor_visible = !self.cursor_visible;
}
/// The primary render callback that is completely thread-safe.
pub fn render(
self: *OpenGL,
@@ -465,7 +470,7 @@ pub fn render(
// Setup our cursor state
if (self.focused) {
self.cursor_visible = state.cursor.visible and !state.cursor.blink;
self.cursor_visible = self.cursor_visible and state.cursor.visible;
self.cursor_style = renderer.CursorStyle.fromTerminal(state.cursor.style) orelse .box;
} else {
self.cursor_visible = true;