Less intrustive code for legacy cursor support

master
kadah 2011-01-18 17:27:11 -08:00
parent 4353f3b3fa
commit a7e724e6c6
9 changed files with 35 additions and 37 deletions

View File

@ -338,8 +338,7 @@ LLWindow* LLWindowManager::createWindow(
BOOL disable_vsync,
BOOL use_gl,
BOOL ignore_pixel_depth,
U32 fsaa_samples,
BOOL use_legacy_cursors)
U32 fsaa_samples)
{
LLWindow* new_window;
@ -352,15 +351,15 @@ LLWindow* LLWindowManager::createWindow(
#elif LL_SDL
new_window = new LLWindowSDL(callbacks,
title, x, y, width, height, flags,
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples, use_legacy_cursors);
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
#elif LL_WINDOWS
new_window = new LLWindowWin32(callbacks,
title, name, x, y, width, height, flags,
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples, use_legacy_cursors);
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
#elif LL_DARWIN
new_window = new LLWindowMacOSX(callbacks,
title, name, x, y, width, height, flags,
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples, use_legacy_cursors);
fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
#endif
}
else

View File

@ -258,8 +258,7 @@ public:
BOOL disable_vsync = TRUE,
BOOL use_gl = TRUE,
BOOL ignore_pixel_depth = FALSE,
U32 fsaa_samples = 0,
BOOL use_legacy_cursors = TRUE);
U32 fsaa_samples = 0);
static BOOL destroyWindow(LLWindow* window);
static BOOL isWindowValid(LLWindow *window);
};

View File

