parent
1f5b11be0b
commit
1df89d9448
6 changed files with 59 additions and 53 deletions
|
|
@ -235,6 +235,9 @@ Detailed list of changes
|
||||||
- macOS: A new option :opt:`macos_dock_badge_on_bell` to show a badge on the
|
- macOS: A new option :opt:`macos_dock_badge_on_bell` to show a badge on the
|
||||||
kitty dock icon when a bell occurs (:pull:`9529`)
|
kitty dock icon when a bell occurs (:pull:`9529`)
|
||||||
|
|
||||||
|
- macOS: Workaround for yet another Tahoe bug causing rendering to fail
|
||||||
|
(:pull:`9520`)
|
||||||
|
|
||||||
|
|
||||||
0.45.0 [2025-12-24]
|
0.45.0 [2025-12-24]
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
|
||||||
|
|
@ -3621,51 +3621,6 @@ GLFWAPI void glfwCocoaRequestRenderFrame(GLFWwindow *w, GLFWcocoarenderframefun
|
||||||
requestRenderFrame((_GLFWwindow*)w, callback);
|
requestRenderFrame((_GLFWwindow*)w, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLFWAPI bool glfwCocoaRecreateGLDrawable(GLFWwindow *w) {
|
|
||||||
_GLFWwindow* window = (_GLFWwindow*)w;
|
|
||||||
if (window->context.client == GLFW_NO_API) return false;
|
|
||||||
@try {
|
|
||||||
// Save current state
|
|
||||||
NSOpenGLPixelFormat *pixelFormat = window->context.nsgl.pixelFormat;
|
|
||||||
NSOpenGLContext *oldContext = window->context.nsgl.object;
|
|
||||||
|
|
||||||
// Create a new context sharing resources with the old one
|
|
||||||
NSOpenGLContext *newContext = [[NSOpenGLContext alloc]
|
|
||||||
initWithFormat:pixelFormat
|
|
||||||
shareContext:oldContext];
|
|
||||||
if (newContext == nil) return false;
|
|
||||||
|
|
||||||
// Copy settings from old context
|
|
||||||
GLint opacity = 0;
|
|
||||||
[oldContext getValues:&opacity forParameter:NSOpenGLContextParameterSurfaceOpacity];
|
|
||||||
[newContext setValues:&opacity forParameter:NSOpenGLContextParameterSurfaceOpacity];
|
|
||||||
GLint interval = 0;
|
|
||||||
[newContext setValues:&interval forParameter:NSOpenGLContextParameterSwapInterval];
|
|
||||||
|
|
||||||
// Detach old context
|
|
||||||
[NSOpenGLContext clearCurrentContext];
|
|
||||||
[oldContext clearDrawable];
|
|
||||||
|
|
||||||
// Attach new context to the view
|
|
||||||
[window->ns.view setWantsBestResolutionOpenGLSurface:window->ns.retina];
|
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
||||||
[newContext setView:window->ns.view];
|
|
||||||
#pragma clang diagnostic pop
|
|
||||||
[newContext makeCurrentContext];
|
|
||||||
[newContext update];
|
|
||||||
|
|
||||||
// Replace context
|
|
||||||
window->context.nsgl.object = newContext;
|
|
||||||
[oldContext release];
|
|
||||||
|
|
||||||
} @catch (NSException *e) {
|
|
||||||
_glfwInputError(GLFW_PLATFORM_ERROR, "Failed to recreate NSGL context: %s (%s)", [[e name] UTF8String], [[e reason] UTF8String]);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLFWAPI GLFWcocoarenderframefun glfwCocoaSetWindowResizeCallback(GLFWwindow *w, GLFWcocoarenderframefun cb) {
|
GLFWAPI GLFWcocoarenderframefun glfwCocoaSetWindowResizeCallback(GLFWwindow *w, GLFWcocoarenderframefun cb) {
|
||||||
_GLFWwindow* window = (_GLFWwindow*)w;
|
_GLFWwindow* window = (_GLFWwindow*)w;
|
||||||
GLFWcocoarenderframefun current = window->ns.resizeCallback;
|
GLFWcocoarenderframefun current = window->ns.resizeCallback;
|
||||||
|
|
|
||||||
|
|
@ -345,3 +345,48 @@ GLFWAPI id glfwGetNSGLContext(GLFWwindow* handle)
|
||||||
|
|
||||||
return window->context.nsgl.object;
|
return window->context.nsgl.object;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLFWAPI bool
|
||||||
|
glfwCocoaRecreateGLDrawable(GLFWwindow *w) {
|
||||||
|
_GLFWwindow* window = (_GLFWwindow*)w;
|
||||||
|
if (window->context.client == GLFW_NO_API) return false;
|
||||||
|
@try {
|
||||||
|
// Save current state
|
||||||
|
NSOpenGLPixelFormat *pixelFormat = window->context.nsgl.pixelFormat;
|
||||||
|
NSOpenGLContext *oldContext = window->context.nsgl.object;
|
||||||
|
|
||||||
|
// Create a new context sharing resources with the old one
|
||||||
|
NSOpenGLContext *newContext = [[NSOpenGLContext alloc]
|
||||||
|
initWithFormat:pixelFormat
|
||||||
|
shareContext:oldContext];
|
||||||
|
if (newContext == nil) return false;
|
||||||
|
|
||||||
|
// Copy settings from old context
|
||||||
|
GLint opacity = 0;
|
||||||
|
[oldContext getValues:&opacity forParameter:NSOpenGLContextParameterSurfaceOpacity];
|
||||||
|
[newContext setValues:&opacity forParameter:NSOpenGLContextParameterSurfaceOpacity];
|
||||||
|
GLint interval = 0;
|
||||||
|
[newContext setValues:&interval forParameter:NSOpenGLContextParameterSwapInterval];
|
||||||
|
|
||||||
|
// Detach old context
|
||||||
|
[NSOpenGLContext clearCurrentContext];
|
||||||
|
[oldContext clearDrawable];
|
||||||
|
|
||||||
|
// Attach new context to the view
|
||||||
|
[window->ns.view setWantsBestResolutionOpenGLSurface:window->ns.retina];
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
[newContext setView:window->ns.view];
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
[newContext makeCurrentContext];
|
||||||
|
[newContext update];
|
||||||
|
|
||||||
|
// Replace context
|
||||||
|
window->context.nsgl.object = newContext;
|
||||||
|
[oldContext release];
|
||||||
|
} @catch (NSException *e) {
|
||||||
|
_glfwInputError(GLFW_PLATFORM_ERROR, "Failed to recreate NSGL context: %s (%s)", [[e name] UTF8String], [[e reason] UTF8String]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
||||||
13
kitty/glfw.c
13
kitty/glfw.c
|
|
@ -11,7 +11,6 @@
|
||||||
#include "control-codes.h"
|
#include "control-codes.h"
|
||||||
#include <structmember.h>
|
#include <structmember.h>
|
||||||
#include "glfw-wrapper.h"
|
#include "glfw-wrapper.h"
|
||||||
#include "gl-wrapper.h"
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include "cocoa_window.h"
|
#include "cocoa_window.h"
|
||||||
#else
|
#else
|
||||||
|
|
@ -347,20 +346,18 @@ window_iconify_callback(GLFWwindow *window, int iconified) {
|
||||||
static void
|
static void
|
||||||
cocoa_out_of_sequence_render(OSWindow *window) {
|
cocoa_out_of_sequence_render(OSWindow *window) {
|
||||||
make_os_window_context_current(window);
|
make_os_window_context_current(window);
|
||||||
|
window->needs_render = true;
|
||||||
|
|
||||||
// On macOS Tahoe, the default framebuffer can become undefined during
|
// On macOS Tahoe, the default framebuffer can become undefined during
|
||||||
// screen change events. Try to recover by recreating the drawable. See #9463
|
// screen change events. Try to recover by recreating the drawable.
|
||||||
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
|
// See https://github.com/kovidgoyal/kitty/issues/9463
|
||||||
if (!glfwCocoaRecreateGLDrawable(window->handle) ||
|
if (!current_framebuffer_is_ok()) {
|
||||||
glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
|
if (!glfwCocoaRecreateGLDrawable(window->handle) || !current_framebuffer_is_ok()) {
|
||||||
window->needs_render = true;
|
|
||||||
request_tick_callback();
|
request_tick_callback();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
window->needs_render = true;
|
|
||||||
bool rendered = false;
|
bool rendered = false;
|
||||||
if (window->fonts_data->sprite_map) rendered = render_os_window(window, monotonic(), true);
|
if (window->fonts_data->sprite_map) rendered = render_os_window(window, monotonic(), true);
|
||||||
if (!rendered) {
|
if (!rendered) {
|
||||||
|
|
|
||||||
|
|
@ -1086,6 +1086,11 @@ screen_needs_rendering_in_layers(OSWindow *os_window, Window *w, Screen *screen)
|
||||||
return has_ui || grman_has_images(grman);
|
return has_ui || grman_has_images(grman);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
current_framebuffer_is_ok(void) {
|
||||||
|
return check_framebuffer_status() == NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// }}}
|
// }}}
|
||||||
|
|
||||||
enum { DRAW_NEITHER_BG = 0, DRAW_DEFAULT_BG = 1, DRAW_NON_DEFAULT_BG = 2, DRAW_BOTH_BG = 3};
|
enum { DRAW_NEITHER_BG = 0, DRAW_DEFAULT_BG = 1, DRAW_NON_DEFAULT_BG = 2, DRAW_BOTH_BG = 3};
|
||||||
|
|
|
||||||
|
|
@ -503,3 +503,4 @@ bool screen_needs_rendering_in_layers(OSWindow *os_window, Window *w, Screen *sc
|
||||||
void setup_os_window_for_rendering(OSWindow*, Tab*, Window*, bool);
|
void setup_os_window_for_rendering(OSWindow*, Tab*, Window*, bool);
|
||||||
void swap_window_buffers(OSWindow *w);
|
void swap_window_buffers(OSWindow *w);
|
||||||
void take_screenshot_of_rectangular_region(OSWindow *os_window, Region region, unsigned char *dst_buf, unsigned *thumb_w, unsigned *thumb_h);
|
void take_screenshot_of_rectangular_region(OSWindow *os_window, Region region, unsigned char *dst_buf, unsigned *thumb_w, unsigned *thumb_h);
|
||||||
|
bool current_framebuffer_is_ok(void);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue