Skip to content

fix: blank screen on macOS resume from sleep - #9520

Merged
kovidgoyal merged 1 commit into
kovidgoyal:masterfrom
jorgemmsilva:fix-sleep-macos
Feb 23, 2026
Merged

kovidgoyal merged 1 commit into
kovidgoyal:masterfrom
jorgemmsilva:fix-sleep-macos

Conversation

@jorgemmsilva

Copy link
Copy Markdown

No description provided.

@kovidgoyal

Copy link
Copy Markdown
Owner

Would it work to just not draw (aka return early) in the out of sequence render function when the framebuffer is not ready. Presumably if we do that, eventually macOS will repair the framebuffer? If not then it should use the context creation code in nsgl_context.m so as to avoid code duplication and ensure the new context is created with all the correct properties.

@jorgemmsilva

Copy link
Copy Markdown
Author

do you mean something like this?

diff --git a/kitty/glfw.c b/kitty/glfw.c
index 846e51900..4ae5d3b7e 100644
--- a/kitty/glfw.c
+++ b/kitty/glfw.c
@@ -346,6 +346,12 @@ window_iconify_callback(GLFWwindow *window, int iconified) {
 static void
 cocoa_out_of_sequence_render(OSWindow *window) {
     make_os_window_context_current(window);
+    GLenum fb_status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
+    if (fb_status != GL_FRAMEBUFFER_COMPLETE) {
+        window->needs_render = true;
+        request_tick_callback();
+        return;
+    }
     window->needs_render = true;
     bool rendered = false;
     if (window->fonts_data->sprite_map) rendered = render_os_window(window, monotonic(), true);

This was my first attempt, but that didn't work unfortunately :/

@jorgemmsilva

jorgemmsilva commented Feb 18, 2026

Copy link
Copy Markdown
Author

If not then it should use the context creation code in nsgl_context.m so as to avoid code duplication and ensure the new context is created with all the correct properties.

👀 I'll try this

@kovidgoyal

kovidgoyal commented Feb 18, 2026 via email

Copy link
Copy Markdown
Owner

@kovidgoyal
kovidgoyal merged commit 1f5b11b into kovidgoyal:master Feb 23, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants