Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
a8494aa9
Commit
a8494aa9
authored
Apr 25, 2006
by
Mike McCormack
Committed by
Alexandre Julliard
May 05, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Store drop targets in a standard list.
parent
2e28e4a7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
176 deletions
+28
-176
ole2.c
dlls/ole32/ole2.c
+28
-176
No files found.
dlls/ole32/ole2.c
View file @
a8494aa9
...
...
@@ -48,6 +48,7 @@
#include "wine/unicode.h"
#include "compobj_private.h"
#include "wine/list.h"
#include "wine/debug.h"
...
...
@@ -61,9 +62,8 @@ WINE_DECLARE_DEBUG_CHANNEL(accel);
typedef
struct
tagDropTargetNode
{
HWND
hwndTarget
;
IDropTarget
*
dropTarget
;
struct
tagDropTargetNode
*
prevDropTarget
;
struct
tagDropTargetNode
*
nextDropTarget
;
IDropTarget
*
dropTarget
;
struct
list
entry
;
}
DropTargetNode
;
typedef
struct
tagTrackerWindowInfo
...
...
@@ -117,7 +117,7 @@ static const char OLEDD_DRAGTRACKERCLASS[] = "WineDragDropTracker32";
/*
* This is the head of the Drop target container.
*/
static
DropTargetNode
*
targetListHead
=
NULL
;
static
struct
list
targetListHead
=
LIST_INIT
(
targetListHead
)
;
/******************************************************************************
* These are the prototypes of miscelaneous utility methods
...
...
@@ -148,12 +148,9 @@ extern void OLEClipbrd_Initialize(void);
*/
static
void
OLEDD_Initialize
(
void
);
static
void
OLEDD_UnInitialize
(
void
);
static
void
OLEDD_InsertDropTarget
(
DropTargetNode
*
nodeToAdd
);
static
DropTargetNode
*
OLEDD_ExtractDropTarget
(
HWND
hwndOfTarget
);
static
DropTargetNode
*
OLEDD_FindDropTarget
(
HWND
hwndOfTarget
);
static
void
OLEDD_FreeDropTarget
(
DropTargetNode
*
);
static
LRESULT
WINAPI
OLEDD_DragTrackerWindowProc
(
HWND
hwnd
,
UINT
uMsg
,
...
...
@@ -321,19 +318,17 @@ HRESULT WINAPI RegisterDragDrop(
return
E_OUTOFMEMORY
;
dropTargetInfo
->
hwndTarget
=
hwnd
;
dropTargetInfo
->
prevDropTarget
=
NULL
;
dropTargetInfo
->
nextDropTarget
=
NULL
;
/*
* Don't forget that this is an interface pointer, need to nail it down since
* we keep a copy of it.
*/
IDropTarget_AddRef
(
pDropTarget
);
dropTargetInfo
->
dropTarget
=
pDropTarget
;
IDropTarget_AddRef
(
dropTargetInfo
->
dropTarget
);
OLEDD_InsertDropTarget
(
dropTargetInfo
);
list_add_tail
(
&
targetListHead
,
&
dropTargetInfo
->
entry
);
return
S_OK
;
return
S_OK
;
}
/***********************************************************************
...
...
@@ -349,7 +344,7 @@ HRESULT WINAPI RevokeDragDrop(
/*
* First, check if the window is already registered.
*/
dropTargetInfo
=
OLEDD_
Extract
DropTarget
(
hwnd
);
dropTargetInfo
=
OLEDD_
Find
DropTarget
(
hwnd
);
/*
* If it ain't in there, it's an error.
...
...
@@ -357,14 +352,9 @@ HRESULT WINAPI RevokeDragDrop(
if
(
dropTargetInfo
==
NULL
)
return
DRAGDROP_E_NOTREGISTERED
;
/*
* If it's in there, clean-up it's used memory and
* references
*/
IDropTarget_Release
(
dropTargetInfo
->
dropTarget
);
HeapFree
(
GetProcessHeap
(),
0
,
dropTargetInfo
);
OLEDD_FreeDropTarget
(
dropTargetInfo
);
return
S_OK
;
return
S_OK
;
}
/***********************************************************************
...
...
@@ -1841,148 +1831,33 @@ static void OLEDD_Initialize()
}
/***
* OLEDD_
UnInitialize
()
* OLEDD_
FreeDropTarget
()
*
*
Releases the OLE drag and drop data structures.
*
Frees the drag and drop data structure
*/
static
void
OLEDD_
UnInitialize
(
)
static
void
OLEDD_
FreeDropTarget
(
DropTargetNode
*
dropTargetInfo
)
{
/*
* Simply empty the list.
*/
while
(
targetListHead
!=
NULL
)
{
RevokeDragDrop
(
targetListHead
->
hwndTarget
);
}
list_remove
(
&
dropTargetInfo
->
entry
);
IDropTarget_Release
(
dropTargetInfo
->
dropTarget
);
HeapFree
(
GetProcessHeap
(),
0
,
dropTargetInfo
);
}
/***
* OLEDD_
InsertDropTarget
()
* OLEDD_
UnInitialize
()
*
*
Insert the target node in the tree
.
*
Releases the OLE drag and drop data structures
.
*/
static
void
OLEDD_
InsertDropTarget
(
DropTargetNode
*
nodeToAd
d
)
static
void
OLEDD_
UnInitialize
(
voi
d
)
{
DropTargetNode
*
curNode
;
DropTargetNode
**
parentNodeLink
;
/*
* Iterate the tree to find the insertion point.
*/
curNode
=
targetListHead
;
parentNodeLink
=
&
targetListHead
;
while
(
curNode
!=
NULL
)
{
if
(
nodeToAdd
->
hwndTarget
<
curNode
->
hwndTarget
)
{
/*
* If the node we want to add has a smaller HWND, go left
*/
parentNodeLink
=
&
curNode
->
prevDropTarget
;
curNode
=
curNode
->
prevDropTarget
;
}
else
if
(
nodeToAdd
->
hwndTarget
>
curNode
->
hwndTarget
)
{
/*
* If the node we want to add has a larger HWND, go right
*/
parentNodeLink
=
&
curNode
->
nextDropTarget
;
curNode
=
curNode
->
nextDropTarget
;
}
else
{
/*
* The item was found in the list. It shouldn't have been there
*/
assert
(
FALSE
);
return
;
}
}
/*
* If we get here, we have found a spot for our item. The parentNodeLink
* pointer points to the pointer that we have to modify.
* The curNode should be NULL. We just have to establish the link and Voila!
*/
assert
(
curNode
==
NULL
);
assert
(
parentNodeLink
!=
NULL
);
assert
(
*
parentNodeLink
==
NULL
);
*
parentNodeLink
=
nodeToAdd
;
}
/***
* OLEDD_ExtractDropTarget()
*
* Removes the target node from the tree.
*/
static
DropTargetNode
*
OLEDD_ExtractDropTarget
(
HWND
hwndOfTarget
)
{
DropTargetNode
*
curNode
;
DropTargetNode
**
parentNodeLink
;
/*
* Iterate the tree to find the insertion point.
* Simply empty the list.
*/
curNode
=
targetListHead
;
parentNodeLink
=
&
targetListHead
;
while
(
curNode
!=
NULL
)
while
(
!
list_empty
(
&
targetListHead
))
{
if
(
hwndOfTarget
<
curNode
->
hwndTarget
)
{
/*
* If the node we want to add has a smaller HWND, go left
*/
parentNodeLink
=
&
curNode
->
prevDropTarget
;
curNode
=
curNode
->
prevDropTarget
;
}
else
if
(
hwndOfTarget
>
curNode
->
hwndTarget
)
{
/*
* If the node we want to add has a larger HWND, go right
*/
parentNodeLink
=
&
curNode
->
nextDropTarget
;
curNode
=
curNode
->
nextDropTarget
;
}
else
{
/*
* The item was found in the list. Detach it from it's parent and
* re-insert it's kids in the tree.
*/
assert
(
parentNodeLink
!=
NULL
);
assert
(
*
parentNodeLink
==
curNode
);
/*
* We arbitrately re-attach the left sub-tree to the parent.
*/
*
parentNodeLink
=
curNode
->
prevDropTarget
;
/*
* And we re-insert the right subtree
*/
if
(
curNode
->
nextDropTarget
!=
NULL
)
{
OLEDD_InsertDropTarget
(
curNode
->
nextDropTarget
);
}
/*
* The node we found is still a valid node once we complete
* the unlinking of the kids.
*/
curNode
->
nextDropTarget
=
NULL
;
curNode
->
prevDropTarget
=
NULL
;
return
curNode
;
}
DropTargetNode
*
curNode
;
curNode
=
LIST_ENTRY
(
list_head
(
&
targetListHead
),
DropTargetNode
,
entry
);
OLEDD_FreeDropTarget
(
curNode
);
}
/*
* If we get here, the node is not in the tree
*/
return
NULL
;
}
/***
...
...
@@ -1995,34 +1870,11 @@ static DropTargetNode* OLEDD_FindDropTarget(HWND hwndOfTarget)
DropTargetNode
*
curNode
;
/*
* Iterate the
tree
to find the HWND value.
* Iterate the
list
to find the HWND value.
*/
curNode
=
targetListHead
;
while
(
curNode
!=
NULL
)
{
if
(
hwndOfTarget
<
curNode
->
hwndTarget
)
{
/*
* If the node we want to add has a smaller HWND, go left
*/
curNode
=
curNode
->
prevDropTarget
;
}
else
if
(
hwndOfTarget
>
curNode
->
hwndTarget
)
{
/*
* If the node we want to add has a larger HWND, go right
*/
curNode
=
curNode
->
nextDropTarget
;
}
else
{
/*
* The item was found in the list.
*/
LIST_FOR_EACH_ENTRY
(
curNode
,
&
targetListHead
,
DropTargetNode
,
entry
)
if
(
hwndOfTarget
==
curNode
->
hwndTarget
)
return
curNode
;
}
}
/*
* If we get here, the item is not in the list
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment