From 36040ec06db75a78c5b804d66f8a6d5eda7a6eba Mon Sep 17 00:00:00 2001 From: Ali Mirjamali Date: Thu, 17 Oct 2024 22:23:24 +0330 Subject: [PATCH] Handle INCR clipboard Warn user if vmside clipboard size is over 256KiB reverting to INCR fixes: https://github.com/QubesOS/qubes-issues/issues/5220 --- gui-agent/vmside.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/gui-agent/vmside.c b/gui-agent/vmside.c index 059d6710..2230ee35 100644 --- a/gui-agent/vmside.c +++ b/gui-agent/vmside.c @@ -1061,11 +1061,18 @@ static void process_xevent_selection(Ghandles * g, XSelectionEvent * ev) g->utf8_string_atom, g->qprop, g->stub_win, ev->time); else - send_clipboard_data(g->vchan, g->stub_win, (char *) data, len, g->protocol_version); - /* even if the clipboard owner does not support UTF8 and we requested - XA_STRING, it is fine - ascii is legal UTF8 */ + if (type == XInternAtom(g->display, "INCR", False)) { + char INCR_WARNING[] = + "Qube clipboard size over 256KiB and X11 INCR protocol support is not implemented!\n"; + send_clipboard_data(g->vchan, g->stub_win, (char *) &INCR_WARNING, + sizeof(INCR_WARNING), g->protocol_version); + } else { + send_clipboard_data(g->vchan, g->stub_win, (char *) data, len, + g->protocol_version); + /* even if the clipboard owner does not support UTF8 and we requested + XA_STRING, it is fine - ascii is legal UTF8 */ + } XFree(data); - } static void process_xevent_selection_req(Ghandles * g,