summaryrefslogtreecommitdiff
path: root/indra/llwindow/llwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llwindow/llwindow.cpp')
-rw-r--r--indra/llwindow/llwindow.cpp118
1 files changed, 60 insertions, 58 deletions
diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp
index 9cc11091b6..93ac58ca6f 100644
--- a/indra/llwindow/llwindow.cpp
+++ b/indra/llwindow/llwindow.cpp
@@ -27,18 +27,19 @@
#include "linden_common.h"
#include "llwindowheadless.h"
-#if LL_MESA_HEADLESS
-#include "llwindowmesaheadless.h"
-#elif LL_SDL
-#include "llwindowsdl.h"
-#elif LL_WINDOWS
+#if LL_WINDOWS
#include "llwindowwin32.h"
#elif LL_DARWIN
#include "llwindowmacosx.h"
+#elif LL_MESA_HEADLESS
+#include "llwindowmesaheadless.h"
+#elif LL_LINUX
+#include "llwindowsdl.h"
#endif
#include "llerror.h"
#include "llkeyboard.h"
+#include "llsdl.h"
#include "llwindowcallbacks.h"
@@ -46,8 +47,8 @@
// Globals
//
LLSplashScreen *gSplashScreenp = NULL;
-BOOL gDebugClicks = FALSE;
-BOOL gDebugWindowProc = FALSE;
+bool gDebugClicks = false;
+bool gDebugWindowProc = false;
const S32 gURLProtocolWhitelistCount = 5;
const std::string gURLProtocolWhitelist[] = { "secondlife:", "http:", "https:", "data:", "mailto:" };
@@ -63,22 +64,22 @@ const std::string gURLProtocolWhitelist[] = { "secondlife:", "http:", "https:",
S32 OSMessageBox(const std::string& text, const std::string& caption, U32 type)
{
// Properly hide the splash screen when displaying the message box
- BOOL was_visible = FALSE;
+ bool was_visible = false;
if (LLSplashScreen::isVisible())
{
- was_visible = TRUE;
+ was_visible = true;
LLSplashScreen::hide();
}
S32 result = 0;
-#if LL_MESA_HEADLESS // !!! *FIX: (?)
LL_WARNS() << "OSMessageBox: " << text << LL_ENDL;
- return OSBTN_OK;
-#elif LL_WINDOWS
+#if LL_WINDOWS
result = OSMessageBoxWin32(text, caption, type);
#elif LL_DARWIN
result = OSMessageBoxMacOSX(text, caption, type);
-#elif LL_SDL
+#elif LL_MESA_HEADLESS // !!! *FIX: (?)
+ return OSBTN_OK;
+#elif LL_LINUX
result = OSMessageBoxSDL(text, caption, type);
#else
#error("OSMessageBox not implemented for this platform!")
@@ -97,9 +98,9 @@ S32 OSMessageBox(const std::string& text, const std::string& caption, U32 type)
// LLWindow
//
-LLWindow::LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags)
+LLWindow::LLWindow(LLWindowCallbacks* callbacks, bool fullscreen, U32 flags)
: mCallbacks(callbacks),
- mPostQuit(TRUE),
+ mPostQuit(true),
mFullscreen(fullscreen),
mFullscreenWidth(0),
mFullscreenHeight(0),
@@ -109,13 +110,13 @@ LLWindow::LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags)
mNumSupportedResolutions(0),
mCurrentCursor(UI_CURSOR_ARROW),
mNextCursor(UI_CURSOR_ARROW),
- mCursorHidden(FALSE),
+ mCursorHidden(false),
mBusyCount(0),
- mIsMouseClipping(FALSE),
+ mIsMouseClipping(false),
mMinWindowWidth(0),
mMinWindowHeight(0),
mSwapMethod(SWAP_METHOD_UNDEFINED),
- mHideCursorPermanent(FALSE),
+ mHideCursorPermanent(false),
mFlags(flags),
mHighSurrogate(0),
mRefreshRate(0)
@@ -127,15 +128,15 @@ LLWindow::~LLWindow()
}
//virtual
-BOOL LLWindow::isValid()
+bool LLWindow::isValid()
{
- return TRUE;
+ return true;
}
//virtual
-BOOL LLWindow::canDelete()
+bool LLWindow::canDelete()
{
- return TRUE;
+ return true;
}
//virtual
@@ -178,9 +179,9 @@ ECursorType LLWindow::getCursor() const
}
//virtual
-BOOL LLWindow::dialogColorPicker(F32 *r, F32 *g, F32 *b)
+bool LLWindow::dialogColorPicker(F32 *r, F32 *g, F32 *b)
{
- return FALSE;
+ return false;
}
void *LLWindow::getMediaWindow()
@@ -189,7 +190,7 @@ void *LLWindow::getMediaWindow()
return getPlatformWindow();
}
-BOOL LLWindow::setSize(LLCoordScreen size)
+bool LLWindow::setSize(LLCoordScreen size)
{
if (!getMaximized())
{
@@ -199,7 +200,7 @@ BOOL LLWindow::setSize(LLCoordScreen size)
return setSizeImpl(size);
}
-BOOL LLWindow::setSize(LLCoordWindow size)
+bool LLWindow::setSize(LLCoordWindow size)
{
//HACK: we are inconsistently using minimum window dimensions
// in this case, we are constraining the inner "client" rect and other times
@@ -241,19 +242,19 @@ void LLWindow::processMiscNativeEvents()
}
//virtual
-BOOL LLWindow::isPrimaryTextAvailable()
+bool LLWindow::isPrimaryTextAvailable()
{
- return FALSE; // no
+ return false; // no
}
//virtual
-BOOL LLWindow::pasteTextFromPrimary(LLWString &dst)
+bool LLWindow::pasteTextFromPrimary(LLWString &dst)
{
- return FALSE; // fail
+ return false; // fail
}
// virtual
-BOOL LLWindow::copyTextToPrimary(const LLWString &src)
+bool LLWindow::copyTextToPrimary(const LLWString &src)
{
- return FALSE; // fail
+ return false; // fail
}
// static
@@ -263,7 +264,7 @@ std::vector<std::string> LLWindow::getDynamicFallbackFontList()
return LLWindowWin32::getDynamicFallbackFontList();
#elif LL_DARWIN
return LLWindowMacOSX::getDynamicFallbackFontList();
-#elif LL_SDL
+#elif LL_LINUX
return LLWindowSDL::getDynamicFallbackFontList();
#else
return std::vector<std::string>();
@@ -336,18 +337,18 @@ void LLWindow::handleUnicodeUTF16(U16 utf16, MASK mask)
// static
bool LLSplashScreen::isVisible()
{
- return gSplashScreenp ? true: false;
+ return gSplashScreenp;
}
// static
LLSplashScreen *LLSplashScreen::create()
{
-#if LL_MESA_HEADLESS || LL_SDL // !!! *FIX: (?)
- return 0;
-#elif LL_WINDOWS
+#if LL_WINDOWS
return new LLSplashScreenWin32;
#elif LL_DARWIN
return new LLSplashScreenMacOSX;
+#elif LL_MESA_HEADLESS || LL_LINUX // !!! *FIX: (?)
+ return 0;
#else
#error("LLSplashScreen not implemented on this platform!")
#endif
@@ -402,36 +403,36 @@ static std::set<LLWindow*> sWindowList;
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,
- BOOL enable_vsync,
- BOOL use_gl,
- BOOL ignore_pixel_depth,
+ bool fullscreen,
+ bool clearBg,
+ bool enable_vsync,
+ bool use_gl,
+ bool ignore_pixel_depth,
U32 fsaa_samples,
U32 max_cores,
- U32 max_vram,
F32 max_gl_version)
{
LLWindow* new_window;
if (use_gl)
{
-#if LL_MESA_HEADLESS
- new_window = new LLWindowMesaHeadless(callbacks,
- title, name, x, y, width, height, flags,
- fullscreen, clearBg, enable_vsync, use_gl, ignore_pixel_depth);
-#elif LL_SDL
- new_window = new LLWindowSDL(callbacks,
- title, x, y, width, height, flags,
- fullscreen, clearBg, enable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
-#elif LL_WINDOWS
+ init_sdl();
+#if LL_WINDOWS
new_window = new LLWindowWin32(callbacks,
title, name, x, y, width, height, flags,
- fullscreen, clearBg, enable_vsync, use_gl, ignore_pixel_depth, fsaa_samples, max_cores, max_vram, max_gl_version);
+ fullscreen, clearBg, enable_vsync, use_gl, ignore_pixel_depth, fsaa_samples, max_cores, max_gl_version);
#elif LL_DARWIN
new_window = new LLWindowMacOSX(callbacks,
title, name, x, y, width, height, flags,
fullscreen, clearBg, enable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
+#elif LL_MESA_HEADLESS
+ new_window = new LLWindowMesaHeadless(callbacks,
+ title, name, x, y, width, height, flags,
+ fullscreen, clearBg, enable_vsync, use_gl, ignore_pixel_depth);
+#elif LL_LINUX
+ new_window = new LLWindowSDL(callbacks,
+ title, name, x, y, width, height, flags,
+ fullscreen, clearBg, enable_vsync, use_gl, ignore_pixel_depth, fsaa_samples);
#endif
}
else
@@ -441,7 +442,7 @@ LLWindow* LLWindowManager::createWindow(
fullscreen, clearBg, enable_vsync, use_gl, ignore_pixel_depth);
}
- if (FALSE == new_window->isValid())
+ if (false == new_window->isValid())
{
delete new_window;
LL_WARNS() << "LLWindowManager::create() : Error creating window." << LL_ENDL;
@@ -451,25 +452,26 @@ LLWindow* LLWindowManager::createWindow(
return new_window;
}
-BOOL LLWindowManager::destroyWindow(LLWindow* window)
+bool LLWindowManager::destroyWindow(LLWindow* window)
{
if (sWindowList.find(window) == sWindowList.end())
{
LL_ERRS() << "LLWindowManager::destroyWindow() : Window pointer not valid, this window doesn't exist!"
<< LL_ENDL;
- return FALSE;
+ return false;
}
window->close();
sWindowList.erase(window);
+ quit_sdl();
delete window;
- return TRUE;
+ return true;
}
-BOOL LLWindowManager::isWindowValid(LLWindow *window)
+bool LLWindowManager::isWindowValid(LLWindow *window)
{
return sWindowList.find(window) != sWindowList.end();
}