cmd/devdraw: handle X11 selections better

x11-screen.c accepts selection targets with the MIME type
"text/plain;charset-UTF8", but it should do so case insensitively. The
current code draws an error when working with xfce4-terminal 1.0.4,
which sends lower case.  To reproduce, run acme, snarf some text, then
paste in the terminal.  acme will report:
acme: cannot handle selection request for 'text/plain;charset=utf-8' (590)
This commit is contained in:
Scott Schwartz
2025-11-03 20:25:23 -08:00
committed by Dan Cross
parent 46fbe4cd00
commit 37cd522b0a

View File

@@ -1612,8 +1612,9 @@ if(0) fprint(2, "xselect target=%d requestor=%d property=%d selection=%d (sizeof
|| xe->target == _x.utf8string
|| xe->target == _x.text
|| xe->target == _x.compoundtext
|| ((name = XGetAtomName(_x.display, xe->target)) && strcmp(name, "text/plain;charset=UTF-8") == 0)){
|| ((name = XGetAtomName(_x.display, xe->target)) && strcasecmp(name, "text/plain;charset=UTF-8") == 0)){
/* text/plain;charset=UTF-8 seems nonstandard but is used by Synergy */
/* text/plain;charset=utf-8 is used by xfce4-terminal 1.0.4 */
/* if the target is STRING we're supposed to reply with Latin1 XXX */
qlock(&clip.lk);
XChangeProperty(_x.display, xe->requestor, xe->property, xe->target,