clipboard fix

Aric Stewart aric at codeweavers.com
Mon Feb 5 19:14:29 CST 2001


If an application directly calls SetClipboardData with CF_TEXT  and then
later called GetClipboardData with CF_TEXT we gave them a NULL. This was
because we where not handling this case.  

This patch ensures we give the text if we have it.

-aric
-------------- next part --------------
Index: windows/clipboard.c
===================================================================
RCS file: /home/wine/wine/windows/clipboard.c,v
retrieving revision 1.34
diff -u -u -r1.34 clipboard.c
--- windows/clipboard.c	2001/01/25 22:22:22	1.34
+++ windows/clipboard.c	2001/02/06 01:02:30
@@ -495,11 +495,17 @@
     LPWINE_CLIPFORMAT lpTarget = NULL;
     BOOL foundData = FALSE;
  
-    /* Asked for CF_TEXT but not available - always attempt to convert
-       from CF_UNICODETEXT or CF_OEMTEXT */
-    if( wFormat == CF_TEXT && !ClipFormats[CF_TEXT-1].wDataPresent )
+    /* Asked for CF_TEXT */
+    if( wFormat == CF_TEXT)
     {
-	if(ClipFormats[CF_UNICODETEXT-1].wDataPresent)
+    if(ClipFormats[CF_TEXT-1].wDataPresent)
+    {
+        lpSource = &ClipFormats[CF_TEXT-1];
+        lpTarget = &ClipFormats[CF_TEXT-1];
+        foundData = TRUE;
+        TRACE("\t TEXT -> TEXT\n");
+    }
+	else if(ClipFormats[CF_UNICODETEXT-1].wDataPresent)
 	{
 	    /* Convert UNICODETEXT -> TEXT */
 	    lpSource = &ClipFormats[CF_UNICODETEXT-1];
@@ -516,11 +522,17 @@
 	    TRACE("\tOEMTEXT -> TEXT\n");
 	}
     }
-    /* Asked for CF_OEMTEXT but not available - always attempt to convert
-       from CF_UNICODETEXT or CF_TEXT */
-    else if( wFormat == CF_OEMTEXT && !ClipFormats[CF_OEMTEXT-1].wDataPresent )
+    /* Asked for CF_OEMTEXT  */
+    else if( wFormat == CF_OEMTEXT)
     {
-	if(ClipFormats[CF_UNICODETEXT-1].wDataPresent)
+    if(ClipFormats[CF_OEMTEXT-1].wDataPresent)
+    {
+   	    lpSource = &ClipFormats[CF_OEMTEXT-1];
+	    lpTarget = &ClipFormats[CF_OEMTEXT-1];
+	    foundData = TRUE;
+	    TRACE("\tOEMTEXT -> OEMTEXT\n");
+    }
+	else if(ClipFormats[CF_UNICODETEXT-1].wDataPresent)
 	{
 	    /* Convert UNICODETEXT -> OEMTEXT */
 	    lpSource = &ClipFormats[CF_UNICODETEXT-1];
@@ -537,11 +549,17 @@
 	    TRACE("\tTEXT -> OEMTEXT\n");
 	}
     }
-    /* Asked for CF_UNICODETEXT but not available - always attempt to convert
-       from CF_TEXT or CF_OEMTEXT */
-    else if( wFormat == CF_UNICODETEXT && !ClipFormats[CF_UNICODETEXT-1].wDataPresent )
+    /* Asked for CF_UNICODETEXT */
+    else if( wFormat == CF_UNICODETEXT )
     {
-	if(ClipFormats[CF_TEXT-1].wDataPresent)
+	if(ClipFormats[CF_UNICODETEXT-1].wDataPresent)
+	{
+	    lpSource = &ClipFormats[CF_UNICODETEXT-1];
+	    lpTarget = &ClipFormats[CF_UNICODETEXT-1];
+            foundData = TRUE;
+	    TRACE("\tUNICODETEXT -> UNICODETEXT\n");
+	}
+    else if(ClipFormats[CF_TEXT-1].wDataPresent)
 	{
 	    /* Convert TEXT -> UNICODETEXT */
 	    lpSource = &ClipFormats[CF_TEXT-1];


More information about the wine-patches mailing list