Fix undefined function pointer usage found by clang sanitizer
This commit is contained in:
parent
a839af04dc
commit
6c49066cde
5 changed files with 6 additions and 10 deletions
|
|
@ -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)
|
||||
|
|
|
|||
3
glfw/x11_window.c
vendored
3
glfw/x11_window.c
vendored
|
|
@ -41,7 +41,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
// 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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
2
kitty/glfw-wrapper.h
generated
2
kitty/glfw-wrapper.h
generated
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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*
|
||||
|
|
|
|||
Loading…
Reference in a new issue