Damjan Jovanovic : winex11.drv: Use a Wine list to store XDnD data.
Alexandre Julliard
julliard at winehq.org
Tue Aug 17 11:31:19 CDT 2010
Module: wine
Branch: master
Commit: ac8c6f2944e2f80d040aa194b3da4d8d3558d01f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ac8c6f2944e2f80d040aa194b3da4d8d3558d01f
Author: Damjan Jovanovic <damjan.jov at gmail.com>
Date: Mon Aug 16 21:07:20 2010 +0200
winex11.drv: Use a Wine list to store XDnD data.
---
dlls/winex11.drv/xdnd.c | 29 +++++++++++++----------------
1 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/dlls/winex11.drv/xdnd.c b/dlls/winex11.drv/xdnd.c
index 9d209fc..ef8dd99 100644
--- a/dlls/winex11.drv/xdnd.c
+++ b/dlls/winex11.drv/xdnd.c
@@ -39,6 +39,7 @@
#include "wine/unicode.h"
#include "wine/debug.h"
+#include "wine/list.h"
WINE_DEFAULT_DEBUG_CHANNEL(xdnd);
@@ -52,10 +53,10 @@ typedef struct tagXDNDDATA
Atom cf_xdnd;
void *data;
unsigned int size;
- struct tagXDNDDATA *next;
+ struct list entry;
} XDNDDATA, *LPXDNDDATA;
-static LPXDNDDATA XDNDData = NULL;
+static struct list xdndData = LIST_INIT(xdndData);
static POINT XDNDxy = { 0, 0 };
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)
{
EnterCriticalSection(&xdnd_cs);
- current->next = XDNDData;
current->cf_xdnd = property;
current->cf_win = format;
current->data = data;
current->size = len;
- XDNDData = current;
+ list_add_tail(&xdndData, ¤t->entry);
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)
{
- LPXDNDDATA current;
+ LPXDNDDATA current = NULL;
+ BOOL found = FALSE;
EnterCriticalSection(&xdnd_cs);
- current = XDNDData;
-
/* Find CF_HDROP type if any */
- while (current != NULL)
+ LIST_FOR_EACH_ENTRY(current, &xdndData, XDNDDATA, entry)
{
if (current->cf_win == CF_HDROP)
+ {
+ found = TRUE;
break;
- current = current->next;
+ }
}
- if (current != NULL)
+ if (found)
{
DROPFILES *lpDrop = current->data;
@@ -530,17 +531,13 @@ static void X11DRV_XDND_FreeDragDropOp(void)
EnterCriticalSection(&xdnd_cs);
- current = XDNDData;
-
/** Free data cache */
- while (current != NULL)
+ LIST_FOR_EACH_ENTRY_SAFE(current, next, &xdndData, XDNDDATA, entry)
{
- next = current->next;
+ list_remove(¤t->entry);
HeapFree(GetProcessHeap(), 0, current);
- current = next;
}
- XDNDData = NULL;
XDNDxy.x = XDNDxy.y = 0;
LeaveCriticalSection(&xdnd_cs);
More information about the wine-cvs
mailing list