Automated merge with ssh://rick@hg.lindenlab.com/viewer/viewer-2-0/
commit
b4ccb9367f
|
|
@ -0,0 +1,23 @@
|
|||
# -*- cmake -*-
|
||||
|
||||
if (VIEWER)
|
||||
|
||||
set(OS_DRAG_DROP ON CACHE BOOL "Build the viewer with OS level drag and drop turned on or off")
|
||||
|
||||
if (OS_DRAG_DROP)
|
||||
|
||||
if (WINDOWS)
|
||||
add_definitions(-DLL_OS_DRAGDROP_ENABLED=1)
|
||||
endif (WINDOWS)
|
||||
|
||||
if (DARWIN)
|
||||
add_definitions(-DLL_OS_DRAGDROP_ENABLED=1)
|
||||
endif (DARWIN)
|
||||
|
||||
if (LINUX)
|
||||
add_definitions(-DLL_OS_DRAGDROP_ENABLED=0)
|
||||
endif (LINUX)
|
||||
|
||||
endif (OS_DRAG_DROP)
|
||||
|
||||
endif (VIEWER)
|
||||
|
|
@ -12,6 +12,7 @@ project(llwindow)
|
|||
|
||||
include(00-Common)
|
||||
include(DirectX)
|
||||
include(DragDrop)
|
||||
include(LLCommon)
|
||||
include(LLImage)
|
||||
include(LLMath)
|
||||
|
|
@ -102,11 +103,13 @@ if (WINDOWS)
|
|||
llwindowwin32.cpp
|
||||
lldxhardware.cpp
|
||||
llkeyboardwin32.cpp
|
||||
lldragdropwin32.cpp
|
||||
)
|
||||
list(APPEND llwindow_HEADER_FILES
|
||||
llwindowwin32.h
|
||||
lldxhardware.h
|
||||
llkeyboardwin32.h
|
||||
lldragdropwin32.h
|
||||
)
|
||||
list(APPEND llwindow_LINK_LIBRARIES
|
||||
comdlg32 # Common Dialogs for ChooseColor
|
||||
|
|
|
|||
|
|
@ -0,0 +1,370 @@
|
|||
/**
|
||||
* @file lldragdrop32.cpp
|
||||
* @brief Handler for Windows specific drag and drop (OS to client) code
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2001-2009, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#if LL_WINDOWS
|
||||
|
||||
#if LL_OS_DRAGDROP_ENABLED
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "llwindowwin32.h"
|
||||
#include "llkeyboardwin32.h"
|
||||
#include "llwindowcallbacks.h"
|
||||
#include "lldragdropwin32.h"
|
||||
|
||||
class LLDragDropWin32Target:
|
||||
public IDropTarget
|
||||
{
|
||||
public:
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
LLDragDropWin32Target( HWND hWnd ) :
|
||||
mRefCount( 1 ),
|
||||
mAppWindowHandle( hWnd ),
|
||||
mAllowDrop( false)
|
||||
{
|
||||
};
|
||||
|
||||
virtual ~LLDragDropWin32Target()
|
||||
{
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
ULONG __stdcall AddRef( void )
|
||||
{
|
||||
return InterlockedIncrement( &mRefCount );
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
ULONG __stdcall Release( void )
|
||||
{
|
||||
LONG count = InterlockedDecrement( &mRefCount );
|
||||
|
||||
if ( count == 0 )
|
||||
{
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return count;
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
HRESULT __stdcall QueryInterface( REFIID iid, void** ppvObject )
|
||||
{
|
||||
if ( iid == IID_IUnknown || iid == IID_IDropTarget )
|
||||
{
|
||||
AddRef();
|
||||
*ppvObject = this;
|
||||
return S_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
*ppvObject = 0;
|
||||
return E_NOINTERFACE;
|
||||
};
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
HRESULT __stdcall DragEnter( IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect )
|
||||
{
|
||||
FORMATETC fmtetc = { CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
|
||||
|
||||
// support CF_TEXT using a HGLOBAL?
|
||||
if ( S_OK == pDataObject->QueryGetData( &fmtetc ) )
|
||||
{
|
||||
mAllowDrop = true;
|
||||
mDropUrl = std::string();
|
||||
mIsSlurl = false;
|
||||
|
||||
STGMEDIUM stgmed;
|
||||
if( S_OK == pDataObject->GetData( &fmtetc, &stgmed ) )
|
||||
{
|
||||
PVOID data = GlobalLock( stgmed.hGlobal );
|
||||
mDropUrl = std::string( (char*)data );
|
||||
// XXX MAJOR MAJOR HACK!
|
||||
LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong(mAppWindowHandle, GWL_USERDATA);
|
||||
if (NULL != window_imp)
|
||||
{
|
||||
LLCoordGL gl_coord( 0, 0 );
|
||||
|
||||
POINT pt2;
|
||||
pt2.x = pt.x;
|
||||
pt2.y = pt.y;
|
||||
ScreenToClient( mAppWindowHandle, &pt2 );
|
||||
|
||||
LLCoordWindow cursor_coord_window( pt2.x, pt2.y );
|
||||
window_imp->convertCoords(cursor_coord_window, &gl_coord);
|
||||
MASK mask = gKeyboard->currentMask(TRUE);
|
||||
|
||||
LLWindowCallbacks::DragNDropResult result = window_imp->completeDragNDropRequest( gl_coord, mask,
|
||||
LLWindowCallbacks::DNDA_START_TRACKING, mDropUrl );
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case LLWindowCallbacks::DND_COPY:
|
||||
*pdwEffect = DROPEFFECT_COPY;
|
||||
break;
|
||||
case LLWindowCallbacks::DND_LINK:
|
||||
*pdwEffect = DROPEFFECT_LINK;
|
||||
break;
|
||||
case LLWindowCallbacks::DND_MOVE:
|
||||
*pdwEffect = DROPEFFECT_MOVE;
|
||||
break;
|
||||
case LLWindowCallbacks::DND_NONE:
|
||||
default:
|
||||
*pdwEffect = DROPEFFECT_NONE;
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
GlobalUnlock( stgmed.hGlobal );
|
||||
ReleaseStgMedium( &stgmed );
|
||||
};
|
||||
SetFocus( mAppWindowHandle );
|
||||
}
|
||||
else
|
||||
{
|
||||
mAllowDrop = false;
|
||||
*pdwEffect = DROPEFFECT_NONE;
|
||||
};
|
||||
|
||||
return S_OK;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
HRESULT __stdcall DragOver( DWORD grfKeyState, POINTL pt, DWORD* pdwEffect )
|
||||
{
|
||||
if ( mAllowDrop )
|
||||
{
|
||||
// XXX MAJOR MAJOR HACK!
|
||||
LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong(mAppWindowHandle, GWL_USERDATA);
|
||||
if (NULL != window_imp)
|
||||
{
|
||||
LLCoordGL gl_coord( 0, 0 );
|
||||
|
||||
POINT pt2;
|
||||
pt2.x = pt.x;
|
||||
pt2.y = pt.y;
|
||||
ScreenToClient( mAppWindowHandle, &pt2 );
|
||||
|
||||
LLCoordWindow cursor_coord_window( pt2.x, pt2.y );
|
||||
window_imp->convertCoords(cursor_coord_window, &gl_coord);
|
||||
MASK mask = gKeyboard->currentMask(TRUE);
|
||||
|
||||
LLWindowCallbacks::DragNDropResult result = window_imp->completeDragNDropRequest( gl_coord, mask,
|
||||
LLWindowCallbacks::DNDA_TRACK, mDropUrl );
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case LLWindowCallbacks::DND_COPY:
|
||||
*pdwEffect = DROPEFFECT_COPY;
|
||||
break;
|
||||
case LLWindowCallbacks::DND_LINK:
|
||||
*pdwEffect = DROPEFFECT_LINK;
|
||||
break;
|
||||
case LLWindowCallbacks::DND_MOVE:
|
||||
*pdwEffect = DROPEFFECT_MOVE;
|
||||
break;
|
||||
case LLWindowCallbacks::DND_NONE:
|
||||
default:
|
||||
*pdwEffect = DROPEFFECT_NONE;
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
*pdwEffect = DROPEFFECT_NONE;
|
||||
};
|
||||
|
||||
return S_OK;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
HRESULT __stdcall DragLeave( void )
|
||||
{
|
||||
// XXX MAJOR MAJOR HACK!
|
||||
LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong(mAppWindowHandle, GWL_USERDATA);
|
||||
if (NULL != window_imp)
|
||||
{
|
||||
LLCoordGL gl_coord( 0, 0 );
|
||||
MASK mask = gKeyboard->currentMask(TRUE);
|
||||
window_imp->completeDragNDropRequest( gl_coord, mask, LLWindowCallbacks::DNDA_STOP_TRACKING, mDropUrl );
|
||||
};
|
||||
return S_OK;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
HRESULT __stdcall Drop( IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect )
|
||||
{
|
||||
if ( mAllowDrop )
|
||||
{
|
||||
// window impl stored in Window data (neat!)
|
||||
LLWindowWin32 *window_imp = (LLWindowWin32 *)GetWindowLong( mAppWindowHandle, GWL_USERDATA );
|
||||
if ( NULL != window_imp )
|
||||
{
|
||||
LLCoordGL gl_coord( 0, 0 );
|
||||
|
||||
POINT pt_client;
|
||||
pt_client.x = pt.x;
|
||||
pt_client.y = pt.y;
|
||||
ScreenToClient( mAppWindowHandle, &pt_client );
|
||||
|
||||
LLCoordWindow cursor_coord_window( pt_client.x, pt_client.y );
|
||||
window_imp->convertCoords(cursor_coord_window, &gl_coord);
|
||||
llinfos << "### (Drop) URL is: " << mDropUrl << llendl;
|
||||
llinfos << "### raw coords are: " << pt.x << " x " << pt.y << llendl;
|
||||
llinfos << "### client coords are: " << pt_client.x << " x " << pt_client.y << llendl;
|
||||
llinfos << "### GL coords are: " << gl_coord.mX << " x " << gl_coord.mY << llendl;
|
||||
llinfos << llendl;
|
||||
|
||||
// no keyboard modifier option yet but we could one day
|
||||
MASK mask = gKeyboard->currentMask( TRUE );
|
||||
|
||||
// actually do the drop
|
||||
LLWindowCallbacks::DragNDropResult result = window_imp->completeDragNDropRequest( gl_coord, mask,
|
||||
LLWindowCallbacks::DNDA_DROPPED, mDropUrl );
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case LLWindowCallbacks::DND_COPY:
|
||||
*pdwEffect = DROPEFFECT_COPY;
|
||||
break;
|
||||
case LLWindowCallbacks::DND_LINK:
|
||||
*pdwEffect = DROPEFFECT_LINK;
|
||||
break;
|
||||
case LLWindowCallbacks::DND_MOVE:
|
||||
*pdwEffect = DROPEFFECT_MOVE;
|
||||
break;
|
||||
case LLWindowCallbacks::DND_NONE:
|
||||
default:
|
||||
*pdwEffect = DROPEFFECT_NONE;
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
*pdwEffect = DROPEFFECT_NONE;
|
||||
};
|
||||
|
||||
return S_OK;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
private:
|
||||
LONG mRefCount;
|
||||
HWND mAppWindowHandle;
|
||||
bool mAllowDrop;
|
||||
std::string mDropUrl;
|
||||
bool mIsSlurl;
|
||||
friend class LLWindowWin32;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
LLDragDropWin32::LLDragDropWin32() :
|
||||
mDropTarget( NULL ),
|
||||
mDropWindowHandle( NULL )
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
LLDragDropWin32::~LLDragDropWin32()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
bool LLDragDropWin32::init( HWND hWnd )
|
||||
{
|
||||
if ( NOERROR != OleInitialize( NULL ) )
|
||||
return FALSE;
|
||||
|
||||
mDropTarget = new LLDragDropWin32Target( hWnd );
|
||||
if ( mDropTarget )
|
||||
{
|
||||
HRESULT result = CoLockObjectExternal( mDropTarget, TRUE, FALSE );
|
||||
if ( S_OK == result )
|
||||
{
|
||||
result = RegisterDragDrop( hWnd, mDropTarget );
|
||||
if ( S_OK != result )
|
||||
{
|
||||
// RegisterDragDrop failed
|
||||
return false;
|
||||
};
|
||||
|
||||
// all ok
|
||||
mDropWindowHandle = hWnd;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Unable to lock OLE object
|
||||
return false;
|
||||
};
|
||||
};
|
||||
|
||||
// success
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void LLDragDropWin32::reset()
|
||||
{
|
||||
if ( mDropTarget )
|
||||
{
|
||||
RevokeDragDrop( mDropWindowHandle );
|
||||
CoLockObjectExternal( mDropTarget, FALSE, TRUE );
|
||||
mDropTarget->Release();
|
||||
};
|
||||
|
||||
OleUninitialize();
|
||||
}
|
||||
|
||||
#endif // LL_OS_DRAGDROP_ENABLED
|
||||
|
||||
#endif // LL_WINDOWS
|
||||
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
/**
|
||||
* @file lldragdrop32.cpp
|
||||
* @brief Handler for Windows specific drag and drop (OS to client) code
|
||||
*
|
||||
* $LicenseInfo:firstyear=2004&license=viewergpl$
|
||||
*
|
||||
* Copyright (c) 2004-2009, Linden Research, Inc.
|
||||
*
|
||||
* Second Life Viewer Source Code
|
||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
||||
* to you under the terms of the GNU General Public License, version 2.0
|
||||
* ("GPL"), unless you have obtained a separate licensing agreement
|
||||
* ("Other License"), formally executed by you and Linden Lab. Terms of
|
||||
* the GPL can be found in doc/GPL-license.txt in this distribution, or
|
||||
* online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
|
||||
*
|
||||
* There are special exceptions to the terms and conditions of the GPL as
|
||||
* it is applied to this Source Code. View the full text of the exception
|
||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
||||
* online at
|
||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
||||
*
|
||||
* By copying, modifying or distributing this software, you acknowledge
|
||||
* that you have read and understood your obligations described above,
|
||||
* and agree to abide by those obligations.
|
||||
*
|
||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
||||
* COMPLETENESS OR PERFORMANCE.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#if LL_WINDOWS
|
||||
|
||||
#if LL_OS_DRAGDROP_ENABLED
|
||||
|
||||
#ifndef LL_LLDRAGDROP32_H
|
||||
#define LL_LLDRAGDROP32_H
|
||||
|
||||
#include <windows.h>
|
||||
#include <ole2.h>
|
||||
|
||||
class LLDragDropWin32
|
||||
{
|
||||
public:
|
||||
LLDragDropWin32();
|
||||
~LLDragDropWin32();
|
||||
|
||||
bool init( HWND hWnd );
|
||||
void reset();
|
||||
|
||||
private:
|
||||
IDropTarget* mDropTarget;
|
||||
HWND mDropWindowHandle;
|
||||
};
|
||||
#endif // LL_LLDRAGDROP32_H
|
||||
|
||||
#else // LL_OS_DRAGDROP_ENABLED
|
||||
|
||||
#ifndef LL_LLDRAGDROP32_H
|
||||
#define LL_LLDRAGDROP32_H
|
||||
|
||||
#include <windows.h>
|
||||
#include <ole2.h>
|
||||
|
||||
// imposter class that does nothing
|
||||
class LLDragDropWin32
|
||||
{
|
||||
public:
|
||||
LLDragDropWin32() {};
|
||||
~LLDragDropWin32() {};
|
||||
|
||||
bool init( HWND hWnd ) { return false; };
|
||||
void reset() { };
|
||||
};
|
||||
#endif // LL_LLDRAGDROP32_H
|
||||
|
||||
#endif // LL_OS_DRAGDROP_ENABLED
|
||||
|
||||
#endif // LL_WINDOWS
|
||||
|
|
@ -163,6 +163,11 @@ void LLWindowCallbacks::handleDataCopy(LLWindow *window, S32 data_type, void *da
|
|||
{
|
||||
}
|
||||
|
||||
LLWindowCallbacks::DragNDropResult LLWindowCallbacks::handleDragNDrop(LLWindow *window, LLCoordGL pos, MASK mask, DragNDropAction action, std::string data )
|
||||
{
|
||||
return LLWindowCallbacks::DND_NONE;
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleTimerEvent(LLWindow *window)
|
||||
{
|
||||
return FALSE;
|
||||
|
|
|
|||
|
|
@ -71,6 +71,21 @@ public:
|
|||
virtual BOOL handleTimerEvent(LLWindow *window);
|
||||
virtual BOOL handleDeviceChange(LLWindow *window);
|
||||
|
||||
enum DragNDropAction {
|
||||
DNDA_START_TRACKING = 0,// Start tracking an incoming drag
|
||||
DNDA_TRACK, // User is dragging an incoming drag around the window
|
||||
DNDA_STOP_TRACKING, // User is no longer dragging an incoming drag around the window (may have either cancelled or dropped on the window)
|
||||
DNDA_DROPPED // User dropped an incoming drag on the window (this is the "commit" event)
|
||||
};
|
||||
|
||||
enum DragNDropResult {
|
||||
DND_NONE = 0, // No drop allowed
|
||||
DND_MOVE, // Drop accepted would result in a "move" operation
|
||||
DND_COPY, // Drop accepted would result in a "copy" operation
|
||||
DND_LINK // Drop accepted would result in a "link" operation
|
||||
};
|
||||
virtual DragNDropResult handleDragNDrop(LLWindow *window, LLCoordGL pos, MASK mask, DragNDropAction action, std::string data);
|
||||
|
||||
virtual void handlePingWatchdog(LLWindow *window, const char * msg);
|
||||
virtual void handlePauseWatchdog(LLWindow *window);
|
||||
virtual void handleResumeWatchdog(LLWindow *window);
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
@ -499,8 +501,11 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
|
|||
|
||||
// Set up window event handlers (some window-related events ONLY go to window handlers.)
|
||||
InstallStandardEventHandler(GetWindowEventTarget(mWindow));
|
||||
InstallWindowEventHandler (mWindow, mEventHandlerUPP, GetEventTypeCount (WindowHandlerEventList), WindowHandlerEventList, (void*)this, &mWindowHandlerRef); // add event handler
|
||||
|
||||
InstallWindowEventHandler(mWindow, mEventHandlerUPP, GetEventTypeCount (WindowHandlerEventList), WindowHandlerEventList, (void*)this, &mWindowHandlerRef); // add event handler
|
||||
#if LL_OS_DRAGDROP_ENABLED
|
||||
InstallTrackingHandler( dragTrackingHandler, mWindow, (void*)this );
|
||||
InstallReceiveHandler( dragReceiveHandler, mWindow, (void*)this );
|
||||
#endif // LL_OS_DRAGDROP_ENABLED
|
||||
}
|
||||
|
||||
{
|
||||
|
|
@ -2174,11 +2179,8 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
|||
}
|
||||
else
|
||||
{
|
||||
MASK mask = 0;
|
||||
if(modifiers & shiftKey) { mask |= MASK_SHIFT; }
|
||||
if(modifiers & (cmdKey | controlKey)) { mask |= MASK_CONTROL; }
|
||||
if(modifiers & optionKey) { mask |= MASK_ALT; }
|
||||
|
||||
MASK mask = LLWindowMacOSX::modifiersToMask(modifiers);
|
||||
|
||||
llassert( actualType == typeUnicodeText );
|
||||
|
||||
// The result is a UTF16 buffer. Pass the characters in turn to handleUnicodeChar.
|
||||
|
|
@ -2795,6 +2797,14 @@ void LLWindowMacOSX::setCursor(ECursorType cursor)
|
|||
{
|
||||
OSStatus result = noErr;
|
||||
|
||||
if (mDragOverrideCursor != -1)
|
||||
{
|
||||
// A drag is in progress...remember the requested cursor and we'll
|
||||
// restore it when it is done
|
||||
mCurrentCursor = cursor;
|
||||
return;
|
||||
}
|
||||
|
||||
if (cursor == UI_CURSOR_ARROW
|
||||
&& mBusyCount > 0)
|
||||
{
|
||||
|
|
@ -3379,3 +3389,174 @@ std::vector<std::string> LLWindowMacOSX::getDynamicFallbackFontList()
|
|||
return std::vector<std::string>();
|
||||
}
|
||||
|
||||
// static
|
||||
MASK LLWindowMacOSX::modifiersToMask(SInt16 modifiers)
|
||||
{
|
||||
MASK mask = 0;
|
||||
if(modifiers & shiftKey) { mask |= MASK_SHIFT; }
|
||||
if(modifiers & (cmdKey | controlKey)) { mask |= MASK_CONTROL; }
|
||||
if(modifiers & optionKey) { mask |= MASK_ALT; }
|
||||
return mask;
|
||||
}
|
||||
|
||||
#if LL_OS_DRAGDROP_ENABLED
|
||||
|
||||
OSErr LLWindowMacOSX::dragTrackingHandler(DragTrackingMessage message, WindowRef theWindow,
|
||||
void * handlerRefCon, DragRef drag)
|
||||
{
|
||||
OSErr result = noErr;
|
||||
LLWindowMacOSX *self = (LLWindowMacOSX*)handlerRefCon;
|
||||
|
||||
lldebugs << "drag tracking handler, message = " << message << llendl;
|
||||
|
||||
switch(message)
|
||||
{
|
||||
case kDragTrackingInWindow:
|
||||
result = self->handleDragNDrop(drag, LLWindowCallbacks::DNDA_TRACK);
|
||||
break;
|
||||
|
||||
case kDragTrackingEnterHandler:
|
||||
result = self->handleDragNDrop(drag, LLWindowCallbacks::DNDA_START_TRACKING);
|
||||
break;
|
||||
|
||||
case kDragTrackingLeaveHandler:
|
||||
result = self->handleDragNDrop(drag, LLWindowCallbacks::DNDA_STOP_TRACKING);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
OSErr LLWindowMacOSX::dragReceiveHandler(WindowRef theWindow, void * handlerRefCon,
|
||||
DragRef drag)
|
||||
{
|
||||
LLWindowMacOSX *self = (LLWindowMacOSX*)handlerRefCon;
|
||||
return self->handleDragNDrop(drag, LLWindowCallbacks::DNDA_DROPPED);
|
||||
|
||||
}
|
||||
|
||||
OSErr LLWindowMacOSX::handleDragNDrop(DragRef drag, LLWindowCallbacks::DragNDropAction action)
|
||||
{
|
||||
OSErr result = dragNotAcceptedErr; // overall function result
|
||||
OSErr err = noErr; // for local error handling
|
||||
|
||||
// Get the mouse position and modifiers of this drag.
|
||||
SInt16 modifiers, mouseDownModifiers, mouseUpModifiers;
|
||||
::GetDragModifiers(drag, &modifiers, &mouseDownModifiers, &mouseUpModifiers);
|
||||
MASK mask = LLWindowMacOSX::modifiersToMask(modifiers);
|
||||
|
||||
Point mouse_point;
|
||||
// This will return the mouse point in global screen coords
|
||||
::GetDragMouse(drag, &mouse_point, NULL);
|
||||
LLCoordScreen screen_coords(mouse_point.h, mouse_point.v);
|
||||
LLCoordGL gl_pos;
|
||||
convertCoords(screen_coords, &gl_pos);
|
||||
|
||||
// Look at the pasteboard and try to extract an URL from it
|
||||
PasteboardRef pasteboard;
|
||||
if(GetDragPasteboard(drag, &pasteboard) == noErr)
|
||||
{
|
||||
ItemCount num_items = 0;
|
||||
// Treat an error here as an item count of 0
|
||||
(void)PasteboardGetItemCount(pasteboard, &num_items);
|
||||
|
||||
// Only deal with single-item drags.
|
||||
if(num_items == 1)
|
||||
{
|
||||
PasteboardItemID item_id = NULL;
|
||||
CFArrayRef flavors = NULL;
|
||||
CFDataRef data = NULL;
|
||||
|
||||
err = PasteboardGetItemIdentifier(pasteboard, 1, &item_id); // Yes, this really is 1-based.
|
||||
|
||||
// Try to extract an URL from the pasteboard
|
||||
if(err == noErr)
|
||||
{
|
||||
err = PasteboardCopyItemFlavors( pasteboard, item_id, &flavors);
|
||||
}
|
||||
|
||||
if(err == noErr)
|
||||
{
|
||||
if(CFArrayContainsValue(flavors, CFRangeMake(0, CFArrayGetCount(flavors)), kUTTypeURL))
|
||||
{
|
||||
// This is an URL.
|
||||
err = PasteboardCopyItemFlavorData(pasteboard, item_id, kUTTypeURL, &data);
|
||||
}
|
||||
else if(CFArrayContainsValue(flavors, CFRangeMake(0, CFArrayGetCount(flavors)), kUTTypeUTF8PlainText))
|
||||
{
|
||||
// This is a string that might be an URL.
|
||||
err = PasteboardCopyItemFlavorData(pasteboard, item_id, kUTTypeUTF8PlainText, &data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(flavors != NULL)
|
||||
{
|
||||
CFRelease(flavors);
|
||||
}
|
||||
|
||||
if(data != NULL)
|
||||
{
|
||||
std::string url;
|
||||
url.assign((char*)CFDataGetBytePtr(data), CFDataGetLength(data));
|
||||
CFRelease(data);
|
||||
|
||||
if(!url.empty())
|
||||
{
|
||||
LLWindowCallbacks::DragNDropResult res =
|
||||
mCallbacks->handleDragNDrop(this, gl_pos, mask, action, url);
|
||||
|
||||
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;
|
||||
}
|
||||
// This overrides the cursor being set by setCursor.
|
||||
// This is a bit of a hack workaround because lots of areas
|
||||
// within the viewer just blindly set the cursor.
|
||||
if (mDragOverrideCursor == -1)
|
||||
{
|
||||
// Restore the cursor
|
||||
ECursorType temp_cursor = mCurrentCursor;
|
||||
// get around the "setting the same cursor" code in setCursor()
|
||||
mCurrentCursor = UI_CURSOR_COUNT;
|
||||
setCursor(temp_cursor);
|
||||
}
|
||||
else {
|
||||
// Override the cursor
|
||||
SetThemeCursor(mDragOverrideCursor);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif // LL_OS_DRAGDROP_ENABLED
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#define LL_LLWINDOWMACOSX_H
|
||||
|
||||
#include "llwindow.h"
|
||||
#include "llwindowcallbacks.h"
|
||||
|
||||
#include "lltimer.h"
|
||||
|
||||
|
|
@ -159,8 +160,15 @@ protected:
|
|||
void adjustCursorDecouple(bool warpingMouse = false);
|
||||
void fixWindowSize(void);
|
||||
void stopDockTileBounce();
|
||||
|
||||
|
||||
static MASK modifiersToMask(SInt16 modifiers);
|
||||
|
||||
#if LL_OS_DRAGDROP_ENABLED
|
||||
static OSErr dragTrackingHandler(DragTrackingMessage message, WindowRef theWindow,
|
||||
void * handlerRefCon, DragRef theDrag);
|
||||
static OSErr dragReceiveHandler(WindowRef theWindow, void * handlerRefCon, DragRef theDrag);
|
||||
OSErr handleDragNDrop(DragRef theDrag, LLWindowCallbacks::DragNDropAction action);
|
||||
#endif // LL_OS_DRAGDROP_ENABLED
|
||||
|
||||
//
|
||||
// Platform specific variables
|
||||
//
|
||||
|
|
@ -193,11 +201,13 @@ protected:
|
|||
U32 mFSAASamples;
|
||||
BOOL mForceRebuild;
|
||||
|
||||
S32 mDragOverrideCursor;
|
||||
|
||||
F32 mBounceTime;
|
||||
NMRec mBounceRec;
|
||||
LLTimer mBounceTimer;
|
||||
|
||||
// Imput method management through Text Service Manager.
|
||||
// Input method management through Text Service Manager.
|
||||
TSMDocumentID mTSMDocument;
|
||||
BOOL mLanguageTextInputAllowed;
|
||||
ScriptCode mTSMScriptCode;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -39,6 +39,8 @@
|
|||
#include <windows.h>
|
||||
|
||||
#include "llwindow.h"
|
||||
#include "llwindowcallbacks.h"
|
||||
#include "lldragdropwin32.h"
|
||||
|
||||
// Hack for async host by name
|
||||
#define LL_WM_HOST_RESOLVED (WM_APP + 1)
|
||||
|
|
@ -114,6 +116,8 @@ public:
|
|||
/*virtual*/ void interruptLanguageTextInput();
|
||||
/*virtual*/ void spawnWebBrowser(const std::string& escaped_url);
|
||||
|
||||
LLWindowCallbacks::DragNDropResult completeDragNDropRequest( const LLCoordGL gl_coord, const MASK mask, LLWindowCallbacks::DragNDropAction action, const std::string url );
|
||||
|
||||
static std::vector<std::string> getDynamicFallbackFontList();
|
||||
|
||||
protected:
|
||||
|
|
@ -205,6 +209,8 @@ protected:
|
|||
|
||||
LLPreeditor *mPreeditor;
|
||||
|
||||
LLDragDropWin32* mDragDrop;
|
||||
|
||||
friend class LLWindowManager;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ include(Boost)
|
|||
include(BuildVersion)
|
||||
include(DBusGlib)
|
||||
include(DirectX)
|
||||
include(DragDrop)
|
||||
include(ELFIO)
|
||||
include(FMOD)
|
||||
include(OPENAL)
|
||||
|
|
|
|||
|
|
@ -5526,6 +5526,17 @@
|
|||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>PrimMediaDragNDrop</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Enable drag and drop</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>PrimMediaMaxRetries</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
|
|
|
|||
|
|
@ -688,6 +688,23 @@ void LLPanelLogin::refreshLocation( bool force_visible )
|
|||
#endif
|
||||
}
|
||||
|
||||
// static
|
||||
void LLPanelLogin::updateLocationUI()
|
||||
{
|
||||
if (!sInstance) return;
|
||||
|
||||
std::string sim_string = LLURLSimString::sInstance.mSimString;
|
||||
if (!sim_string.empty())
|
||||
{
|
||||
// Replace "<Type region name>" with this region name
|
||||
LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
|
||||
combo->remove(2);
|
||||
combo->add( sim_string );
|
||||
combo->setTextEntry(sim_string);
|
||||
combo->setCurrentByIndex( 2 );
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void LLPanelLogin::closePanel()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ public:
|
|||
|
||||
static void addServer(const std::string& server, S32 domain_name);
|
||||
static void refreshLocation( bool force_visible );
|
||||
static void updateLocationUI();
|
||||
|
||||
static void getFields(std::string *firstname, std::string *lastname,
|
||||
std::string *password);
|
||||
|
|
@ -102,7 +103,7 @@ private:
|
|||
static void onPassKey(LLLineEditor* caller, void* user_data);
|
||||
static void onSelectServer(LLUICtrl*, void*);
|
||||
static void onServerComboLostFocus(LLFocusableElement*);
|
||||
|
||||
|
||||
private:
|
||||
LLPointer<LLUIImage> mLogoImage;
|
||||
boost::scoped_ptr<LLPanelLoginListener> mListener;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@
|
|||
|
||||
#include "llviewquery.h"
|
||||
#include "llxmltree.h"
|
||||
#include "llslurl.h"
|
||||
//#include "llviewercamera.h"
|
||||
#include "llrender.h"
|
||||
|
||||
|
|
@ -80,6 +81,9 @@
|
|||
#include "timing.h"
|
||||
#include "llviewermenu.h"
|
||||
#include "lltooltip.h"
|
||||
#include "llmediaentry.h"
|
||||
#include "llurldispatcher.h"
|
||||
#include "llurlsimstring.h"
|
||||
|
||||
// newview includes
|
||||
#include "llagent.h"
|
||||
|
|
@ -819,6 +823,127 @@ BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MAS
|
|||
// Always handled as far as the OS is concerned.
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *window, LLCoordGL pos, MASK mask, LLWindowCallbacks::DragNDropAction action, std::string data)
|
||||
{
|
||||
LLWindowCallbacks::DragNDropResult result = LLWindowCallbacks::DND_NONE;
|
||||
|
||||
if (gSavedSettings.getBOOL("PrimMediaDragNDrop"))
|
||||
{
|
||||
switch(action)
|
||||
{
|
||||
// Much of the handling for these two cases is the same.
|
||||
case LLWindowCallbacks::DNDA_TRACK:
|
||||
case LLWindowCallbacks::DNDA_DROPPED:
|
||||
case LLWindowCallbacks::DNDA_START_TRACKING:
|
||||
{
|
||||
bool drop = (LLWindowCallbacks::DNDA_DROPPED == action);
|
||||
|
||||
// special case SLURLs
|
||||
if ( LLSLURL::isSLURL( data ) )
|
||||
{
|
||||
if (drop)
|
||||
{
|
||||
LLURLDispatcher::dispatch( data, NULL, true );
|
||||
LLURLSimString::setString( LLSLURL::stripProtocol( data ) );
|
||||
LLPanelLogin::refreshLocation( true );
|
||||
LLPanelLogin::updateLocationUI();
|
||||
}
|
||||
return LLWindowCallbacks::DND_MOVE;
|
||||
};
|
||||
|
||||
LLPickInfo pick_info = pickImmediate( pos.mX, pos.mY, TRUE /*BOOL pick_transparent*/ );
|
||||
|
||||
LLUUID object_id = pick_info.getObjectID();
|
||||
S32 object_face = pick_info.mObjectFace;
|
||||
std::string url = data;
|
||||
|
||||
lldebugs << "Object: picked at " << pos.mX << ", " << pos.mY << " - face = " << object_face << " - URL = " << url << llendl;
|
||||
|
||||
LLVOVolume *obj = dynamic_cast<LLVOVolume*>(static_cast<LLViewerObject*>(pick_info.getObject()));
|
||||
|
||||
if (obj && obj->permModify() && !obj->getRegion()->getCapability("ObjectMedia").empty())
|
||||
{
|
||||
LLTextureEntry *te = obj->getTE(object_face);
|
||||
if (te)
|
||||
{
|
||||
if (drop)
|
||||
{
|
||||
if (! te->hasMedia())
|
||||
{
|
||||
// Create new media entry
|
||||
LLSD media_data;
|
||||
// XXX Should we really do Home URL too?
|
||||
media_data[LLMediaEntry::HOME_URL_KEY] = url;
|
||||
media_data[LLMediaEntry::CURRENT_URL_KEY] = url;
|
||||
media_data[LLMediaEntry::AUTO_PLAY_KEY] = true;
|
||||
obj->syncMediaData(object_face, media_data, true, true);
|
||||
// XXX This shouldn't be necessary, should it ?!?
|
||||
if (obj->getMediaImpl(object_face))
|
||||
obj->getMediaImpl(object_face)->navigateReload();
|
||||
obj->sendMediaDataUpdate();
|
||||
|
||||
result = LLWindowCallbacks::DND_COPY;
|
||||
}
|
||||
else {
|
||||
// Check the whitelist
|
||||
if (te->getMediaData()->checkCandidateUrl(url))
|
||||
{
|
||||
// just navigate to the URL
|
||||
if (obj->getMediaImpl(object_face))
|
||||
{
|
||||
obj->getMediaImpl(object_face)->navigateTo(url);
|
||||
}
|
||||
else {
|
||||
// This is very strange. Navigation should
|
||||
// happen via the Impl, but we don't have one.
|
||||
// This sends it to the server, which /should/
|
||||
// trigger us getting it. Hopefully.
|
||||
LLSD media_data;
|
||||
media_data[LLMediaEntry::CURRENT_URL_KEY] = url;
|
||||
obj->syncMediaData(object_face, media_data, true, true);
|
||||
obj->sendMediaDataUpdate();
|
||||
}
|
||||
result = LLWindowCallbacks::DND_LINK;
|
||||
}
|
||||
}
|
||||
LLSelectMgr::getInstance()->unhighlightObjectOnly(mDragHoveredObject);
|
||||
mDragHoveredObject = NULL;
|
||||
|
||||
}
|
||||
else {
|
||||
// Check the whitelist, if there's media (otherwise just show it)
|
||||
if (te->getMediaData() == NULL || te->getMediaData()->checkCandidateUrl(url))
|
||||
{
|
||||
if ( obj != mDragHoveredObject)
|
||||
{
|
||||
// Highlight the dragged object
|
||||
LLSelectMgr::getInstance()->unhighlightObjectOnly(mDragHoveredObject);
|
||||
mDragHoveredObject = obj;
|
||||
LLSelectMgr::getInstance()->highlightObjectOnly(mDragHoveredObject);
|
||||
}
|
||||
result = (! te->hasMedia()) ? LLWindowCallbacks::DND_COPY : LLWindowCallbacks::DND_LINK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case LLWindowCallbacks::DNDA_STOP_TRACKING:
|
||||
// The cleanup case below will make sure things are unhilighted if necessary.
|
||||
break;
|
||||
}
|
||||
|
||||
if (result == LLWindowCallbacks::DND_NONE && !mDragHoveredObject.isNull())
|
||||
{
|
||||
LLSelectMgr::getInstance()->unhighlightObjectOnly(mDragHoveredObject);
|
||||
mDragHoveredObject = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -169,7 +169,8 @@ public:
|
|||
/*virtual*/ BOOL handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||
/*virtual*/ BOOL handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||
/*virtual*/ BOOL handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||
/*virtual*/ void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||
/*virtual*/ LLWindowCallbacks::DragNDropResult handleDragNDrop(LLWindow *window, LLCoordGL pos, MASK mask, LLWindowCallbacks::DragNDropAction action, std::string data);
|
||||
void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||
/*virtual*/ void handleMouseLeave(LLWindow *window);
|
||||
/*virtual*/ void handleResize(LLWindow *window, S32 x, S32 y);
|
||||
/*virtual*/ void handleFocus(LLWindow *window);
|
||||
|
|
@ -475,6 +476,10 @@ protected:
|
|||
static std::string sSnapshotDir;
|
||||
|
||||
static std::string sMovieBaseName;
|
||||
|
||||
private:
|
||||
// Object temporarily hovered over while dragging
|
||||
LLPointer<LLViewerObject> mDragHoveredObject;
|
||||
};
|
||||
|
||||
void toggle_flying(void*);
|
||||
|
|
|
|||
Loading…
Reference in New Issue