Make the Apple context preserving window 1x1

This commit is contained in:
Kovid Goyal
2025-09-05 14:42:01 +05:30
parent ce4c511fdc
commit b241811a74

View File

@@ -1408,15 +1408,16 @@ create_os_window(PyObject UNUSED *self, PyObject *args, PyObject *kw) {
// creation, which causes a resize event and all the associated processing.
// The temp window is used to get the DPI. On Wayland no temp window can be
// used, so start with window visible unless hidden window requested.
glfwWindowHint(GLFW_VISIBLE, window_state != WINDOW_HIDDEN && global_state.is_wayland);
GLFWwindow *common_context = global_state.num_os_windows ? global_state.os_windows[0].handle : NULL;
GLFWwindow *temp_window = NULL;
#ifdef __APPLE__
if (!apple_preserve_common_context) {
apple_preserve_common_context = glfwCreateWindow(640, 480, "kitty", NULL, common_context, NULL);
glfwWindowHint(GLFW_VISIBLE, false);
apple_preserve_common_context = glfwCreateWindow(1, 1, "kitty", NULL, common_context, NULL);
}
if (!common_context) common_context = apple_preserve_common_context;
#endif
glfwWindowHint(GLFW_VISIBLE, window_state != WINDOW_HIDDEN && global_state.is_wayland);
float xscale, yscale;
double xdpi, ydpi;
if (global_state.is_wayland) {