From 96c9c557c6e311fe66fbd8e52ebe1504a75705a2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 11 Aug 2025 10:55:29 +0530 Subject: [PATCH] Dont include gl.h in glfw.c --- kitty/debug_config.py | 4 ++-- kitty/fast_data_types.pyi | 2 +- kitty/glfw.c | 7 ------- kitty/shaders.c | 6 ++++++ 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/kitty/debug_config.py b/kitty/debug_config.py index 132a00e0b..75c3573d2 100644 --- a/kitty/debug_config.py +++ b/kitty/debug_config.py @@ -19,7 +19,7 @@ from .child import cmdline_of_pid from .cli import version from .colors import theme_colors from .constants import extensions_dir, is_macos, is_wayland, kitty_base_dir, kitty_exe, shell_path -from .fast_data_types import Color, SingleKey, current_fonts, glfw_get_system_color_theme, num_users, opengl_version_string, wayland_compositor_data +from .fast_data_types import Color, SingleKey, current_fonts, glfw_get_system_color_theme, gpu_driver_version_string, num_users, wayland_compositor_data from .options.types import Options as KittyOpts from .options.types import defaults, secret_options from .options.utils import KeyboardMode, KeyDefinition @@ -265,7 +265,7 @@ def debug_config(opts: KittyOpts, global_shortcuts: dict[str, SingleKey] | None p(f.read().strip()) if not is_macos: p('Running under:', green(compositor_name())) - p(green('OpenGL:'), opengl_version_string()) + p(green('OpenGL:'), gpu_driver_version_string()) p(green('Frozen:'), 'True' if getattr(sys, 'frozen', False) else 'False') p(green('Fonts:')) for k, font in current_fonts().items(): diff --git a/kitty/fast_data_types.pyi b/kitty/fast_data_types.pyi index 58615cd2b..e57a00755 100644 --- a/kitty/fast_data_types.pyi +++ b/kitty/fast_data_types.pyi @@ -1733,7 +1733,7 @@ def terminfo_data() -> bytes:... def wayland_compositor_data() -> Tuple[int, Optional[str]]:... def monotonic() -> float: ... def timed_debug_print(x: str) -> None: ... -def opengl_version_string() -> str: ... +def gpu_driver_version_string() -> str: ... def systemd_move_pid_into_new_scope(pid: int, scope_name: str, description: str) -> str: ... def play_desktop_sound_async(name: str, event_id: str = 'test sound', is_path: bool = False, theme_name: str = '') -> str: ... def cocoa_play_system_sound_by_id_async(sound_id: int) -> None: ... diff --git a/kitty/glfw.c b/kitty/glfw.c index 8928fd1af..b38206803 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -11,7 +11,6 @@ #include "control-codes.h" #include #include "glfw-wrapper.h" -#include "gl.h" #ifdef __APPLE__ #include "cocoa_window.h" #else @@ -1703,11 +1702,6 @@ dbus_user_notification_activated(uint32_t notification_id, int type, const char* } #endif -static PyObject* -opengl_version_string(PyObject *self UNUSED, PyObject *args UNUSED) { - return PyUnicode_FromString(global_state.gl_version ? gl_version_string() : ""); -} - static PyObject* glfw_init(PyObject UNUSED *self, PyObject *args) { const char* path; @@ -2660,7 +2654,6 @@ static PyMethodDef module_methods[] = { METHODB(cocoa_hide_other_apps, METH_NOARGS), METHODB(cocoa_minimize_os_window, METH_VARARGS), {"glfw_init", (PyCFunction)glfw_init, METH_VARARGS, ""}, - METHODB(opengl_version_string, METH_NOARGS), {"glfw_terminate", (PyCFunction)glfw_terminate, METH_NOARGS, ""}, {"glfw_get_physical_dpi", (PyCFunction)glfw_get_physical_dpi, METH_NOARGS, ""}, {"glfw_get_key_name", (PyCFunction)glfw_get_key_name, METH_VARARGS, ""}, diff --git a/kitty/shaders.c b/kitty/shaders.c index c6c67f481..06c381e72 100644 --- a/kitty/shaders.c +++ b/kitty/shaders.c @@ -1224,6 +1224,11 @@ setup_os_window_for_rendering(OSWindow *os_window, Tab *tab, Window *active_wind // Python API {{{ +static PyObject* +pygpu_driver_version_string(PyObject *self UNUSED, PyObject *args UNUSED) { + return PyUnicode_FromString(global_state.gl_version ? gl_version_string() : ""); +} + static bool attach_shaders(PyObject *sources, GLuint program_id, GLenum shader_type) { RAII_ALLOC(const GLchar*, c_sources, calloc(PyTuple_GET_SIZE(sources), sizeof(GLchar*))); @@ -1309,6 +1314,7 @@ static PyMethodDef module_methods[] = { M(compile_program, METH_VARARGS), M(sprite_map_set_limits, METH_VARARGS), MW(create_vao, METH_NOARGS), + MW(gpu_driver_version_string, METH_NOARGS), MW(bind_vertex_array, METH_O), MW(unbind_vertex_array, METH_NOARGS), MW(unmap_vao_buffer, METH_VARARGS),