mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-11-13 12:09:35 +03:00
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))
|
||||
for line in '''\
|
||||
void* glfwGetCocoaWindow(GLFWwindow* window)
|
||||
void* glfwGetNSGLContext(GLFWwindow *window)
|
||||
uint32_t glfwGetCocoaMonitor(GLFWmonitor* monitor)
|
||||
GLFWcocoatextinputfilterfun glfwSetCocoaTextInputFilter(GLFWwindow* window, GLFWcocoatextinputfilterfun callback)
|
||||
GLFWcocoatogglefullscreenfun glfwSetCocoaToggleFullscreenIntercept(GLFWwindow *window, GLFWcocoatogglefullscreenfun callback)
|
||||
|
@ -99,6 +99,12 @@ cocoa_set_new_window_trigger(PyObject *self UNUSED, PyObject *args) {
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
cocoa_update_nsgl_context(void* id) {
|
||||
NSOpenGLContext *ctx = id;
|
||||
[ctx update];
|
||||
}
|
||||
|
||||
void
|
||||
cocoa_create_global_menu(void) {
|
||||
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 **) (&glfwGetNSGLContext_impl) = dlsym(handle, "glfwGetNSGLContext");
|
||||
|
||||
*(void **) (&glfwGetCocoaMonitor_impl) = dlsym(handle, "glfwGetCocoaMonitor");
|
||||
|
||||
*(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;
|
||||
#define glfwGetCocoaWindow glfwGetCocoaWindow_impl
|
||||
|
||||
typedef void* (*glfwGetNSGLContext_func)(GLFWwindow*);
|
||||
glfwGetNSGLContext_func glfwGetNSGLContext_impl;
|
||||
#define glfwGetNSGLContext glfwGetNSGLContext_impl
|
||||
|
||||
typedef uint32_t (*glfwGetCocoaMonitor_func)(GLFWmonitor*);
|
||||
glfwGetCocoaMonitor_func 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_set_hide_from_tasks(void);
|
||||
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
|
||||
#error "glfw has too many keys, you should increase MAX_KEY_COUNT"
|
||||
@ -808,6 +810,11 @@ hide_mouse(OSWindow *w) {
|
||||
|
||||
void
|
||||
swap_window_buffers(OSWindow *w) {
|
||||
#ifdef __APPLE__
|
||||
if (w->nsgl_ctx_updated++ < 2) {
|
||||
cocoa_update_nsgl_context(glfwGetNSGLContext(w->handle));
|
||||
}
|
||||
#endif
|
||||
glfwSwapBuffers(w->handle);
|
||||
}
|
||||
|
||||
|
@ -126,6 +126,7 @@ typedef struct {
|
||||
FONTS_DATA_HANDLE fonts_data;
|
||||
id_type temp_font_group_id;
|
||||
double pending_scroll_pixels;
|
||||
unsigned int nsgl_ctx_updated;
|
||||
} OSWindow;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user