mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 21:14:35 +00:00
X11: Let the language initialize XEvent structs
(cherry picked from commit 1f508530f0
)
This commit is contained in:
parent
e276f6731e
commit
1e12653348
@ -215,10 +215,7 @@ static int translateKey(int scancode)
|
|||||||
static void sendEventToWM(_GLFWwindow* window, Atom type,
|
static void sendEventToWM(_GLFWwindow* window, Atom type,
|
||||||
long a, long b, long c, long d, long e)
|
long a, long b, long c, long d, long e)
|
||||||
{
|
{
|
||||||
XEvent event;
|
XEvent event = { ClientMessage };
|
||||||
memset(&event, 0, sizeof(event));
|
|
||||||
|
|
||||||
event.type = ClientMessage;
|
|
||||||
event.xclient.window = window->x11.handle;
|
event.xclient.window = window->x11.handle;
|
||||||
event.xclient.format = 32; // Data is 32-bit longs
|
event.xclient.format = 32; // Data is 32-bit longs
|
||||||
event.xclient.message_type = type;
|
event.xclient.message_type = type;
|
||||||
@ -946,11 +943,8 @@ static void handleSelectionRequest(XEvent* event)
|
|||||||
{
|
{
|
||||||
const XSelectionRequestEvent* request = &event->xselectionrequest;
|
const XSelectionRequestEvent* request = &event->xselectionrequest;
|
||||||
|
|
||||||
XEvent reply;
|
XEvent reply = { SelectionNotify };
|
||||||
memset(&reply, 0, sizeof(reply));
|
|
||||||
|
|
||||||
reply.xselection.property = writeTargetToProperty(request);
|
reply.xselection.property = writeTargetToProperty(request);
|
||||||
reply.xselection.type = SelectionNotify;
|
|
||||||
reply.xselection.display = request->display;
|
reply.xselection.display = request->display;
|
||||||
reply.xselection.requestor = request->requestor;
|
reply.xselection.requestor = request->requestor;
|
||||||
reply.xselection.selection = request->selection;
|
reply.xselection.selection = request->selection;
|
||||||
@ -1647,10 +1641,7 @@ static void processEvent(XEvent *event)
|
|||||||
}
|
}
|
||||||
else if (_glfw.x11.xdnd.version >= 2)
|
else if (_glfw.x11.xdnd.version >= 2)
|
||||||
{
|
{
|
||||||
XEvent reply;
|
XEvent reply = { ClientMessage };
|
||||||
memset(&reply, 0, sizeof(reply));
|
|
||||||
|
|
||||||
reply.type = ClientMessage;
|
|
||||||
reply.xclient.window = _glfw.x11.xdnd.source;
|
reply.xclient.window = _glfw.x11.xdnd.source;
|
||||||
reply.xclient.message_type = _glfw.x11.XdndFinished;
|
reply.xclient.message_type = _glfw.x11.XdndFinished;
|
||||||
reply.xclient.format = 32;
|
reply.xclient.format = 32;
|
||||||
@ -1683,10 +1674,7 @@ static void processEvent(XEvent *event)
|
|||||||
|
|
||||||
_glfwInputCursorPos(window, xpos, ypos);
|
_glfwInputCursorPos(window, xpos, ypos);
|
||||||
|
|
||||||
XEvent reply;
|
XEvent reply = { ClientMessage };
|
||||||
memset(&reply, 0, sizeof(reply));
|
|
||||||
|
|
||||||
reply.type = ClientMessage;
|
|
||||||
reply.xclient.window = _glfw.x11.xdnd.source;
|
reply.xclient.window = _glfw.x11.xdnd.source;
|
||||||
reply.xclient.message_type = _glfw.x11.XdndStatus;
|
reply.xclient.message_type = _glfw.x11.XdndStatus;
|
||||||
reply.xclient.format = 32;
|
reply.xclient.format = 32;
|
||||||
@ -1739,10 +1727,7 @@ static void processEvent(XEvent *event)
|
|||||||
|
|
||||||
if (_glfw.x11.xdnd.version >= 2)
|
if (_glfw.x11.xdnd.version >= 2)
|
||||||
{
|
{
|
||||||
XEvent reply;
|
XEvent reply = { ClientMessage };
|
||||||
memset(&reply, 0, sizeof(reply));
|
|
||||||
|
|
||||||
reply.type = ClientMessage;
|
|
||||||
reply.xclient.window = _glfw.x11.xdnd.source;
|
reply.xclient.window = _glfw.x11.xdnd.source;
|
||||||
reply.xclient.message_type = _glfw.x11.XdndFinished;
|
reply.xclient.message_type = _glfw.x11.XdndFinished;
|
||||||
reply.xclient.format = 32;
|
reply.xclient.format = 32;
|
||||||
@ -2738,10 +2723,7 @@ void _glfwPlatformWaitEventsTimeout(double timeout)
|
|||||||
|
|
||||||
void _glfwPlatformPostEmptyEvent(void)
|
void _glfwPlatformPostEmptyEvent(void)
|
||||||
{
|
{
|
||||||
XEvent event;
|
XEvent event = { ClientMessage };
|
||||||
|
|
||||||
memset(&event, 0, sizeof(event));
|
|
||||||
event.type = ClientMessage;
|
|
||||||
event.xclient.window = _glfw.x11.helperWindowHandle;
|
event.xclient.window = _glfw.x11.helperWindowHandle;
|
||||||
event.xclient.format = 32; // Data is 32-bit longs
|
event.xclient.format = 32; // Data is 32-bit longs
|
||||||
event.xclient.message_type = _glfw.x11.NULL_;
|
event.xclient.message_type = _glfw.x11.NULL_;
|
||||||
|
Loading…
Reference in New Issue
Block a user