@ -38,6 +38,7 @@
#include "llstring.h"
#include "lldir.h"
#include "indra_constants.h"
#include "../newview/llviewercontrol.h"
#include <Carbon/Carbon.h>
#include <OpenGL/OpenGL.h>
@ -217,8 +218,7 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
BOOL fullscreen, BOOL clearBg,
BOOL disable_vsync, BOOL use_gl,
BOOL ignore_pixel_depth,
U32 fsaa_samples,
BOOL use_legacy_cursors)
U32 fsaa_samples)
: LLWindow(NULL, fullscreen, flags)
{
// *HACK: During window construction we get lots of OS events for window
@ -320,7 +320,7 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks,
}
//start with arrow cursor
initCursors(use_legacy_cursors);
initCursors();
setCursor( UI_CURSOR_ARROW );
}
@ -2740,8 +2740,9 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e
return result;
}
const char* cursorIDToName(int id, BOOL use_legacy_cursors)
const char* cursorIDToName(int id)
{
BOOL use_legacy_cursors = gSavedSettings.getBOOL("UseLegacyCursors");
switch (id)
{
case UI_CURSOR_ARROW: return "UI_CURSOR_ARROW";
@ -2776,7 +2777,7 @@ const char* cursorIDToName(int id, BOOL use_legacy_cursors)
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_PIPETTE: return "UI_CURSOR_PIPETTE";
case UI_CURSOR_TOOLSIT: if (use_legacy_cursors) return "UI_CURSOR_TOOLSIT_LEGACY"; else return "UI_CURSOR_TOOLSIT";
case UI_CURSOR_TOOLBUY: if (use_legacy_cursors) return "UI_CURSOR_TOOLBUY_LEGACY"; else return "UI_CURSOR_TOOLBUY";
case UI_CURSOR_TOOLOPEN: if (use_legacy_cursors) return "UI_CURSOR_TOOLOPEN_LEGACY"; else return "UI_CURSOR_TOOLOPEN";
@ -2791,14 +2792,14 @@ const char* cursorIDToName(int id, BOOL use_legacy_cursors)
static CursorRef gCursors[UI_CURSOR_COUNT];
static void initPixmapCursor(int cursorid, int hotspotX, int hotspotY, BOOL use_legacy_cursors = TRUE)
static void initPixmapCursor(int cursorid, int hotspotX, int hotspotY)
{
// cursors are in <Application Bundle>/Contents/Resources/cursors_mac/UI_CURSOR_FOO.tif
std::string fullpath = gDirUtilp->getAppRODataDir();
fullpath += gDirUtilp->getDirDelimiter();
fullpath += "cursors_mac";
fullpath += gDirUtilp->getDirDelimiter();
fullpath += cursorIDToName(cursorid, use_legacy_cursors);
fullpath += cursorIDToName(cursorid);
fullpath += ".tif";
gCursors[cursorid] = createImageCursor(fullpath.c_str(), hotspotX, hotspotY);
@ -2905,7 +2906,7 @@ ECursorType LLWindowMacOSX::getCursor() const
return mCurrentCursor;
}
void LLWindowMacOSX::initCursors(BOOL use_legacy_cursors)
void LLWindowMacOSX::initCursors()
{
initPixmapCursor(UI_CURSOR_NO, 8, 8);
initPixmapCursor(UI_CURSOR_WORKING, 1, 1);
@ -2928,10 +2929,10 @@ void LLWindowMacOSX::initCursors(BOOL use_legacy_cursors)
initPixmapCursor(UI_CURSOR_TOOLPLAY, 1, 1);
initPixmapCursor(UI_CURSOR_TOOLPAUSE, 1, 1);
initPixmapCursor(UI_CURSOR_TOOLMEDIAOPEN, 1, 1);
initPixmapCursor(UI_CURSOR_TOOLSIT, 20, 15, use_legacy_cursors);
initPixmapCursor(UI_CURSOR_TOOLBUY, 20, 15, use_legacy_cursors);
initPixmapCursor(UI_CURSOR_TOOLOPEN, 20, 15, use_legacy_cursors);
initPixmapCursor(UI_CURSOR_TOOLPAY, 20, 15, use_legacy_cursors);
initPixmapCursor(UI_CURSOR_TOOLSIT, 20, 15);
initPixmapCursor(UI_CURSOR_TOOLBUY, 20, 15);
initPixmapCursor(UI_CURSOR_TOOLOPEN, 20, 15);
initPixmapCursor(UI_CURSOR_TOOLPAY, 20, 15);
initPixmapCursor(UI_CURSOR_SIZENWSE, 10, 10);
initPixmapCursor(UI_CURSOR_SIZENESW, 10, 10);

View File

@ -123,11 +123,10 @@ protected:
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,
BOOL use_legacy_cursors);
U32 fsaa_samples);
~LLWindowMacOSX();
void initCursors(BOOL use_legacy_cursors = TRUE);
void initCursors();
BOOL isValid();
void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size);

View File

@ -39,6 +39,7 @@
#include "llstring.h"
#include "lldir.h"
#include "llfindlocale.h"
#include "../newview/llviewercontrol.h"
#if LL_GTK
extern "C" {
@ -187,7 +188,7 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks,
S32 height, U32 flags,
BOOL fullscreen, BOOL clearBg,
BOOL disable_vsync, BOOL use_gl,
BOOL ignore_pixel_depth, U32 fsaa_samples, BOOL use_legacy_cursors)
BOOL ignore_pixel_depth, U32 fsaa_samples)
: LLWindow(callbacks, fullscreen, flags),
Lock_Display(NULL),
Unlock_Display(NULL), mGamma(1.0f)
@ -233,7 +234,7 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks,
gGLManager.initGL();
//start with arrow cursor
initCursors(use_legacy_cursors);
initCursors();
setCursor( UI_CURSOR_ARROW );
}
@ -2023,7 +2024,7 @@ void LLWindowSDL::setCursor(ECursorType cursor)
}
}
void LLWindowSDL::initCursors(BOOL use_legacy_cursors)
void LLWindowSDL::initCursors()
{
int i;
// Blank the cursor pointer array for those we may miss.
@ -2068,7 +2069,7 @@ void LLWindowSDL::initCursors(BOOL use_legacy_cursors)
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);
if (use_legacy_cursors) {
if (gSavedSettings.getBOOL("UseLegacyCursors")) {
mSDLCursors[UI_CURSOR_TOOLSIT] = makeSDLCursorFromBMP("toolsit-legacy.BMP",20,15);
mSDLCursors[UI_CURSOR_TOOLBUY] = makeSDLCursorFromBMP("toolbuy-legacy.BMP",20,15);
mSDLCursors[UI_CURSOR_TOOLOPEN] = makeSDLCursorFromBMP("toolopen-legacy.BMP",20,15);

View File

@ -146,13 +146,13 @@ protected:
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, BOOL use_legacy_cursors);
BOOL ignore_pixel_depth, U32 fsaa_samples);
~LLWindowSDL();
/*virtual*/ BOOL isValid();
/*virtual*/ LLSD getNativeKeyData();
void initCursors(BOOL use_legacy_cursors = TRUE);
void initCursors();
void quitCursors();
void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size);

