Skip to content

bug: GLFW X11/Wayland platform struct missing setWindowTitleBar function pointer #33

Description

@killerdevildog

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:

  1. Add a _glfwSetWindowTitlebarX11 function (or rename existing _glfwPlatformSetWindowTitlebar in x11_window.c)
  2. Declare it in x11_platform.h
  3. Insert it in the correct position in the struct initializer in x11_init.c

For Wayland:

  1. Add a _glfwSetWindowTitlebarWayland stub function in wl_window.c
  2. Declare it in wl_platform.h
  3. 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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions