Description
The GLFW fork (MohitSethi99/glfw) used as a submodule has a bug in the X11 and Wayland platform struct initializers. The setWindowTitleBar function pointer (added as a Hazel-specific extension in internal.h line 747) is present in win32_init.c and null_init.c but missing from both x11_init.c and wl_init.c.
Impact
This causes every function pointer after the setWindowTitleBar slot to be assigned to the wrong position in the struct, resulting in:
- Compilation errors on Linux (
-Wincompatible-function-pointer-types)
- Potential undefined behavior if warnings are suppressed
Affected Files (in MohitSethi99/glfw)
src/x11_init.c (line ~1206)
Missing entry between _glfwPostEmptyEventX11 and _glfwGetEGLPlatformX11:
_glfwPostEmptyEventX11,
// MISSING: setWindowTitleBar function pointer
_glfwGetEGLPlatformX11, // <-- wrong slot, should be one position later
src/wl_init.c (line ~1109)
Same issue — missing entry between _glfwPostEmptyEventWayland and _glfwGetEGLPlatformWayland.
Expected Fix
For X11:
- Add a
_glfwSetWindowTitlebarX11 function (or rename existing _glfwPlatformSetWindowTitlebar in x11_window.c)
- Declare it in
x11_platform.h
- Insert it in the correct position in the struct initializer in
x11_init.c
For Wayland:
- Add a
_glfwSetWindowTitlebarWayland stub function in wl_window.c
- Declare it in
wl_platform.h
- Insert it in the correct position in the struct initializer in
wl_init.c
Current Workaround
PR #25 includes a build-time patch in GenerateMake.sh that inserts a NULL stub at the correct position. This should be removed once the upstream GLFW fork is fixed.
Reference
- Struct definition:
src/internal.h line 747 (void (*setWindowTitleBar)(_GLFWwindow*,GLFWbool);)
- Win32 reference:
src/win32_init.c line 609 (_glfwSetWindowTitlebarWin32)
- Null reference:
src/null_init.c line 109 (_glfwSetWindowTitlebarNull)
Description
The GLFW fork (
MohitSethi99/glfw) used as a submodule has a bug in the X11 and Wayland platform struct initializers. ThesetWindowTitleBarfunction pointer (added as a Hazel-specific extension ininternal.hline 747) is present inwin32_init.candnull_init.cbut missing from bothx11_init.candwl_init.c.Impact
This causes every function pointer after the
setWindowTitleBarslot to be assigned to the wrong position in the struct, resulting in:-Wincompatible-function-pointer-types)Affected Files (in MohitSethi99/glfw)
src/x11_init.c(line ~1206)Missing entry between
_glfwPostEmptyEventX11and_glfwGetEGLPlatformX11:src/wl_init.c(line ~1109)Same issue — missing entry between
_glfwPostEmptyEventWaylandand_glfwGetEGLPlatformWayland.Expected Fix
For X11:
_glfwSetWindowTitlebarX11function (or rename existing_glfwPlatformSetWindowTitlebarinx11_window.c)x11_platform.hx11_init.cFor Wayland:
_glfwSetWindowTitlebarWaylandstub function inwl_window.cwl_platform.hwl_init.cCurrent Workaround
PR #25 includes a build-time patch in
GenerateMake.shthat inserts aNULLstub at the correct position. This should be removed once the upstream GLFW fork is fixed.Reference
src/internal.hline 747 (void (*setWindowTitleBar)(_GLFWwindow*,GLFWbool);)src/win32_init.cline 609 (_glfwSetWindowTitlebarWin32)src/null_init.cline 109 (_glfwSetWindowTitlebarNull)