Add cursor-change override while dragging on the mac

This changes the setCursor() call in LLWindowMacOSX to be ignored if we're
currently dragging via the OS

http://codereview.lindenlab.com/273045
master
Rick Pasetto 2010-01-11 18:44:00 -08:00
parent a74d494dd7
commit b06d655727
2 changed files with 39 additions and 3 deletions

View File

@ -278,6 +278,8 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
mMoveEventCampartorUPP = NewEventComparatorUPP(staticMoveEventComparator);
mGlobalHandlerRef = NULL;
mWindowHandlerRef = NULL;
mDragOverrideCursor = -1;
// We're not clipping yet
SetRect( &mOldMouseClip, 0, 0, 0, 0 );
@ -2795,6 +2797,8 @@ void LLWindowMacOSX::setCursor(ECursorType cursor)
{
OSStatus result = noErr;
if (mDragOverrideCursor != -1) return;
if (cursor == UI_CURSOR_ARROW
&& mBusyCount > 0)
{
@ -3499,10 +3503,40 @@ OSErr LLWindowMacOSX::handleDragNDrop(DragRef drag, LLWindowCallbacks::DragNDrop
LLWindowCallbacks::DragNDropResult res =
mCallbacks->handleDragNDrop(this, gl_pos, mask, action, url);
if (LLWindowCallbacks::DND_NONE != res)
{
result = noErr;
switch (res) {
case LLWindowCallbacks::DND_NONE: // No drop allowed
if (action == LLWindowCallbacks::DNDA_TRACK)
{
mDragOverrideCursor = kThemeNotAllowedCursor;
}
else {
mDragOverrideCursor = -1;
}
break;
case LLWindowCallbacks::DND_MOVE: // Drop accepted would result in a "move" operation
mDragOverrideCursor = kThemePointingHandCursor;
result = noErr;
break;
case LLWindowCallbacks::DND_COPY: // Drop accepted would result in a "copy" operation
mDragOverrideCursor = kThemeCopyArrowCursor;
result = noErr;
break;
case LLWindowCallbacks::DND_LINK: // Drop accepted would result in a "link" operation:
mDragOverrideCursor = kThemeAliasArrowCursor;
result = noErr;
break;
default:
mDragOverrideCursor = -1;
break;
}
if (mDragOverrideCursor == -1)
{
SetThemeCursor(kThemeArrowCursor);
}
else {
SetThemeCursor(mDragOverrideCursor);
}
}
}
}

View File

@ -201,6 +201,8 @@ protected:
U32 mFSAASamples;
BOOL mForceRebuild;
S32 mDragOverrideCursor;
F32 mBounceTime;
NMRec mBounceRec;
LLTimer mBounceTimer;