From 117e22047c5752352342d64e3fb7ce00a4eb8113 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:45:04 -0500 Subject: Second Life viewer sources 1.18.1.2 --- linden/indra/llwindow/files.sunos5.lst | 4 ++ linden/indra/llwindow/files.win32.lst | 2 + linden/indra/llwindow/llglstubs.h | 2 +- linden/indra/llwindow/llwindowsdl.cpp | 46 ++++++++++-- linden/indra/llwindow/llwindowsolaris.cpp | 58 +++++++++++++++ linden/indra/llwindow/llwindowsolaris.h | 116 ++++++++++++++++++++++++++++++ linden/indra/llwindow/llwindowwin32.cpp | 12 ++++ 7 files changed, 235 insertions(+), 5 deletions(-) create mode 100644 linden/indra/llwindow/files.sunos5.lst create mode 100644 linden/indra/llwindow/files.win32.lst create mode 100644 linden/indra/llwindow/llwindowsolaris.cpp create mode 100644 linden/indra/llwindow/llwindowsolaris.h (limited to 'linden/indra/llwindow') diff --git a/linden/indra/llwindow/files.sunos5.lst b/linden/indra/llwindow/files.sunos5.lst new file mode 100644 index 0000000..ee20b05 --- /dev/null +++ b/linden/indra/llwindow/files.sunos5.lst @@ -0,0 +1,4 @@ +llwindow/llkeyboardsdl.cpp +llwindow/llwindowsdl.cpp +llwindow/llwindowsolaris.cpp +llwindow/llwindowmesaheadless.cpp diff --git a/linden/indra/llwindow/files.win32.lst b/linden/indra/llwindow/files.win32.lst new file mode 100644 index 0000000..1abcb6e --- /dev/null +++ b/linden/indra/llwindow/files.win32.lst @@ -0,0 +1,2 @@ +llwindow/llkeyboardwin32.cpp +llwindow/llwindowwin32.cpp diff --git a/linden/indra/llwindow/llglstubs.h b/linden/indra/llwindow/llglstubs.h index 1d70400..fbbcd1f 100644 --- a/linden/indra/llwindow/llglstubs.h +++ b/linden/indra/llwindow/llglstubs.h @@ -222,7 +222,7 @@ GL_FUNC(void,glArrayObjectATI,(GLenum a, GLint b, GLenum c, GLsizei d, GLuint e, GL_FUNC(void,glVertexAttribArrayObjectATI,(GLuint a, GLint b, GLenum c, GLboolean d, GLsizei e, GLuint f, GLuint g),(a,b,c,d,e,f,g),) // CgGL needs these on Linux... -#if LL_LINUX +#if LL_LINUX || LL_SOLARIS GL_FUNC(void*,glXGetCurrentDisplay,(void),(),return) GL_FUNC(const char *,glXQueryExtensionsString,(void *dpy, int screen),(dpy,screen),return) GL_FUNC(void*,glXGetProcAddressARB,(const GLubyte *fn),(fn),return) diff --git a/linden/indra/llwindow/llwindowsdl.cpp b/linden/indra/llwindow/llwindowsdl.cpp index 94111e7..b38d4d1 100644 --- a/linden/indra/llwindow/llwindowsdl.cpp +++ b/linden/indra/llwindow/llwindowsdl.cpp @@ -47,13 +47,13 @@ extern "C" { } #endif // LL_GTK -#if LL_LINUX +#if LL_LINUX || LL_SOLARIS // not necessarily available on random SDL platforms, so #if LL_LINUX // for execv(), waitpid(), fork() # include # include # include -#endif // LL_LINUX +#endif // LL_LINUX || LL_SOLARIS extern BOOL gDebugWindowProc; @@ -349,6 +349,13 @@ static int x11_detect_VRAM_kb_fp(FILE *fp, const char *prefix_str) static int x11_detect_VRAM_kb() { +#if LL_SOLARIS +#error Can this be done without an explicit architecture test, ie a test FOR xorg? Was followed by: && defined(__sparc) + // NOTE: there's no Xorg server on SPARC so just return 0 + // and allow SDL to attempt to get the amount of VRAM + return(0); +#else + std::string x_log_location("/var/log/"); std::string fname; int rtn = 0; // 'could not detect' @@ -420,6 +427,7 @@ static int x11_detect_VRAM_kb() } } return rtn; +#endif // LL_SOLARIS } #endif // LL_X11 @@ -489,7 +497,24 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE,8); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); +#if !LL_SOLARIS SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, (bits <= 16) ? 16 : 24); +#else + // NOTE- use smaller Z-buffer to enable more graphics cards + // - This should not affect better GPUs and has been proven + // to provide 24-bit z-buffers when available. + // + // As the API states: + // + // GLX_DEPTH_SIZE Must be followed by a nonnegative + // minimum size specification. If this + // value is zero, visuals with no depth + // buffer are preferred. Otherwise, the + // largest available depth buffer of at + // least the minimum size is preferred. + + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); +#endif SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, (bits <= 16) ? 1 : 8); // *FIX: try to toggle vsync here? @@ -655,13 +680,26 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B // fixme: actually, it's REALLY important for picking that we get at // least 8 bits each of red,green,blue. Alpha we can be a bit more // relaxed about if we have to. +#if LL_SOLARIS +#error && defined(__sparc) + if(colorBits < 24) //HACK: on SPARC allow 24-bit color +#else if (colorBits < 32) +#endif { close(); setupFailure( +#if LL_SOLARIS +#error && defined(__sparc) + "Second Life requires at least 24-bit color on SPARC to run in a window.\n" + "Please use fbconfig to set your default color depth to 24 bits.\n" + "You may also need to adjust the X11 setting in SMF. To do so use\n" + " 'svccfg -s svc:/application/x11/x11-server setprop options/default_depth=24'\n" +#else "Second Life requires True Color (32-bit) to run in a window.\n" "Please go to Control Panels -> Display -> Settings and\n" "set the screen to 32-bit color.\n" +#endif "Alternately, if you choose to run fullscreen, Second Life\n" "will automatically adjust the screen each time it runs.", "Error", @@ -2657,7 +2695,7 @@ void spawn_web_browser(const char* escaped_url) { llinfos << "spawn_web_browser: " << escaped_url << llendl; -#if LL_LINUX +#if LL_LINUX || LL_SOLARIS # if LL_X11 if (gWindowImplementation && gWindowImplementation->mSDL_Display) { @@ -2697,7 +2735,7 @@ void spawn_web_browser(const char* escaped_url) llwarns << "fork failure." << llendl; } } -#endif // LL_LINUX +#endif // LL_LINUX || LL_SOLARIS llinfos << "spawn_web_browser returning." << llendl; } diff --git a/linden/indra/llwindow/llwindowsolaris.cpp b/linden/indra/llwindow/llwindowsolaris.cpp new file mode 100644 index 0000000..7e3c3e6 --- /dev/null +++ b/linden/indra/llwindow/llwindowsolaris.cpp @@ -0,0 +1,58 @@ +/** + * @file fmodwrapper.cpp + * @brief dummy source file for building a shared library to wrap libfmod.a + * + * Copyright (c) 2005-2007, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + */ + +#if LL_SOLARIS + +#include "linden_common.h" +#include "indra_constants.h" + +#include "llwindowsolaris.h" +#include "llgl.h" +#include "llglheaders.h" + +// +// LLWindowSolaris +// +LLWindowSolaris::LLWindowSolaris(char *title, char *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) +{ + llerrs << "Solaris window not yet supported" << llendl; +} + + +LLWindowSolaris::~LLWindowSolaris() +{ +} + +void LLWindowSolaris::swapBuffers() +{ +} + +#endif // LL_SOLARIS diff --git a/linden/indra/llwindow/llwindowsolaris.h b/linden/indra/llwindow/llwindowsolaris.h new file mode 100644 index 0000000..57aa9b9 --- /dev/null +++ b/linden/indra/llwindow/llwindowsolaris.h @@ -0,0 +1,116 @@ +/** + * @file fmodwrapper.cpp + * @brief dummy source file for building a shared library to wrap libfmod.a + * + * Copyright (c) 2005-2007, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + */ + +#ifndef LL_LLWINDOWSOLARIS_H +#define LL_LLWINDOWSOLARIS_H + +#include "llwindow.h" + +class LLWindowSolaris : public LLWindow +{ +public: + /*virtual*/ void show() {}; + /*virtual*/ void hide() {}; + /*virtual*/ void close() {}; + /*virtual*/ BOOL getVisible() {return FALSE;}; + /*virtual*/ BOOL getMinimized() {return FALSE;}; + /*virtual*/ BOOL getMaximized() {return FALSE;}; + /*virtual*/ BOOL maximize() {return FALSE;}; + /*virtual*/ BOOL getFullscreen() {return FALSE;}; + /*virtual*/ BOOL getPosition(LLCoordScreen *position) {return FALSE;}; + /*virtual*/ BOOL getSize(LLCoordScreen *size) {return FALSE;}; + /*virtual*/ BOOL getSize(LLCoordWindow *size) {return FALSE;}; + /*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;}; + /*virtual*/ BOOL setSize(LLCoordScreen size) {return FALSE;}; + /*virtual*/ BOOL switchContext(BOOL fullscreen, LLCoordScreen size, BOOL disable_vsync) {return FALSE;}; + /*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;}; + /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;}; + /*virtual*/ void showCursor() {}; + /*virtual*/ void hideCursor() {}; + /*virtual*/ void showCursorFromMouseMove() {}; + /*virtual*/ void hideCursorUntilMouseMove() {}; + /*virtual*/ BOOL isCursorHidden() {return FALSE;}; + /*virtual*/ void setCursor(ECursorType cursor) {}; + //virtual ECursorType getCursor() { return mCurrentCursor; }; + /*virtual*/ void captureMouse() {}; + /*virtual*/ void releaseMouse() {}; + /*virtual*/ void setMouseClipping( BOOL b ) {}; + /*virtual*/ BOOL isClipboardTextAvailable() {return FALSE; }; + /*virtual*/ BOOL pasteTextFromClipboard(LLWString &dst) {return FALSE; }; + /*virtual*/ BOOL copyTextToClipboard(const LLWString &src) {return FALSE; }; + /*virtual*/ void flashIcon(F32 seconds) {}; + /*virtual*/ F32 getGamma() {return 1.0f; }; + /*virtual*/ BOOL setGamma(const F32 gamma) {return FALSE; }; // Set the gamma + /*virtual*/ BOOL restoreGamma() {return FALSE; }; // Restore original gamma table (before updating gamma) + //virtual ESwapMethod getSwapMethod() { return mSwapMethod; } + /*virtual*/ void gatherInput() {}; + /*virtual*/ void delayInputProcessing() {}; + /*virtual*/ void swapBuffers(); + + /*virtual*/ LLString getTempFileName() {return LLString(""); }; + /*virtual*/ void deleteFile( const char* file_name ) {}; + /*virtual*/ S32 stat( const char* file_name, struct stat* stat_info ) {return 0; }; + /*virtual*/ BOOL sendEmail(const char* address,const char* subject,const char* body_text,const char* attachment=NULL, const char* attachment_displayed_name=NULL) { return FALSE; }; + + + // handy coordinate space conversion routines + /*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to) { return FALSE; }; + /*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to) { return FALSE; }; + /*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordGL *to) { return FALSE; }; + /*virtual*/ BOOL convertCoords(LLCoordGL from, LLCoordWindow *to) { return FALSE; }; + /*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordGL *to) { return FALSE; }; + /*virtual*/ BOOL convertCoords(LLCoordGL from, LLCoordScreen *to) { return FALSE; }; + + /*virtual*/ LLWindowResolution* getSupportedResolutions(S32 &num_resolutions) { return NULL; }; + /*virtual*/ F32 getNativeAspectRatio() { return 1.0f; }; + /*virtual*/ F32 getPixelAspectRatio() { return 1.0f; }; + /*virtual*/ void setNativeAspectRatio(F32 ratio) {} + + //virtual BOOL dialog_color_picker (F32 *r, F32 *g, F32 *b ); + + /*virtual*/ void *getPlatformWindow() { return NULL; } + + LLWindowSolaris(char *title, char *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); + ~LLWindowSolaris(); +}; + +class LLSplashScreenLinux : public LLSplashScreen +{ +public: + LLSplashScreenLinux() {}; + virtual ~LLSplashScreenLinux() {}; + + /*virtual*/ void showImpl() {}; + /*virtual*/ void updateImpl(const char* mesg) {}; + /*virtual*/ void hideImpl() {}; + +}; + +#endif //LL_LLWINDOWSOLARIS_H diff --git a/linden/indra/llwindow/llwindowwin32.cpp b/linden/indra/llwindow/llwindowwin32.cpp index 0b3cdd4..3a41d01 100644 --- a/linden/indra/llwindow/llwindowwin32.cpp +++ b/linden/indra/llwindow/llwindowwin32.cpp @@ -1585,6 +1585,11 @@ void LLWindowWin32::moveWindow( const LLCoordScreen& position, const LLCoordScre } } + // if the window was already maximized, MoveWindow seems to still set the maximized flag even if + // the window is smaller than maximized. + // So we're going to do a restore first (which is a ShowWindow call) (SL-44655). + ShowWindow(mWindowHandle, SW_RESTORE); + // NOW we can call MoveWindow MoveWindow(mWindowHandle, position.mX, position.mY, size.mX, size.mY, TRUE); } @@ -2289,6 +2294,13 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ << llendl; } + // There's an odd behavior with WM_SIZE that I would call a bug. If + // the window is maximized, and you call MoveWindow() with a size smaller + // than a maximized window, it ends up sending WM_SIZE with w_param set + // to SIZE_MAXIMIZED -- which isn't true. So the logic below doesn't work. + // (SL-44655). Fixed it by calling ShowWindow(SW_RESTORE) first (see + // LLWindowWin32::moveWindow in this file). + // If we are now restored, but we weren't before, this // means that the window was un-minimized. if (w_param == SIZE_RESTORED && window_imp->mLastSizeWParam != SIZE_RESTORED) -- cgit v1.1