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>
This commit is contained in:
Huw Davies 2016-02-23 10:09:28 +00:00 committed by Alexandre Julliard
parent bf8e8f56f5
commit f2530ca18f
3 changed files with 42 additions and 46 deletions

View File

@ -46,6 +46,7 @@
#include "wine/unicode.h" #include "wine/unicode.h"
#include "compobj_private.h" #include "compobj_private.h"
#include "olestd.h"
#include "wine/list.h" #include "wine/list.h"
#include "wine/debug.h" #include "wine/debug.h"
@ -2181,6 +2182,35 @@ static LRESULT WINAPI OLEDD_DragTrackerWindowProc(
return DefWindowProcW (hwnd, uMsg, wParam, lParam); 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() * OLEDD_TrackStateChange()
* *
@ -2288,48 +2318,7 @@ static void OLEDD_TrackStateChange(TrackerWindowInfo* trackerInfo)
} }
} }
/* give_feedback( 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);
}
/* /*
* All the return valued will stop the operation except the S_OK * All the return valued will stop the operation except the S_OK

View File

@ -23,6 +23,8 @@
#include "winuser.h" #include "winuser.h"
#include "winnls.h" #include "winnls.h"
#include "olestd.h"
#define WINE_FILENAME_STR "ole32.dll" #define WINE_FILENAME_STR "ole32.dll"
#define WINE_EXTRAVALUES VALUE "OLESelfRegister","" #define WINE_EXTRAVALUES VALUE "OLESelfRegister",""
@ -37,13 +39,13 @@
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
/* @makedep: nodrop.cur */ /* @makedep: nodrop.cur */
1 CURSOR nodrop.cur CURSOR_NODROP CURSOR nodrop.cur
/* @makedep: drag_move.cur */ /* @makedep: drag_move.cur */
2 CURSOR drag_move.cur CURSOR_MOVE CURSOR drag_move.cur
/* @makedep: drag_copy.cur */ /* @makedep: drag_copy.cur */
3 CURSOR drag_copy.cur CURSOR_COPY CURSOR drag_copy.cur
/* @makedep: drag_link.cur */ /* @makedep: drag_link.cur */
4 CURSOR drag_link.cur CURSOR_LINK CURSOR drag_link.cur

View File

@ -49,4 +49,9 @@
#define OleStdCopyMetafilePict(hpictin, phpictout) \ #define OleStdCopyMetafilePict(hpictin, phpictout) \
(*(phpictout) = OleDuplicateData(hpictin,CF_METAFILEPICT,GHND|GMEM_SHARE)) (*(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_ */ #endif /* __WINE_OLESTD_H_ */