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

Alexandre Julliard julliard at winehq.org
Tue Oct 5 14:41:46 CDT 2010


Module: wine
Branch: stable
Commit: ee626d20873067c2f15d12c496311d40363eab78
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ee626d20873067c2f15d12c496311d40363eab78

Author: Ken Thomases <ken at 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.
(cherry picked from commit b95275115839ded61f4f56d2c6f444819a7671ce)

---

 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);




More information about the wine-cvs mailing list