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");
if (length < sizeof(line))
{
_GLFWmapping mapping = {{0}};
_GLFWmapping mapping = { .name = {0} };
memcpy(line, c, length);
line[length] = '\0';

View File

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

View File

@ -474,8 +474,8 @@ static void surfaceHandleLeave(void* userData,
static const struct wl_surface_listener surfaceListener =
{
surfaceHandleEnter,
surfaceHandleLeave
.enter = surfaceHandleEnter,
.leave = surfaceHandleLeave
};
static void setIdleInhibitor(_GLFWwindow* window, GLFWbool enable)
@ -616,8 +616,8 @@ static void xdgToplevelHandleClose(void* userData,
static const struct xdg_toplevel_listener xdgToplevelListener =
{
xdgToplevelHandleConfigure,
xdgToplevelHandleClose
.configure = xdgToplevelHandleConfigure,
.close = xdgToplevelHandleClose
};
static void xdgSurfaceHandleConfigure(void* userData,
@ -791,10 +791,10 @@ void libdecorFrameHandleDismissPopup(struct libdecor_frame* frame,
static const struct libdecor_frame_interface libdecorFrameInterface =
{
libdecorFrameHandleConfigure,
libdecorFrameHandleClose,
libdecorFrameHandleCommit,
libdecorFrameHandleDismissPopup
.configure = libdecorFrameHandleConfigure,
.close = libdecorFrameHandleClose,
.commit = libdecorFrameHandleCommit,
.dismiss_popup = libdecorFrameHandleDismissPopup
};
static GLFWbool createLibdecorFrame(_GLFWwindow* window)
@ -1144,7 +1144,7 @@ static GLFWbool flushDisplay(void)
if (errno != EAGAIN)
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)
{
@ -1624,11 +1624,11 @@ static void pointerHandleAxis(void* userData,
static const struct wl_pointer_listener pointerListener =
{
pointerHandleEnter,
pointerHandleLeave,
pointerHandleMotion,
pointerHandleButton,
pointerHandleAxis,
.enter = pointerHandleEnter,
.leave = pointerHandleLeave,
.motion = pointerHandleMotion,
.button = pointerHandleButton,
.axis = pointerHandleAxis,
};
static void keyboardHandleKeymap(void* userData,
@ -1936,7 +1936,7 @@ static void dataOfferHandleOffer(void* userData,
static const struct wl_data_offer_listener dataOfferListener =
{
dataOfferHandleOffer
.offer = dataOfferHandleOffer
};
static void dataDeviceHandleDataOffer(void* userData,
@ -1955,7 +1955,7 @@ static void dataDeviceHandleDataOffer(void* userData,
_glfw.wl.offers = offers;
_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);
}
@ -3131,9 +3131,9 @@ static void dataSourceHandleCancelled(void* userData,
static const struct wl_data_source_listener dataSourceListener =
{
dataSourceHandleTarget,
dataSourceHandleSend,
dataSourceHandleCancelled,
.target = dataSourceHandleTarget,
.send = dataSourceHandleSend,
.cancelled = dataSourceHandleCancelled,
};
void _glfwSetClipboardStringWayland(const char* string)

View File

@ -62,7 +62,7 @@
//
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))
{