Compare commits

...

8 Commits

Author SHA1 Message Date
Marco Lizza
991434dbfd
Merge cdcd9c194a into 63a7e8b7f8 2025-08-29 17:36:08 +02:00
Camilla Löwy
63a7e8b7f8 Add and update Wayland-specific notes in docs
Fixes #2746
2025-08-20 20:13:07 +02:00
Doug Binks
acb92944d4 Revert readme for "Wayland: Keyboard leave event handler now processes key repeats" 2025-08-19 11:30:52 +02:00
Marco Lizza
cdcd9c194a Fixing dlsym cast warning. 2024-02-29 01:57:41 +01:00
Marco Lizza
596cabbe58 Tweaking GLFW_ANY_POSITION to int32_t max value to avoid signed/unsigned warnings. 2024-02-29 01:51:48 +01:00
Marco Lizza
a02b287b1d Fixing signed/unsigned mismatch warnings. 2024-02-29 01:50:49 +01:00
Marco Lizza
7c2e8c7c5a Using designated initializers to avoid warnings. 2024-02-29 01:50:21 +01:00
Marco Lizza
58f2aab759 Fixing constant pointers. 2024-02-29 01:49:48 +01:00
22 changed files with 96 additions and 68 deletions

View File

@ -55,6 +55,7 @@ video tutorials.
- Jason Daly - Jason Daly
- danhambleton - danhambleton
- Jarrod Davis - Jarrod Davis
- decce
- Olivier Delannoy - Olivier Delannoy
- Paul R. Deppe - Paul R. Deppe
- Michael Dickens - Michael Dickens

View File

@ -134,7 +134,6 @@ information on what to include when reporting a bug.
- [Wayland] Bugfix: Ignore key repeat events when no window has keyboard focus (#2727) - [Wayland] Bugfix: Ignore key repeat events when no window has keyboard focus (#2727)
- [Wayland] Bugfix: Reset key repeat timer when window destroyed (#2741,#2727) - [Wayland] Bugfix: Reset key repeat timer when window destroyed (#2741,#2727)
- [Wayland] Bugfix: Memory would leak if reading a data offer failed midway - [Wayland] Bugfix: Memory would leak if reading a data offer failed midway
- [Wayland] Bugfix: Keyboard leave event handler now processes key repeats (#2736)
- [Wayland] Bugfix: Retrieved cursor position would be incorrect when hovering over - [Wayland] Bugfix: Retrieved cursor position would be incorrect when hovering over
fallback decorations fallback decorations
- [Wayland] Bugfix: Fallback decorations would report scroll events - [Wayland] Bugfix: Fallback decorations would report scroll events

View File

@ -255,3 +255,7 @@ hardware gamma correction, which today is typically an approximation of sRGB
gamma. This means that setting a perfectly linear ramp, or gamma 1.0, will gamma. This means that setting a perfectly linear ramp, or gamma 1.0, will
produce the default (usually sRGB-like) behavior. produce the default (usually sRGB-like) behavior.
@note @wayland An application cannot read or modify the monitor gamma ramp. The
@ref glfwGetGammaRamp, @ref glfwSetGammaRamp and @ref glfwSetGamma functions
emit @ref GLFW_FEATURE_UNAVAILABLE.

View File

@ -893,6 +893,12 @@ int xpos, ypos;
glfwGetWindowPos(window, &xpos, &ypos); glfwGetWindowPos(window, &xpos, &ypos);
``` ```
@note @wayland An applications cannot know the positions of its windows or
whether one has been moved. The @ref GLFW_POSITION_X and @ref GLFW_POSITION_Y
window hints are ignored. The @ref glfwGetWindowPos and @ref glfwSetWindowPos
functions emit @ref GLFW_FEATURE_UNAVAILABLE. The window position callback will
not be called.
### Window title {#window_title} ### Window title {#window_title}
@ -1038,6 +1044,12 @@ You can also get the current iconification state with @ref glfwGetWindowAttrib.
int iconified = glfwGetWindowAttrib(window, GLFW_ICONIFIED); int iconified = glfwGetWindowAttrib(window, GLFW_ICONIFIED);
``` ```
@note @wayland An application cannot know if any of its windows have been
iconified or restore one from iconification. The @ref glfwRestoreWindow
function can only restore windows from maximization and the iconify callback
will not be called. The [GLFW_ICONIFIED](@ref GLFW_ICONIFIED_attrib) attribute
will be false. The @ref glfwIconifyWindow function works normally.
### Window maximization {#window_maximize} ### Window maximization {#window_maximize}

View File

@ -1180,7 +1180,7 @@ extern "C" {
#define GLFW_WAYLAND_PREFER_LIBDECOR 0x00038001 #define GLFW_WAYLAND_PREFER_LIBDECOR 0x00038001
#define GLFW_WAYLAND_DISABLE_LIBDECOR 0x00038002 #define GLFW_WAYLAND_DISABLE_LIBDECOR 0x00038002
#define GLFW_ANY_POSITION 0x80000000 #define GLFW_ANY_POSITION 0x7FFFFFFF
/*! @defgroup shapes Standard cursor shapes /*! @defgroup shapes Standard cursor shapes
* @brief Standard system cursor shapes. * @brief Standard system cursor shapes.
@ -2915,8 +2915,8 @@ GLFWAPI const GLFWvidmode* glfwGetVideoMode(GLFWmonitor* monitor);
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_INVALID_VALUE, * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_INVALID_VALUE,
* @ref GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * @ref GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
* *
* @remark @wayland Gamma handling is a privileged protocol, this function * @remark @wayland Monitor gamma is a privileged protocol, so this function
* will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE. * cannot be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
@ -2939,8 +2939,8 @@ GLFWAPI void glfwSetGamma(GLFWmonitor* monitor, float gamma);
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_PLATFORM_ERROR * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_PLATFORM_ERROR
* and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
* *
* @remark @wayland Gamma handling is a privileged protocol, this function * @remark @wayland Monitor gamma is a privileged protocol, so this function
* will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE while * cannot be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE while
* returning `NULL`. * returning `NULL`.
* *
* @pointer_lifetime The returned structure and its arrays are allocated and * @pointer_lifetime The returned structure and its arrays are allocated and
@ -2983,8 +2983,8 @@ GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* monitor);
* *
* @remark @win32 The gamma ramp size must be 256. * @remark @win32 The gamma ramp size must be 256.
* *
* @remark @wayland Gamma handling is a privileged protocol, this function * @remark @wayland Monitor gamma is a privileged protocol, so this function
* will thus never be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE. * cannot be implemented and emits @ref GLFW_FEATURE_UNAVAILABLE.
* *
* @pointer_lifetime The specified gamma ramp is copied before this function * @pointer_lifetime The specified gamma ramp is copied before this function
* returns. * returns.
@ -3430,8 +3430,8 @@ GLFWAPI void glfwSetWindowIcon(GLFWwindow* window, int count, const GLFWimage* i
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
* *
* @remark @wayland There is no way for an application to retrieve the global * @remark @wayland Window positions are not currently part of any common
* position of its windows. This function will emit @ref * Wayland protocol, so this function cannot be implemented and will emit @ref
* GLFW_FEATURE_UNAVAILABLE. * GLFW_FEATURE_UNAVAILABLE.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
@ -3464,8 +3464,8 @@ GLFWAPI void glfwGetWindowPos(GLFWwindow* window, int* xpos, int* ypos);
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref
* GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks). * GLFW_PLATFORM_ERROR and @ref GLFW_FEATURE_UNAVAILABLE (see remarks).
* *
* @remark @wayland There is no way for an application to set the global * @remark @wayland Window positions are not currently part of any common
* position of its windows. This function will emit @ref * Wayland protocol, so this function cannot be implemented and will emit @ref
* GLFW_FEATURE_UNAVAILABLE. * GLFW_FEATURE_UNAVAILABLE.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
@ -3807,10 +3807,6 @@ GLFWAPI void glfwSetWindowOpacity(GLFWwindow* window, float opacity);
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR. * GLFW_PLATFORM_ERROR.
* *
* @remark @wayland Once a window is iconified, @ref glfwRestoreWindow wont
* be able to restore it. This is a design decision of the xdg-shell
* protocol.
*
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
* @sa @ref window_iconify * @sa @ref window_iconify
@ -3838,6 +3834,10 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow* window);
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref * @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR. * GLFW_PLATFORM_ERROR.
* *
* @remark @wayland Restoring a window from maximization is not currently part
* of any common Wayland protocol, so this function can only restore windows
* from maximization.
*
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
* @sa @ref window_iconify * @sa @ref window_iconify
@ -4058,8 +4058,8 @@ GLFWAPI GLFWmonitor* glfwGetWindowMonitor(GLFWwindow* window);
* affected by any resizing or mode switching, although you may need to update * affected by any resizing or mode switching, although you may need to update
* your viewport if the framebuffer size has changed. * your viewport if the framebuffer size has changed.
* *
* @remark @wayland The desired window position is ignored, as there is no way * @remark @wayland Window positions are not currently part of any common
* for an application to set this property. * Wayland protocol. The window position arguments are ignored.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
@ -4096,8 +4096,9 @@ GLFWAPI void glfwSetWindowMonitor(GLFWwindow* window, GLFWmonitor* monitor, int
* errors. However, this function should not fail as long as it is passed * errors. However, this function should not fail as long as it is passed
* valid arguments and the library has been [initialized](@ref intro_init). * valid arguments and the library has been [initialized](@ref intro_init).
* *
* @remark @wayland The Wayland protocol provides no way to check whether a * @remark @wayland Checking whether a window is iconified is not currently
* window is iconfied, so @ref GLFW_ICONIFIED always returns `GLFW_FALSE`. * part of any common Wayland protocol, so the @ref GLFW_ICONIFIED attribute
* cannot be implemented and is always `GLFW_FALSE`.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
@ -4219,8 +4220,8 @@ GLFWAPI void* glfwGetWindowUserPointer(GLFWwindow* window);
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
* *
* @remark @wayland This callback will never be called, as there is no way for * @remark @wayland This callback will not be called. The Wayland protocol
* an application to know its global position. * provides no way to be notified of when a window is moved.
* *
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
@ -4395,6 +4396,10 @@ GLFWAPI GLFWwindowfocusfun glfwSetWindowFocusCallback(GLFWwindow* window, GLFWwi
* *
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED. * @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
* *
* @remark @wayland This callback will not be called. The Wayland protocol
* provides no way to be notified of when a window is iconified, and no way to
* check whether a window is currently iconified.
*
* @thread_safety This function must only be called from the main thread. * @thread_safety This function must only be called from the main thread.
* *
* @sa @ref window_iconify * @sa @ref window_iconify

View File

@ -272,7 +272,7 @@ EGLenum _glfwGetEGLPlatformCocoa(EGLint** attribs);
EGLNativeDisplayType _glfwGetEGLNativeDisplayCocoa(void); EGLNativeDisplayType _glfwGetEGLNativeDisplayCocoa(void);
EGLNativeWindowType _glfwGetEGLNativeWindowCocoa(_GLFWwindow* window); EGLNativeWindowType _glfwGetEGLNativeWindowCocoa(_GLFWwindow* window);
void _glfwGetRequiredInstanceExtensionsCocoa(char** extensions); void _glfwGetRequiredInstanceExtensionsCocoa(const char** extensions);
GLFWbool _glfwGetPhysicalDevicePresentationSupportCocoa(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); GLFWbool _glfwGetPhysicalDevicePresentationSupportCocoa(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
VkResult _glfwCreateWindowSurfaceCocoa(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); VkResult _glfwCreateWindowSurfaceCocoa(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);

View File

@ -1922,7 +1922,7 @@ EGLNativeWindowType _glfwGetEGLNativeWindowCocoa(_GLFWwindow* window)
return window->ns.layer; return window->ns.layer;
} }
void _glfwGetRequiredInstanceExtensionsCocoa(char** extensions) void _glfwGetRequiredInstanceExtensionsCocoa(const char** extensions)
{ {
if (_glfw.vk.KHR_surface && _glfw.vk.EXT_metal_surface) if (_glfw.vk.KHR_surface && _glfw.vk.EXT_metal_surface)
{ {

View File

@ -1289,7 +1289,7 @@ GLFWAPI int glfwUpdateGamepadMappings(const char* string)
const size_t length = strcspn(c, "\r\n"); const size_t length = strcspn(c, "\r\n");
if (length < sizeof(line)) if (length < sizeof(line))
{ {
_GLFWmapping mapping = {{0}}; _GLFWmapping mapping = { .name = {0} };
memcpy(line, c, length); memcpy(line, c, length);
line[length] = '\0'; line[length] = '\0';

View File

@ -756,7 +756,7 @@ struct _GLFWplatform
EGLNativeDisplayType (*getEGLNativeDisplay)(void); EGLNativeDisplayType (*getEGLNativeDisplay)(void);
EGLNativeWindowType (*getEGLNativeWindow)(_GLFWwindow*); EGLNativeWindowType (*getEGLNativeWindow)(_GLFWwindow*);
// vulkan // vulkan
void (*getRequiredInstanceExtensions)(char**); void (*getRequiredInstanceExtensions)(const char**);
GLFWbool (*getPhysicalDevicePresentationSupport)(VkInstance,VkPhysicalDevice,uint32_t); GLFWbool (*getPhysicalDevicePresentationSupport)(VkInstance,VkPhysicalDevice,uint32_t);
VkResult (*createWindowSurface)(VkInstance,_GLFWwindow*,const VkAllocationCallbacks*,VkSurfaceKHR*); VkResult (*createWindowSurface)(VkInstance,_GLFWwindow*,const VkAllocationCallbacks*,VkSurfaceKHR*);
}; };
@ -863,7 +863,7 @@ struct _GLFWlibrary
struct { struct {
GLFWbool available; GLFWbool available;
void* handle; void* handle;
char* extensions[2]; const char* extensions[2];
PFN_vkGetInstanceProcAddr GetInstanceProcAddr; PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
GLFWbool KHR_surface; GLFWbool KHR_surface;
GLFWbool KHR_win32_surface; GLFWbool KHR_win32_surface;

View File

@ -274,7 +274,7 @@ EGLenum _glfwGetEGLPlatformNull(EGLint** attribs);
EGLNativeDisplayType _glfwGetEGLNativeDisplayNull(void); EGLNativeDisplayType _glfwGetEGLNativeDisplayNull(void);
EGLNativeWindowType _glfwGetEGLNativeWindowNull(_GLFWwindow* window); EGLNativeWindowType _glfwGetEGLNativeWindowNull(_GLFWwindow* window);
void _glfwGetRequiredInstanceExtensionsNull(char** extensions); void _glfwGetRequiredInstanceExtensionsNull(const char** extensions);
GLFWbool _glfwGetPhysicalDevicePresentationSupportNull(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); GLFWbool _glfwGetPhysicalDevicePresentationSupportNull(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
VkResult _glfwCreateWindowSurfaceNull(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); VkResult _glfwCreateWindowSurfaceNull(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);

View File

@ -701,7 +701,7 @@ int _glfwGetKeyScancodeNull(int key)
return _glfw.null.scancodes[key]; return _glfw.null.scancodes[key];
} }
void _glfwGetRequiredInstanceExtensionsNull(char** extensions) void _glfwGetRequiredInstanceExtensionsNull(const char** extensions)
{ {
if (!_glfw.vk.KHR_surface || !_glfw.vk.EXT_headless_surface) if (!_glfw.vk.KHR_surface || !_glfw.vk.EXT_headless_surface)
return; return;

View File

@ -44,10 +44,17 @@ void _glfwPlatformFreeModule(void* module)
dlclose(module); dlclose(module);
} }
#if defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
#endif
GLFWproc _glfwPlatformGetModuleSymbol(void* module, const char* name) GLFWproc _glfwPlatformGetModuleSymbol(void* module, const char* name)
{ {
return dlsym(module, name); return (GLFWproc)dlsym(module, name);
} }
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
#endif // GLFW_BUILD_POSIX_MODULE #endif // GLFW_BUILD_POSIX_MODULE

View File

@ -150,7 +150,7 @@ GLFWbool _glfwInitVulkan(int mode)
_glfw.vk.available = GLFW_TRUE; _glfw.vk.available = GLFW_TRUE;
_glfw.platform.getRequiredInstanceExtensions(_glfw.vk.extensions); _glfw.platform.getRequiredInstanceExtensions((const char **)_glfw.vk.extensions);
return GLFW_TRUE; return GLFW_TRUE;
} }

View File

@ -540,7 +540,7 @@ EGLenum _glfwGetEGLPlatformWin32(EGLint** attribs);
EGLNativeDisplayType _glfwGetEGLNativeDisplayWin32(void); EGLNativeDisplayType _glfwGetEGLNativeDisplayWin32(void);
EGLNativeWindowType _glfwGetEGLNativeWindowWin32(_GLFWwindow* window); EGLNativeWindowType _glfwGetEGLNativeWindowWin32(_GLFWwindow* window);
void _glfwGetRequiredInstanceExtensionsWin32(char** extensions); void _glfwGetRequiredInstanceExtensionsWin32(const char** extensions);
GLFWbool _glfwGetPhysicalDevicePresentationSupportWin32(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); GLFWbool _glfwGetPhysicalDevicePresentationSupportWin32(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
VkResult _glfwCreateWindowSurfaceWin32(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); VkResult _glfwCreateWindowSurfaceWin32(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);

View File

@ -2501,7 +2501,7 @@ EGLNativeWindowType _glfwGetEGLNativeWindowWin32(_GLFWwindow* window)
return window->win32.handle; return window->win32.handle;
} }
void _glfwGetRequiredInstanceExtensionsWin32(char** extensions) void _glfwGetRequiredInstanceExtensionsWin32(const char** extensions)
{ {
if (!_glfw.vk.KHR_surface || !_glfw.vk.KHR_win32_surface) if (!_glfw.vk.KHR_surface || !_glfw.vk.KHR_win32_surface)
return; return;

View File

@ -243,7 +243,7 @@ void libdecorHandleError(struct libdecor* context,
static const struct libdecor_interface libdecorInterface = static const struct libdecor_interface libdecorInterface =
{ {
libdecorHandleError .error = libdecorHandleError
}; };
static void libdecorReadyCallback(void* userData, static void libdecorReadyCallback(void* userData,

View File

@ -674,7 +674,7 @@ EGLenum _glfwGetEGLPlatformWayland(EGLint** attribs);
EGLNativeDisplayType _glfwGetEGLNativeDisplayWayland(void); EGLNativeDisplayType _glfwGetEGLNativeDisplayWayland(void);
EGLNativeWindowType _glfwGetEGLNativeWindowWayland(_GLFWwindow* window); EGLNativeWindowType _glfwGetEGLNativeWindowWayland(_GLFWwindow* window);
void _glfwGetRequiredInstanceExtensionsWayland(char** extensions); void _glfwGetRequiredInstanceExtensionsWayland(const char** extensions);
GLFWbool _glfwGetPhysicalDevicePresentationSupportWayland(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); GLFWbool _glfwGetPhysicalDevicePresentationSupportWayland(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
VkResult _glfwCreateWindowSurfaceWayland(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); VkResult _glfwCreateWindowSurfaceWayland(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);

View File

@ -620,8 +620,8 @@ static void surfaceHandleLeave(void* userData,
static const struct wl_surface_listener surfaceListener = static const struct wl_surface_listener surfaceListener =
{ {
surfaceHandleEnter, .enter = surfaceHandleEnter,
surfaceHandleLeave .leave = surfaceHandleLeave
}; };
static void setIdleInhibitor(_GLFWwindow* window, GLFWbool enable) static void setIdleInhibitor(_GLFWwindow* window, GLFWbool enable)
@ -762,8 +762,8 @@ static void xdgToplevelHandleClose(void* userData,
static const struct xdg_toplevel_listener xdgToplevelListener = static const struct xdg_toplevel_listener xdgToplevelListener =
{ {
xdgToplevelHandleConfigure, .configure = xdgToplevelHandleConfigure,
xdgToplevelHandleClose .close = xdgToplevelHandleClose
}; };
static void xdgSurfaceHandleConfigure(void* userData, static void xdgSurfaceHandleConfigure(void* userData,
@ -937,10 +937,10 @@ void libdecorFrameHandleDismissPopup(struct libdecor_frame* frame,
static const struct libdecor_frame_interface libdecorFrameInterface = static const struct libdecor_frame_interface libdecorFrameInterface =
{ {
libdecorFrameHandleConfigure, .configure = libdecorFrameHandleConfigure,
libdecorFrameHandleClose, .close = libdecorFrameHandleClose,
libdecorFrameHandleCommit, .commit = libdecorFrameHandleCommit,
libdecorFrameHandleDismissPopup .dismiss_popup = libdecorFrameHandleDismissPopup
}; };
static GLFWbool createLibdecorFrame(_GLFWwindow* window) static GLFWbool createLibdecorFrame(_GLFWwindow* window)
@ -1290,7 +1290,7 @@ static GLFWbool flushDisplay(void)
if (errno != EAGAIN) if (errno != EAGAIN)
return GLFW_FALSE; return GLFW_FALSE;
struct pollfd fd = { wl_display_get_fd(_glfw.wl.display), POLLOUT }; struct pollfd fd = { .fd = wl_display_get_fd(_glfw.wl.display), POLLOUT };
while (poll(&fd, 1, -1) == -1) while (poll(&fd, 1, -1) == -1)
{ {
@ -1664,11 +1664,11 @@ static void pointerHandleAxis(void* userData,
static const struct wl_pointer_listener pointerListener = static const struct wl_pointer_listener pointerListener =
{ {
pointerHandleEnter, .enter = pointerHandleEnter,
pointerHandleLeave, .leave = pointerHandleLeave,
pointerHandleMotion, .motion = pointerHandleMotion,
pointerHandleButton, .button = pointerHandleButton,
pointerHandleAxis, .axis = pointerHandleAxis,
}; };
static void keyboardHandleKeymap(void* userData, static void keyboardHandleKeymap(void* userData,
@ -1977,7 +1977,7 @@ static void dataOfferHandleOffer(void* userData,
static const struct wl_data_offer_listener dataOfferListener = static const struct wl_data_offer_listener dataOfferListener =
{ {
dataOfferHandleOffer .offer = dataOfferHandleOffer
}; };
static void dataDeviceHandleDataOffer(void* userData, static void dataDeviceHandleDataOffer(void* userData,
@ -1996,7 +1996,7 @@ static void dataDeviceHandleDataOffer(void* userData,
_glfw.wl.offers = offers; _glfw.wl.offers = offers;
_glfw.wl.offerCount++; _glfw.wl.offerCount++;
_glfw.wl.offers[_glfw.wl.offerCount - 1] = (_GLFWofferWayland) { offer }; _glfw.wl.offers[_glfw.wl.offerCount - 1] = (_GLFWofferWayland) { .offer = offer };
wl_data_offer_add_listener(offer, &dataOfferListener, NULL); wl_data_offer_add_listener(offer, &dataOfferListener, NULL);
} }
@ -3185,9 +3185,9 @@ static void dataSourceHandleCancelled(void* userData,
static const struct wl_data_source_listener dataSourceListener = static const struct wl_data_source_listener dataSourceListener =
{ {
dataSourceHandleTarget, .target = dataSourceHandleTarget,
dataSourceHandleSend, .send = dataSourceHandleSend,
dataSourceHandleCancelled, .cancelled = dataSourceHandleCancelled,
}; };
void _glfwSetClipboardStringWayland(const char* string) void _glfwSetClipboardStringWayland(const char* string)
@ -3261,7 +3261,7 @@ EGLNativeWindowType _glfwGetEGLNativeWindowWayland(_GLFWwindow* window)
return window->wl.egl.window; return window->wl.egl.window;
} }
void _glfwGetRequiredInstanceExtensionsWayland(char** extensions) void _glfwGetRequiredInstanceExtensionsWayland(const char** extensions)
{ {
if (!_glfw.vk.KHR_surface || !_glfw.vk.KHR_wayland_surface) if (!_glfw.vk.KHR_surface || !_glfw.vk.KHR_wayland_surface)
return; return;

View File

@ -231,7 +231,7 @@ static void createKeyTables(void)
const struct const struct
{ {
int key; int key;
char* name; const char* name;
} keymap[] = } keymap[] =
{ {
{ GLFW_KEY_GRAVE_ACCENT, "TLDE" }, { GLFW_KEY_GRAVE_ACCENT, "TLDE" },
@ -366,7 +366,7 @@ static void createKeyTables(void)
// keyboard layout. Because function keys aren't mapped correctly // keyboard layout. Because function keys aren't mapped correctly
// when using traditional KeySym translations, they are mapped // when using traditional KeySym translations, they are mapped
// here instead. // here instead.
for (int i = 0; i < sizeof(keymap) / sizeof(keymap[0]); i++) for (size_t i = 0; i < sizeof(keymap) / sizeof(keymap[0]); i++)
{ {
if (strncmp(desc->names->keys[scancode].name, if (strncmp(desc->names->keys[scancode].name,
keymap[i].name, keymap[i].name,
@ -390,7 +390,7 @@ static void createKeyTables(void)
continue; continue;
} }
for (int j = 0; j < sizeof(keymap) / sizeof(keymap[0]); j++) for (size_t j = 0; j < sizeof(keymap) / sizeof(keymap[0]); j++)
{ {
if (strncmp(desc->names->key_aliases[i].alias, if (strncmp(desc->names->key_aliases[i].alias,
keymap[j].name, keymap[j].name,

View File

@ -180,8 +180,8 @@ void _glfwPollMonitorsX11(void)
{ {
if (screens[j].x_org == ci->x && if (screens[j].x_org == ci->x &&
screens[j].y_org == ci->y && screens[j].y_org == ci->y &&
screens[j].width == ci->width && screens[j].width == (int)ci->width &&
screens[j].height == ci->height) screens[j].height == (int)ci->height)
{ {
monitor->x11.index = j; monitor->x11.index = j;
break; break;
@ -573,7 +573,7 @@ void _glfwSetGammaRampX11(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
{ {
if (_glfw.x11.randr.available && !_glfw.x11.randr.gammaBroken) if (_glfw.x11.randr.available && !_glfw.x11.randr.gammaBroken)
{ {
if (XRRGetCrtcGammaSize(_glfw.x11.display, monitor->x11.crtc) != ramp->size) if (XRRGetCrtcGammaSize(_glfw.x11.display, monitor->x11.crtc) != (int)ramp->size)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"X11: Gamma ramp size must match current ramp size"); "X11: Gamma ramp size must match current ramp size");

View File

@ -959,7 +959,7 @@ EGLenum _glfwGetEGLPlatformX11(EGLint** attribs);
EGLNativeDisplayType _glfwGetEGLNativeDisplayX11(void); EGLNativeDisplayType _glfwGetEGLNativeDisplayX11(void);
EGLNativeWindowType _glfwGetEGLNativeWindowX11(_GLFWwindow* window); EGLNativeWindowType _glfwGetEGLNativeWindowX11(_GLFWwindow* window);
void _glfwGetRequiredInstanceExtensionsX11(char** extensions); void _glfwGetRequiredInstanceExtensionsX11(const char** extensions);
GLFWbool _glfwGetPhysicalDevicePresentationSupportX11(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily); GLFWbool _glfwGetPhysicalDevicePresentationSupportX11(VkInstance instance, VkPhysicalDevice device, uint32_t queuefamily);
VkResult _glfwCreateWindowSurfaceX11(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); VkResult _glfwCreateWindowSurfaceX11(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface);

View File

@ -62,7 +62,7 @@
// //
static GLFWbool waitForX11Event(double* timeout) static GLFWbool waitForX11Event(double* timeout)
{ {
struct pollfd fd = { ConnectionNumber(_glfw.x11.display), POLLIN }; struct pollfd fd = { .fd = ConnectionNumber(_glfw.x11.display), .events = POLLIN };
while (!XPending(_glfw.x11.display)) while (!XPending(_glfw.x11.display))
{ {
@ -97,7 +97,7 @@ static GLFWbool waitForAnyEvent(double* timeout)
if (!_glfwPollPOSIX(fds, sizeof(fds) / sizeof(fds[0]), timeout)) if (!_glfwPollPOSIX(fds, sizeof(fds) / sizeof(fds[0]), timeout))
return GLFW_FALSE; return GLFW_FALSE;
for (int i = 1; i < sizeof(fds) / sizeof(fds[0]); i++) for (size_t i = 1; i < sizeof(fds) / sizeof(fds[0]); i++)
{ {
if (fds[i].revents & POLLIN) if (fds[i].revents & POLLIN)
return GLFW_TRUE; return GLFW_TRUE;
@ -235,10 +235,10 @@ static int translateState(int state)
// Translates an X11 key code to a GLFW key token // Translates an X11 key code to a GLFW key token
// //
static int translateKey(int scancode) static int translateKey(unsigned int scancode)
{ {
// Use the pre-filled LUT (see createKeyTables() in x11_init.c) // Use the pre-filled LUT (see createKeyTables() in x11_init.c)
if (scancode < 0 || scancode > 255) if (scancode > 255)
return GLFW_KEY_UNKNOWN; return GLFW_KEY_UNKNOWN;
return _glfw.x11.keycodes[scancode]; return _glfw.x11.keycodes[scancode];
@ -1145,7 +1145,7 @@ static void releaseMonitor(_GLFWwindow* window)
// //
static void processEvent(XEvent *event) static void processEvent(XEvent *event)
{ {
int keycode = 0; unsigned int keycode = 0;
Bool filtered = False; Bool filtered = False;
// HACK: Save scancode as some IMs clear the field in XFilterEvent // HACK: Save scancode as some IMs clear the field in XFilterEvent
@ -3133,7 +3133,7 @@ EGLNativeWindowType _glfwGetEGLNativeWindowX11(_GLFWwindow* window)
return (EGLNativeWindowType) window->x11.handle; return (EGLNativeWindowType) window->x11.handle;
} }
void _glfwGetRequiredInstanceExtensionsX11(char** extensions) void _glfwGetRequiredInstanceExtensionsX11(const char** extensions)
{ {
if (!_glfw.vk.KHR_surface) if (!_glfw.vk.KHR_surface)
return; return;