From b1886b8bb7c92a4aa045a79c5e3a76c8bf83a55e Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Tue, 18 Jun 2024 12:34:13 +0300 Subject: [PATCH] steamcompmgr: Advertise UTF8_STRING in clipboard TARGETS. Software respecting ICCCM will ask for TARGETS first before asking for one of the supported formats. Advertising only STRING will break with any non-ANSI characters, especially since handle_selection_notify() process UTF8 only and gamescope only returns UTF8 strings. This fixes non-ANSI text copied from Firefox / Chrome running on a Steam deck into any Wine app being a garbled mess. --- src/steamcompmgr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp index a8d959f78..8055e880b 100644 --- a/src/steamcompmgr.cpp +++ b/src/steamcompmgr.cpp @@ -4891,11 +4891,11 @@ handle_selection_request(xwayland_ctx_t *ctx, XSelectionRequestEvent *ev) { Atom targetList[] = { ctx->atoms.targets, - XA_STRING, + ctx->atoms.utf8StringAtom, }; XChangeProperty(ctx->dpy, ev->requestor, ev->property, XA_ATOM, 32, PropModeReplace, - (unsigned char *)&targetList, 2); + (unsigned char *)&targetList, sizeof(targetList) / sizeof(targetList[0])); response.xselection.property = ev->property; response.xselection.target = ev->target; }