winex11: Pass window property to server in 64KB chunks.

Large clipboard contents, like images, can exceed the maximum X request size
if sent all at once, which can cause the X server to kill the connection.
This commit is contained in:
Ken Thomases 2010-08-23 22:40:19 -05:00 committed by Alexandre Julliard
parent 84f6bb3e3f
commit b952751158
1 changed files with 11 additions and 2 deletions

View File

@ -3227,11 +3227,20 @@ static void X11DRV_HandleSelectionRequest( HWND hWnd, XSelectionRequestEvent *ev
if (hClipData && (lpClipData = GlobalLock(hClipData)))
{
int mode = PropModeReplace;
TRACE("\tUpdating property %s, %d bytes\n", debugstr_w(lpFormat->Name), cBytes);
wine_tsx11_lock();
XChangeProperty(display, request, rprop, event->target,
8, PropModeReplace, lpClipData, cBytes);
do
{
int nelements = min(cBytes, 65536);
XChangeProperty(display, request, rprop, event->target,
8, mode, lpClipData, nelements);
mode = PropModeAppend;
cBytes -= nelements;
lpClipData += nelements;
} while (cBytes > 0);
wine_tsx11_unlock();
GlobalUnlock(hClipData);