mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-29 20:27:12 +01:00
X11: Fixed SelectionRequest replies for target TARGETS.
Fixes Google Chrome, etc, freezing up when SDL owns the clipboard selection and actually sends thems the correct text for pasting. Confirmed working with Unicode strings in UTF-8 format. There were a few tweaks in this patch, but the specific fix is that event.xselection.target in the SelectionNotify event we send back in reply must be set to the same atom as the request ("TARGETS" in this case), and we failed to do that in this special case. Things that don't ask for a target, like the Gnome Terminal app, worked fine because they don't ask for TARGETS and just go right to asking for a UTF8_STRING, and Mozilla apparently just was more liberal in what they accepted in reply. Chrome would reject our wrong reply and freeze up waiting for a valid one. Someone should fix that in Chrome, too. :) Fixes Bugzilla #2926.
This commit is contained in:
parent
96aef8cbca
commit
360d05bf72
@ -1189,6 +1189,7 @@ X11_DispatchEvent(_THIS)
|
||||
sevent.xselection.property = None;
|
||||
sevent.xselection.requestor = req->requestor;
|
||||
sevent.xselection.time = req->time;
|
||||
|
||||
if (X11_XGetWindowProperty(display, DefaultRootWindow(display),
|
||||
X11_GetSDLCutBufferClipboardType(display), 0, INT_MAX/4, False, req->target,
|
||||
&sevent.xselection.target, &seln_format, &nbytes,
|
||||
@ -1200,12 +1201,13 @@ X11_DispatchEvent(_THIS)
|
||||
seln_data, nbytes);
|
||||
sevent.xselection.property = req->property;
|
||||
} else if (XA_TARGETS == req->target) {
|
||||
Atom SupportedFormats[] = { sevent.xselection.target, XA_TARGETS };
|
||||
Atom SupportedFormats[] = { XA_TARGETS, sevent.xselection.target };
|
||||
X11_XChangeProperty(display, req->requestor, req->property,
|
||||
XA_ATOM, 32, PropModeReplace,
|
||||
(unsigned char*)SupportedFormats,
|
||||
sizeof(SupportedFormats)/sizeof(*SupportedFormats));
|
||||
SDL_arraysize(SupportedFormats));
|
||||
sevent.xselection.property = req->property;
|
||||
sevent.xselection.target = XA_TARGETS;
|
||||
}
|
||||
X11_XFree(seln_data);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user