LLWindow V3 partial merge. Includes Most everything sans new LLMouseHandler which requires some messy changes in llviewerwindow that are best left for a dedicated commit. Also, some translation fluff was skipped for now.
This commit is contained in:
@@ -33,14 +33,18 @@ include_directories(
|
||||
|
||||
set(llwindow_SOURCE_FILES
|
||||
llkeyboard.cpp
|
||||
llkeyboardheadless.cpp
|
||||
llwindowheadless.cpp
|
||||
llwindowcallbacks.cpp
|
||||
)
|
||||
|
||||
set(llwindows_HEADER_FILES
|
||||
set(llwindow_HEADER_FILES
|
||||
CMakeLists.txt
|
||||
|
||||
llkeyboard.h
|
||||
llkeyboardheadless.h
|
||||
llwindowheadless.h
|
||||
llwindowcallbacks.h
|
||||
)
|
||||
|
||||
set(viewer_SOURCE_FILES
|
||||
@@ -55,10 +59,13 @@ set(viewer_HEADER_FILES
|
||||
|
||||
# Libraries on which this library depends, needed for Linux builds
|
||||
# Sort by high-level to low-level
|
||||
set(llwindow_LINK_LIBRARIES
|
||||
${UI_LIBRARIES} # for GTK
|
||||
${SDL_LIBRARY}
|
||||
)
|
||||
if (LINUX AND VIEWER)
|
||||
set(llwindow_LINK_LIBRARIES
|
||||
${UI_LIBRARIES} # for GTK
|
||||
${SDL_LIBRARY}
|
||||
fontconfig # For FCInit and other FC* functions.
|
||||
)
|
||||
endif (LINUX AND VIEWER)
|
||||
|
||||
if (DARWIN)
|
||||
list(APPEND llwindow_SOURCE_FILES
|
||||
@@ -81,7 +88,7 @@ if (DARWIN)
|
||||
)
|
||||
endif (DARWIN)
|
||||
|
||||
if (LINUX)
|
||||
if (LINUX AND VIEWER)
|
||||
list(APPEND viewer_SOURCE_FILES
|
||||
llkeyboardsdl.cpp
|
||||
llwindowsdl.cpp
|
||||
@@ -90,21 +97,24 @@ if (LINUX)
|
||||
llkeyboardsdl.h
|
||||
llwindowsdl.h
|
||||
)
|
||||
endif (LINUX)
|
||||
endif (LINUX AND VIEWER)
|
||||
|
||||
if (WINDOWS)
|
||||
list(APPEND llwindow_SOURCE_FILES
|
||||
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
|
||||
ole32
|
||||
)
|
||||
endif (WINDOWS)
|
||||
|
||||
@@ -141,8 +151,7 @@ if (SERVER AND NOT WINDOWS AND NOT DARWIN)
|
||||
${llwindow_SOURCE_FILES}
|
||||
${server_SOURCE_FILES}
|
||||
)
|
||||
add_dependencies(llwindowheadless prepare)
|
||||
# *TODO: This should probably have target_link_libraries
|
||||
target_link_libraries (llwindowheadless ${llwindow_LINK_LIBRARIES})
|
||||
endif (SERVER AND NOT WINDOWS AND NOT DARWIN)
|
||||
|
||||
if (llwindow_HEADER_FILES)
|
||||
|
||||
365
indra/llwindow/lldragdropwin32.cpp
Normal file
365
indra/llwindow/lldragdropwin32.cpp
Normal file
@@ -0,0 +1,365 @@
|
||||
/**
|
||||
* @file lldragdrop32.cpp
|
||||
* @brief Handler for Windows specific drag and drop (OS to client) code
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/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),
|
||||
mIsSlurl(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
|
||||
|
||||
74
indra/llwindow/lldragdropwin32.h
Normal file
74
indra/llwindow/lldragdropwin32.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* @file lldragdrop32.cpp
|
||||
* @brief Handler for Windows specific drag and drop (OS to client) code
|
||||
*
|
||||
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/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
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "indra_constants.h"
|
||||
#include "llkeyboard.h"
|
||||
|
||||
#include "llwindow.h"
|
||||
#include "llwindowcallbacks.h"
|
||||
|
||||
|
||||
//
|
||||
|
||||
73
indra/llwindow/llkeyboardheadless.cpp
Normal file
73
indra/llwindow/llkeyboardheadless.cpp
Normal file
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* @file llkeyboardheadless.cpp
|
||||
* @brief Handler for assignable key bindings
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
#include "llkeyboardheadless.h"
|
||||
#include "llwindowcallbacks.h"
|
||||
|
||||
LLKeyboardHeadless::LLKeyboardHeadless()
|
||||
{ }
|
||||
|
||||
void LLKeyboardHeadless::resetMaskKeys()
|
||||
{ }
|
||||
|
||||
|
||||
BOOL LLKeyboardHeadless::handleKeyDown(const U16 key, const U32 mask)
|
||||
{ return FALSE; }
|
||||
|
||||
|
||||
BOOL LLKeyboardHeadless::handleKeyUp(const U16 key, const U32 mask)
|
||||
{ return FALSE; }
|
||||
|
||||
MASK LLKeyboardHeadless::currentMask(BOOL for_mouse_event)
|
||||
{ return MASK_NONE; }
|
||||
|
||||
void LLKeyboardHeadless::scanKeyboard()
|
||||
{
|
||||
for (S32 key = 0; key < KEY_COUNT; key++)
|
||||
{
|
||||
// Generate callback if any event has occurred on this key this frame.
|
||||
// Can't just test mKeyLevel, because this could be a slow frame and
|
||||
// key might have gone down then up. JC
|
||||
if (mKeyLevel[key] || mKeyDown[key] || mKeyUp[key])
|
||||
{
|
||||
mCurScanKey = key;
|
||||
mCallbacks->handleScanKey(key, mKeyDown[key], mKeyUp[key], mKeyLevel[key]);
|
||||
}
|
||||
}
|
||||
|
||||
// Reset edges for next frame
|
||||
for (S32 key = 0; key < KEY_COUNT; key++)
|
||||
{
|
||||
mKeyUp[key] = FALSE;
|
||||
mKeyDown[key] = FALSE;
|
||||
if (mKeyLevel[key])
|
||||
{
|
||||
mKeyLevelFrameCount[key]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
45
indra/llwindow/llkeyboardheadless.h
Normal file
45
indra/llwindow/llkeyboardheadless.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* @file llkeyboardheadless.h
|
||||
* @brief Handler for assignable key bindings
|
||||
*
|
||||
* $LicenseInfo:firstyear=2004&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef LL_LLKEYBOARDHEADLESS_H
|
||||
#define LL_LLKEYBOARDHEADLESS_H
|
||||
|
||||
#include "llkeyboard.h"
|
||||
|
||||
class LLKeyboardHeadless : public LLKeyboard
|
||||
{
|
||||
public:
|
||||
LLKeyboardHeadless();
|
||||
/*virtual*/ ~LLKeyboardHeadless() {};
|
||||
|
||||
/*virtual*/ BOOL handleKeyUp(const U16 key, MASK mask);
|
||||
/*virtual*/ BOOL handleKeyDown(const U16 key, MASK mask);
|
||||
/*virtual*/ void resetMaskKeys();
|
||||
/*virtual*/ MASK currentMask(BOOL for_mouse_event);
|
||||
/*virtual*/ void scanKeyboard();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
#include "linden_common.h"
|
||||
#include "llkeyboardmacosx.h"
|
||||
#include "llwindow.h"
|
||||
#include "llwindowcallbacks.h"
|
||||
|
||||
#include <Carbon/Carbon.h>
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
#include "linden_common.h"
|
||||
#include "llkeyboardsdl.h"
|
||||
#include "llwindow.h"
|
||||
#include "llwindowcallbacks.h"
|
||||
#include "SDL/SDL.h"
|
||||
|
||||
LLKeyboardSDL::LLKeyboardSDL()
|
||||
|
||||
@@ -34,14 +34,15 @@
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "llkeyboardwin32.h"
|
||||
|
||||
#include "llwindow.h"
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "llkeyboardwin32.h"
|
||||
|
||||
#include "llwindowcallbacks.h"
|
||||
|
||||
|
||||
LLKeyboardWin32::LLKeyboardWin32()
|
||||
{
|
||||
// Set up key mapping for windows - eventually can read this from a file?
|
||||
@@ -63,7 +64,7 @@ LLKeyboardWin32::LLKeyboardWin32()
|
||||
// numpad number keys
|
||||
for (cur_char = 0x60; cur_char <= 0x69; cur_char++)
|
||||
{
|
||||
mTranslateKeyMap[cur_char] = (KEY)('0' + (0x60 - cur_char));
|
||||
mTranslateKeyMap[cur_char] = (KEY)('0' + (cur_char - 0x60));
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +79,7 @@ LLKeyboardWin32::LLKeyboardWin32()
|
||||
mTranslateKeyMap[VK_OEM_COMMA] = ',';
|
||||
mTranslateKeyMap[VK_OEM_MINUS] = '-';
|
||||
mTranslateKeyMap[VK_OEM_PERIOD] = '.';
|
||||
mTranslateKeyMap[VK_OEM_2] = KEY_PAD_DIVIDE;
|
||||
mTranslateKeyMap[VK_OEM_2] = '/';//This used to be KEY_PAD_DIVIDE, but that breaks typing into text fields in media prims
|
||||
mTranslateKeyMap[VK_OEM_3] = '`';
|
||||
mTranslateKeyMap[VK_OEM_4] = '[';
|
||||
mTranslateKeyMap[VK_OEM_5] = '\\';
|
||||
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
// the returned LLWString contains it.
|
||||
|
||||
virtual const LLWString & getWText() const = 0;
|
||||
|
||||
const LLWString & getPreeditString() const {return getWText();}
|
||||
// Handle a UTF-32 char on this preeditor, i.e., add the character
|
||||
// to the contents.
|
||||
// This is a back door of the method of same name of LLWindowCallback.
|
||||
|
||||
@@ -46,14 +46,11 @@
|
||||
#include "llerror.h"
|
||||
#include "llkeyboard.h"
|
||||
#include "linked_lists.h"
|
||||
|
||||
//static instance for default callbacks
|
||||
LLWindowCallbacks LLWindow::sDefaultCallbacks;
|
||||
#include "llwindowcallbacks.h"
|
||||
|
||||
//
|
||||
// LLWindowCallbacks
|
||||
//
|
||||
|
||||
LLSplashScreen *gSplashScreenp = NULL;
|
||||
BOOL gDebugClicks = FALSE;
|
||||
BOOL gDebugWindowProc = FALSE;
|
||||
@@ -67,158 +64,6 @@ const std::string gURLProtocolWhitelist[] = { "file:", "http:", "https:" };
|
||||
// Important - these lists should match - protocol to handler
|
||||
const std::string gURLProtocolWhitelistHandler[] = { "http", "http", "https" };
|
||||
|
||||
BOOL LLWindowCallbacks::handleTranslatedKeyDown(const KEY key, const MASK mask, BOOL repeated)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
BOOL LLWindowCallbacks::handleTranslatedKeyUp(const KEY key, const MASK mask)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level)
|
||||
{
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleUnicodeChar(llwchar uni_char, MASK mask)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
BOOL LLWindowCallbacks::handleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleMouseLeave(LLWindow *window)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleCloseRequest(LLWindow *window)
|
||||
{
|
||||
//allow the window to close
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleQuit(LLWindow *window)
|
||||
{
|
||||
if(LLWindowManager::destroyWindow(window) == FALSE)
|
||||
{
|
||||
llerrs << "LLWindowCallbacks::handleQuit() : Couldn't destroy window" << llendl;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleRightMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleRightMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleMiddleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleMiddleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleActivate(LLWindow *window, BOOL activated)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleActivateApp(LLWindow *window, BOOL activating)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleMouseMove(LLWindow *window, const LLCoordGL pos, MASK mask)
|
||||
{
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleScrollWheel(LLWindow *window, S32 clicks)
|
||||
{
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleResize(LLWindow *window, const S32 width, const S32 height)
|
||||
{
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleFocus(LLWindow *window)
|
||||
{
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleFocusLost(LLWindow *window)
|
||||
{
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleMenuSelect(LLWindow *window, const S32 menu_item)
|
||||
{
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handlePaint(LLWindow *window, const S32 x, const S32 y,
|
||||
const S32 width, const S32 height)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleDoubleClick(LLWindow *window, const LLCoordGL pos, MASK mask)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleWindowBlock(LLWindow *window)
|
||||
{
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleWindowUnblock(LLWindow *window)
|
||||
{
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleDataCopy(LLWindow *window, S32 data_type, void *data)
|
||||
{
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleTimerEvent(LLWindow *window)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleDeviceChange(LLWindow *window)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handlePingWatchdog(LLWindow *window, const char * msg)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handlePauseWatchdog(LLWindow *window)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleResumeWatchdog(LLWindow *window)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
S32 OSMessageBox(const std::string& text, const std::string& caption, U32 type)
|
||||
{
|
||||
@@ -257,8 +102,8 @@ S32 OSMessageBox(const std::string& text, const std::string& caption, U32 type)
|
||||
// LLWindow
|
||||
//
|
||||
|
||||
LLWindow::LLWindow(BOOL fullscreen, U32 flags)
|
||||
: mCallbacks(&sDefaultCallbacks),
|
||||
LLWindow::LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags)
|
||||
: mCallbacks(callbacks),
|
||||
mPostQuit(TRUE),
|
||||
mFullscreen(fullscreen),
|
||||
mFullscreenWidth(0),
|
||||
@@ -277,7 +122,23 @@ LLWindow::LLWindow(BOOL fullscreen, U32 flags)
|
||||
mHighSurrogate(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
LLWindow::~LLWindow()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//virtual
|
||||
BOOL LLWindow::isValid()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//virtual
|
||||
BOOL LLWindow::canDelete()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
// virtual
|
||||
void LLWindow::incBusyCount()
|
||||
{
|
||||
@@ -293,13 +154,28 @@ void LLWindow::decBusyCount()
|
||||
}
|
||||
}
|
||||
|
||||
void LLWindow::setCallbacks(LLWindowCallbacks *callbacks)
|
||||
//virtual
|
||||
void LLWindow::resetBusyCount()
|
||||
{
|
||||
mCallbacks = callbacks;
|
||||
if (gKeyboard)
|
||||
{
|
||||
gKeyboard->setCallbacks(callbacks);
|
||||
}
|
||||
mBusyCount = 0;
|
||||
}
|
||||
|
||||
//virtual
|
||||
S32 LLWindow::getBusyCount() const
|
||||
{
|
||||
return mBusyCount;
|
||||
}
|
||||
|
||||
//virtual
|
||||
ECursorType LLWindow::getCursor() const
|
||||
{
|
||||
return mCurrentCursor;
|
||||
}
|
||||
|
||||
//virtual
|
||||
BOOL LLWindow::dialogColorPicker(F32 *r, F32 *g, F32 *b)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void *LLWindow::getMediaWindow()
|
||||
@@ -462,23 +338,7 @@ void LLSplashScreen::hide()
|
||||
static std::set<LLWindow*> sWindowList;
|
||||
|
||||
LLWindow* LLWindowManager::createWindow(
|
||||
const std::string& title,
|
||||
const std::string& name,
|
||||
LLCoordScreen upper_left,
|
||||
LLCoordScreen size,
|
||||
U32 flags,
|
||||
BOOL fullscreen,
|
||||
BOOL clearBg,
|
||||
BOOL disable_vsync,
|
||||
BOOL use_gl,
|
||||
BOOL ignore_pixel_depth)
|
||||
{
|
||||
return createWindow(
|
||||
title, name, upper_left.mX, upper_left.mY, size.mX, size.mY, flags,
|
||||
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth);
|
||||
}
|
||||
|
||||
LLWindow* LLWindowManager::createWindow(
|
||||
LLWindowCallbacks* callbacks,
|
||||
const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, U32 flags,
|
||||
BOOL fullscreen,
|
||||
BOOL clearBg,
|
||||
@@ -492,26 +352,26 @@ LLWindow* LLWindowManager::createWindow(
|
||||
if (use_gl)
|
||||
{
|
||||
#if LL_MESA_HEADLESS
|
||||
new_window = new LLWindowMesaHeadless(
|
||||
new_window = new LLWindowMesaHeadless(callbacks,
|
||||
title, name, x, y, width, height, flags,
|
||||
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth);
|
||||
#elif LL_SDL
|
||||
new_window = new LLWindowSDL(
|
||||
new_window = new LLWindowSDL(callbacks,
|
||||
title, x, y, width, height, flags,
|
||||
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
|
||||
#elif LL_WINDOWS
|
||||
new_window = new LLWindowWin32(
|
||||
new_window = new LLWindowWin32(callbacks,
|
||||
title, name, x, y, width, height, flags,
|
||||
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
|
||||
#elif LL_DARWIN
|
||||
new_window = new LLWindowMacOSX(
|
||||
new_window = new LLWindowMacOSX(callbacks,
|
||||
title, name, x, y, width, height, flags,
|
||||
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
new_window = new LLWindowHeadless(
|
||||
new_window = new LLWindowHeadless(callbacks,
|
||||
title, name, x, y, width, height, flags,
|
||||
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth);
|
||||
}
|
||||
|
||||
@@ -37,54 +37,15 @@
|
||||
#include "llcoord.h"
|
||||
#include "llstring.h"
|
||||
#include "llcursortypes.h"
|
||||
#include "llsd.h"
|
||||
|
||||
class LLSplashScreen;
|
||||
|
||||
class LLWindow;
|
||||
|
||||
class LLPreeditor;
|
||||
class LLWindowCallbacks;
|
||||
|
||||
class LLWindowCallbacks
|
||||
{
|
||||
public:
|
||||
virtual ~LLWindowCallbacks() {}
|
||||
virtual BOOL handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated);
|
||||
virtual BOOL handleTranslatedKeyUp(KEY key, MASK mask);
|
||||
virtual void handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level);
|
||||
virtual BOOL handleUnicodeChar(llwchar uni_char, MASK mask);
|
||||
|
||||
virtual BOOL handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||
virtual BOOL handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||
virtual void handleMouseLeave(LLWindow *window);
|
||||
// return TRUE to allow window to close, which will then cause handleQuit to be called
|
||||
virtual BOOL handleCloseRequest(LLWindow *window);
|
||||
// window is about to be destroyed, clean up your business
|
||||
virtual void handleQuit(LLWindow *window);
|
||||
virtual BOOL handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||
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 BOOL handleActivate(LLWindow *window, BOOL activated);
|
||||
virtual BOOL handleActivateApp(LLWindow *window, BOOL activating);
|
||||
virtual void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||
virtual void handleScrollWheel(LLWindow *window, S32 clicks);
|
||||
virtual void handleResize(LLWindow *window, S32 width, S32 height);
|
||||
virtual void handleFocus(LLWindow *window);
|
||||
virtual void handleFocusLost(LLWindow *window);
|
||||
virtual void handleMenuSelect(LLWindow *window, S32 menu_item);
|
||||
virtual BOOL handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S32 height);
|
||||
virtual BOOL handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask); // double-click of left mouse button
|
||||
virtual void handleWindowBlock(LLWindow *window); // window is taking over CPU for a while
|
||||
virtual void handleWindowUnblock(LLWindow *window); // window coming back after taking over CPU for a while
|
||||
virtual void handleDataCopy(LLWindow *window, S32 data_type, void *data);
|
||||
virtual BOOL handleTimerEvent(LLWindow *window);
|
||||
virtual BOOL handleDeviceChange(LLWindow *window);
|
||||
|
||||
virtual void handlePingWatchdog(LLWindow *window, const char * msg);
|
||||
virtual void handlePauseWatchdog(LLWindow *window);
|
||||
virtual void handleResumeWatchdog(LLWindow *window);
|
||||
|
||||
};
|
||||
|
||||
// Refer to llwindow_test in test/common/llwindow for usage example
|
||||
|
||||
@@ -114,6 +75,8 @@ public:
|
||||
virtual BOOL getMinimized() = 0;
|
||||
virtual BOOL getMaximized() = 0;
|
||||
virtual BOOL maximize() = 0;
|
||||
virtual void minimize() = 0;
|
||||
virtual void restore() = 0;
|
||||
BOOL getFullscreen() { return mFullscreen; };
|
||||
virtual BOOL getPosition(LLCoordScreen *position) = 0;
|
||||
virtual BOOL getSize(LLCoordScreen *size) = 0;
|
||||
@@ -134,12 +97,12 @@ public:
|
||||
// arrow/hour if busycount > 0.
|
||||
virtual void incBusyCount();
|
||||
virtual void decBusyCount();
|
||||
virtual void resetBusyCount() { mBusyCount = 0; }
|
||||
virtual S32 getBusyCount() const { return mBusyCount; }
|
||||
virtual void resetBusyCount();
|
||||
virtual S32 getBusyCount() const;
|
||||
|
||||
// Sets cursor, may set to arrow+hourglass
|
||||
virtual void setCursor(ECursorType cursor) = 0;
|
||||
virtual ECursorType getCursor() const { return mCurrentCursor; }
|
||||
virtual ECursorType getCursor() const;
|
||||
|
||||
virtual void captureMouse() = 0;
|
||||
virtual void releaseMouse() = 0;
|
||||
@@ -182,13 +145,12 @@ public:
|
||||
virtual F32 getPixelAspectRatio() = 0;
|
||||
virtual void setNativeAspectRatio(F32 aspect) = 0;
|
||||
|
||||
void setCallbacks(LLWindowCallbacks *callbacks);
|
||||
|
||||
virtual void beforeDialog() {}; // prepare to put up an OS dialog (if special measures are required, such as in fullscreen mode)
|
||||
virtual void afterDialog() {}; // undo whatever was done in beforeDialog()
|
||||
|
||||
// opens system default color picker
|
||||
virtual BOOL dialog_color_picker (F32 *r, F32 *g, F32 *b) { return FALSE; };
|
||||
// opens system default color picker, modally
|
||||
// Returns TRUE if valid color selected
|
||||
virtual BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b);
|
||||
|
||||
// return a platform-specific window reference (HWND on Windows, WindowRef on the Mac, Gtk window on Linux)
|
||||
virtual void *getPlatformWindow() = 0;
|
||||
@@ -201,18 +163,21 @@ public:
|
||||
virtual void setLanguageTextInput( const LLCoordGL & pos ) {};
|
||||
virtual void updateLanguageTextInputArea() {}
|
||||
virtual void interruptLanguageTextInput() {}
|
||||
virtual void spawnWebBrowser(const std::string& escaped_url) {};
|
||||
virtual void spawnWebBrowser(const std::string& escaped_url, bool async) {};
|
||||
virtual void ShellEx(const std::string& command) {};
|
||||
|
||||
static std::vector<std::string> getDynamicFallbackFontList();
|
||||
|
||||
// Provide native key event data
|
||||
virtual LLSD getNativeKeyData() { return LLSD::emptyMap(); }
|
||||
|
||||
protected:
|
||||
LLWindow(BOOL fullscreen, U32 flags);
|
||||
virtual ~LLWindow() {}
|
||||
virtual BOOL isValid() {return TRUE;}
|
||||
virtual BOOL canDelete() {return TRUE;}
|
||||
protected:
|
||||
static LLWindowCallbacks sDefaultCallbacks;
|
||||
LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags);
|
||||
virtual ~LLWindow();
|
||||
// Defaults to true
|
||||
virtual BOOL isValid();
|
||||
// Defaults to true
|
||||
virtual BOOL canDelete();
|
||||
|
||||
protected:
|
||||
LLWindowCallbacks* mCallbacks;
|
||||
@@ -294,18 +259,8 @@ const S32 OSBTN_CANCEL = 3;
|
||||
class LLWindowManager
|
||||
{
|
||||
public:
|
||||
static LLWindow* createWindow(
|
||||
const std::string& title,
|
||||
const std::string& name,
|
||||
LLCoordScreen upper_left = LLCoordScreen(10, 10),
|
||||
LLCoordScreen size = LLCoordScreen(320, 240),
|
||||
U32 flags = 0,
|
||||
BOOL fullscreen = FALSE,
|
||||
BOOL clearBg = FALSE,
|
||||
BOOL disable_vsync = TRUE,
|
||||
BOOL use_gl = TRUE,
|
||||
BOOL ignore_pixel_depth = FALSE);
|
||||
static LLWindow *createWindow(
|
||||
LLWindowCallbacks* callbacks,
|
||||
const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
|
||||
U32 flags = 0,
|
||||
BOOL fullscreen = FALSE,
|
||||
|
||||
189
indra/llwindow/llwindowcallbacks.cpp
Normal file
189
indra/llwindow/llwindowcallbacks.cpp
Normal file
@@ -0,0 +1,189 @@
|
||||
/**
|
||||
* @file llwindowcallbacks.cpp
|
||||
* @brief OS event callback class
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "llwindowcallbacks.h"
|
||||
|
||||
#include "llcoord.h"
|
||||
|
||||
//
|
||||
// LLWindowCallbacks
|
||||
//
|
||||
|
||||
BOOL LLWindowCallbacks::handleTranslatedKeyDown(const KEY key, const MASK mask, BOOL repeated)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
BOOL LLWindowCallbacks::handleTranslatedKeyUp(const KEY key, const MASK mask)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level)
|
||||
{
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleUnicodeChar(llwchar uni_char, MASK mask)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
BOOL LLWindowCallbacks::handleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleMouseLeave(LLWindow *window)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleCloseRequest(LLWindow *window)
|
||||
{
|
||||
//allow the window to close
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleQuit(LLWindow *window)
|
||||
{
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleRightMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleRightMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleMiddleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleMiddleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleActivate(LLWindow *window, BOOL activated)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleActivateApp(LLWindow *window, BOOL activating)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleMouseMove(LLWindow *window, const LLCoordGL pos, MASK mask)
|
||||
{
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleScrollWheel(LLWindow *window, S32 clicks)
|
||||
{
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleResize(LLWindow *window, const S32 width, const S32 height)
|
||||
{
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleFocus(LLWindow *window)
|
||||
{
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleFocusLost(LLWindow *window)
|
||||
{
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleMenuSelect(LLWindow *window, const S32 menu_item)
|
||||
{
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handlePaint(LLWindow *window, const S32 x, const S32 y,
|
||||
const S32 width, const S32 height)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleDoubleClick(LLWindow *window, const LLCoordGL pos, MASK mask)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleWindowBlock(LLWindow *window)
|
||||
{
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleWindowUnblock(LLWindow *window)
|
||||
{
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleDataCopy(LLWindow *window, S32 data_type, void *data)
|
||||
{
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
BOOL LLWindowCallbacks::handleDeviceChange(LLWindow *window)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handlePingWatchdog(LLWindow *window, const char * msg)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handlePauseWatchdog(LLWindow *window)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleResumeWatchdog(LLWindow *window)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
91
indra/llwindow/llwindowcallbacks.h
Normal file
91
indra/llwindow/llwindowcallbacks.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/**
|
||||
* @file llwindowcallbacks.h
|
||||
* @brief OS event callback class
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation;
|
||||
* version 2.1 of the License only.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
#ifndef LLWINDOWCALLBACKS_H
|
||||
#define LLWINDOWCALLBACKS_H
|
||||
|
||||
class LLCoordGL;
|
||||
class LLWindow;
|
||||
|
||||
class LLWindowCallbacks
|
||||
{
|
||||
public:
|
||||
virtual ~LLWindowCallbacks() {}
|
||||
virtual BOOL handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated);
|
||||
virtual BOOL handleTranslatedKeyUp(KEY key, MASK mask);
|
||||
virtual void handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level);
|
||||
virtual BOOL handleUnicodeChar(llwchar uni_char, MASK mask);
|
||||
|
||||
virtual BOOL handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||
virtual BOOL handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||
virtual void handleMouseLeave(LLWindow *window);
|
||||
// return TRUE to allow window to close, which will then cause handleQuit to be called
|
||||
virtual BOOL handleCloseRequest(LLWindow *window);
|
||||
// window is about to be destroyed, clean up your business
|
||||
virtual void handleQuit(LLWindow *window);
|
||||
virtual BOOL handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||
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 BOOL handleActivate(LLWindow *window, BOOL activated);
|
||||
virtual BOOL handleActivateApp(LLWindow *window, BOOL activating);
|
||||
virtual void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask);
|
||||
virtual void handleScrollWheel(LLWindow *window, S32 clicks);
|
||||
virtual void handleResize(LLWindow *window, S32 width, S32 height);
|
||||
virtual void handleFocus(LLWindow *window);
|
||||
virtual void handleFocusLost(LLWindow *window);
|
||||
virtual void handleMenuSelect(LLWindow *window, S32 menu_item);
|
||||
virtual BOOL handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S32 height);
|
||||
virtual BOOL handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask); // double-click of left mouse button
|
||||
virtual void handleWindowBlock(LLWindow *window); // window is taking over CPU for a while
|
||||
virtual void handleWindowUnblock(LLWindow *window); // window coming back after taking over CPU for a while
|
||||
virtual void handleDataCopy(LLWindow *window, S32 data_type, void *data);
|
||||
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);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -34,15 +34,19 @@
|
||||
#include "indra_constants.h"
|
||||
|
||||
#include "llwindowheadless.h"
|
||||
#include "llkeyboardheadless.h"
|
||||
|
||||
//
|
||||
// LLWindowHeadless
|
||||
//
|
||||
LLWindowHeadless::LLWindowHeadless(const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
|
||||
U32 flags, BOOL fullscreen, BOOL clearBg,
|
||||
LLWindowHeadless::LLWindowHeadless(LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
|
||||
U32 flags, BOOL fullscreen, BOOL clear_background,
|
||||
BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth)
|
||||
: LLWindow(fullscreen, flags)
|
||||
: LLWindow(callbacks, fullscreen, flags)
|
||||
{
|
||||
// Initialize a headless keyboard.
|
||||
gKeyboard = new LLKeyboardHeadless();
|
||||
gKeyboard->setCallbacks(callbacks);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -45,6 +45,8 @@ public:
|
||||
/*virtual*/ BOOL getMinimized() {return FALSE;};
|
||||
/*virtual*/ BOOL getMaximized() {return FALSE;};
|
||||
/*virtual*/ BOOL maximize() {return FALSE;};
|
||||
/*virtual*/ void minimize() {};
|
||||
/*virtual*/ void restore() {};
|
||||
/*virtual*/ BOOL getFullscreen() {return FALSE;};
|
||||
/*virtual*/ BOOL getPosition(LLCoordScreen *position) {return FALSE;};
|
||||
/*virtual*/ BOOL getSize(LLCoordScreen *size) {return FALSE;};
|
||||
@@ -94,9 +96,12 @@ public:
|
||||
/*virtual*/ void *getPlatformWindow() { return 0; };
|
||||
/*virtual*/ void bringToFront() {};
|
||||
|
||||
LLWindowHeadless(const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
|
||||
U32 flags, BOOL fullscreen, BOOL clearBg,
|
||||
BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth);
|
||||
LLWindowHeadless(LLWindowCallbacks* callbacks,
|
||||
const std::string& title, const std::string& name,
|
||||
S32 x, S32 y,
|
||||
S32 width, S32 height,
|
||||
U32 flags, BOOL fullscreen, BOOL clear_background,
|
||||
BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth);
|
||||
virtual ~LLWindowHeadless();
|
||||
|
||||
private:
|
||||
|
||||
@@ -32,19 +32,21 @@
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
#include <Carbon/Carbon.h>
|
||||
#include <OpenGL/OpenGL.h>
|
||||
|
||||
#include "llwindowmacosx.h"
|
||||
|
||||
#include "llkeyboardmacosx.h"
|
||||
#include "llwindowcallbacks.h"
|
||||
#include "llwindowmacosx-objc.h"
|
||||
#include "llpreeditor.h"
|
||||
|
||||
#include "llerror.h"
|
||||
#include "llgl.h"
|
||||
#include "llstring.h"
|
||||
#include "lldir.h"
|
||||
#include "indra_constants.h"
|
||||
|
||||
#include "llwindowmacosx-objc.h"
|
||||
#include "llpreeditor.h"
|
||||
#include <Carbon/Carbon.h>
|
||||
#include <OpenGL/OpenGL.h>
|
||||
|
||||
extern BOOL gDebugWindowProc;
|
||||
|
||||
@@ -112,9 +114,6 @@ static long getDictLong (CFDictionaryRef refDict, CFStringRef key);
|
||||
static EventTypeSpec WindowHandlerEventList[] =
|
||||
{
|
||||
// Window-related events
|
||||
// { kEventClassWindow, kEventWindowCollapsing },
|
||||
// { kEventClassWindow, kEventWindowCollapsed },
|
||||
// { kEventClassWindow, kEventWindowShown },
|
||||
{ kEventClassWindow, kEventWindowActivated },
|
||||
{ kEventClassWindow, kEventWindowDeactivated },
|
||||
{ kEventClassWindow, kEventWindowShown },
|
||||
@@ -125,8 +124,7 @@ static EventTypeSpec WindowHandlerEventList[] =
|
||||
{ kEventClassWindow, kEventWindowClose },
|
||||
{ kEventClassWindow, kEventWindowBoundsChanging },
|
||||
{ kEventClassWindow, kEventWindowBoundsChanged },
|
||||
// { kEventClassWindow, kEventWindowZoomed },
|
||||
// { kEventClassWindow, kEventWindowDrawContent },
|
||||
{ kEventClassWindow, kEventWindowGetIdealSize },
|
||||
|
||||
// Mouse events
|
||||
{ kEventClassMouse, kEventMouseDown },
|
||||
@@ -214,19 +212,27 @@ static LLWindowMacOSX *gWindowImplementation = NULL;
|
||||
|
||||
|
||||
|
||||
LLWindowMacOSX::LLWindowMacOSX(const std::string& title, const std::string& name, S32 x, S32 y, S32 width,
|
||||
LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
|
||||
const std::string& title, const std::string& name, S32 x, S32 y, S32 width,
|
||||
S32 height, U32 flags,
|
||||
BOOL fullscreen, BOOL clearBg,
|
||||
BOOL disable_vsync, BOOL use_gl,
|
||||
BOOL ignore_pixel_depth,
|
||||
U32 fsaa_samples)
|
||||
: LLWindow(fullscreen, flags)
|
||||
: LLWindow(NULL, fullscreen, flags)
|
||||
{
|
||||
// *HACK: During window construction we get lots of OS events for window
|
||||
// reshape, activate, etc. that the viewer isn't ready to handle.
|
||||
// Route them to a dummy callback structure until the end of constructor.
|
||||
LLWindowCallbacks null_callbacks;
|
||||
mCallbacks = &null_callbacks;
|
||||
|
||||
// Voodoo for calling cocoa from carbon (see llwindowmacosx-objc.mm).
|
||||
setupCocoa();
|
||||
|
||||
// Initialize the keyboard
|
||||
gKeyboard = new LLKeyboardMacOSX();
|
||||
gKeyboard->setCallbacks(callbacks);
|
||||
|
||||
// Ignore use_gl for now, only used for drones on PC
|
||||
mWindow = NULL;
|
||||
@@ -244,12 +250,14 @@ LLWindowMacOSX::LLWindowMacOSX(const std::string& title, const std::string& name
|
||||
mCursorIgnoreNextDelta = FALSE;
|
||||
mNeedsResize = FALSE;
|
||||
mOverrideAspectRatio = 0.f;
|
||||
mMaximized = FALSE;
|
||||
mMinimized = FALSE;
|
||||
mTSMDocument = NULL; // Just in case.
|
||||
mLanguageTextInputAllowed = FALSE;
|
||||
mTSMScriptCode = 0;
|
||||
mTSMLangCode = 0;
|
||||
mPreeditor = NULL;
|
||||
mRawKeyEvent = NULL;
|
||||
mFSAASamples = fsaa_samples;
|
||||
mForceRebuild = FALSE;
|
||||
|
||||
@@ -268,6 +276,8 @@ LLWindowMacOSX::LLWindowMacOSX(const std::string& title, const std::string& name
|
||||
mMoveEventCampartorUPP = NewEventComparatorUPP(staticMoveEventComparator);
|
||||
mGlobalHandlerRef = NULL;
|
||||
mWindowHandlerRef = NULL;
|
||||
|
||||
mDragOverrideCursor = -1;
|
||||
|
||||
// We're not clipping yet
|
||||
SetRect( &mOldMouseClip, 0, 0, 0, 0 );
|
||||
@@ -315,6 +325,7 @@ LLWindowMacOSX::LLWindowMacOSX(const std::string& title, const std::string& name
|
||||
setCursor( UI_CURSOR_ARROW );
|
||||
}
|
||||
|
||||
mCallbacks = callbacks;
|
||||
stop_glerror();
|
||||
}
|
||||
|
||||
@@ -447,24 +458,23 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
|
||||
|
||||
if(!mFullscreen && (mWindow == NULL))
|
||||
{
|
||||
Rect window_rect;
|
||||
//int displayWidth = CGDisplayPixelsWide(mDisplay);
|
||||
//int displayHeight = CGDisplayPixelsHigh(mDisplay);
|
||||
//const int menuBarPlusTitleBar = 44; // Ugly magic number.
|
||||
|
||||
LL_DEBUGS("Window") << "createContext: creating window" << LL_ENDL;
|
||||
|
||||
window_rect.left = (long) x;
|
||||
window_rect.right = (long) x + width;
|
||||
window_rect.top = (long) y;
|
||||
window_rect.bottom = (long) y + height;
|
||||
mPreviousWindowRect.left = (long) x;
|
||||
mPreviousWindowRect.right = (long) x + width;
|
||||
mPreviousWindowRect.top = (long) y;
|
||||
mPreviousWindowRect.bottom = (long) y + height;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Create the window
|
||||
//-----------------------------------------------------------------------
|
||||
mWindow = NewCWindow(
|
||||
NULL,
|
||||
&window_rect,
|
||||
&mPreviousWindowRect,
|
||||
mWindowTitle,
|
||||
false, // Create the window invisible. Whoever calls createContext() should show it after any moving/resizing.
|
||||
// noGrowDocProc, // Window with no grow box and no zoom box
|
||||
@@ -488,8 +498,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
|
||||
}
|
||||
|
||||
{
|
||||
@@ -511,7 +524,6 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
|
||||
if (mTSMDocument)
|
||||
{
|
||||
ActivateTSMDocument(mTSMDocument);
|
||||
UseInputWindow(mTSMDocument, FALSE);
|
||||
allowLanguageTextInput(NULL, FALSE);
|
||||
}
|
||||
}
|
||||
@@ -531,20 +543,20 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
|
||||
GLint fullscreenAttrib[] =
|
||||
{
|
||||
AGL_RGBA,
|
||||
AGL_FULLSCREEN,
|
||||
// AGL_NO_RECOVERY, // MBW -- XXX -- Not sure if we want this attribute
|
||||
AGL_SAMPLE_BUFFERS_ARB, mFSAASamples > 0 ? 1 : 0,
|
||||
AGL_SAMPLES_ARB, mFSAASamples,
|
||||
AGL_DOUBLEBUFFER,
|
||||
AGL_CLOSEST_POLICY,
|
||||
AGL_ACCELERATED,
|
||||
AGL_RED_SIZE, 8,
|
||||
AGL_GREEN_SIZE, 8,
|
||||
AGL_BLUE_SIZE, 8,
|
||||
AGL_ALPHA_SIZE, 8,
|
||||
AGL_DEPTH_SIZE, 24,
|
||||
AGL_STENCIL_SIZE, 8,
|
||||
AGL_NONE
|
||||
AGL_FULLSCREEN,
|
||||
AGL_NO_RECOVERY,
|
||||
AGL_SAMPLE_BUFFERS_ARB, mFSAASamples > 0 ? 1 : 0,
|
||||
AGL_SAMPLES_ARB, mFSAASamples,
|
||||
AGL_DOUBLEBUFFER,
|
||||
AGL_CLOSEST_POLICY,
|
||||
AGL_ACCELERATED,
|
||||
AGL_RED_SIZE, 8,
|
||||
AGL_GREEN_SIZE, 8,
|
||||
AGL_BLUE_SIZE, 8,
|
||||
AGL_ALPHA_SIZE, 8,
|
||||
AGL_DEPTH_SIZE, 24,
|
||||
AGL_STENCIL_SIZE, 8,
|
||||
AGL_NONE
|
||||
};
|
||||
|
||||
LL_DEBUGS("Window") << "createContext: creating fullscreen pixelformat" << LL_ENDL;
|
||||
@@ -557,11 +569,18 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits
|
||||
}
|
||||
else
|
||||
{
|
||||
// NOTE from Leslie:
|
||||
//
|
||||
// AGL_NO_RECOVERY, when combined with AGL_ACCELERATED prevents software rendering
|
||||
// fallback which means we won't hvae shaders that compile and link but then don't
|
||||
// work. The drawback is that our shader compilation will be a bit more finicky though.
|
||||
|
||||
GLint windowedAttrib[] =
|
||||
{
|
||||
AGL_RGBA,
|
||||
AGL_DOUBLEBUFFER,
|
||||
AGL_CLOSEST_POLICY,
|
||||
AGL_NO_RECOVERY,
|
||||
AGL_DOUBLEBUFFER,
|
||||
AGL_CLOSEST_POLICY,
|
||||
AGL_ACCELERATED,
|
||||
AGL_SAMPLE_BUFFERS_ARB, mFSAASamples > 0 ? 1 : 0,
|
||||
AGL_SAMPLES_ARB, mFSAASamples,
|
||||
@@ -1081,31 +1100,22 @@ BOOL LLWindowMacOSX::getVisible()
|
||||
|
||||
BOOL LLWindowMacOSX::getMinimized()
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
|
||||
// Since the set of states where we want to act "minimized" is non-trivial, it's easier to
|
||||
// track things locally than to try and retrieve the state from the window manager.
|
||||
result = mMinimized;
|
||||
|
||||
return(result);
|
||||
return mMinimized;
|
||||
}
|
||||
|
||||
BOOL LLWindowMacOSX::getMaximized()
|
||||
{
|
||||
BOOL result = FALSE;
|
||||
|
||||
if (mWindow)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
return(result);
|
||||
return mMaximized;
|
||||
}
|
||||
|
||||
BOOL LLWindowMacOSX::maximize()
|
||||
{
|
||||
// TODO
|
||||
return FALSE;
|
||||
if (mWindow && !mMaximized)
|
||||
{
|
||||
ZoomWindow(mWindow, inContent, true);
|
||||
}
|
||||
|
||||
return mMaximized;
|
||||
}
|
||||
|
||||
BOOL LLWindowMacOSX::getFullscreen()
|
||||
@@ -1261,6 +1271,7 @@ BOOL LLWindowMacOSX::setSize(const LLCoordScreen size)
|
||||
|
||||
void LLWindowMacOSX::swapBuffers()
|
||||
{
|
||||
glFinish();
|
||||
aglSwapBuffers(mContext);
|
||||
}
|
||||
|
||||
@@ -2005,7 +2016,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
||||
// Although the spec. is unclear, replace range should
|
||||
// not present when there is an active preedit. We just
|
||||
// ignore the case. markAsPreedit will detect the case and warn it.
|
||||
const LLWString & text = mPreeditor->getWText();
|
||||
const LLWString & text = mPreeditor->getPreeditString();
|
||||
const S32 location = wstring_wstring_length_from_utf16_length(text, 0, range.location);
|
||||
const S32 length = wstring_wstring_length_from_utf16_length(text, location, range.length);
|
||||
mPreeditor->markAsPreedit(location, length);
|
||||
@@ -2125,8 +2136,8 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
||||
|
||||
// First, process the raw event.
|
||||
{
|
||||
EventRef rawEvent;
|
||||
|
||||
EventRef rawEvent = NULL;
|
||||
|
||||
// Get the original event and extract the modifier keys, so we can ignore command-key events.
|
||||
if (GetEventParameter(event, kEventParamTextInputSendKeyboardEvent, typeEventRef, NULL, sizeof(rawEvent), NULL, &rawEvent) == noErr)
|
||||
{
|
||||
@@ -2135,6 +2146,9 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
||||
|
||||
// and call this function recursively to handle the raw key event.
|
||||
eventHandler (myHandler, rawEvent);
|
||||
|
||||
// save the raw event until we're done processing the unicode input as well.
|
||||
mRawKeyEvent = rawEvent;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2162,11 +2176,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.
|
||||
@@ -2188,6 +2199,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
||||
delete[] buffer;
|
||||
}
|
||||
|
||||
mRawKeyEvent = NULL;
|
||||
result = err;
|
||||
}
|
||||
break;
|
||||
@@ -2203,7 +2215,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
||||
{
|
||||
S32 preedit, preedit_length;
|
||||
mPreeditor->getPreeditRange(&preedit, &preedit_length);
|
||||
const LLWString & text = mPreeditor->getWText();
|
||||
const LLWString & text = mPreeditor->getPreeditString();
|
||||
|
||||
LLCoordGL caret_coord;
|
||||
LLRect preedit_bounds;
|
||||
@@ -2240,7 +2252,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
||||
mPreeditor->getSelectionRange(&selection, &selection_length);
|
||||
if (selection_length)
|
||||
{
|
||||
const LLWString text = mPreeditor->getWText().substr(selection, selection_length);
|
||||
const LLWString text = mPreeditor->getPreeditString().substr(selection, selection_length);
|
||||
const llutf16string text_utf16 = wstring_to_utf16str(text);
|
||||
result = SetEventParameter(event, kEventParamTextInputReplyText, typeUnicodeText,
|
||||
text_utf16.length() * sizeof(U16), text_utf16.c_str());
|
||||
@@ -2262,6 +2274,9 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
||||
GetEventParameter (event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode);
|
||||
GetEventParameter (event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
|
||||
|
||||
// save the raw event so getNativeKeyData can use it.
|
||||
mRawKeyEvent = event;
|
||||
|
||||
// printf("key event, key code = 0x%08x, char code = 0x%02x (%c), modifiers = 0x%08x\n", keyCode, charCode, (char)charCode, modifiers);
|
||||
// fflush(stdout);
|
||||
|
||||
@@ -2357,6 +2372,8 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
||||
result = eventNotHandledErr;
|
||||
break;
|
||||
}
|
||||
|
||||
mRawKeyEvent = NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2527,31 +2544,92 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
||||
}
|
||||
mCallbacks->handleFocusLost(this);
|
||||
break;
|
||||
|
||||
case kEventWindowBoundsChanging:
|
||||
{
|
||||
// This is where we would constrain move/resize to a particular screen
|
||||
|
||||
const S32 MIN_WIDTH = 320;
|
||||
const S32 MIN_HEIGHT = 240;
|
||||
|
||||
Rect currentBounds;
|
||||
Rect previousBounds;
|
||||
|
||||
GetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, ¤tBounds);
|
||||
GetEventParameter(event, kEventParamPreviousBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &previousBounds);
|
||||
|
||||
// This is where we would constrain move/resize to a particular screen
|
||||
if(0)
|
||||
|
||||
// Put an offset into window un-maximize operation since the kEventWindowGetIdealSize
|
||||
// event only allows the specification of size and not position.
|
||||
if (mMaximized)
|
||||
{
|
||||
SetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, sizeof(Rect), ¤tBounds);
|
||||
short leftOffset = mPreviousWindowRect.left - currentBounds.left;
|
||||
currentBounds.left += leftOffset;
|
||||
currentBounds.right += leftOffset;
|
||||
|
||||
short topOffset = mPreviousWindowRect.top - currentBounds.top;
|
||||
currentBounds.top += topOffset;
|
||||
currentBounds.bottom += topOffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Store off the size for future un-maximize operations
|
||||
mPreviousWindowRect = previousBounds;
|
||||
}
|
||||
|
||||
if ((currentBounds.right - currentBounds.left) < MIN_WIDTH)
|
||||
{
|
||||
currentBounds.right = currentBounds.left + MIN_WIDTH;
|
||||
}
|
||||
|
||||
if ((currentBounds.bottom - currentBounds.top) < MIN_HEIGHT)
|
||||
{
|
||||
currentBounds.bottom = currentBounds.top + MIN_HEIGHT;
|
||||
}
|
||||
|
||||
SetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, sizeof(Rect), ¤tBounds);
|
||||
result = noErr;
|
||||
}
|
||||
break;
|
||||
|
||||
case kEventWindowBoundsChanged:
|
||||
{
|
||||
// Get new window bounds
|
||||
Rect newBounds;
|
||||
|
||||
GetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &newBounds);
|
||||
|
||||
// Get previous window bounds
|
||||
Rect oldBounds;
|
||||
GetEventParameter(event, kEventParamPreviousBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &oldBounds);
|
||||
|
||||
// Determine if the new size is larger than the old
|
||||
bool newBoundsLarger = ((newBounds.right - newBounds.left) >= (oldBounds.right - oldBounds.left));
|
||||
newBoundsLarger &= ((newBounds.bottom - newBounds.top) >= (oldBounds.bottom - oldBounds.top));
|
||||
|
||||
// Check to see if this is a zoom event (+ button on window pane)
|
||||
unsigned int eventParams;
|
||||
GetEventParameter(event, kEventParamAttributes, typeUInt32, NULL, sizeof(int), NULL, &eventParams);
|
||||
bool isZoomEvent = ((eventParams & kWindowBoundsChangeZoom) != 0);
|
||||
|
||||
// Maximized flag is if zoom event and increasing window size
|
||||
mMaximized = (isZoomEvent && newBoundsLarger);
|
||||
|
||||
aglUpdateContext(mContext);
|
||||
|
||||
mCallbacks->handleResize(this, newBounds.right - newBounds.left, newBounds.bottom - newBounds.top);
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case kEventWindowGetIdealSize:
|
||||
// Only recommend a new ideal size when un-maximizing
|
||||
if (mMaximized == TRUE)
|
||||
{
|
||||
Point nonMaximizedSize;
|
||||
|
||||
nonMaximizedSize.v = mPreviousWindowRect.bottom - mPreviousWindowRect.top;
|
||||
nonMaximizedSize.h = mPreviousWindowRect.right - mPreviousWindowRect.left;
|
||||
|
||||
SetEventParameter(event, kEventParamDimensions, typeQDPoint, sizeof(Point), &nonMaximizedSize);
|
||||
result = noErr;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2597,7 +2675,6 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
||||
// BringToFront(mWindow);
|
||||
// result = noErr;
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2613,7 +2690,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
||||
|
||||
S32 preedit, preedit_length;
|
||||
mPreeditor->getPreeditRange(&preedit, &preedit_length);
|
||||
const LLWString & text = mPreeditor->getWText();
|
||||
const LLWString & text = mPreeditor->getPreeditString();
|
||||
const CFIndex length = wstring_utf16_length(text, 0, preedit)
|
||||
+ wstring_utf16_length(text, preedit + preedit_length, text.length());
|
||||
result = SetEventParameter(event, kEventParamTSMDocAccessCharacterCount, typeCFIndex, sizeof(length), &length);
|
||||
@@ -2630,7 +2707,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
||||
|
||||
S32 preedit, preedit_length;
|
||||
mPreeditor->getPreeditRange(&preedit, &preedit_length);
|
||||
const LLWString & text = mPreeditor->getWText();
|
||||
const LLWString & text = mPreeditor->getPreeditString();
|
||||
|
||||
CFRange range;
|
||||
if (preedit_length)
|
||||
@@ -2664,7 +2741,7 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
|
||||
{
|
||||
S32 preedit, preedit_length;
|
||||
mPreeditor->getPreeditRange(&preedit, &preedit_length);
|
||||
const LLWString & text = mPreeditor->getWText();
|
||||
const LLWString & text = mPreeditor->getPreeditString();
|
||||
|
||||
// The GetCharacters event of TSMDA has a fundamental flaw;
|
||||
// An input method need to decide the starting offset and length
|
||||
@@ -2739,14 +2816,14 @@ const char* cursorIDToName(int id)
|
||||
case UI_CURSOR_TOOLPAN: return "UI_CURSOR_TOOLPAN";
|
||||
case UI_CURSOR_TOOLZOOMIN: return "UI_CURSOR_TOOLZOOMIN";
|
||||
case UI_CURSOR_TOOLPICKOBJECT3: return "UI_CURSOR_TOOLPICKOBJECT3";
|
||||
case UI_CURSOR_TOOLSIT: return "UI_CURSOR_TOOLSIT";
|
||||
case UI_CURSOR_TOOLBUY: return "UI_CURSOR_TOOLBUY";
|
||||
case UI_CURSOR_TOOLPAY: return "UI_CURSOR_TOOLPAY";
|
||||
case UI_CURSOR_TOOLOPEN: return "UI_CURSOR_TOOLOPEN";
|
||||
case UI_CURSOR_TOOLPLAY: return "UI_CURSOR_TOOLPLAY";
|
||||
case UI_CURSOR_TOOLPAUSE: return "UI_CURSOR_TOOLPAUSE";
|
||||
case UI_CURSOR_TOOLMEDIAOPEN: return "UI_CURSOR_TOOLMEDIAOPEN";
|
||||
case UI_CURSOR_PIPETTE: return "UI_CURSOR_PIPETTE";
|
||||
case UI_CURSOR_TOOLSIT: return "UI_CURSOR_TOOLSIT";
|
||||
case UI_CURSOR_TOOLBUY: return "UI_CURSOR_TOOLBUY";
|
||||
case UI_CURSOR_TOOLOPEN: return "UI_CURSOR_TOOLOPEN";
|
||||
case UI_CURSOR_TOOLPAY: return "UI_CURSOR_TOOLPAY";
|
||||
}
|
||||
|
||||
llerrs << "cursorIDToName: unknown cursor id" << id << llendl;
|
||||
@@ -2774,6 +2851,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)
|
||||
{
|
||||
@@ -2838,13 +2923,13 @@ void LLWindowMacOSX::setCursor(ECursorType cursor)
|
||||
case UI_CURSOR_TOOLPAN:
|
||||
case UI_CURSOR_TOOLZOOMIN:
|
||||
case UI_CURSOR_TOOLPICKOBJECT3:
|
||||
case UI_CURSOR_TOOLSIT:
|
||||
case UI_CURSOR_TOOLBUY:
|
||||
case UI_CURSOR_TOOLPAY:
|
||||
case UI_CURSOR_TOOLOPEN:
|
||||
case UI_CURSOR_TOOLPLAY:
|
||||
case UI_CURSOR_TOOLPAUSE:
|
||||
case UI_CURSOR_TOOLMEDIAOPEN:
|
||||
case UI_CURSOR_TOOLSIT:
|
||||
case UI_CURSOR_TOOLBUY:
|
||||
case UI_CURSOR_TOOLOPEN:
|
||||
case UI_CURSOR_TOOLPAY:
|
||||
result = setImageCursor(gCursors[cursor]);
|
||||
break;
|
||||
|
||||
@@ -2883,13 +2968,13 @@ void LLWindowMacOSX::initCursors()
|
||||
initPixmapCursor(UI_CURSOR_TOOLPAN, 7, 6);
|
||||
initPixmapCursor(UI_CURSOR_TOOLZOOMIN, 7, 6);
|
||||
initPixmapCursor(UI_CURSOR_TOOLPICKOBJECT3, 1, 1);
|
||||
initPixmapCursor(UI_CURSOR_TOOLSIT, 1, 1);
|
||||
initPixmapCursor(UI_CURSOR_TOOLBUY, 1, 1);
|
||||
initPixmapCursor(UI_CURSOR_TOOLPAY, 1, 1);
|
||||
initPixmapCursor(UI_CURSOR_TOOLOPEN, 1, 1);
|
||||
initPixmapCursor(UI_CURSOR_TOOLPLAY, 1, 1);
|
||||
initPixmapCursor(UI_CURSOR_TOOLPAUSE, 1, 1);
|
||||
initPixmapCursor(UI_CURSOR_TOOLMEDIAOPEN, 1, 1);
|
||||
initPixmapCursor(UI_CURSOR_TOOLSIT, 1, 1);
|
||||
initPixmapCursor(UI_CURSOR_TOOLBUY, 1, 1);
|
||||
initPixmapCursor(UI_CURSOR_TOOLOPEN, 1, 1);
|
||||
initPixmapCursor(UI_CURSOR_TOOLPAY, 1, 1);
|
||||
|
||||
initPixmapCursor(UI_CURSOR_SIZENWSE, 10, 10);
|
||||
initPixmapCursor(UI_CURSOR_SIZENESW, 10, 10);
|
||||
@@ -3135,7 +3220,7 @@ S32 OSMessageBoxMacOSX(const std::string& text, const std::string& caption, U32
|
||||
|
||||
// Open a URL with the user's default web browser.
|
||||
// Must begin with protocol identifier.
|
||||
void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url)
|
||||
void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url, bool async)
|
||||
{
|
||||
bool found = false;
|
||||
S32 i;
|
||||
@@ -3188,8 +3273,62 @@ void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url)
|
||||
}
|
||||
}
|
||||
|
||||
LLSD LLWindowMacOSX::getNativeKeyData()
|
||||
{
|
||||
LLSD result = LLSD::emptyMap();
|
||||
|
||||
if(mRawKeyEvent)
|
||||
{
|
||||
char char_code = 0;
|
||||
UInt32 key_code = 0;
|
||||
UInt32 modifiers = 0;
|
||||
UInt32 keyboard_type = 0;
|
||||
|
||||
GetEventParameter (mRawKeyEvent, kEventParamKeyMacCharCodes, typeChar, NULL, sizeof(char), NULL, &char_code);
|
||||
GetEventParameter (mRawKeyEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &key_code);
|
||||
GetEventParameter (mRawKeyEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
|
||||
GetEventParameter (mRawKeyEvent, kEventParamKeyboardType, typeUInt32, NULL, sizeof(UInt32), NULL, &keyboard_type);
|
||||
|
||||
BOOL LLWindowMacOSX::dialog_color_picker ( F32 *r, F32 *g, F32 *b)
|
||||
result["char_code"] = (S32)char_code;
|
||||
result["key_code"] = (S32)key_code;
|
||||
result["modifiers"] = (S32)modifiers;
|
||||
result["keyboard_type"] = (S32)keyboard_type;
|
||||
|
||||
#if 0
|
||||
// This causes trouble for control characters -- apparently character codes less than 32 (escape, control-A, etc)
|
||||
// cause llsd serialization to create XML that the llsd deserializer won't parse!
|
||||
std::string unicode;
|
||||
OSStatus err = noErr;
|
||||
EventParamType actualType = typeUTF8Text;
|
||||
UInt32 actualSize = 0;
|
||||
char *buffer = NULL;
|
||||
|
||||
err = GetEventParameter (mRawKeyEvent, kEventParamKeyUnicodes, typeUTF8Text, &actualType, 0, &actualSize, NULL);
|
||||
if(err == noErr)
|
||||
{
|
||||
// allocate a buffer and get the actual data.
|
||||
buffer = new char[actualSize];
|
||||
err = GetEventParameter (mRawKeyEvent, kEventParamKeyUnicodes, typeUTF8Text, &actualType, actualSize, &actualSize, buffer);
|
||||
if(err == noErr)
|
||||
{
|
||||
unicode.assign(buffer, actualSize);
|
||||
}
|
||||
delete[] buffer;
|
||||
}
|
||||
|
||||
result["unicode"] = unicode;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
lldebugs << "native key data is: " << result << llendl;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
BOOL LLWindowMacOSX::dialogColorPicker( F32 *r, F32 *g, F32 *b)
|
||||
{
|
||||
BOOL retval = FALSE;
|
||||
OSErr error = noErr;
|
||||
@@ -3305,6 +3444,8 @@ void LLWindowMacOSX::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b)
|
||||
return;
|
||||
}
|
||||
|
||||
UseInputWindow(mTSMDocument, !b);
|
||||
|
||||
// Take care of old and new preeditors.
|
||||
if (preeditor != mPreeditor || !b)
|
||||
{
|
||||
@@ -3364,3 +3505,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,8 @@
|
||||
#define LL_LLWINDOWMACOSX_H
|
||||
|
||||
#include "llwindow.h"
|
||||
#include "llwindowcallbacks.h"
|
||||
|
||||
#include "lltimer.h"
|
||||
|
||||
#include <Carbon/Carbon.h>
|
||||
@@ -55,6 +57,8 @@ public:
|
||||
/*virtual*/ BOOL getMinimized();
|
||||
/*virtual*/ BOOL getMaximized();
|
||||
/*virtual*/ BOOL maximize();
|
||||
/*virtual*/ void minimize();
|
||||
/*virtual*/ void restore();
|
||||
/*virtual*/ BOOL getFullscreen();
|
||||
/*virtual*/ BOOL getPosition(LLCoordScreen *position);
|
||||
/*virtual*/ BOOL getSize(LLCoordScreen *size);
|
||||
@@ -104,7 +108,7 @@ public:
|
||||
/*virtual*/ void beforeDialog();
|
||||
/*virtual*/ void afterDialog();
|
||||
|
||||
/*virtual*/ BOOL dialog_color_picker(F32 *r, F32 *g, F32 *b);
|
||||
/*virtual*/ BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b);
|
||||
|
||||
/*virtual*/ void *getPlatformWindow();
|
||||
/*virtual*/ void *getMediaWindow();
|
||||
@@ -112,12 +116,16 @@ public:
|
||||
|
||||
/*virtual*/ void allowLanguageTextInput(LLPreeditor *preeditor, BOOL b);
|
||||
/*virtual*/ void interruptLanguageTextInput();
|
||||
/*virtual*/ void spawnWebBrowser(const std::string& escaped_url);
|
||||
/*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async);
|
||||
|
||||
static std::vector<std::string> getDynamicFallbackFontList();
|
||||
|
||||
// Provide native key event data
|
||||
/*virtual*/ LLSD getNativeKeyData();
|
||||
|
||||
|
||||
protected:
|
||||
LLWindowMacOSX(
|
||||
LLWindowMacOSX(LLWindowCallbacks* callbacks,
|
||||
const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags,
|
||||
BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
|
||||
BOOL ignore_pixel_depth,
|
||||
@@ -138,9 +146,6 @@ protected:
|
||||
// Restore the display resolution to its value before we ran the app.
|
||||
BOOL resetDisplayResolution();
|
||||
|
||||
void minimize();
|
||||
void restore();
|
||||
|
||||
BOOL shouldPostQuit() { return mPostQuit; }
|
||||
|
||||
|
||||
@@ -157,10 +162,16 @@ protected:
|
||||
static pascal Boolean staticMoveEventComparator( EventRef event, void* data);
|
||||
OSStatus eventHandler (EventHandlerCallRef myHandler, EventRef event);
|
||||
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
|
||||
//
|
||||
@@ -176,6 +187,7 @@ protected:
|
||||
EventComparatorUPP mMoveEventCampartorUPP;
|
||||
|
||||
Rect mOldMouseClip; // Screen rect to which the mouse cursor was globally constrained before we changed it in clipMouse()
|
||||
Rect mPreviousWindowRect; // Save previous window for un-maximize event
|
||||
Str255 mWindowTitle;
|
||||
double mOriginalAspectRatio;
|
||||
BOOL mSimulatedRightClick;
|
||||
@@ -189,15 +201,18 @@ protected:
|
||||
BOOL mNeedsResize; // Constructor figured out the window is too big, it needs a resize.
|
||||
LLCoordScreen mNeedsResizeSize;
|
||||
F32 mOverrideAspectRatio;
|
||||
BOOL mMaximized;
|
||||
BOOL mMinimized;
|
||||
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;
|
||||
@@ -208,6 +223,7 @@ protected:
|
||||
|
||||
friend class LLWindowManager;
|
||||
static WindowRef sMediaWindow;
|
||||
EventRef mRawKeyEvent;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -44,10 +44,11 @@ U16 *gMesaBuffer = NULL;
|
||||
//
|
||||
// LLWindowMesaHeadless
|
||||
//
|
||||
LLWindowMesaHeadless::LLWindowMesaHeadless(const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
|
||||
LLWindowMesaHeadless::LLWindowMesaHeadless(LLWindowCallbacks* callbacks,
|
||||
const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
|
||||
U32 flags, BOOL fullscreen, BOOL clearBg,
|
||||
BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth)
|
||||
: LLWindow(fullscreen, flags)
|
||||
: LLWindow(callbacks, fullscreen, flags)
|
||||
{
|
||||
if (use_gl)
|
||||
{
|
||||
|
||||
@@ -49,6 +49,8 @@ public:
|
||||
/*virtual*/ BOOL getMinimized() {return FALSE;};
|
||||
/*virtual*/ BOOL getMaximized() {return FALSE;};
|
||||
/*virtual*/ BOOL maximize() {return FALSE;};
|
||||
/*virtual*/ void minimize() {};
|
||||
/*virtual*/ void restore() {};
|
||||
/*virtual*/ BOOL getFullscreen() {return FALSE;};
|
||||
/*virtual*/ BOOL getPosition(LLCoordScreen *position) {return FALSE;};
|
||||
/*virtual*/ BOOL getSize(LLCoordScreen *size) {return FALSE;};
|
||||
@@ -98,7 +100,8 @@ public:
|
||||
/*virtual*/ void *getPlatformWindow() { return 0; };
|
||||
/*virtual*/ void bringToFront() {};
|
||||
|
||||
LLWindowMesaHeadless(const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
|
||||
LLWindowMesaHeadless(LLWindowCallbacks* callbacks,
|
||||
const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height,
|
||||
U32 flags, BOOL fullscreen, BOOL clearBg,
|
||||
BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth);
|
||||
~LLWindowMesaHeadless();
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "llwindowsdl.h"
|
||||
|
||||
#include "llwindowcallbacks.h"
|
||||
#include "llkeyboardsdl.h"
|
||||
#include "llerror.h"
|
||||
#include "llgl.h"
|
||||
@@ -188,16 +190,19 @@ Display* LLWindowSDL::get_SDL_Display(void)
|
||||
#endif // LL_X11
|
||||
|
||||
|
||||
LLWindowSDL::LLWindowSDL(const std::string& title, S32 x, S32 y, S32 width,
|
||||
LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks,
|
||||
const std::string& title, S32 x, S32 y, S32 width,
|
||||
S32 height, U32 flags,
|
||||
BOOL fullscreen, BOOL clearBg,
|
||||
BOOL disable_vsync, BOOL use_gl,
|
||||
BOOL ignore_pixel_depth, U32 fsaa_samples)
|
||||
: LLWindow(fullscreen, flags), Lock_Display(NULL),
|
||||
: LLWindow(callbacks, fullscreen, flags),
|
||||
Lock_Display(NULL),
|
||||
Unlock_Display(NULL), mGamma(1.0f)
|
||||
{
|
||||
// Initialize the keyboard
|
||||
gKeyboard = new LLKeyboardSDL();
|
||||
gKeyboard->setCallbacks(callbacks);
|
||||
// Note that we can't set up key-repeat until after SDL has init'd video
|
||||
|
||||
// Ignore use_gl for now, only used for drones on PC
|
||||
@@ -249,6 +254,10 @@ LLWindowSDL::LLWindowSDL(const std::string& title, S32 x, S32 y, S32 width,
|
||||
#if LL_X11
|
||||
mFlashing = FALSE;
|
||||
#endif // LL_X11
|
||||
|
||||
mKeyScanCode = 0;
|
||||
mKeyVirtualKey = 0;
|
||||
mKeyModifiers = KMOD_NONE;
|
||||
}
|
||||
|
||||
static SDL_Surface *Load_BMP_Resource(const char *basename)
|
||||
@@ -445,14 +454,20 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
|
||||
<< int(r_sdl_version->minor) << "."
|
||||
<< int(r_sdl_version->patch) << llendl;
|
||||
|
||||
const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo( );
|
||||
if (!videoInfo)
|
||||
const SDL_VideoInfo *video_info = SDL_GetVideoInfo( );
|
||||
if (!video_info)
|
||||
{
|
||||
llinfos << "SDL_GetVideoInfo() failed! " << SDL_GetError() << llendl;
|
||||
setupFailure("SDL_GetVideoInfo() failed, Window creation error", "Error", OSMB_OK);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (video_info->current_h > 0)
|
||||
{
|
||||
mOriginalAspectRatio = (float)video_info->current_w / (float)video_info->current_h;
|
||||
llinfos << "Original aspect ratio was " << video_info->current_w << ":" << video_info->current_h << "=" << mOriginalAspectRatio << llendl;
|
||||
}
|
||||
|
||||
SDL_EnableUNICODE(1);
|
||||
SDL_WM_SetCaption(mWindowTitle.c_str(), mWindowTitle.c_str());
|
||||
|
||||
@@ -653,7 +668,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B
|
||||
// fallback to letting SDL detect VRAM.
|
||||
// note: I've not seen SDL's detection ever actually find
|
||||
// VRAM != 0, but if SDL *does* detect it then that's a bonus.
|
||||
gGLManager.mVRAM = videoInfo->video_mem / 1024;
|
||||
gGLManager.mVRAM = video_info->video_mem / 1024;
|
||||
if (gGLManager.mVRAM != 0)
|
||||
{
|
||||
llinfos << "SDL detected " << gGLManager.mVRAM << "MB VRAM." << llendl;
|
||||
@@ -986,7 +1001,10 @@ BOOL LLWindowSDL::setSize(const LLCoordScreen size)
|
||||
void LLWindowSDL::swapBuffers()
|
||||
{
|
||||
if (mWindow)
|
||||
{
|
||||
glFinish();
|
||||
SDL_GL_SwapBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
U32 LLWindowSDL::getFSAASamples()
|
||||
@@ -1282,6 +1300,49 @@ BOOL LLWindowSDL::copyTextToClipboard(const LLWString &text)
|
||||
return FALSE; // failure
|
||||
}
|
||||
|
||||
|
||||
BOOL LLWindowSDL::isPrimaryTextAvailable()
|
||||
{
|
||||
if (ll_try_gtk_init())
|
||||
{
|
||||
GtkClipboard * const clipboard =
|
||||
gtk_clipboard_get(GDK_SELECTION_PRIMARY);
|
||||
return gtk_clipboard_wait_is_text_available(clipboard) ?
|
||||
TRUE : FALSE;
|
||||
}
|
||||
return FALSE; // failure
|
||||
}
|
||||
|
||||
BOOL LLWindowSDL::pasteTextFromPrimary(LLWString &text)
|
||||
{
|
||||
if (ll_try_gtk_init())
|
||||
{
|
||||
GtkClipboard * const clipboard =
|
||||
gtk_clipboard_get(GDK_SELECTION_PRIMARY);
|
||||
gchar * const data = gtk_clipboard_wait_for_text(clipboard);
|
||||
if (data)
|
||||
{
|
||||
text = LLWString(utf8str_to_wstring(data));
|
||||
g_free(data);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE; // failure
|
||||
}
|
||||
|
||||
BOOL LLWindowSDL::copyTextToPrimary(const LLWString &text)
|
||||
{
|
||||
if (ll_try_gtk_init())
|
||||
{
|
||||
const std::string utf8 = wstring_to_utf8str(text);
|
||||
GtkClipboard * const clipboard =
|
||||
gtk_clipboard_get(GDK_SELECTION_PRIMARY);
|
||||
gtk_clipboard_set_text(clipboard, utf8.c_str(), utf8.length());
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE; // failure
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
BOOL LLWindowSDL::isClipboardTextAvailable()
|
||||
@@ -1298,6 +1359,22 @@ BOOL LLWindowSDL::copyTextToClipboard(const LLWString &s)
|
||||
{
|
||||
return FALSE; // unsupported
|
||||
}
|
||||
|
||||
BOOL LLWindowSDL::isPrimaryTextAvailable()
|
||||
{
|
||||
return FALSE; // unsupported
|
||||
}
|
||||
|
||||
BOOL LLWindowSDL::pasteTextFromPrimary(LLWString &dst)
|
||||
{
|
||||
return FALSE; // unsupported
|
||||
}
|
||||
|
||||
BOOL LLWindowSDL::copyTextToPrimary(const LLWString &s)
|
||||
{
|
||||
return FALSE; // unsupported
|
||||
}
|
||||
|
||||
#endif // LL_GTK
|
||||
|
||||
LLWindow::LLWindowResolution* LLWindowSDL::getSupportedResolutions(S32 &num_resolutions)
|
||||
@@ -1534,6 +1611,76 @@ U32 LLWindowSDL::SDLCheckGrabbyKeys(SDLKey keysym, BOOL gain)
|
||||
return mGrabbyKeyFlags;
|
||||
}
|
||||
|
||||
|
||||
void check_vm_bloat()
|
||||
{
|
||||
#if LL_LINUX
|
||||
// watch our own VM and RSS sizes, warn if we bloated rapidly
|
||||
FILE *fp = fopen("/proc/self/stat", "r");
|
||||
if (fp)
|
||||
{
|
||||
static long long last_vm_size = 0;
|
||||
static long long last_rss_size = 0;
|
||||
const long long significant_vm_difference = 250 * 1024*1024;
|
||||
const long long significant_rss_difference = 50 * 1024*1024;
|
||||
|
||||
ssize_t res;
|
||||
size_t dummy;
|
||||
char *ptr;
|
||||
for (int i=0; i<22; ++i) // parse past the values we don't want
|
||||
{
|
||||
ptr = NULL;
|
||||
res = getdelim(&ptr, &dummy, ' ', fp);
|
||||
free(ptr);
|
||||
}
|
||||
// 23rd space-delimited entry is vsize
|
||||
ptr = NULL;
|
||||
res = getdelim(&ptr, &dummy, ' ', fp);
|
||||
llassert(ptr);
|
||||
long long this_vm_size = atoll(ptr);
|
||||
free(ptr);
|
||||
// 24th space-delimited entry is RSS
|
||||
ptr = NULL;
|
||||
res = getdelim(&ptr, &dummy, ' ', fp);
|
||||
llassert(ptr);
|
||||
long long this_rss_size = getpagesize() * atoll(ptr);
|
||||
free(ptr);
|
||||
|
||||
llinfos << "VM SIZE IS NOW " << (this_vm_size/(1024*1024)) << " MB, RSS SIZE IS NOW " << (this_rss_size/(1024*1024)) << " MB" << llendl;
|
||||
|
||||
if (llabs(last_vm_size - this_vm_size) >
|
||||
significant_vm_difference)
|
||||
{
|
||||
if (this_vm_size > last_vm_size)
|
||||
{
|
||||
llwarns << "VM size grew by " << (this_vm_size - last_vm_size)/(1024*1024) << " MB in last frame" << llendl;
|
||||
}
|
||||
else
|
||||
{
|
||||
llinfos << "VM size shrank by " << (last_vm_size - this_vm_size)/(1024*1024) << " MB in last frame" << llendl;
|
||||
}
|
||||
}
|
||||
|
||||
if (llabs(last_rss_size - this_rss_size) >
|
||||
significant_rss_difference)
|
||||
{
|
||||
if (this_rss_size > last_rss_size)
|
||||
{
|
||||
llwarns << "RSS size grew by " << (this_rss_size - last_rss_size)/(1024*1024) << " MB in last frame" << llendl;
|
||||
}
|
||||
else
|
||||
{
|
||||
llinfos << "RSS size shrank by " << (last_rss_size - this_rss_size)/(1024*1024) << " MB in last frame" << llendl;
|
||||
}
|
||||
}
|
||||
|
||||
last_rss_size = this_rss_size;
|
||||
last_vm_size = this_vm_size;
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
#endif // LL_LINUX
|
||||
}
|
||||
// virtual
|
||||
void LLWindowSDL::processMiscNativeEvents()
|
||||
{
|
||||
@@ -1558,13 +1705,19 @@ void LLWindowSDL::processMiscNativeEvents()
|
||||
pump_timer.setTimerExpirySec(1.0f / 15.0f);
|
||||
do {
|
||||
// Always do at least one non-blocking pump
|
||||
gtk_main_iteration_do(0);
|
||||
gtk_main_iteration_do(FALSE);
|
||||
} while (gtk_events_pending() &&
|
||||
!pump_timer.hasExpired());
|
||||
|
||||
setlocale(LC_ALL, saved_locale.c_str() );
|
||||
}
|
||||
#endif // LL_GTK
|
||||
|
||||
// hack - doesn't belong here - but this is just for debugging
|
||||
if (getenv("LL_DEBUG_BLOAT"))
|
||||
{
|
||||
check_vm_bloat();
|
||||
}
|
||||
}
|
||||
|
||||
void LLWindowSDL::gatherInput()
|
||||
@@ -1592,6 +1745,9 @@ void LLWindowSDL::gatherInput()
|
||||
}
|
||||
|
||||
case SDL_KEYDOWN:
|
||||
mKeyScanCode = event.key.keysym.scancode;
|
||||
mKeyVirtualKey = event.key.keysym.unicode;
|
||||
mKeyModifiers = event.key.keysym.mod;
|
||||
gKeyboard->handleKeyDown(event.key.keysym.sym, event.key.keysym.mod);
|
||||
// part of the fix for SL-13243
|
||||
if (SDLCheckGrabbyKeys(event.key.keysym.sym, TRUE) != 0)
|
||||
@@ -1605,8 +1761,12 @@ void LLWindowSDL::gatherInput()
|
||||
break;
|
||||
|
||||
case SDL_KEYUP:
|
||||
if (SDLCheckGrabbyKeys(event.key.keysym.sym, FALSE) == 0)
|
||||
SDLReallyCaptureInput(FALSE); // part of the fix for SL-13243
|
||||
mKeyScanCode = event.key.keysym.scancode;
|
||||
mKeyVirtualKey = event.key.keysym.unicode;
|
||||
mKeyModifiers = event.key.keysym.mod;
|
||||
|
||||
if (SDLCheckGrabbyKeys(event.key.keysym.sym, FALSE) == 0)
|
||||
SDLReallyCaptureInput(FALSE); // part of the fix for SL-13243
|
||||
|
||||
gKeyboard->handleKeyUp(event.key.keysym.sym, event.key.keysym.mod);
|
||||
break;
|
||||
@@ -1922,14 +2082,14 @@ void LLWindowSDL::initCursors()
|
||||
mSDLCursors[UI_CURSOR_TOOLPAN] = makeSDLCursorFromBMP("lltoolpan.BMP",7,5);
|
||||
mSDLCursors[UI_CURSOR_TOOLZOOMIN] = makeSDLCursorFromBMP("lltoolzoomin.BMP",7,5);
|
||||
mSDLCursors[UI_CURSOR_TOOLPICKOBJECT3] = makeSDLCursorFromBMP("toolpickobject3.BMP",0,0);
|
||||
mSDLCursors[UI_CURSOR_TOOLSIT] = makeSDLCursorFromBMP("toolsit.BMP",0,0);
|
||||
mSDLCursors[UI_CURSOR_TOOLBUY] = makeSDLCursorFromBMP("toolbuy.BMP",0,0);
|
||||
mSDLCursors[UI_CURSOR_TOOLPAY] = makeSDLCursorFromBMP("toolpay.BMP",0,0);
|
||||
mSDLCursors[UI_CURSOR_TOOLOPEN] = makeSDLCursorFromBMP("toolopen.BMP",0,0);
|
||||
mSDLCursors[UI_CURSOR_TOOLPLAY] = makeSDLCursorFromBMP("toolplay.BMP",0,0);
|
||||
mSDLCursors[UI_CURSOR_TOOLPAUSE] = makeSDLCursorFromBMP("toolpause.BMP",0,0);
|
||||
mSDLCursors[UI_CURSOR_TOOLMEDIAOPEN] = makeSDLCursorFromBMP("toolmediaopen.BMP",0,0);
|
||||
mSDLCursors[UI_CURSOR_PIPETTE] = makeSDLCursorFromBMP("lltoolpipette.BMP",2,28);
|
||||
mSDLCursors[UI_CURSOR_TOOLSIT] = makeSDLCursorFromBMP("toolsit.BMP",0,0);
|
||||
mSDLCursors[UI_CURSOR_TOOLBUY] = makeSDLCursorFromBMP("toolbuy.BMP",0,0);
|
||||
mSDLCursors[UI_CURSOR_TOOLOPEN] = makeSDLCursorFromBMP("toolopen.BMP",0,0);
|
||||
mSDLCursors[UI_CURSOR_TOOLPAY] = makeSDLCursorFromBMP("toolpay.BMP",0,0);
|
||||
|
||||
if (getenv("LL_ATI_MOUSE_CURSOR_BUG") != NULL) {
|
||||
llinfos << "Disabling cursor updating due to LL_ATI_MOUSE_CURSOR_BUG" << llendl;
|
||||
@@ -2169,7 +2329,40 @@ static void color_changed_callback(GtkWidget *widget,
|
||||
gtk_color_selection_get_current_color(colorsel, colorp);
|
||||
}
|
||||
|
||||
BOOL LLWindowSDL::dialog_color_picker ( F32 *r, F32 *g, F32 *b)
|
||||
|
||||
/*
|
||||
Make the raw keyboard data available - used to poke through to LLQtWebKit so
|
||||
that Qt/Webkit has access to the virtual keycodes etc. that it needs
|
||||
*/
|
||||
LLSD LLWindowSDL::getNativeKeyData()
|
||||
{
|
||||
LLSD result = LLSD::emptyMap();
|
||||
|
||||
U32 modifiers = 0; // pretend-native modifiers... oh what a tangled web we weave!
|
||||
|
||||
// we go through so many levels of device abstraction that I can't really guess
|
||||
// what a plugin under GDK under Qt under SL under SDL under X11 considers
|
||||
// a 'native' modifier mask. this has been sort of reverse-engineered... they *appear*
|
||||
// to match GDK consts, but that may be co-incidence.
|
||||
modifiers |= (mKeyModifiers & KMOD_LSHIFT) ? 0x0001 : 0;
|
||||
modifiers |= (mKeyModifiers & KMOD_RSHIFT) ? 0x0001 : 0;// munge these into the same shift
|
||||
modifiers |= (mKeyModifiers & KMOD_CAPS) ? 0x0002 : 0;
|
||||
modifiers |= (mKeyModifiers & KMOD_LCTRL) ? 0x0004 : 0;
|
||||
modifiers |= (mKeyModifiers & KMOD_RCTRL) ? 0x0004 : 0;// munge these into the same ctrl
|
||||
modifiers |= (mKeyModifiers & KMOD_LALT) ? 0x0008 : 0;// untested
|
||||
modifiers |= (mKeyModifiers & KMOD_RALT) ? 0x0008 : 0;// untested
|
||||
// *todo: test ALTs - I don't have a case for testing these. Do you?
|
||||
// *todo: NUM? - I don't care enough right now (and it's not a GDK modifier).
|
||||
|
||||
result["scan_code"] = (S32)mKeyScanCode;
|
||||
result["virtual_key"] = (S32)mKeyVirtualKey;
|
||||
result["modifiers"] = (S32)modifiers;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
BOOL LLWindowSDL::dialogColorPicker( F32 *r, F32 *g, F32 *b)
|
||||
{
|
||||
BOOL rtn = FALSE;
|
||||
|
||||
@@ -2247,7 +2440,7 @@ S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 typ
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL LLWindowSDL::dialog_color_picker ( F32 *r, F32 *g, F32 *b)
|
||||
BOOL LLWindowSDL::dialogColorPicker( F32 *r, F32 *g, F32 *b)
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
@@ -2288,7 +2481,7 @@ void exec_cmd(const std::string& cmd, const std::string& arg)
|
||||
|
||||
// Open a URL with the user's default web browser.
|
||||
// Must begin with protocol identifier.
|
||||
void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url)
|
||||
void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async)
|
||||
{
|
||||
llinfos << "spawn_web_browser: " << escaped_url << llendl;
|
||||
|
||||
@@ -2304,8 +2497,10 @@ void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url)
|
||||
# endif // LL_X11
|
||||
|
||||
std::string cmd, arg;
|
||||
cmd = gDirUtilp->getAppRODataDir().c_str();
|
||||
cmd += gDirUtilp->getDirDelimiter().c_str();
|
||||
cmd = gDirUtilp->getAppRODataDir();
|
||||
cmd += gDirUtilp->getDirDelimiter();
|
||||
cmd += "etc";
|
||||
cmd += gDirUtilp->getDirDelimiter();
|
||||
cmd += "launch_url.sh";
|
||||
arg = escaped_url;
|
||||
exec_cmd(cmd, arg);
|
||||
@@ -2364,6 +2559,7 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList()
|
||||
// Use libfontconfig to find us a nice ordered list of fallback fonts
|
||||
// specific to this system.
|
||||
std::string final_fallback("/usr/share/fonts/truetype/kochi/kochi-gothic.ttf");
|
||||
const int max_font_count_cutoff = 40; // fonts are expensive in the current system, don't enumerate an arbitrary number of them
|
||||
// Our 'ideal' font properties which define the sorting results.
|
||||
// slant=0 means Roman, index=0 means the first face in a font file
|
||||
// (the one we actually use), weight=80 means medium weight,
|
||||
@@ -2379,7 +2575,6 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList()
|
||||
std::vector<std::string> rtns;
|
||||
FcFontSet *fs = NULL;
|
||||
FcPattern *sortpat = NULL;
|
||||
int font_count = 0;
|
||||
|
||||
llinfos << "Getting system font list from FontConfig..." << llendl;
|
||||
|
||||
@@ -2423,12 +2618,13 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList()
|
||||
FcPatternDestroy(sortpat);
|
||||
}
|
||||
|
||||
int found_font_count = 0;
|
||||
if (fs)
|
||||
{
|
||||
// Get the full pathnames to the fonts, where available,
|
||||
// which is what we really want.
|
||||
int i;
|
||||
for (i=0; i<fs->nfont; ++i)
|
||||
found_font_count = fs->nfont;
|
||||
for (int i=0; i<fs->nfont; ++i)
|
||||
{
|
||||
FcChar8 *filename;
|
||||
if (FcResultMatch == FcPatternGetString(fs->fonts[i],
|
||||
@@ -2437,7 +2633,8 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList()
|
||||
&& filename)
|
||||
{
|
||||
rtns.push_back(std::string((const char*)filename));
|
||||
++font_count;
|
||||
if (rtns.size() >= max_font_count_cutoff)
|
||||
break; // hit limit
|
||||
}
|
||||
}
|
||||
FcFontSetDestroy (fs);
|
||||
@@ -2450,7 +2647,7 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList()
|
||||
{
|
||||
lldebugs << " file: " << *it << llendl;
|
||||
}
|
||||
llinfos << "Using " << font_count << " system font(s)." << llendl;
|
||||
llinfos << "Using " << rtns.size() << "/" << found_font_count << " system fonts." << llendl;
|
||||
|
||||
rtns.push_back(final_fallback);
|
||||
return rtns;
|
||||
|
||||
@@ -62,6 +62,8 @@ public:
|
||||
/*virtual*/ BOOL getMinimized();
|
||||
/*virtual*/ BOOL getMaximized();
|
||||
/*virtual*/ BOOL maximize();
|
||||
/*virtual*/ void minimize();
|
||||
/*virtual*/ void restore();
|
||||
/*virtual*/ BOOL getFullscreen();
|
||||
/*virtual*/ BOOL getPosition(LLCoordScreen *position);
|
||||
/*virtual*/ BOOL getSize(LLCoordScreen *size);
|
||||
@@ -83,6 +85,11 @@ public:
|
||||
/*virtual*/ BOOL isClipboardTextAvailable();
|
||||
/*virtual*/ BOOL pasteTextFromClipboard(LLWString &dst);
|
||||
/*virtual*/ BOOL copyTextToClipboard(const LLWString & src);
|
||||
|
||||
/*virtual*/ BOOL isPrimaryTextAvailable();
|
||||
/*virtual*/ BOOL pasteTextFromPrimary(LLWString &dst);
|
||||
/*virtual*/ BOOL copyTextToPrimary(const LLWString & src);
|
||||
|
||||
/*virtual*/ void flashIcon(F32 seconds);
|
||||
/*virtual*/ F32 getGamma();
|
||||
/*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma
|
||||
@@ -112,12 +119,12 @@ public:
|
||||
/*virtual*/ void beforeDialog();
|
||||
/*virtual*/ void afterDialog();
|
||||
|
||||
/*virtual*/ BOOL dialog_color_picker(F32 *r, F32 *g, F32 *b);
|
||||
/*virtual*/ BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b);
|
||||
|
||||
/*virtual*/ void *getPlatformWindow();
|
||||
/*virtual*/ void bringToFront();
|
||||
|
||||
/*virtual*/ void spawnWebBrowser(const std::string& escaped_url);
|
||||
/*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async);
|
||||
|
||||
static std::vector<std::string> getDynamicFallbackFontList();
|
||||
|
||||
@@ -141,27 +148,25 @@ public:
|
||||
#endif // LL_X11
|
||||
|
||||
protected:
|
||||
LLWindowSDL(
|
||||
LLWindowSDL(LLWindowCallbacks* callbacks,
|
||||
const std::string& title, int x, int y, int width, int height, U32 flags,
|
||||
BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
|
||||
BOOL ignore_pixel_depth, U32 fsaa_samples);
|
||||
~LLWindowSDL();
|
||||
|
||||
/*virtual*/ BOOL isValid();
|
||||
/*virtual*/ LLSD getNativeKeyData();
|
||||
|
||||
void initCursors();
|
||||
void quitCursors();
|
||||
BOOL isValid();
|
||||
void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size);
|
||||
|
||||
|
||||
// Changes display resolution. Returns true if successful
|
||||
BOOL setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh);
|
||||
|
||||
// Go back to last fullscreen display resolution.
|
||||
BOOL setFullscreenResolution();
|
||||
|
||||
void minimize();
|
||||
void restore();
|
||||
|
||||
BOOL shouldPostQuit() { return mPostQuit; }
|
||||
|
||||
protected:
|
||||
@@ -199,12 +204,16 @@ protected:
|
||||
|
||||
friend class LLWindowManager;
|
||||
|
||||
#if LL_X11
|
||||
private:
|
||||
#if LL_X11
|
||||
void x11_set_urgent(BOOL urgent);
|
||||
BOOL mFlashing;
|
||||
LLTimer mFlashTimer;
|
||||
#endif //LL_X11
|
||||
|
||||
U32 mKeyScanCode;
|
||||
U32 mKeyVirtualKey;
|
||||
SDLMod mKeyModifiers;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -36,11 +36,25 @@
|
||||
|
||||
#include "llwindowwin32.h"
|
||||
|
||||
// LLWindow library includes
|
||||
#include "llkeyboardwin32.h"
|
||||
#include "lldragdropwin32.h"
|
||||
#include "llpreeditor.h"
|
||||
#include "llwindowcallbacks.h"
|
||||
|
||||
// Linden library includes
|
||||
#include "llerror.h"
|
||||
#include "llgl.h"
|
||||
#include "llstring.h"
|
||||
#include "lldir.h"
|
||||
|
||||
// System includes
|
||||
#include <commdlg.h>
|
||||
#include <WinUser.h>
|
||||
#include <mapi.h>
|
||||
#include <process.h> // for _spawn
|
||||
#include <shellapi.h>
|
||||
#include <fstream>
|
||||
#include <Imm.h>
|
||||
|
||||
// Require DirectInput version 8
|
||||
@@ -49,16 +63,6 @@
|
||||
#include <dinput.h>
|
||||
#include <Dbt.h.>
|
||||
|
||||
#include "llkeyboardwin32.h"
|
||||
#include "llerror.h"
|
||||
#include "llgl.h"
|
||||
#include "llstring.h"
|
||||
#include "lldir.h"
|
||||
|
||||
#include "indra_constants.h"
|
||||
|
||||
#include "llpreeditor.h"
|
||||
|
||||
#include "llfasttimer.h"
|
||||
|
||||
// culled from winuser.h
|
||||
@@ -360,13 +364,14 @@ LLWinImm::~LLWinImm()
|
||||
}
|
||||
|
||||
|
||||
LLWindowWin32::LLWindowWin32(const std::string& title, const std::string& name, S32 x, S32 y, S32 width,
|
||||
LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
|
||||
const std::string& title, const std::string& name, S32 x, S32 y, S32 width,
|
||||
S32 height, U32 flags,
|
||||
BOOL fullscreen, BOOL clearBg,
|
||||
BOOL disable_vsync, BOOL use_gl,
|
||||
BOOL ignore_pixel_depth,
|
||||
U32 fsaa_samples)
|
||||
: LLWindow(fullscreen, flags)
|
||||
: LLWindow(callbacks, fullscreen, flags)
|
||||
{
|
||||
mFSAASamples = fsaa_samples;
|
||||
mIconResource = gIconResource;
|
||||
@@ -375,11 +380,18 @@ LLWindowWin32::LLWindowWin32(const std::string& title, const std::string& name,
|
||||
mMousePositionModified = FALSE;
|
||||
mInputProcessingPaused = FALSE;
|
||||
mPreeditor = NULL;
|
||||
mKeyCharCode = 0;
|
||||
mKeyScanCode = 0;
|
||||
mKeyVirtualKey = 0;
|
||||
mhDC = NULL;
|
||||
mhRC = NULL;
|
||||
|
||||
// Initialize the keyboard
|
||||
gKeyboard = new LLKeyboardWin32();
|
||||
gKeyboard->setCallbacks(callbacks);
|
||||
|
||||
// Initialize the Drag and Drop functionality
|
||||
mDragDrop = new LLDragDropWin32;
|
||||
|
||||
// Initialize (boot strap) the Language text input management,
|
||||
// based on the system's (user's) default settings.
|
||||
@@ -494,6 +506,8 @@ LLWindowWin32::LLWindowWin32(const std::string& title, const std::string& name,
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
DEVMODE dev_mode;
|
||||
::ZeroMemory(&dev_mode, sizeof(DEVMODE));
|
||||
dev_mode.dmSize = sizeof(DEVMODE);
|
||||
DWORD current_refresh;
|
||||
if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode))
|
||||
{
|
||||
@@ -538,7 +552,26 @@ LLWindowWin32::LLWindowWin32(const std::string& title, const std::string& name,
|
||||
if (closest_refresh == 0)
|
||||
{
|
||||
LL_WARNS("Window") << "Couldn't find display mode " << width << " by " << height << " at " << BITS_PER_PIXEL << " bits per pixel" << LL_ENDL;
|
||||
success = FALSE;
|
||||
|
||||
if (!EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode))
|
||||
{
|
||||
success = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dev_mode.dmBitsPerPel == BITS_PER_PIXEL)
|
||||
{
|
||||
LL_WARNS("Window") << "Current BBP is OK falling back to that" << LL_ENDL;
|
||||
window_rect.right=width=dev_mode.dmPelsWidth;
|
||||
window_rect.bottom=height=dev_mode.dmPelsHeight;
|
||||
success = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS("Window") << "Current BBP is BAD" << LL_ENDL;
|
||||
success = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we found a good resolution, use it.
|
||||
@@ -614,6 +647,8 @@ LLWindowWin32::LLWindowWin32(const std::string& title, const std::string& name,
|
||||
|
||||
LLWindowWin32::~LLWindowWin32()
|
||||
{
|
||||
delete mDragDrop;
|
||||
|
||||
delete [] mWindowTitle;
|
||||
mWindowTitle = NULL;
|
||||
|
||||
@@ -664,6 +699,8 @@ void LLWindowWin32::close()
|
||||
return;
|
||||
}
|
||||
|
||||
mDragDrop->reset();
|
||||
|
||||
// Make sure cursor is visible and we haven't mangled the clipping state.
|
||||
setMouseClipping(FALSE);
|
||||
showCursor();
|
||||
@@ -842,6 +879,8 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
|
||||
{
|
||||
GLuint pixel_format;
|
||||
DEVMODE dev_mode;
|
||||
::ZeroMemory(&dev_mode, sizeof(DEVMODE));
|
||||
dev_mode.dmSize = sizeof(DEVMODE);
|
||||
DWORD current_refresh;
|
||||
DWORD dw_ex_style;
|
||||
DWORD dw_style;
|
||||
@@ -1139,8 +1178,39 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
|
||||
|
||||
// First we try and get a 32 bit depth pixel format
|
||||
BOOL result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats);
|
||||
|
||||
while(!result && mFSAASamples > 0)
|
||||
{
|
||||
llwarns << "FSAASamples: " << mFSAASamples << " not supported." << llendl ;
|
||||
|
||||
mFSAASamples /= 2 ; //try to decrease sample pixel number until to disable anti-aliasing
|
||||
if(mFSAASamples < 2)
|
||||
{
|
||||
mFSAASamples = 0 ;
|
||||
}
|
||||
|
||||
if (mFSAASamples > 0)
|
||||
{
|
||||
attrib_list[end_attrib + 3] = mFSAASamples;
|
||||
}
|
||||
else
|
||||
{
|
||||
cur_attrib = end_attrib ;
|
||||
end_attrib = 0 ;
|
||||
attrib_list[cur_attrib++] = 0 ; //end
|
||||
}
|
||||
result = wglChoosePixelFormatARB(mhDC, attrib_list, NULL, 256, pixel_formats, &num_formats);
|
||||
|
||||
if(result)
|
||||
{
|
||||
llwarns << "Only support FSAASamples: " << mFSAASamples << llendl ;
|
||||
}
|
||||
}
|
||||
|
||||
if (!result)
|
||||
{
|
||||
llwarns << "mFSAASamples: " << mFSAASamples << llendl ;
|
||||
|
||||
close();
|
||||
show_window_creation_error("Error after wglChoosePixelFormatARB 32-bit");
|
||||
return FALSE;
|
||||
@@ -1368,6 +1438,11 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO
|
||||
}
|
||||
|
||||
SetWindowLong(mWindowHandle, GWL_USERDATA, (U32)this);
|
||||
|
||||
// register this window as handling drag/drop events from the OS
|
||||
DragAcceptFiles( mWindowHandle, TRUE );
|
||||
|
||||
mDragDrop->init( mWindowHandle );
|
||||
|
||||
//register joystick timer callback
|
||||
SetTimer( mWindowHandle, 0, 1000 / 30, NULL ); // 30 fps timer
|
||||
@@ -1876,6 +1951,10 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
|
||||
// allow system keys, such as ALT-F4 to be processed by Windows
|
||||
eat_keystroke = FALSE;
|
||||
case WM_KEYDOWN:
|
||||
window_imp->mKeyCharCode = 0; // don't know until wm_char comes in next
|
||||
window_imp->mKeyScanCode = ( l_param >> 16 ) & 0xff;
|
||||
window_imp->mKeyVirtualKey = w_param;
|
||||
|
||||
window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_KEYDOWN");
|
||||
{
|
||||
if (gDebugWindowProc)
|
||||
@@ -1895,6 +1974,9 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
|
||||
eat_keystroke = FALSE;
|
||||
case WM_KEYUP:
|
||||
{
|
||||
window_imp->mKeyScanCode = ( l_param >> 16 ) & 0xff;
|
||||
window_imp->mKeyVirtualKey = w_param;
|
||||
|
||||
window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_KEYUP");
|
||||
LLFastTimer t2(LLFastTimer::FTM_KEYHANDLER);
|
||||
|
||||
@@ -1980,6 +2062,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
|
||||
break;
|
||||
|
||||
case WM_CHAR:
|
||||
window_imp->mKeyCharCode = w_param;
|
||||
|
||||
// Should really use WM_UNICHAR eventually, but it requires a specific Windows version and I need
|
||||
// to figure out how that works. - Doug
|
||||
//
|
||||
@@ -2232,7 +2316,27 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
|
||||
window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MOUSEWHEEL");
|
||||
static short z_delta = 0;
|
||||
|
||||
z_delta += HIWORD(w_param);
|
||||
RECT client_rect;
|
||||
|
||||
// eat scroll events that occur outside our window, since we use mouse position to direct scroll
|
||||
// instead of keyboard focus
|
||||
// NOTE: mouse_coord is in *window* coordinates for scroll events
|
||||
POINT mouse_coord = {(S32)(S16)LOWORD(l_param), (S32)(S16)HIWORD(l_param)};
|
||||
|
||||
if (ScreenToClient(window_imp->mWindowHandle, &mouse_coord)
|
||||
&& GetClientRect(window_imp->mWindowHandle, &client_rect))
|
||||
{
|
||||
// we have a valid mouse point and client rect
|
||||
if (mouse_coord.x < client_rect.left || client_rect.right < mouse_coord.x
|
||||
|| mouse_coord.y < client_rect.top || client_rect.bottom < mouse_coord.y)
|
||||
{
|
||||
// mouse is outside of client rect, so don't do anything
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
S16 incoming_z_delta = HIWORD(w_param);
|
||||
z_delta += incoming_z_delta;
|
||||
// cout << "z_delta " << z_delta << endl;
|
||||
|
||||
// current mouse wheels report changes in increments of zDelta (+120, -120)
|
||||
@@ -2352,11 +2456,15 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
|
||||
return 0;
|
||||
|
||||
case WM_COPYDATA:
|
||||
window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_COPYDATA");
|
||||
// received a URL
|
||||
PCOPYDATASTRUCT myCDS = (PCOPYDATASTRUCT) l_param;
|
||||
window_imp->mCallbacks->handleDataCopy(window_imp, myCDS->dwData, myCDS->lpData);
|
||||
{
|
||||
window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_COPYDATA");
|
||||
// received a URL
|
||||
PCOPYDATASTRUCT myCDS = (PCOPYDATASTRUCT) l_param;
|
||||
window_imp->mCallbacks->handleDataCopy(window_imp, myCDS->dwData, myCDS->lpData);
|
||||
};
|
||||
return 0;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
window_imp->mCallbacks->handlePauseWatchdog(window_imp);
|
||||
@@ -2661,6 +2769,8 @@ LLWindow::LLWindowResolution* LLWindowWin32::getSupportedResolutions(S32 &num_re
|
||||
{
|
||||
mSupportedResolutions = new LLWindowResolution[MAX_NUM_RESOLUTIONS];
|
||||
DEVMODE dev_mode;
|
||||
::ZeroMemory(&dev_mode, sizeof(DEVMODE));
|
||||
dev_mode.dmSize = sizeof(DEVMODE);
|
||||
|
||||
mNumSupportedResolutions = 0;
|
||||
for (S32 mode_num = 0; mNumSupportedResolutions < MAX_NUM_RESOLUTIONS; mode_num++)
|
||||
@@ -2736,7 +2846,8 @@ F32 LLWindowWin32::getPixelAspectRatio()
|
||||
BOOL LLWindowWin32::setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh)
|
||||
{
|
||||
DEVMODE dev_mode;
|
||||
dev_mode.dmSize = sizeof(dev_mode);
|
||||
::ZeroMemory(&dev_mode, sizeof(DEVMODE));
|
||||
dev_mode.dmSize = sizeof(DEVMODE);
|
||||
BOOL success = FALSE;
|
||||
|
||||
// Don't change anything if we don't have to
|
||||
@@ -2808,6 +2919,7 @@ BOOL LLWindowWin32::resetDisplayResolution()
|
||||
|
||||
void LLWindowWin32::swapBuffers()
|
||||
{
|
||||
glFinish();
|
||||
SwapBuffers(mhDC);
|
||||
}
|
||||
|
||||
@@ -2942,7 +3054,7 @@ void LLWindowWin32::ShellEx(const std::string& command )
|
||||
}
|
||||
|
||||
|
||||
void LLWindowWin32::spawnWebBrowser(const std::string& escaped_url )
|
||||
void LLWindowWin32::spawnWebBrowser(const std::string& escaped_url, bool async)
|
||||
{
|
||||
bool found = false;
|
||||
S32 i;
|
||||
@@ -2972,16 +3084,36 @@ void LLWindowWin32::spawnWebBrowser(const std::string& escaped_url )
|
||||
|
||||
// let the OS decide what to use to open the URL
|
||||
SHELLEXECUTEINFO sei = { sizeof( sei ) };
|
||||
sei.fMask = SEE_MASK_FLAG_DDEWAIT;
|
||||
if (async)
|
||||
{
|
||||
sei.fMask = SEE_MASK_ASYNCOK;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
sei.fMask = SEE_MASK_FLAG_DDEWAIT;
|
||||
}
|
||||
sei.nShow = SW_SHOWNORMAL;
|
||||
sei.lpVerb = L"open";
|
||||
sei.lpFile = url_utf16.c_str();
|
||||
ShellExecuteEx( &sei );
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
Make the raw keyboard data available - used to poke through to LLQtWebKit so
|
||||
that Qt/Webkit has access to the virtual keycodes etc. that it needs
|
||||
*/
|
||||
LLSD LLWindowWin32::getNativeKeyData()
|
||||
{
|
||||
LLSD result = LLSD::emptyMap();
|
||||
|
||||
BOOL LLWindowWin32::dialog_color_picker ( F32 *r, F32 *g, F32 *b )
|
||||
result["scan_code"] = (S32)mKeyScanCode;
|
||||
result["virtual_key"] = (S32)mKeyVirtualKey;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BOOL LLWindowWin32::dialogColorPicker( F32 *r, F32 *g, F32 *b )
|
||||
{
|
||||
BOOL retval = FALSE;
|
||||
|
||||
@@ -3475,6 +3607,13 @@ static LLWString find_context(const LLWString & wtext, S32 focus, S32 focus_leng
|
||||
return wtext.substr(start, end - start);
|
||||
}
|
||||
|
||||
// final stage of handling drop requests - both from WM_DROPFILES message
|
||||
// for files and via IDropTarget interface requests.
|
||||
LLWindowCallbacks::DragNDropResult LLWindowWin32::completeDragNDropRequest( const LLCoordGL gl_coord, const MASK mask, LLWindowCallbacks::DragNDropAction action, const std::string url )
|
||||
{
|
||||
return mCallbacks->handleDragNDrop( this, gl_coord, mask, action, url );
|
||||
}
|
||||
|
||||
// Handle WM_IME_REQUEST message.
|
||||
// If it handled the message, returns TRUE. Otherwise, FALSE.
|
||||
// When it handled the message, the value to be returned from
|
||||
@@ -3508,7 +3647,7 @@ BOOL LLWindowWin32::handleImeRequests(U32 request, U32 param, LRESULT *result)
|
||||
// WCHARs, i.e., UTF-16 encoding units, so we can't simply pass the
|
||||
// number to getPreeditLocation.
|
||||
|
||||
const LLWString & wtext = mPreeditor->getWText();
|
||||
const LLWString & wtext = mPreeditor->getPreeditString();
|
||||
S32 preedit, preedit_length;
|
||||
mPreeditor->getPreeditRange(&preedit, &preedit_length);
|
||||
LLCoordGL caret_coord;
|
||||
@@ -3535,7 +3674,7 @@ BOOL LLWindowWin32::handleImeRequests(U32 request, U32 param, LRESULT *result)
|
||||
case IMR_RECONVERTSTRING:
|
||||
{
|
||||
mPreeditor->resetPreedit();
|
||||
const LLWString & wtext = mPreeditor->getWText();
|
||||
const LLWString & wtext = mPreeditor->getPreeditString();
|
||||
S32 select, select_length;
|
||||
mPreeditor->getSelectionRange(&select, &select_length);
|
||||
|
||||
@@ -3577,7 +3716,7 @@ BOOL LLWindowWin32::handleImeRequests(U32 request, U32 param, LRESULT *result)
|
||||
}
|
||||
case IMR_DOCUMENTFEED:
|
||||
{
|
||||
const LLWString & wtext = mPreeditor->getWText();
|
||||
const LLWString & wtext = mPreeditor->getPreeditString();
|
||||
S32 preedit, preedit_length;
|
||||
mPreeditor->getPreeditRange(&preedit, &preedit_length);
|
||||
|
||||
|
||||
@@ -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)
|
||||
@@ -54,6 +56,8 @@ public:
|
||||
/*virtual*/ BOOL getMinimized();
|
||||
/*virtual*/ BOOL getMaximized();
|
||||
/*virtual*/ BOOL maximize();
|
||||
/*virtual*/ void minimize();
|
||||
/*virtual*/ void restore();
|
||||
/*virtual*/ BOOL getFullscreen();
|
||||
/*virtual*/ BOOL getPosition(LLCoordScreen *position);
|
||||
/*virtual*/ BOOL getSize(LLCoordScreen *size);
|
||||
@@ -100,7 +104,7 @@ public:
|
||||
/*virtual*/ F32 getPixelAspectRatio();
|
||||
/*virtual*/ void setNativeAspectRatio(F32 ratio) { mOverrideAspectRatio = ratio; }
|
||||
|
||||
/*virtual*/ BOOL dialog_color_picker (F32 *r, F32 *g, F32 *b );
|
||||
/*virtual*/ BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b );
|
||||
|
||||
/*virtual*/ void *getPlatformWindow();
|
||||
/*virtual*/ void bringToFront();
|
||||
@@ -110,13 +114,15 @@ public:
|
||||
/*virtual*/ void setLanguageTextInput( const LLCoordGL & pos );
|
||||
/*virtual*/ void updateLanguageTextInputArea();
|
||||
/*virtual*/ void interruptLanguageTextInput();
|
||||
/*virtual*/ void spawnWebBrowser(const std::string& escaped_url);
|
||||
/*virtual*/ void ShellEx(const std::string& command);
|
||||
void ShellEx(const std::string& command);
|
||||
/*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async);
|
||||
|
||||
LLWindowCallbacks::DragNDropResult completeDragNDropRequest( const LLCoordGL gl_coord, const MASK mask, LLWindowCallbacks::DragNDropAction action, const std::string url );
|
||||
|
||||
static std::vector<std::string> getDynamicFallbackFontList();
|
||||
|
||||
protected:
|
||||
LLWindowWin32(
|
||||
LLWindowWin32(LLWindowCallbacks* callbacks,
|
||||
const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags,
|
||||
BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl,
|
||||
BOOL ignore_pixel_depth, U32 fsaa_samples);
|
||||
@@ -127,7 +133,7 @@ protected:
|
||||
HCURSOR loadColorCursor(LPCTSTR name);
|
||||
BOOL isValid();
|
||||
void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size);
|
||||
|
||||
LLSD getNativeKeyData();
|
||||
|
||||
// Changes display resolution. Returns true if successful
|
||||
BOOL setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh);
|
||||
@@ -138,9 +144,6 @@ protected:
|
||||
// Restore the display resolution to its value before we ran the app.
|
||||
BOOL resetDisplayResolution();
|
||||
|
||||
void minimize();
|
||||
void restore();
|
||||
|
||||
BOOL shouldPostQuit() { return mPostQuit; }
|
||||
|
||||
void fillCompositionForm(const LLRect& bounds, COMPOSITIONFORM *form);
|
||||
@@ -207,6 +210,12 @@ protected:
|
||||
|
||||
LLPreeditor *mPreeditor;
|
||||
|
||||
LLDragDropWin32* mDragDrop;
|
||||
|
||||
U32 mKeyCharCode;
|
||||
U32 mKeyScanCode;
|
||||
U32 mKeyVirtualKey;
|
||||
|
||||
friend class LLWindowManager;
|
||||
};
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "llweb.h"
|
||||
#include "llviewercontrol.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llwindow.h"
|
||||
#include "lldiriterator.h"
|
||||
#include "llfile.h"
|
||||
#include "llhttpclient.h"
|
||||
|
||||
@@ -2868,6 +2868,23 @@ void LLAppViewer::forceQuit()
|
||||
LLApp::setQuitting();
|
||||
}
|
||||
|
||||
//TODO: remove
|
||||
void LLAppViewer::fastQuit(S32 error_code)
|
||||
{
|
||||
// finish pending transfers
|
||||
flushVFSIO();
|
||||
// let sim know we're logging out
|
||||
sendLogoutRequest();
|
||||
// flush network buffers by shutting down messaging system
|
||||
end_messaging_system();
|
||||
// figure out the error code
|
||||
S32 final_error_code = error_code ? error_code : (S32)isError();
|
||||
// this isn't a crash
|
||||
removeMarkerFile();
|
||||
// get outta here
|
||||
_exit(final_error_code);
|
||||
}
|
||||
|
||||
void LLAppViewer::requestQuit()
|
||||
{
|
||||
llinfos << "requestQuit" << llendl;
|
||||
@@ -2943,13 +2960,6 @@ void LLAppViewer::earlyExit(const std::string& name, const LLSD& substitutions)
|
||||
LLNotifications::instance().add(name, substitutions, LLSD(), finish_early_exit);
|
||||
}
|
||||
|
||||
void LLAppViewer::forceExit(S32 arg)
|
||||
{
|
||||
removeMarkerFile();
|
||||
|
||||
// *FIX:Mani - This kind of exit hardly seems appropriate.
|
||||
exit(arg);
|
||||
}
|
||||
|
||||
void LLAppViewer::abortQuit()
|
||||
{
|
||||
|
||||
@@ -66,11 +66,11 @@ public:
|
||||
// Application control
|
||||
void flushVFSIO(); // waits for vfs transfers to complete
|
||||
void forceQuit(); // Puts the viewer into 'shutting down without error' mode.
|
||||
void fastQuit(S32 error_code = 0); // Shuts down the viewer immediately after sending a logout message
|
||||
void requestQuit(); // Request a quit. A kinder, gentler quit.
|
||||
void userQuit(); // The users asks to quit. Confirm, then requestQuit()
|
||||
void earlyExit(const std::string& name,
|
||||
const LLSD& substitutions = LLSD()); // Display an error dialog and forcibly quit.
|
||||
void forceExit(S32 arg); // exit() immediately (after some cleanup).
|
||||
void abortQuit(); // Called to abort a quit request.
|
||||
|
||||
bool quitRequested() { return mQuitRequested; }
|
||||
|
||||
@@ -37,12 +37,12 @@
|
||||
|
||||
// Linden library includes
|
||||
#include "v4color.h"
|
||||
#include "llwindow.h" // setCursor()
|
||||
|
||||
// Project includes
|
||||
#include "llui.h"
|
||||
#include "llrender.h"
|
||||
#include "lluiconstants.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llviewercontrol.h"
|
||||
#include "llbutton.h"
|
||||
#include "lltextbox.h"
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
#include "lldynamictexture.h"
|
||||
#include "llglheaders.h"
|
||||
#include "llwindow.h" // getPosition()
|
||||
#include "llviewerwindow.h"
|
||||
#include "llviewercamera.h"
|
||||
#include "llviewercontrol.h"
|
||||
@@ -55,6 +56,13 @@ LLViewerDynamicTexture::LLViewerDynamicTexture(S32 width, S32 height, S32 compon
|
||||
{
|
||||
llassert((1 <= components) && (components <= 4));
|
||||
|
||||
if(gGLManager.mDebugGPU)
|
||||
{
|
||||
if(components == 3)
|
||||
{
|
||||
mComponents = 4 ; //convert to 32bits.
|
||||
}
|
||||
}
|
||||
generateGLTexture();
|
||||
|
||||
llassert( 0 <= order && order < ORDER_COUNT );
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#ifndef LL_LLDYNAMICTEXTURE_H
|
||||
#define LL_LLDYNAMICTEXTURE_H
|
||||
|
||||
#include "llcamera.h"
|
||||
#include "llgl.h"
|
||||
#include "llcoord.h"
|
||||
#include "llviewertexture.h"
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
#include "llparcel.h"
|
||||
#include "llvfile.h"
|
||||
#include "llvfs.h"
|
||||
#include "llwindow.h"
|
||||
#include "message.h"
|
||||
|
||||
#include "llagent.h"
|
||||
#include "llcombobox.h"
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "lluictrlfactory.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llwindow.h"
|
||||
#include "llscrolllistctrl.h"
|
||||
#include "llradiogroup.h"
|
||||
#include "llviewercontrol.h"
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "llcheckboxctrl.h"
|
||||
#include "statemachine/aifilepicker.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llwindow.h"
|
||||
#include "llviewercontrol.h"
|
||||
#include "lldate.h"
|
||||
#include "llagent.h"
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "llviewercontrol.h"
|
||||
#include "lluictrlfactory.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llwindow.h"
|
||||
#include "llgl.h"
|
||||
#include "llmemory.h"
|
||||
#include "llimage.h"
|
||||
@@ -203,7 +204,7 @@ showUI ()
|
||||
{
|
||||
LLColor4 curCol = swatch->get ();
|
||||
send_agent_pause();
|
||||
gViewerWindow->getWindow ()->dialog_color_picker ( &curCol [ 0 ], &curCol [ 1 ], &curCol [ 2 ] );
|
||||
gViewerWindow->getWindow()->dialogColorPicker( &curCol [ 0 ], &curCol [ 1 ], &curCol [ 2 ] );
|
||||
send_agent_resume();
|
||||
|
||||
setOrigRgb ( curCol [ 0 ], curCol [ 1 ], curCol [ 2 ] );
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "llfloaterhardwaresettings.h"
|
||||
#include "llfloaterpreference.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llwindow.h"
|
||||
#include "llviewercontrol.h"
|
||||
#include "llviewertexturelist.h"
|
||||
#include "llfeaturemanager.h"
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
#include "llviewerstats.h"
|
||||
#include "llviewercamera.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llwindow.h"
|
||||
#include "llviewermenufile.h" // upload_new_resource()
|
||||
#include "llfloaterpostcard.h"
|
||||
#include "llcheckboxctrl.h"
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "llurlsimstring.h"
|
||||
#include "llviewercontrol.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llwindow.h"
|
||||
#include "llweb.h"
|
||||
#include "llsdserialize.h"
|
||||
// [RLVa:KB]
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "llagent.h"
|
||||
#include "llagentcamera.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llwindow.h"
|
||||
#include "llbutton.h"
|
||||
#include "llcallingcard.h"
|
||||
#include "llcolorscheme.h"
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
#include "llviewerobject.h"
|
||||
#include "llviewerregion.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llwindow.h"
|
||||
#include "llhudrender.h"
|
||||
#include "llworld.h"
|
||||
#include "v2math.h"
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "llrender.h"
|
||||
#include "lldrawable.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llwindow.h"
|
||||
#include "lluictrlfactory.h"
|
||||
#include "llbutton.h"
|
||||
#include "llface.h"
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
#include "llviewerobject.h"
|
||||
#include "llviewerregion.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llwindow.h"
|
||||
#include "llvovolume.h"
|
||||
#include "llworld.h"
|
||||
#include "pipeline.h"
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "llstring.h"
|
||||
|
||||
#include "llviewerwindow.h"
|
||||
#include "llwindow.h"
|
||||
#include "llresmgr.h"
|
||||
#include "lltextbox.h"
|
||||
#include "llbutton.h"
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "llview.h"
|
||||
|
||||
#include "llviewerwindow.h"
|
||||
#include "llwindow.h"
|
||||
#include "lltoolcomp.h"
|
||||
#include "lltoolfocus.h"
|
||||
#include "llfocusmgr.h"
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "llagent.h"
|
||||
#include "llcallbacklist.h"
|
||||
#include "llviewercontrol.h"
|
||||
#include "llwindow.h"
|
||||
#include "llfloatertools.h"
|
||||
#include "llregionposition.h"
|
||||
#include "llstatusbar.h"
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "lltoolgun.h"
|
||||
|
||||
#include "llviewerwindow.h"
|
||||
#include "llwindow.h"
|
||||
#include "llagent.h"
|
||||
#include "llagentcamera.h"
|
||||
#include "llviewercontrol.h"
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include "llviewermenu.h"
|
||||
#include "llviewercamera.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llwindow.h"
|
||||
#include "lldrawable.h"
|
||||
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
#include "llviewerobject.h"
|
||||
#include "llviewerparcelmgr.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llwindow.h"
|
||||
#include "llviewermedia.h"
|
||||
#include "llviewermediafocus.h"
|
||||
#include "llvoavatar.h"
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "llviewerobject.h"
|
||||
#include "llviewerregion.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llwindow.h"
|
||||
#include "llworld.h"
|
||||
#include "llui.h"
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "llstatusbar.h"
|
||||
#include "llviewerparcelmgr.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llwindow.h"
|
||||
|
||||
//
|
||||
// Member functions
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "llviewerobject.h"
|
||||
#include "llviewerobjectlist.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llwindow.h"
|
||||
#include "llviewercamera.h"
|
||||
|
||||
#include "llglheaders.h"
|
||||
|
||||
@@ -34,18 +34,10 @@
|
||||
|
||||
#include "llviewercamera.h"
|
||||
|
||||
#include <iomanip> // for setprecision
|
||||
|
||||
#include "llquaternion.h"
|
||||
|
||||
#include "llagent.h"
|
||||
#include "llagentcamera.h"
|
||||
#include "llmatrix4a.h"
|
||||
#include "llviewercontrol.h"
|
||||
#include "lldrawable.h"
|
||||
#include "llface.h"
|
||||
#include "llgl.h"
|
||||
#include "llglheaders.h"
|
||||
#include "llviewerobjectlist.h"
|
||||
#include "llviewerregion.h"
|
||||
#include "llviewerwindow.h"
|
||||
@@ -54,6 +46,17 @@
|
||||
#include "lltoolmgr.h"
|
||||
#include "llviewerjoystick.h"
|
||||
|
||||
// Linden library includes
|
||||
#include "lldrawable.h"
|
||||
#include "llface.h"
|
||||
#include "llgl.h"
|
||||
#include "llglheaders.h"
|
||||
#include "llquaternion.h"
|
||||
#include "llwindow.h" // getPixelAspectRatio()
|
||||
|
||||
// System includes
|
||||
#include <iomanip> // for setprecision
|
||||
|
||||
U32 LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
|
||||
|
||||
//glu pick matrix implementation borrowed from Mesa3D
|
||||
|
||||
@@ -34,8 +34,9 @@
|
||||
#define LL_LLVIEWERCAMERA_H
|
||||
|
||||
#include "llcamera.h"
|
||||
#include "lltimer.h"
|
||||
#include "llsingleton.h"
|
||||
#include "llstat.h"
|
||||
#include "lltimer.h"
|
||||
#include "m4math.h"
|
||||
|
||||
class LLCoordGL;
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#include "llviewertexturelist.h"
|
||||
#include "llviewerthrottle.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llwindow.h"
|
||||
#include "llvoavatar.h"
|
||||
#include "llvoiceclient.h"
|
||||
#include "llvosky.h"
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "llvoavatar.h"
|
||||
#include "llviewerobject.h"
|
||||
#include "llviewerwindow.h"
|
||||
#include "llwindow.h"
|
||||
#include "llnetmap.h"
|
||||
#include "llagent.h"
|
||||
#include "llagentcamera.h"
|
||||
|
||||
@@ -1222,11 +1222,16 @@ void LLViewerWindow::handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask
|
||||
|
||||
LLCoordGL prev_saved_mouse_point = mCurrentMousePoint;
|
||||
LLCoordGL mouse_point(x, y);
|
||||
|
||||
if (mouse_point != mCurrentMousePoint)
|
||||
{
|
||||
gMouseIdleTimer.reset();
|
||||
}
|
||||
saveLastMouse(mouse_point);
|
||||
BOOL mouse_actually_moved = !gFocusMgr.getMouseCapture() && // mouse is not currenty captured
|
||||
((prev_saved_mouse_point.mX != mCurrentMousePoint.mX) || (prev_saved_mouse_point.mY != mCurrentMousePoint.mY)); // mouse moved from last recorded position
|
||||
|
||||
gMouseIdleTimer.reset();
|
||||
|
||||
|
||||
mWindow->showCursorFromMouseMove();
|
||||
|
||||
@@ -1574,6 +1579,7 @@ LLViewerWindow::LLViewerWindow(
|
||||
S32 width, S32 height,
|
||||
BOOL fullscreen, BOOL ignore_pixel_depth)
|
||||
:
|
||||
mWindow(NULL),
|
||||
mActive(TRUE),
|
||||
mWantFullscreen(fullscreen),
|
||||
mShowFullscreenProgress(FALSE),
|
||||
@@ -1608,15 +1614,33 @@ LLViewerWindow::LLViewerWindow(
|
||||
resetSnapshotLoc();
|
||||
|
||||
// create window
|
||||
mWindow = LLWindowManager::createWindow(
|
||||
mWindow = LLWindowManager::createWindow(this,
|
||||
title, name, x, y, width, height, 0,
|
||||
fullscreen,
|
||||
gNoRender,
|
||||
gSavedSettings.getBOOL("DisableVerticalSync"),
|
||||
!gNoRender,
|
||||
ignore_pixel_depth,
|
||||
gSavedSettings.getU32("RenderFSAASamples"));
|
||||
gSavedSettings.getBOOL("RenderUseFBO") ? 0 : gSavedSettings.getU32("RenderFSAASamples")); //don't use window level anti-aliasing if FBOs are enabled
|
||||
|
||||
if (NULL == mWindow)
|
||||
{
|
||||
LLSplashScreen::update("Graphics Initialization Failed. Please Update Your Graphics Driver!");
|
||||
|
||||
LL_WARNS("Window") << "Failed to create window, to be shutting Down, be sure your graphics driver is updated." << llendl ;
|
||||
|
||||
ms_sleep(5000) ; //wait for 5 seconds.
|
||||
LLSplashScreen::update("Shutting down...");
|
||||
#if LL_LINUX || LL_SOLARIS
|
||||
llwarns << "Unable to create window, be sure screen is set at 32-bit color and your graphics driver is configured correctly. See README-linux.txt or README-solaris.txt for further information."
|
||||
<< llendl;
|
||||
#else
|
||||
LL_WARNS("Window") << "Unable to create window, be sure screen is set at 32-bit color in Control Panels->Display->Settings"
|
||||
<< LL_ENDL;
|
||||
#endif
|
||||
LLAppViewer::instance()->fastQuit(1);
|
||||
}
|
||||
|
||||
if (!LLAppViewer::instance()->restoreErrorTrap())
|
||||
{
|
||||
LL_WARNS("Window") << " Someone took over my signal/exception handler (post createWindow)!" << LL_ENDL;
|
||||
@@ -1631,19 +1655,6 @@ LLViewerWindow::LLViewerWindow(
|
||||
gSavedSettings.setS32("FullScreenWidth",scr.mX);
|
||||
gSavedSettings.setS32("FullScreenHeight",scr.mY);
|
||||
}
|
||||
|
||||
if (NULL == mWindow)
|
||||
{
|
||||
LLSplashScreen::update("Shutting down...");
|
||||
#if LL_LINUX || LL_SOLARIS
|
||||
llwarns << "Unable to create window, be sure screen is set at 32-bit color and your graphics driver is configured correctly. See README-linux.txt or README-solaris.txt for further information."
|
||||
<< llendl;
|
||||
#else
|
||||
LL_WARNS("Window") << "Unable to create window, be sure screen is set at 32-bit color in Control Panels->Display->Settings"
|
||||
<< LL_ENDL;
|
||||
#endif
|
||||
LLAppViewer::instance()->forceExit(1);
|
||||
}
|
||||
|
||||
// Get the real window rect the window was created with (since there are various OS-dependent reasons why
|
||||
// the size of a window or fullscreen context may have been adjusted slightly...)
|
||||
@@ -1698,12 +1709,8 @@ LLViewerWindow::LLViewerWindow(
|
||||
mInitAlert = "DisplaySettingsNoShaders";
|
||||
LLFeatureManager::getInstance()->setGraphicsLevel(0, false);
|
||||
gSavedSettings.setU32("RenderQualityPerformance", 0);
|
||||
|
||||
}
|
||||
|
||||
// set callbacks
|
||||
mWindow->setCallbacks(this);
|
||||
|
||||
// Init the image list. Must happen after GL is initialized and before the images that
|
||||
// LLViewerWindow needs are requested.
|
||||
LLImageGL::initClass(LLViewerTexture::MAX_GL_IMAGE_CATEGORY) ;
|
||||
@@ -4729,7 +4736,20 @@ void LLViewerWindow::drawMouselookInstructions()
|
||||
LLFontGL::LEFT, LLFontGL::TOP);
|
||||
}
|
||||
|
||||
void* LLViewerWindow::getPlatformWindow() const
|
||||
{
|
||||
return mWindow->getPlatformWindow();
|
||||
}
|
||||
|
||||
void* LLViewerWindow::getMediaWindow() const
|
||||
{
|
||||
return mWindow->getMediaWindow();
|
||||
}
|
||||
|
||||
void LLViewerWindow::focusClient() const
|
||||
{
|
||||
return mWindow->focusClient();
|
||||
}
|
||||
S32 LLViewerWindow::getWindowHeight() const
|
||||
{
|
||||
return mWindowRectScaled.getHeight();
|
||||
@@ -4793,10 +4813,7 @@ void LLViewerWindow::setShowProgress(const BOOL show)
|
||||
}
|
||||
}
|
||||
|
||||
BOOL LLViewerWindow::getShowProgress() const
|
||||
{
|
||||
return (mProgressView && mProgressView->getVisible());
|
||||
}
|
||||
|
||||
|
||||
|
||||
void LLViewerWindow::moveProgressViewToFront()
|
||||
@@ -4808,6 +4825,11 @@ void LLViewerWindow::moveProgressViewToFront()
|
||||
}
|
||||
}
|
||||
|
||||
BOOL LLViewerWindow::getShowProgress() const
|
||||
{
|
||||
return (mProgressView && mProgressView->getVisible());
|
||||
}
|
||||
|
||||
void LLViewerWindow::setProgressString(const std::string& string)
|
||||
{
|
||||
if (mProgressView)
|
||||
|
||||
@@ -44,9 +44,11 @@
|
||||
|
||||
#include "v3dmath.h"
|
||||
#include "v2math.h"
|
||||
#include "llwindow.h"
|
||||
#include "llcursortypes.h"
|
||||
#include "llwindowcallbacks.h"
|
||||
#include "lltimer.h"
|
||||
#include "llstat.h"
|
||||
#include "llmousehandler.h"
|
||||
#include "llalertdialog.h"
|
||||
#include "llnotifications.h"
|
||||
|
||||
@@ -58,8 +60,9 @@ class LLTool;
|
||||
class LLVelocityBar;
|
||||
class LLTextBox;
|
||||
class LLImageRaw;
|
||||
class LLImageFormatted;
|
||||
class LLHUDIcon;
|
||||
class LLMouseHandler;
|
||||
class LLWindow;
|
||||
class AIFilePicker;
|
||||
|
||||
#define PICK_HALF_WIDTH 5
|
||||
@@ -67,6 +70,17 @@ class AIFilePicker;
|
||||
|
||||
class LLPickInfo
|
||||
{
|
||||
public:
|
||||
typedef enum e_pick_type
|
||||
{
|
||||
PICK_OBJECT,
|
||||
PICK_FLORA,
|
||||
PICK_LAND,
|
||||
PICK_ICON,
|
||||
PICK_PARCEL_WALL,
|
||||
PICK_INVALID
|
||||
} EPickType;
|
||||
|
||||
public:
|
||||
LLPickInfo();
|
||||
LLPickInfo(const LLCoordGL& mouse_pos,
|
||||
@@ -80,20 +94,11 @@ public:
|
||||
void fetchResults();
|
||||
LLPointer<LLViewerObject> getObject() const;
|
||||
LLUUID getObjectID() const { return mObjectID; }
|
||||
bool isValid() const { return mPickType != PICK_INVALID; }
|
||||
void drawPickBuffer() const;
|
||||
|
||||
static bool isFlora(LLViewerObject* object);
|
||||
|
||||
typedef enum e_pick_type
|
||||
{
|
||||
PICK_OBJECT,
|
||||
PICK_FLORA,
|
||||
PICK_LAND,
|
||||
PICK_ICON,
|
||||
PICK_PARCEL_WALL,
|
||||
PICK_INVALID
|
||||
} EPickType;
|
||||
|
||||
public:
|
||||
LLCoordGL mMousePt;
|
||||
MASK mKeyMask;
|
||||
@@ -216,9 +221,9 @@ public:
|
||||
|
||||
|
||||
LLWindow* getWindow() const { return mWindow; }
|
||||
void* getPlatformWindow() const { return mWindow->getPlatformWindow(); }
|
||||
void* getMediaWindow() const { return mWindow->getMediaWindow(); }
|
||||
void focusClient() const { return mWindow->focusClient(); };
|
||||
void* getPlatformWindow() const;
|
||||
void* getMediaWindow() const;
|
||||
void focusClient() const;
|
||||
|
||||
LLCoordGL getLastMouse() const { return mLastMousePoint; }
|
||||
S32 getLastMouseX() const { return mLastMousePoint.mX; }
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "llweb.h"
|
||||
|
||||
#include "llviewerwindow.h"
|
||||
#include "llwindow.h"
|
||||
|
||||
#include "llviewercontrol.h"
|
||||
#include "llfloatermediabrowser.h"
|
||||
@@ -64,7 +65,7 @@ void LLWeb::loadURL(const std::string& url)
|
||||
void LLWeb::loadURLExternal(const std::string& url)
|
||||
{
|
||||
std::string escaped_url = escapeURL(url);
|
||||
gViewerWindow->getWindow()->spawnWebBrowser(escaped_url);
|
||||
gViewerWindow->getWindow()->spawnWebBrowser(escaped_url,true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
#include "llui.h"
|
||||
#include "llglheaders.h"
|
||||
#include "llrender.h"
|
||||
#include "llwindow.h"
|
||||
|
||||
// newview includes
|
||||
#include "llagent.h"
|
||||
|
||||
Reference in New Issue
Block a user