diff --git a/src/x11_window.c b/src/x11_window.c index da39a39d..dc8c1e93 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -215,10 +215,7 @@ static int translateKey(int scancode) static void sendEventToWM(_GLFWwindow* window, Atom type, long a, long b, long c, long d, long e) { - XEvent event; - memset(&event, 0, sizeof(event)); - - event.type = ClientMessage; + XEvent event = { ClientMessage }; event.xclient.window = window->x11.handle; event.xclient.format = 32; // Data is 32-bit longs event.xclient.message_type = type; @@ -946,11 +943,8 @@ static void handleSelectionRequest(XEvent* event) { const XSelectionRequestEvent* request = &event->xselectionrequest; - XEvent reply; - memset(&reply, 0, sizeof(reply)); - + XEvent reply = { SelectionNotify }; reply.xselection.property = writeTargetToProperty(request); - reply.xselection.type = SelectionNotify; reply.xselection.display = request->display; reply.xselection.requestor = request->requestor; reply.xselection.selection = request->selection; @@ -1647,10 +1641,7 @@ static void processEvent(XEvent *event) } else if (_glfw.x11.xdnd.version >= 2) { - XEvent reply; - memset(&reply, 0, sizeof(reply)); - - reply.type = ClientMessage; + XEvent reply = { ClientMessage }; reply.xclient.window = _glfw.x11.xdnd.source; reply.xclient.message_type = _glfw.x11.XdndFinished; reply.xclient.format = 32; @@ -1683,10 +1674,7 @@ static void processEvent(XEvent *event) _glfwInputCursorPos(window, xpos, ypos); - XEvent reply; - memset(&reply, 0, sizeof(reply)); - - reply.type = ClientMessage; + XEvent reply = { ClientMessage }; reply.xclient.window = _glfw.x11.xdnd.source; reply.xclient.message_type = _glfw.x11.XdndStatus; reply.xclient.format = 32; @@ -1739,10 +1727,7 @@ static void processEvent(XEvent *event) if (_glfw.x11.xdnd.version >= 2) { - XEvent reply; - memset(&reply, 0, sizeof(reply)); - - reply.type = ClientMessage; + XEvent reply = { ClientMessage }; reply.xclient.window = _glfw.x11.xdnd.source; reply.xclient.message_type = _glfw.x11.XdndFinished; reply.xclient.format = 32; @@ -2738,10 +2723,7 @@ void _glfwPlatformWaitEventsTimeout(double timeout) void _glfwPlatformPostEmptyEvent(void) { - XEvent event; - - memset(&event, 0, sizeof(event)); - event.type = ClientMessage; + XEvent event = { ClientMessage }; event.xclient.window = _glfw.x11.helperWindowHandle; event.xclient.format = 32; // Data is 32-bit longs event.xclient.message_type = _glfw.x11.NULL_;