From a9df08221b9eea2c3c2761975b2919e03def9527 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 --- gui-agent/vmside.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/gui-agent/vmside.c b/gui-agent/vmside.c index 059d6710..b0b12242 100644 --- a/gui-agent/vmside.c +++ b/gui-agent/vmside.c @@ -59,8 +59,6 @@ #include #include - - /* Time in milliseconds after which the clipboard data should be wiped */ #define CLIPBOARD_WIPE_TIME 60000 @@ -1061,11 +1059,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,