Commit 80d02bc8 authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent 7f39cc3f
...@@ -1267,13 +1267,21 @@ static HANDLE import_selection( Display *display, Window win, Atom selection, ...@@ -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. * Import the X selection into the clipboard format registered for the given X target.
*/ */
HANDLE X11DRV_CLIPBOARD_ImportSelection( Display *display, Window win, Atom selection, void X11DRV_CLIPBOARD_ImportSelection( Display *display, Window win, Atom selection,
Atom target, UINT *windowsFormat ) Atom *targets, UINT count,
void (*callback)( Atom, UINT, HANDLE ))
{ {
struct clipboard_format *format = X11DRV_CLIPBOARD_LookupProperty( NULL, target ); UINT i;
if (!format) return 0; HANDLE handle;
*windowsFormat = format->id; struct clipboard_format *format;
return import_selection( display, win, selection, 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 );
}
} }
......
...@@ -239,8 +239,9 @@ extern void X11DRV_XDND_EnterEvent( HWND hWnd, XClientMessageEvent *event ) DECL ...@@ -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_PositionEvent( HWND hWnd, XClientMessageEvent *event ) DECLSPEC_HIDDEN;
extern void X11DRV_XDND_DropEvent( 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 void X11DRV_XDND_LeaveEvent( HWND hWnd, XClientMessageEvent *event ) DECLSPEC_HIDDEN;
extern HANDLE X11DRV_CLIPBOARD_ImportSelection( Display *display, Window win, Atom selection, extern void X11DRV_CLIPBOARD_ImportSelection( Display *display, Window win, Atom selection,
Atom target, UINT *windowsFormat ) DECLSPEC_HIDDEN; Atom *targets, UINT count,
void (*callback)( Atom, UINT, HANDLE )) DECLSPEC_HIDDEN;
/************************************************************************** /**************************************************************************
* X11 GDI driver * X11 GDI driver
......
...@@ -67,7 +67,7 @@ static HWND XDNDLastTargetWnd; ...@@ -67,7 +67,7 @@ static HWND XDNDLastTargetWnd;
/* might be an ancestor of XDNDLastTargetWnd */ /* might be an ancestor of XDNDLastTargetWnd */
static HWND XDNDLastDropTargetWnd; 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, static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm,
Atom *types, unsigned long count); Atom *types, unsigned long count);
static BOOL X11DRV_XDND_HasHDROP(void); static BOOL X11DRV_XDND_HasHDROP(void);
...@@ -492,7 +492,6 @@ void X11DRV_XDND_LeaveEvent( HWND hWnd, XClientMessageEvent *event ) ...@@ -492,7 +492,6 @@ void X11DRV_XDND_LeaveEvent( HWND hWnd, XClientMessageEvent *event )
static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm, static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm,
Atom *types, unsigned long count) Atom *types, unsigned long count)
{ {
unsigned int i;
XDNDDATA *current, *next; XDNDDATA *current, *next;
BOOL haveHDROP = FALSE; BOOL haveHDROP = FALSE;
...@@ -500,21 +499,8 @@ static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm, ...@@ -500,21 +499,8 @@ static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm,
X11DRV_XDND_FreeDragDropOp(); /* Clear previously cached data */ X11DRV_XDND_FreeDragDropOp(); /* Clear previously cached data */
for (i = 0; i < count; i++) X11DRV_CLIPBOARD_ImportSelection( display, xwin, x11drv_atom(XdndSelection),
{ types, count, X11DRV_XDND_InsertXDNDData );
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);
}
/* On Windows when there is a CF_HDROP, there are no other CF_ formats. /* On Windows when there is a CF_HDROP, there are no other CF_ formats.
* foobar2000 relies on this (spaces -> %20's without it). * foobar2000 relies on this (spaces -> %20's without it).
...@@ -547,7 +533,7 @@ static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm, ...@@ -547,7 +533,7 @@ static void X11DRV_XDND_ResolveProperty(Display *display, Window xwin, Time tm,
* *
* Cache available XDND property * 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)); LPXDNDDATA current = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(XDNDDATA));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment