Fixed building on 32-bit Linux
parent
06d5989157
commit
a9c988b2a9
|
@ -41,13 +41,15 @@ static void *X11_ClipboardTextCallback(size_t *length, const char *mime_type, vo
|
||||||
{
|
{
|
||||||
void *data = NULL;
|
void *data = NULL;
|
||||||
SDL_bool valid_mime_type = SDL_FALSE;
|
SDL_bool valid_mime_type = SDL_FALSE;
|
||||||
|
size_t i;
|
||||||
|
|
||||||
*length = 0;
|
*length = 0;
|
||||||
|
|
||||||
if (userdata == NULL) {
|
if (userdata == NULL) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < TEXT_MIME_TYPES_LEN; ++i) {
|
for (i = 0; i < TEXT_MIME_TYPES_LEN; ++i) {
|
||||||
if (SDL_strcmp(mime_type, text_mime_types[i]) == 0) {
|
if (SDL_strcmp(mime_type, text_mime_types[i]) == 0) {
|
||||||
valid_mime_type = SDL_TRUE;
|
valid_mime_type = SDL_TRUE;
|
||||||
break;
|
break;
|
||||||
|
@ -163,6 +165,7 @@ static void *GetSelectionData(SDL_VideoDevice *_this, Atom selection_type, size_
|
||||||
Atom selection;
|
Atom selection;
|
||||||
Atom seln_type;
|
Atom seln_type;
|
||||||
int seln_format;
|
int seln_format;
|
||||||
|
unsigned long count;
|
||||||
unsigned long overflow;
|
unsigned long overflow;
|
||||||
Uint64 waitStart;
|
Uint64 waitStart;
|
||||||
Uint64 waitElapsed;
|
Uint64 waitElapsed;
|
||||||
|
@ -170,6 +173,7 @@ static void *GetSelectionData(SDL_VideoDevice *_this, Atom selection_type, size_
|
||||||
void *data = NULL;
|
void *data = NULL;
|
||||||
unsigned char *src = NULL;
|
unsigned char *src = NULL;
|
||||||
Atom XA_MIME = X11_XInternAtom(display, mime_type, False);
|
Atom XA_MIME = X11_XInternAtom(display, mime_type, False);
|
||||||
|
|
||||||
*length = 0;
|
*length = 0;
|
||||||
|
|
||||||
/* Get the window that holds the selection */
|
/* Get the window that holds the selection */
|
||||||
|
@ -216,8 +220,9 @@ static void *GetSelectionData(SDL_VideoDevice *_this, Atom selection_type, size_
|
||||||
}
|
}
|
||||||
|
|
||||||
if (X11_XGetWindowProperty(display, owner, selection, 0, INT_MAX / 4, False,
|
if (X11_XGetWindowProperty(display, owner, selection, 0, INT_MAX / 4, False,
|
||||||
XA_MIME, &seln_type, &seln_format, length, &overflow, &src) == Success) {
|
XA_MIME, &seln_type, &seln_format, &count, &overflow, &src) == Success) {
|
||||||
if (seln_type == XA_MIME) {
|
if (seln_type == XA_MIME) {
|
||||||
|
*length = (size_t)count;
|
||||||
data = CloneDataBuffer(src, length, nullterminate);
|
data = CloneDataBuffer(src, length, nullterminate);
|
||||||
}
|
}
|
||||||
X11_XFree(src);
|
X11_XFree(src);
|
||||||
|
|
|
@ -628,8 +628,8 @@ static void X11_HandleClipboardEvent(SDL_VideoDevice *_this, const XEvent *xeven
|
||||||
const XSelectionRequestEvent *req = &xevent->xselectionrequest;
|
const XSelectionRequestEvent *req = &xevent->xselectionrequest;
|
||||||
XEvent sevent;
|
XEvent sevent;
|
||||||
int mime_formats;
|
int mime_formats;
|
||||||
unsigned long nbytes;
|
|
||||||
unsigned char *seln_data;
|
unsigned char *seln_data;
|
||||||
|
size_t seln_length = 0;
|
||||||
Atom XA_TARGETS = X11_XInternAtom(display, "TARGETS", 0);
|
Atom XA_TARGETS = X11_XInternAtom(display, "TARGETS", 0);
|
||||||
SDLX11_ClipboardData *clipboard;
|
SDLX11_ClipboardData *clipboard;
|
||||||
|
|
||||||
|
@ -685,11 +685,11 @@ static void X11_HandleClipboardEvent(SDL_VideoDevice *_this, const XEvent *xeven
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: We don't support the X11 INCR protocol for large clipboards. Do we want that? */
|
/* FIXME: We don't support the X11 INCR protocol for large clipboards. Do we want that? */
|
||||||
seln_data = clipboard->callback(&nbytes, mime_type, clipboard->userdata);
|
seln_data = clipboard->callback(&seln_length, mime_type, clipboard->userdata);
|
||||||
if (seln_data != NULL) {
|
if (seln_data != NULL) {
|
||||||
X11_XChangeProperty(display, req->requestor, req->property,
|
X11_XChangeProperty(display, req->requestor, req->property,
|
||||||
req->target, 8, PropModeReplace,
|
req->target, 8, PropModeReplace,
|
||||||
seln_data, nbytes);
|
seln_data, seln_length);
|
||||||
sevent.xselection.property = req->property;
|
sevent.xselection.property = req->property;
|
||||||
sevent.xselection.target = req->target;
|
sevent.xselection.target = req->target;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue