winex11: Move CF_HDROP filtering to import_xdnd_selection.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-04-27 14:01:16 +01:00 committed by Alexandre Julliard
parent fa9e9b5c56
commit f7ac2c7833
2 changed files with 11 additions and 26 deletions

View File

@ -1108,14 +1108,25 @@ struct format_entry *import_xdnd_selection( Display *display, Window win, Atom s
void *data;
struct clipboard_format *format;
struct format_entry *ret = NULL, *entry;
BOOL have_hdrop = FALSE;
register_x11_formats( targets, count );
*ret_size = 0;
for (i = 0; i < count; i++)
{
if (!(format = find_x11_format( targets[i] ))) continue;
if (format->id != CF_HDROP) continue;
have_hdrop = TRUE;
break;
}
for (i = 0; i < count; i++)
{
if (!(format = find_x11_format( targets[i] ))) continue;
if (!format->id) continue;
if (have_hdrop && format->id != CF_HDROP && format->id < CF_MAX) continue;
if (!(data = import_selection( display, win, selection, format, &size ))) continue;
entry_size = (FIELD_OFFSET( struct format_entry, data[size] ) + 7) & ~7;

View File

@ -530,8 +530,6 @@ static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm,
Atom *types, unsigned long count)
{
struct format_entry *formats, *formats_end, *iter;
XDNDDATA *current, *next;
BOOL haveHDROP = FALSE;
size_t size;
TRACE("count(%ld)\n", count);
@ -554,30 +552,6 @@ static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm,
}
}
}
/* 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);
GlobalFree(current->contents);
HeapFree(GetProcessHeap(), 0, current);
}
}
}
}