diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c index 8457a034c14..d7480ae807d 100644 --- a/dlls/winex11.drv/clipboard.c +++ b/dlls/winex11.drv/clipboard.c @@ -1267,13 +1267,21 @@ static HANDLE import_selection( Display *display, Window win, Atom selection, * * Import the X selection into the clipboard format registered for the given X target. */ -HANDLE X11DRV_CLIPBOARD_ImportSelection( Display *display, Window win, Atom selection, - Atom target, UINT *windowsFormat ) +void X11DRV_CLIPBOARD_ImportSelection( Display *display, Window win, Atom selection, + Atom *targets, UINT count, + void (*callback)( Atom, UINT, HANDLE )) { - struct clipboard_format *format = X11DRV_CLIPBOARD_LookupProperty( NULL, target ); - if (!format) return 0; - *windowsFormat = format->id; - return import_selection( display, win, selection, format ); + UINT i; + HANDLE handle; + struct clipboard_format *format; + + for (i = 0; i < count; i++) + { + if (!(format = X11DRV_CLIPBOARD_LookupProperty( NULL, targets[i] ))) continue; + if (!format->id) continue; + if (!(handle = import_selection( display, win, selection, format ))) continue; + callback( targets[i], format->id, handle ); + } } diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 48f39998e75..d88e65b3d7b 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -239,8 +239,9 @@ extern void X11DRV_XDND_EnterEvent( HWND hWnd, XClientMessageEvent *event ) DECL extern void X11DRV_XDND_PositionEvent( HWND hWnd, XClientMessageEvent *event ) DECLSPEC_HIDDEN; extern void X11DRV_XDND_DropEvent( HWND hWnd, XClientMessageEvent *event ) DECLSPEC_HIDDEN; extern void X11DRV_XDND_LeaveEvent( HWND hWnd, XClientMessageEvent *event ) DECLSPEC_HIDDEN; -extern HANDLE X11DRV_CLIPBOARD_ImportSelection( Display *display, Window win, Atom selection, - Atom target, UINT *windowsFormat ) DECLSPEC_HIDDEN; +extern void X11DRV_CLIPBOARD_ImportSelection( Display *display, Window win, Atom selection, + Atom *targets, UINT count, + void (*callback)( Atom, UINT, HANDLE )) DECLSPEC_HIDDEN; /************************************************************************** * X11 GDI driver diff --git a/dlls/winex11.drv/xdnd.c b/dlls/winex11.drv/xdnd.c index eb9b1170022..2ab28e43bfe 100644 --- a/dlls/winex11.drv/xdnd.c +++ b/dlls/winex11.drv/xdnd.c @@ -67,7 +67,7 @@ static HWND XDNDLastTargetWnd; /* might be an ancestor of XDNDLastTargetWnd */ static HWND XDNDLastDropTargetWnd; -static void X11DRV_XDND_InsertXDNDData(int property, int format, HANDLE contents); +static void X11DRV_XDND_InsertXDNDData( Atom property, UINT format, HANDLE contents ); static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm, Atom *types, unsigned long count); static BOOL X11DRV_XDND_HasHDROP(void); @@ -492,7 +492,6 @@ void X11DRV_XDND_LeaveEvent( HWND hWnd, XClientMessageEvent *event ) static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm, Atom *types, unsigned long count) { - unsigned int i; XDNDDATA *current, *next; BOOL haveHDROP = FALSE; @@ -500,21 +499,8 @@ static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm, X11DRV_XDND_FreeDragDropOp(); /* Clear previously cached data */ - for (i = 0; i < count; i++) - { - HANDLE contents; - UINT windowsFormat; - - TRACE("requesting atom %ld from xwin %ld\n", types[i], xwin); - - if (types[i] == 0) - continue; - - contents = X11DRV_CLIPBOARD_ImportSelection( display, xwin, x11drv_atom(XdndSelection), - types[i], &windowsFormat ); - if (contents) - X11DRV_XDND_InsertXDNDData(types[i], windowsFormat, contents); - } + X11DRV_CLIPBOARD_ImportSelection( display, xwin, x11drv_atom(XdndSelection), + types, count, X11DRV_XDND_InsertXDNDData ); /* On Windows when there is a CF_HDROP, there are no other CF_ formats. * foobar2000 relies on this (spaces -> %20's without it). @@ -547,7 +533,7 @@ static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm, * * Cache available XDND property */ -static void X11DRV_XDND_InsertXDNDData(int property, int format, HANDLE contents) +static void X11DRV_XDND_InsertXDNDData( Atom property, UINT format, HANDLE contents ) { LPXDNDDATA current = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(XDNDDATA));