diff --git a/glfw/glfw.py b/glfw/glfw.py index 8605ec65d..b957bb3c0 100755 --- a/glfw/glfw.py +++ b/glfw/glfw.py @@ -285,7 +285,7 @@ def generate_wrappers(glfw_header: str) -> None: int glfwCocoaSetBackgroundBlur(GLFWwindow *w, int blur_radius) bool glfwSetX11WindowBlurred(GLFWwindow *w, bool enable_blur) void* glfwGetX11Display(void) - int32_t glfwGetX11Window(GLFWwindow* window) + unsigned long glfwGetX11Window(GLFWwindow* window) void glfwSetPrimarySelectionString(GLFWwindow* window, const char* string) void glfwCocoaSetWindowChrome(GLFWwindow* window, unsigned int color, bool use_system_color, unsigned int system_color,\ int background_blur, unsigned int hide_window_decorations, bool show_text_in_titlebar, int color_space, float background_opacity, bool resizable) diff --git a/glfw/x11_window.c b/glfw/x11_window.c index 3b940d2ee..cd958e1bf 100644 --- a/glfw/x11_window.c +++ b/glfw/x11_window.c @@ -41,7 +41,6 @@ #include #include #include -#include // Action for EWMH client messages #define _NET_WM_STATE_REMOVE 0 @@ -3227,7 +3226,7 @@ GLFWAPI Display* glfwGetX11Display(void) return _glfw.x11.display; } -GLFWAPI Window glfwGetX11Window(GLFWwindow* handle) +GLFWAPI unsigned long glfwGetX11Window(GLFWwindow* handle) { _GLFWwindow* window = (_GLFWwindow*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(None); diff --git a/kitty/fonts.c b/kitty/fonts.c index ed0733849..ae746b563 100644 --- a/kitty/fonts.c +++ b/kitty/fonts.c @@ -15,9 +15,8 @@ #define MISSING_GLYPH (NUM_UNDERLINE_STYLES + 2) #define MAX_NUM_EXTRA_GLYPHS_PUA 4u -typedef void (*send_sprite_to_gpu_func)(FONTS_DATA_HANDLE fg, unsigned int, unsigned int, unsigned int, pixel*); -send_sprite_to_gpu_func current_send_sprite_to_gpu = NULL; static PyObject *python_send_to_gpu_impl = NULL; +#define current_send_sprite_to_gpu(...) (python_send_to_gpu_impl ? python_send_to_gpu(__VA_ARGS__) : send_sprite_to_gpu(__VA_ARGS__)) extern PyTypeObject Line_Type; enum {NO_FONT=-3, MISSING_FONT=-2, BLANK_FONT=-1, BOX_FONT=0}; @@ -1580,7 +1579,6 @@ set_send_sprite_to_gpu(PyObject UNUSED *self, PyObject *func) { python_send_to_gpu_impl = func; Py_INCREF(python_send_to_gpu_impl); } - current_send_sprite_to_gpu = python_send_to_gpu_impl ? python_send_to_gpu : send_sprite_to_gpu; Py_RETURN_NONE; } @@ -1738,6 +1736,5 @@ init_fonts(PyObject *module) { create_feature("-calt", CALT_FEATURE); #undef create_feature if (PyModule_AddFunctions(module, module_methods) != 0) return false; - current_send_sprite_to_gpu = send_sprite_to_gpu; return true; } diff --git a/kitty/glfw-wrapper.h b/kitty/glfw-wrapper.h index d2c506780..3e43bf81c 100644 --- a/kitty/glfw-wrapper.h +++ b/kitty/glfw-wrapper.h @@ -2258,7 +2258,7 @@ typedef void* (*glfwGetX11Display_func)(void); GFW_EXTERN glfwGetX11Display_func glfwGetX11Display_impl; #define glfwGetX11Display glfwGetX11Display_impl -typedef int32_t (*glfwGetX11Window_func)(GLFWwindow*); +typedef unsigned long (*glfwGetX11Window_func)(GLFWwindow*); GFW_EXTERN glfwGetX11Window_func glfwGetX11Window_impl; #define glfwGetX11Window glfwGetX11Window_impl diff --git a/kitty/glfw.c b/kitty/glfw.c index 9076b6891..32dd05128 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -1044,7 +1044,7 @@ native_window_handle(GLFWwindow *w) { void *ans = glfwGetCocoaWindow(w); return PyLong_FromVoidPtr(ans); #endif - if (glfwGetX11Window) return PyLong_FromLong((long)glfwGetX11Window(w)); + if (glfwGetX11Window) return PyLong_FromUnsignedLong(glfwGetX11Window(w)); return Py_None; } @@ -1768,7 +1768,7 @@ x11_window_id(PyObject UNUSED *self, PyObject *os_wid) { OSWindow *w = os_window_for_id(PyLong_AsUnsignedLongLong(os_wid)); if (!w) { PyErr_SetString(PyExc_ValueError, "No OSWindow with the specified id found"); return NULL; } if (!glfwGetX11Window) { PyErr_SetString(PyExc_RuntimeError, "Failed to load glfwGetX11Window"); return NULL; } - return Py_BuildValue("l", (long)glfwGetX11Window(w->handle)); + return PyLong_FromUnsignedLong(glfwGetX11Window(w->handle)); } static PyObject*