winex11: Support import multiple drag&drop properties in a single call.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2016-09-22 13:07:44 +09:00
parent 7f39cc3f2b
commit 80d02bc849
3 changed files with 21 additions and 26 deletions

View File

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

View File

@ -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

View File

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