diff options
| author | Scott Schwartz <scott7z123@gmail.com> | 2025-11-03 20:25:23 -0800 |
|---|---|---|
| committer | Dan Cross <crossd@gmail.com> | 2025-11-04 07:10:14 -0500 |
| commit | 37cd522b0a79b4f6b2b5d4b8d27667dea44f71d4 (patch) | |
| tree | 31757c5301aa2a229d26798680db6424e49c6e4d | |
| parent | 46fbe4cd00252a93e9ffcedb3154b53453d0993e (diff) | |
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)
| -rw-r--r-- | src/cmd/devdraw/x11-screen.c | 3 |
1 files changed, 2 insertions, 1 deletions
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, |