mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-11-03 17:24:34 +00:00
Add MIME targets to SDL_EVENT_DROP_TEXT in X11
src/video/x11/SDL_x11events.c
Add Text targets "text/plain;charset=utf-8",
"UTF8_STRING", "TEXT" to "text/plain".
This commit is contained in:
committed by
Sam Lantinga
parent
44927fe5e3
commit
ca127106ee
@@ -126,9 +126,19 @@ static Atom X11_PickTarget(Display *disp, Atom list[], int list_count)
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i < list_count && request == None; i++) {
|
for (i = 0; i < list_count && request == None; i++) {
|
||||||
name = X11_XGetAtomName(disp, list[i]);
|
name = X11_XGetAtomName(disp, list[i]);
|
||||||
if ((SDL_strcmp("text/uri-list", name) == 0) || (SDL_strcmp("text/plain", name) == 0)) {
|
/* Preferred MIME targets */
|
||||||
|
if ((SDL_strcmp("text/uri-list", name) == 0) ||
|
||||||
|
(SDL_strcmp("text/plain;charset=utf-8", name) == 0) ||
|
||||||
|
(SDL_strcmp("UTF8_STRING", name) == 0)) {
|
||||||
request = list[i];
|
request = list[i];
|
||||||
}
|
}
|
||||||
|
/* Fallback MIME targets */
|
||||||
|
if ((SDL_strcmp("text/plain", name) == 0) ||
|
||||||
|
(SDL_strcmp("TEXT", name) == 0)) {
|
||||||
|
if (request == None) {
|
||||||
|
request = list[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
X11_XFree(name);
|
X11_XFree(name);
|
||||||
}
|
}
|
||||||
return request;
|
return request;
|
||||||
@@ -1759,7 +1769,10 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
|
|||||||
if (name) {
|
if (name) {
|
||||||
char *token = SDL_strtok_r((char *)p.data, "\r\n", &saveptr);
|
char *token = SDL_strtok_r((char *)p.data, "\r\n", &saveptr);
|
||||||
while (token) {
|
while (token) {
|
||||||
if (SDL_strcmp("text/plain", name) == 0) {
|
if ((SDL_strcmp("text/plain;charset=utf-8", name) == 0) ||
|
||||||
|
(SDL_strcmp("UTF8_STRING", name) == 0) ||
|
||||||
|
(SDL_strcmp("text/plain", name) == 0) ||
|
||||||
|
(SDL_strcmp("TEXT", name) == 0)) {
|
||||||
SDL_SendDropText(data->window, token);
|
SDL_SendDropText(data->window, token);
|
||||||
} else if (SDL_strcmp("text/uri-list", name) == 0) {
|
} else if (SDL_strcmp("text/uri-list", name) == 0) {
|
||||||
if (SDL_URIToLocal(token, token) >= 0) {
|
if (SDL_URIToLocal(token, token) >= 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user