winex11.drv: Filter out all CF_* formats when CF_HDROP is present.
authorDamjan Jovanovic <damjan.jov@gmail.com>
Mon, 16 Aug 2010 19:08:49 +0000 (21:08 +0200)
committerAlexandre Julliard <julliard@winehq.org>
Tue, 17 Aug 2010 12:44:36 +0000 (14:44 +0200)
dlls/winex11.drv/xdnd.c

index ef8dd99c1a2c45b4b1684485dbbc6073721beca3..f0704da3f35b497763b8a42baa319d8951f343d8 100644 (file)
@@ -257,6 +257,8 @@ static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm,
     unsigned long bytesret, icount;
     int entries = 0;
     unsigned char* data = NULL;
+    XDNDDATA *current, *next;
+    BOOL haveHDROP = FALSE;
 
     TRACE("count(%ld)\n", *count);
 
@@ -301,6 +303,31 @@ static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm,
         wine_tsx11_unlock();
     }
 
+    /* On Windows when there is a CF_HDROP, there are no other CF_ formats.
+     * foobar2000 relies on this (spaces -> %20's without it).
+     */
+    LIST_FOR_EACH_ENTRY(current, &xdndData, XDNDDATA, entry)
+    {
+        if (current->cf_win == CF_HDROP)
+        {
+            haveHDROP = TRUE;
+            break;
+        }
+    }
+    if (haveHDROP)
+    {
+        LIST_FOR_EACH_ENTRY_SAFE(current, next, &xdndData, XDNDDATA, entry)
+        {
+            if (current->cf_win != CF_HDROP && current->cf_win < CF_MAX)
+            {
+                list_remove(&current->entry);
+                HeapFree(GetProcessHeap(), 0, current->data);
+                HeapFree(GetProcessHeap(), 0, current);
+                --entries;
+            }
+        }
+    }
+
     *count = entries;
 }