X11: Let the language initialize XEvent structs

From upstream: 1f508530f0
This commit is contained in:
Kovid Goyal 2019-07-01 05:47:04 +05:30
parent 41ebb72276
commit a491a801bf
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

26
glfw/x11_window.c vendored
View File

@ -198,10 +198,7 @@ static int translateState(int state)
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;
@ -842,11 +839,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;
@ -1488,10 +1482,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;
@ -1524,10 +1515,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;
@ -1580,10 +1568,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;
@ -2896,4 +2881,3 @@ GLFWAPI unsigned long long glfwDBusUserNotify(const char *app_name, const char*
GLFWAPI void glfwDBusSetUserNotificationHandler(GLFWDBusnotificationactivatedfun handler) {
glfw_dbus_set_user_notification_activated_handler(handler);
}