mirror of
https://github.com/yawut/SDL.git
synced 2026-08-16 22:06:30 -05:00
Make SDL support the X11 clipboard TARGETS protocol, which advertises what formats text is available in from the application. This is necessary for many Linux programs to interact well with the clipboard.
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -735,11 +735,19 @@ X11_DispatchEvent(_THIS)
|
||||
XA_CUT_BUFFER0, 0, INT_MAX/4, False, req->target,
|
||||
&sevent.xselection.target, &seln_format, &nbytes,
|
||||
&overflow, &seln_data) == Success) {
|
||||
Atom XA_TARGETS = XInternAtom(display, "TARGETS", 0);
|
||||
if (sevent.xselection.target == req->target) {
|
||||
XChangeProperty(display, req->requestor, req->property,
|
||||
sevent.xselection.target, seln_format, PropModeReplace,
|
||||
seln_data, nbytes);
|
||||
sevent.xselection.property = req->property;
|
||||
} else if (XA_TARGETS == req->target) {
|
||||
Atom SupportedFormats[] = { sevent.xselection.target, XA_TARGETS };
|
||||
XChangeProperty(display, req->requestor, req->property,
|
||||
XA_ATOM, 32, PropModeReplace,
|
||||
(unsigned char*)SupportedFormats,
|
||||
sizeof(SupportedFormats)/sizeof(*SupportedFormats));
|
||||
sevent.xselection.property = req->property;
|
||||
}
|
||||
XFree(seln_data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user