Fix for kitty window not being rendered until moved/resized on macOS Mojave
Fixes #887
This commit is contained in:
parent
9b293ad66a
commit
b82e74f99a
@ -192,6 +192,7 @@ def generate_wrappers(glfw_header, glfw_native_header):
|
|||||||
functions.append(Function(decl))
|
functions.append(Function(decl))
|
||||||
for line in '''\
|
for line in '''\
|
||||||
void* glfwGetCocoaWindow(GLFWwindow* window)
|
void* glfwGetCocoaWindow(GLFWwindow* window)
|
||||||
|
void* glfwGetNSGLContext(GLFWwindow *window)
|
||||||
uint32_t glfwGetCocoaMonitor(GLFWmonitor* monitor)
|
uint32_t glfwGetCocoaMonitor(GLFWmonitor* monitor)
|
||||||
GLFWcocoatextinputfilterfun glfwSetCocoaTextInputFilter(GLFWwindow* window, GLFWcocoatextinputfilterfun callback)
|
GLFWcocoatextinputfilterfun glfwSetCocoaTextInputFilter(GLFWwindow* window, GLFWcocoatextinputfilterfun callback)
|
||||||
GLFWcocoatogglefullscreenfun glfwSetCocoaToggleFullscreenIntercept(GLFWwindow *window, GLFWcocoatogglefullscreenfun callback)
|
GLFWcocoatogglefullscreenfun glfwSetCocoaToggleFullscreenIntercept(GLFWwindow *window, GLFWcocoatogglefullscreenfun callback)
|
||||||
|
|||||||
@ -99,6 +99,12 @@ cocoa_set_new_window_trigger(PyObject *self UNUSED, PyObject *args) {
|
|||||||
Py_RETURN_FALSE;
|
Py_RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cocoa_update_nsgl_context(void* id) {
|
||||||
|
NSOpenGLContext *ctx = id;
|
||||||
|
[ctx update];
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cocoa_create_global_menu(void) {
|
cocoa_create_global_menu(void) {
|
||||||
NSString* app_name = find_app_name();
|
NSString* app_name = find_app_name();
|
||||||
|
|||||||
2
kitty/glfw-wrapper.c
generated
2
kitty/glfw-wrapper.c
generated
@ -358,6 +358,8 @@ load_glfw(const char* path) {
|
|||||||
|
|
||||||
*(void **) (&glfwGetCocoaWindow_impl) = dlsym(handle, "glfwGetCocoaWindow");
|
*(void **) (&glfwGetCocoaWindow_impl) = dlsym(handle, "glfwGetCocoaWindow");
|
||||||
|
|
||||||
|
*(void **) (&glfwGetNSGLContext_impl) = dlsym(handle, "glfwGetNSGLContext");
|
||||||
|
|
||||||
*(void **) (&glfwGetCocoaMonitor_impl) = dlsym(handle, "glfwGetCocoaMonitor");
|
*(void **) (&glfwGetCocoaMonitor_impl) = dlsym(handle, "glfwGetCocoaMonitor");
|
||||||
|
|
||||||
*(void **) (&glfwSetCocoaTextInputFilter_impl) = dlsym(handle, "glfwSetCocoaTextInputFilter");
|
*(void **) (&glfwSetCocoaTextInputFilter_impl) = dlsym(handle, "glfwSetCocoaTextInputFilter");
|
||||||
|
|||||||
4
kitty/glfw-wrapper.h
generated
4
kitty/glfw-wrapper.h
generated
@ -1848,6 +1848,10 @@ typedef void* (*glfwGetCocoaWindow_func)(GLFWwindow*);
|
|||||||
glfwGetCocoaWindow_func glfwGetCocoaWindow_impl;
|
glfwGetCocoaWindow_func glfwGetCocoaWindow_impl;
|
||||||
#define glfwGetCocoaWindow glfwGetCocoaWindow_impl
|
#define glfwGetCocoaWindow glfwGetCocoaWindow_impl
|
||||||
|
|
||||||
|
typedef void* (*glfwGetNSGLContext_func)(GLFWwindow*);
|
||||||
|
glfwGetNSGLContext_func glfwGetNSGLContext_impl;
|
||||||
|
#define glfwGetNSGLContext glfwGetNSGLContext_impl
|
||||||
|
|
||||||
typedef uint32_t (*glfwGetCocoaMonitor_func)(GLFWmonitor*);
|
typedef uint32_t (*glfwGetCocoaMonitor_func)(GLFWmonitor*);
|
||||||
glfwGetCocoaMonitor_func glfwGetCocoaMonitor_impl;
|
glfwGetCocoaMonitor_func glfwGetCocoaMonitor_impl;
|
||||||
#define glfwGetCocoaMonitor glfwGetCocoaMonitor_impl
|
#define glfwGetCocoaMonitor glfwGetCocoaMonitor_impl
|
||||||
|
|||||||
@ -14,6 +14,8 @@ extern bool cocoa_toggle_fullscreen(void *w, bool);
|
|||||||
extern void cocoa_create_global_menu(void);
|
extern void cocoa_create_global_menu(void);
|
||||||
extern void cocoa_set_hide_from_tasks(void);
|
extern void cocoa_set_hide_from_tasks(void);
|
||||||
extern void cocoa_set_titlebar_color(void *w, color_type color);
|
extern void cocoa_set_titlebar_color(void *w, color_type color);
|
||||||
|
extern void cocoa_update_nsgl_context(void* id);
|
||||||
|
|
||||||
|
|
||||||
#if GLFW_KEY_LAST >= MAX_KEY_COUNT
|
#if GLFW_KEY_LAST >= MAX_KEY_COUNT
|
||||||
#error "glfw has too many keys, you should increase MAX_KEY_COUNT"
|
#error "glfw has too many keys, you should increase MAX_KEY_COUNT"
|
||||||
@ -808,6 +810,11 @@ hide_mouse(OSWindow *w) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
swap_window_buffers(OSWindow *w) {
|
swap_window_buffers(OSWindow *w) {
|
||||||
|
#ifdef __APPLE__
|
||||||
|
if (w->nsgl_ctx_updated++ < 2) {
|
||||||
|
cocoa_update_nsgl_context(glfwGetNSGLContext(w->handle));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
glfwSwapBuffers(w->handle);
|
glfwSwapBuffers(w->handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -126,6 +126,7 @@ typedef struct {
|
|||||||
FONTS_DATA_HANDLE fonts_data;
|
FONTS_DATA_HANDLE fonts_data;
|
||||||
id_type temp_font_group_id;
|
id_type temp_font_group_id;
|
||||||
double pending_scroll_pixels;
|
double pending_scroll_pixels;
|
||||||
|
unsigned int nsgl_ctx_updated;
|
||||||
} OSWindow;
|
} OSWindow;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user