aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO3
-rw-r--r--src/window/window.c12
2 files changed, 14 insertions, 1 deletions
diff --git a/TODO b/TODO
index df13b75..859b9db 100644
--- a/TODO
+++ b/TODO
@@ -7,4 +7,5 @@ Experiment with reducing latency by removing GLX_DOUBLEBUFFER and using glFlush&
Only render one glyph for missing symbols.\
High precision mouse wheel event by using xi2, which also allows us to get which scroll wheel was used and scrolling in y direction.\
Use XPresent (PresentNotifyMSC, glSwapBuffers, wait for PresentCompleteNotify before doing presentNotifyMsc and glSwapBuffers again), see https://invent.kde.org/plasma/kwin/-/issues/27. This doesn't work on nvidia because nvidia never sends the PresentCompleteNotify event.
-Support drag and drop. \ No newline at end of file
+Support drag and drop.\
+Pasting image into mgl doesn't always work. For example when using wayland + sway. Only 64k are copied (even when chunk size is set to 20kb instead of 32kb. One workaround would be to set chunk size and 1024 to 0x1ffffffff). \ No newline at end of file
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) {