This commit is contained in:
Andrew Marshall 2026-02-05 22:39:24 +01:00 committed by GitHub
commit a79580be1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 0 deletions

View File

@ -91,6 +91,19 @@
#include "idle-inhibit-unstable-v1-client-protocol-code.h"
#undef types
static void xkbForwardError(struct xkb_context* context,
enum xkb_log_level level,
const char *format,
va_list args)
{
if (level <= XKB_LOG_LEVEL_ERROR)
{
char description[_GLFW_MESSAGE_SIZE];
vsnprintf(description, _GLFW_MESSAGE_SIZE, format, args);
_glfwInputError(GLFW_PLATFORM_ERROR, "xkbcommon: %s", description);
}
}
static void wmBaseHandlePing(void* userData,
struct xdg_wm_base* wmBase,
uint32_t serial)
@ -675,6 +688,8 @@ int _glfwInitWayland(void)
_glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_context_new");
_glfw.wl.xkb.context_unref = (PFN_xkb_context_unref)
_glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_context_unref");
_glfw.wl.xkb.context_set_log_fn = (PFN_xkb_context_set_log_fn)
_glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_context_set_log_fn");
_glfw.wl.xkb.keymap_new_from_string = (PFN_xkb_keymap_new_from_string)
_glfwPlatformGetModuleSymbol(_glfw.wl.xkb.handle, "xkb_keymap_new_from_string");
_glfw.wl.xkb.keymap_unref = (PFN_xkb_keymap_unref)
@ -841,6 +856,7 @@ int _glfwInitWayland(void)
"Wayland: Failed to initialize xkb context");
return GLFW_FALSE;
}
xkb_context_set_log_fn(_glfw.wl.xkb.context, xkbForwardError);
// Sync so we got all registry objects
wl_display_roundtrip(_glfw.wl.display);

View File

@ -170,6 +170,7 @@ typedef void (* PFN_wl_egl_window_resize)(struct wl_egl_window*, int, int, int,
typedef struct xkb_context* (* PFN_xkb_context_new)(enum xkb_context_flags);
typedef void (* PFN_xkb_context_unref)(struct xkb_context*);
typedef void (* PFN_xkb_context_set_log_fn)(struct xkb_context*, void(* log_fn)(struct xkb_context *context, enum xkb_log_level level, const char *format, va_list args));
typedef struct xkb_keymap* (* PFN_xkb_keymap_new_from_string)(struct xkb_context*, const char*, enum xkb_keymap_format, enum xkb_keymap_compile_flags);
typedef void (* PFN_xkb_keymap_unref)(struct xkb_keymap*);
typedef xkb_mod_index_t (* PFN_xkb_keymap_mod_get_index)(struct xkb_keymap*, const char*);
@ -185,6 +186,7 @@ typedef uint32_t (* PFN_xkb_keysym_to_utf32)(xkb_keysym_t);
typedef int (* PFN_xkb_keysym_to_utf8)(xkb_keysym_t, char*, size_t);
#define xkb_context_new _glfw.wl.xkb.context_new
#define xkb_context_unref _glfw.wl.xkb.context_unref
#define xkb_context_set_log_fn _glfw.wl.xkb.context_set_log_fn
#define xkb_keymap_new_from_string _glfw.wl.xkb.keymap_new_from_string
#define xkb_keymap_unref _glfw.wl.xkb.keymap_unref
#define xkb_keymap_mod_get_index _glfw.wl.xkb.keymap_mod_get_index
@ -490,6 +492,7 @@ typedef struct _GLFWlibraryWayland
PFN_xkb_context_new context_new;
PFN_xkb_context_unref context_unref;
PFN_xkb_context_set_log_fn context_set_log_fn;
PFN_xkb_keymap_new_from_string keymap_new_from_string;
PFN_xkb_keymap_unref keymap_unref;
PFN_xkb_keymap_mod_get_index keymap_mod_get_index;