View File

@ -41,6 +41,7 @@
#include "llgl.h"
#include "llstring.h"
#include "lldir.h"
#include "../newview/llviewercontrol.h"
// System includes
#include <commdlg.h>
@ -363,8 +364,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
BOOL fullscreen, BOOL clearBg,
BOOL disable_vsync, BOOL use_gl,
BOOL ignore_pixel_depth,
U32 fsaa_samples,
BOOL use_legacy_cursors)
U32 fsaa_samples)
: LLWindow(callbacks, fullscreen, flags)
{
mFSAASamples = fsaa_samples;
@ -613,7 +613,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
}
//start with arrow cursor
initCursors(use_legacy_cursors);
initCursors();
setCursor( UI_CURSOR_ARROW );
// Initialize (boot strap) the Language text input management,
@ -1505,7 +1505,7 @@ HCURSOR LLWindowWin32::loadColorCursor(LPCTSTR name)
}
void LLWindowWin32::initCursors(BOOL use_legacy_cursors)
void LLWindowWin32::initCursors()
{
mCursor[ UI_CURSOR_ARROW ] = LoadCursor(NULL, IDC_ARROW);
mCursor[ UI_CURSOR_WAIT ] = LoadCursor(NULL, IDC_WAIT);
@ -1539,7 +1539,7 @@ void LLWindowWin32::initCursors(BOOL use_legacy_cursors)
mCursor[ UI_CURSOR_TOOLZOOMIN ] = LoadCursor(module, TEXT("TOOLZOOMIN"));
mCursor[ UI_CURSOR_TOOLPICKOBJECT3 ] = LoadCursor(module, TEXT("TOOLPICKOBJECT3"));
mCursor[ UI_CURSOR_PIPETTE ] = LoadCursor(module, TEXT("TOOLPIPETTE"));
if (use_legacy_cursors)
if (gSavedSettings.getBOOL("UseLegacyCursors"))
{
mCursor[ UI_CURSOR_TOOLSIT ] = LoadCursor(module, TEXT("TOOLSIT-LEGACY"));
mCursor[ UI_CURSOR_TOOLBUY ] = LoadCursor(module, TEXT("TOOLBUY-LEGACY"));

View File

@ -118,10 +118,10 @@ protected:
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, BOOL use_legacy_cursors);
BOOL ignore_pixel_depth, U32 fsaa_samples);
~LLWindowWin32();
void initCursors(BOOL use_legacy_cursors = TRUE);
void initCursors();
void initInputDevices();
HCURSOR loadColorCursor(LPCTSTR name);
BOOL isValid();

View File

@ -1358,8 +1358,7 @@ LLViewerWindow::LLViewerWindow(
gSavedSettings.getBOOL("DisableVerticalSync"),
!gNoRender,
ignore_pixel_depth,
gSavedSettings.getBOOL("RenderUseFBO") ? 0 : gSavedSettings.getU32("RenderFSAASamples"), //don't use window level anti-aliasing if FBOs are enabled
gSavedSettings.getBOOL("UseLegacyCursors"));
gSavedSettings.getBOOL("RenderUseFBO") ? 0 : gSavedSettings.getU32("RenderFSAASamples")); //don't use window level anti-aliasing if FBOs are enabled
if (!LLAppViewer::instance()->restoreErrorTrap())
{