aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/window/window.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/window/window.c b/src/window/window.c
index 709f4b1..60f6277 100644
--- a/src/window/window.c
+++ b/src/window/window.c
@@ -758,21 +758,31 @@ static void mgl_window_on_receive_event(mgl_window *self, XEvent *xev, mgl_event
XChangeProperty(context->connection, selection_event.requestor, selection_event.property, XA_ATOM, 32, PropModeReplace, (unsigned char*)targets, num_targets);
selection_event.target = x11_context->targets_atom;
XSendEvent(context->connection, selection_event.requestor, True, NoEventMask, (XEvent*)&selection_event);
+ XFlush(context->connection);
+ event->type = MGL_EVENT_UNKNOWN;
+ return;
} else if(selection_event.target == XA_STRING || (!x11_context->utf8_string_atom && selection_event.target == x11_context->text_atom)) {
/* A client requested ascii clipboard */
XChangeProperty(context->connection, selection_event.requestor, selection_event.property, XA_STRING, 8, PropModeReplace, self->clipboard_string, self->clipboard_size);
selection_event.target = XA_STRING;
XSendEvent(context->connection, selection_event.requestor, True, NoEventMask, (XEvent*)&selection_event);
+ XFlush(context->connection);
+ event->type = MGL_EVENT_UNKNOWN;
+ return;
} else if(x11_context->utf8_string_atom && (selection_event.target == x11_context->utf8_string_atom || selection_event.target == x11_context->text_atom)) {
/* A client requested utf8 clipboard */
XChangeProperty(context->connection, selection_event.requestor, selection_event.property, x11_context->utf8_string_atom, 8, PropModeReplace, self->clipboard_string, self->clipboard_size);
selection_event.target = x11_context->utf8_string_atom;
XSendEvent(context->connection, selection_event.requestor, True, NoEventMask, (XEvent*)&selection_event);
+ XFlush(context->connection);
+ event->type = MGL_EVENT_UNKNOWN;
+ return;
}
}
selection_event.property = None;
XSendEvent(context->connection, selection_event.requestor, True, NoEventMask, (XEvent*)&selection_event);
+ XFlush(context->connection);
event->type = MGL_EVENT_UNKNOWN;
return;
}
@@ -784,6 +794,7 @@ static void mgl_window_on_receive_event(mgl_window *self, XEvent *xev, mgl_event
} else if(xev->xclient.format == 32 && (unsigned long)xev->xclient.data.l[0] == context->net_wm_ping_atom) {
xev->xclient.window = DefaultRootWindow(context->connection);
XSendEvent(context->connection, DefaultRootWindow(context->connection), False, SubstructureNotifyMask | SubstructureRedirectMask, xev);
+ XFlush(context->connection);
}
event->type = MGL_EVENT_UNKNOWN;
return;
@@ -989,6 +1000,7 @@ void mgl_window_set_clipboard(mgl_window *self, const char *str, size_t size) {
}
XSetSelectionOwner(context->connection, x11_context->clipboard_atom, self->window, CurrentTime);
+ XFlush(context->connection);
/* Check if setting the selection owner was successful */
if(XGetSelectionOwner(context->connection, x11_context->clipboard_atom) != self->window) {