Module: wine Branch: master Commit: f2530ca18fcf0b93e4ac33617ca4c3d76524faad URL: http://source.winehq.org/git/wine.git/?a=commit;h=f2530ca18fcf0b93e4ac33617c...
Author: Huw Davies huw@codeweavers.com Date: Tue Feb 23 10:09:28 2016 +0000
ole32: Move the GiveFeedback handling to a separate function.
Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ole32/ole2.c | 73 +++++++++++++++++++++----------------------------- dlls/ole32/ole32res.rc | 10 ++++--- dlls/ole32/olestd.h | 5 ++++ 3 files changed, 42 insertions(+), 46 deletions(-)
diff --git a/dlls/ole32/ole2.c b/dlls/ole32/ole2.c index 3740968..315f403 100644 --- a/dlls/ole32/ole2.c +++ b/dlls/ole32/ole2.c @@ -46,6 +46,7 @@
#include "wine/unicode.h" #include "compobj_private.h" +#include "olestd.h" #include "wine/list.h"
#include "wine/debug.h" @@ -2181,6 +2182,35 @@ static LRESULT WINAPI OLEDD_DragTrackerWindowProc( return DefWindowProcW (hwnd, uMsg, wParam, lParam); }
+static HRESULT give_feedback( TrackerWindowInfo *info ) +{ + HRESULT hr; + int res; + HCURSOR cur; + + if (info->curDragTarget == NULL) + *info->pdwEffect = DROPEFFECT_NONE; + + hr = IDropSource_GiveFeedback( info->dropSource, *info->pdwEffect ); + + if (hr == DRAGDROP_S_USEDEFAULTCURSORS) + { + if (*info->pdwEffect & DROPEFFECT_MOVE) + res = CURSOR_MOVE; + else if (*info->pdwEffect & DROPEFFECT_COPY) + res = CURSOR_COPY; + else if (*info->pdwEffect & DROPEFFECT_LINK) + res = CURSOR_LINK; + else + res = CURSOR_NODROP; + + cur = LoadCursorW( hProxyDll, MAKEINTRESOURCEW( res ) ); + SetCursor( cur ); + } + + return hr; +} + /*** * OLEDD_TrackStateChange() * @@ -2288,48 +2318,7 @@ static void OLEDD_TrackStateChange(TrackerWindowInfo* trackerInfo) } }
- /* - * Now that we have done that, we have to tell the source to give - * us feedback on the work being done by the target. If we don't - * have a target, simulate no effect. - */ - if (trackerInfo->curDragTarget==0) - { - *trackerInfo->pdwEffect = DROPEFFECT_NONE; - } - - hr = IDropSource_GiveFeedback(trackerInfo->dropSource, - *trackerInfo->pdwEffect); - - /* - * When we ask for feedback from the drop source, sometimes it will - * do all the necessary work and sometimes it will not handle it - * when that's the case, we must display the standard drag and drop - * cursors. - */ - if (hr == DRAGDROP_S_USEDEFAULTCURSORS) - { - HCURSOR hCur; - - if (*trackerInfo->pdwEffect & DROPEFFECT_MOVE) - { - hCur = LoadCursorW(hProxyDll, MAKEINTRESOURCEW(2)); - } - else if (*trackerInfo->pdwEffect & DROPEFFECT_COPY) - { - hCur = LoadCursorW(hProxyDll, MAKEINTRESOURCEW(3)); - } - else if (*trackerInfo->pdwEffect & DROPEFFECT_LINK) - { - hCur = LoadCursorW(hProxyDll, MAKEINTRESOURCEW(4)); - } - else - { - hCur = LoadCursorW(hProxyDll, MAKEINTRESOURCEW(1)); - } - - SetCursor(hCur); - } + give_feedback( trackerInfo );
/* * All the return valued will stop the operation except the S_OK diff --git a/dlls/ole32/ole32res.rc b/dlls/ole32/ole32res.rc index 11b255a..5190ba6 100644 --- a/dlls/ole32/ole32res.rc +++ b/dlls/ole32/ole32res.rc @@ -23,6 +23,8 @@ #include "winuser.h" #include "winnls.h"
+#include "olestd.h" + #define WINE_FILENAME_STR "ole32.dll" #define WINE_EXTRAVALUES VALUE "OLESelfRegister",""
@@ -37,13 +39,13 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
/* @makedep: nodrop.cur */ -1 CURSOR nodrop.cur +CURSOR_NODROP CURSOR nodrop.cur
/* @makedep: drag_move.cur */ -2 CURSOR drag_move.cur +CURSOR_MOVE CURSOR drag_move.cur
/* @makedep: drag_copy.cur */ -3 CURSOR drag_copy.cur +CURSOR_COPY CURSOR drag_copy.cur
/* @makedep: drag_link.cur */ -4 CURSOR drag_link.cur +CURSOR_LINK CURSOR drag_link.cur diff --git a/dlls/ole32/olestd.h b/dlls/ole32/olestd.h index fbc4442..33063c7 100644 --- a/dlls/ole32/olestd.h +++ b/dlls/ole32/olestd.h @@ -49,4 +49,9 @@ #define OleStdCopyMetafilePict(hpictin, phpictout) \ (*(phpictout) = OleDuplicateData(hpictin,CF_METAFILEPICT,GHND|GMEM_SHARE))
+#define CURSOR_NODROP 1 +#define CURSOR_MOVE 2 +#define CURSOR_COPY 3 +#define CURSOR_LINK 4 + #endif /* __WINE_OLESTD_H_ */