Using designated initializers to avoid warnings.

This commit is contained in:
Marco Lizza 2024-02-29 01:50:21 +01:00
parent 58f2aab759
commit 7c2e8c7c5a
4 changed files with 22 additions and 22 deletions

View File

@ -1271,7 +1271,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

@ -236,7 +236,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

@ -474,8 +474,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)
@ -616,8 +616,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,
@ -791,10 +791,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)
@ -1144,7 +1144,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)
{ {
@ -1624,11 +1624,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,
@ -1936,7 +1936,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,
@ -1955,7 +1955,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);
} }
@ -3131,9 +3131,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)

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))
{ {