winex11.drv: Use a Wine list to store XDnD data.

This commit is contained in:
Damjan Jovanovic 2010-08-16 21:07:20 +02:00 committed by Alexandre Julliard
parent 2464733ef3
commit ac8c6f2944
1 changed files with 13 additions and 16 deletions

View File

@ -39,6 +39,7 @@
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/list.h"
WINE_DEFAULT_DEBUG_CHANNEL(xdnd); WINE_DEFAULT_DEBUG_CHANNEL(xdnd);
@ -52,10 +53,10 @@ typedef struct tagXDNDDATA
Atom cf_xdnd; Atom cf_xdnd;
void *data; void *data;
unsigned int size; unsigned int size;
struct tagXDNDDATA *next; struct list entry;
} XDNDDATA, *LPXDNDDATA; } XDNDDATA, *LPXDNDDATA;
static LPXDNDDATA XDNDData = NULL; static struct list xdndData = LIST_INIT(xdndData);
static POINT XDNDxy = { 0, 0 }; static POINT XDNDxy = { 0, 0 };
static void X11DRV_XDND_InsertXDNDData(int property, int format, void* data, unsigned int len); static void X11DRV_XDND_InsertXDNDData(int property, int format, void* data, unsigned int len);
@ -316,12 +317,11 @@ static void X11DRV_XDND_InsertXDNDData(int property, int format, void* data, uns
if (current) if (current)
{ {
EnterCriticalSection(&xdnd_cs); EnterCriticalSection(&xdnd_cs);
current->next = XDNDData;
current->cf_xdnd = property; current->cf_xdnd = property;
current->cf_win = format; current->cf_win = format;
current->data = data; current->data = data;
current->size = len; current->size = len;
XDNDData = current; list_add_tail(&xdndData, &current->entry);
LeaveCriticalSection(&xdnd_cs); LeaveCriticalSection(&xdnd_cs);
} }
} }
@ -484,21 +484,22 @@ static int X11DRV_XDND_DeconstructTextHTML(int property, void* data, int len)
*/ */
static void X11DRV_XDND_SendDropFiles(HWND hwnd) static void X11DRV_XDND_SendDropFiles(HWND hwnd)
{ {
LPXDNDDATA current; LPXDNDDATA current = NULL;
BOOL found = FALSE;
EnterCriticalSection(&xdnd_cs); EnterCriticalSection(&xdnd_cs);
current = XDNDData;
/* Find CF_HDROP type if any */ /* Find CF_HDROP type if any */
while (current != NULL) LIST_FOR_EACH_ENTRY(current, &xdndData, XDNDDATA, entry)
{ {
if (current->cf_win == CF_HDROP) if (current->cf_win == CF_HDROP)
{
found = TRUE;
break; break;
current = current->next; }
} }
if (current != NULL) if (found)
{ {
DROPFILES *lpDrop = current->data; DROPFILES *lpDrop = current->data;
@ -530,17 +531,13 @@ static void X11DRV_XDND_FreeDragDropOp(void)
EnterCriticalSection(&xdnd_cs); EnterCriticalSection(&xdnd_cs);
current = XDNDData;
/** Free data cache */ /** Free data cache */
while (current != NULL) LIST_FOR_EACH_ENTRY_SAFE(current, next, &xdndData, XDNDDATA, entry)
{ {
next = current->next; list_remove(&current->entry);
HeapFree(GetProcessHeap(), 0, current); HeapFree(GetProcessHeap(), 0, current);
current = next;
} }
XDNDData = NULL;
XDNDxy.x = XDNDxy.y = 0; XDNDxy.x = XDNDxy.y = 0;
LeaveCriticalSection(&xdnd_cs); LeaveCriticalSection(&xdnd_cs);