From 37cd522b0a79b4f6b2b5d4b8d27667dea44f71d4 Mon Sep 17 00:00:00 2001 From: Scott Schwartz Date: Mon, 3 Nov 2025 20:25:23 -0800 Subject: 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) --- src/cmd/devdraw/x11-screen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/cmd') diff --git a/src/cmd/devdraw/x11-screen.c b/src/cmd/devdraw/x11-screen.c index 79dc5c81..0033035e 100644 --- a/src/cmd/devdraw/x11-screen.c +++ b/src/cmd/devdraw/x11-screen.c @@ -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, -- cgit v1.2.3