Module: wine Branch: master Commit: b95275115839ded61f4f56d2c6f444819a7671ce URL: http://source.winehq.org/git/wine.git/?a=commit;h=b95275115839ded61f4f56d2c6...
Author: Ken Thomases ken@codeweavers.com Date: Mon Aug 23 22:40:19 2010 -0500
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.
---
dlls/winex11.drv/clipboard.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c index 584136a..fcec86b 100644 --- a/dlls/winex11.drv/clipboard.c +++ b/dlls/winex11.drv/clipboard.c @@ -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);