diff options
Diffstat (limited to 'indra/llwindow')
31 files changed, 995 insertions, 1222 deletions
diff --git a/indra/llwindow/lldragdropwin32.cpp b/indra/llwindow/lldragdropwin32.cpp index b164eb9579..15490ef953 100644 --- a/indra/llwindow/lldragdropwin32.cpp +++ b/indra/llwindow/lldragdropwin32.cpp @@ -124,7 +124,7 @@ class LLDragDropWin32Target: ScreenToClient( mAppWindowHandle, &pt2 ); LLCoordWindow cursor_coord_window( pt2.x, pt2.y ); - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); LLWindowCallbacks::DragNDropResult result = window_imp->completeDragNDropRequest( cursor_coord_window.convert(), mask, LLWindowCallbacks::DNDA_START_TRACKING, mDropUrl ); @@ -179,7 +179,7 @@ class LLDragDropWin32Target: ScreenToClient( mAppWindowHandle, &pt2 ); LLCoordWindow cursor_coord_window( pt2.x, pt2.y ); - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); LLWindowCallbacks::DragNDropResult result = window_imp->completeDragNDropRequest( cursor_coord_window.convert(), mask, LLWindowCallbacks::DNDA_TRACK, mDropUrl ); @@ -219,7 +219,7 @@ class LLDragDropWin32Target: if (NULL != window_imp) { LLCoordGL gl_coord( 0, 0 ); - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); window_imp->completeDragNDropRequest( gl_coord, mask, LLWindowCallbacks::DNDA_STOP_TRACKING, mDropUrl ); }; return S_OK; @@ -249,7 +249,7 @@ class LLDragDropWin32Target: LL_INFOS() << LL_ENDL; // no keyboard modifier option yet but we could one day - MASK mask = gKeyboard->currentMask( TRUE ); + MASK mask = gKeyboard->currentMask( true ); // actually do the drop LLWindowCallbacks::DragNDropResult result = window_imp->completeDragNDropRequest( gl_coord, mask, @@ -312,7 +312,7 @@ LLDragDropWin32::~LLDragDropWin32() bool LLDragDropWin32::init( HWND hWnd ) { if ( NOERROR != OleInitialize( NULL ) ) - return FALSE; + return false; mDropTarget = new LLDragDropWin32Target( hWnd ); if ( mDropTarget ) diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp index f972e8f628..d916d95713 100644 --- a/indra/llwindow/lldxhardware.cpp +++ b/indra/llwindow/lldxhardware.cpp @@ -216,7 +216,7 @@ HRESULT GetVideoMemoryViaWMI(WCHAR* strInputDeviceID, DWORD* pdwAdapterRam) } //static -S32 LLDXHardware::getMBVideoMemoryViaWMI() +U32 LLDXHardware::getMBVideoMemoryViaWMI() { DWORD vram = 0; if (SUCCEEDED(GetVideoMemoryViaWMI(NULL, &vram))) @@ -454,10 +454,10 @@ void get_wstring(IDxDiagContainer* containerp, WCHAR* wszPropName, WCHAR* wszPro switch( var.vt ) { case VT_UI4: - swprintf( wszPropValue, L"%d", var.ulVal ); /* Flawfinder: ignore */ + swprintf( wszPropValue, outputSize, L"%d", var.ulVal ); /* Flawfinder: ignore */ break; case VT_I4: - swprintf( wszPropValue, L"%d", var.lVal ); /* Flawfinder: ignore */ + swprintf( wszPropValue, outputSize, L"%d", var.lVal ); /* Flawfinder: ignore */ break; case VT_BOOL: wcscpy( wszPropValue, (var.boolVal) ? L"true" : L"false" ); /* Flawfinder: ignore */ @@ -483,7 +483,7 @@ std::string get_string(IDxDiagContainer *containerp, WCHAR *wszPropName) LLVersion::LLVersion() { - mValid = FALSE; + mValid = false; S32 i; for (i = 0; i < 4; i++) { @@ -491,7 +491,7 @@ LLVersion::LLVersion() } } -BOOL LLVersion::set(const std::string &version_string) +bool LLVersion::set(const std::string &version_string) { S32 i; for (i = 0; i < 4; i++) @@ -518,11 +518,11 @@ BOOL LLVersion::set(const std::string &version_string) { mFields[i] = 0; } - mValid = FALSE; + mValid = false; } else { - mValid = TRUE; + mValid = true; } return mValid; } @@ -678,10 +678,10 @@ LLDXDevice *LLDXHardware::findDevice(const std::string &vendor, const std::strin } */ -BOOL LLDXHardware::getInfo(BOOL vram_only) +bool LLDXHardware::getInfo(bool vram_only) { LLTimer hw_timer; - BOOL ok = FALSE; + bool ok = false; HRESULT hr; // CLSID_DxDiagProvider does not work with Multithreaded? @@ -809,7 +809,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only) if (vram_only) { - ok = TRUE; + ok = true; goto LCleanup; } @@ -869,7 +869,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only) tokenizer::iterator iter = tokens.begin(); S32 count = 0; - BOOL valid = TRUE; + bool valid = true; for (;(iter != tokens.end()) && (count < 3);++iter) { switch (count) @@ -877,7 +877,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only) case 0: if (strcmp(iter->c_str(), "PCI")) { - valid = FALSE; + valid = false; } break; case 1: @@ -948,7 +948,7 @@ BOOL LLDXHardware::getInfo(BOOL vram_only) } // dumpDevices(); - ok = TRUE; + ok = true; LCleanup: if (!ok) diff --git a/indra/llwindow/lldxhardware.h b/indra/llwindow/lldxhardware.h index 12273e97bc..2b879e021c 100644 --- a/indra/llwindow/lldxhardware.h +++ b/indra/llwindow/lldxhardware.h @@ -37,12 +37,12 @@ class LLVersion { public: LLVersion(); - BOOL set(const std::string &version_string); + bool set(const std::string &version_string); S32 getField(const S32 field_num); protected: std::string mVersionString; S32 mFields[4]; - BOOL mValid; + bool mValid; }; class LLDXDriverFile @@ -84,9 +84,9 @@ public: void setWriteDebugFunc(void (*func)(const char*)); void cleanup(); - // Returns TRUE on success. - // vram_only TRUE does a "light" probe. - BOOL getInfo(BOOL vram_only); + // Returns true on success. + // vram_only true does a "light" probe. + bool getInfo(bool vram_only); // WMI can return multiple GPU drivers // specify which one to output @@ -104,7 +104,7 @@ public: // Will get memory of best GPU in MB, return memory on sucsess, 0 on failure // Note: WMI is not accurate in some cases - static S32 getMBVideoMemoryViaWMI(); + static U32 getMBVideoMemoryViaWMI(); // Find a particular device that matches the following specs. // Empty strings indicate that you don't care. diff --git a/indra/llwindow/llkeyboard.cpp b/indra/llwindow/llkeyboard.cpp index d4b0743f32..d76a90e98a 100644 --- a/indra/llwindow/llkeyboard.cpp +++ b/indra/llwindow/llkeyboard.cpp @@ -54,10 +54,10 @@ LLKeyboard::LLKeyboard() : mCallbacks(NULL) for (i = 0; i < KEY_COUNT; i++) { mKeyLevelFrameCount[i] = 0; - mKeyLevel[i] = FALSE; - mKeyUp[i] = FALSE; - mKeyDown[i] = FALSE; - mKeyRepeated[i] = FALSE; + mKeyLevel[i] = false; + mKeyUp[i] = false; + mKeyDown[i] = false; + mKeyRepeated[i] = false; } mInsertMode = LL_KIM_INSERT; @@ -149,14 +149,14 @@ void LLKeyboard::addKeyName(KEY key, const std::string& name) void LLKeyboard::resetKeyDownAndHandle() { - MASK mask = currentMask(FALSE); + MASK mask = currentMask(false); for (S32 i = 0; i < KEY_COUNT; i++) { if (mKeyLevel[i]) { - mKeyDown[i] = FALSE; - mKeyLevel[i] = FALSE; - mKeyUp[i] = TRUE; + mKeyDown[i] = false; + mKeyLevel[i] = false; + mKeyUp[i] = true; mCurTranslatedKey = (KEY)i; mCallbacks->handleTranslatedKeyUp(i, mask); } @@ -173,28 +173,28 @@ void LLKeyboard::resetKeys() { if( mKeyLevel[i] ) { - mKeyLevel[i] = FALSE; + mKeyLevel[i] = false; } } for (i = 0; i < KEY_COUNT; i++) { - mKeyUp[i] = FALSE; + mKeyUp[i] = false; } for (i = 0; i < KEY_COUNT; i++) { - mKeyDown[i] = FALSE; + mKeyDown[i] = false; } for (i = 0; i < KEY_COUNT; i++) { - mKeyRepeated[i] = FALSE; + mKeyRepeated[i] = false; } } -BOOL LLKeyboard::translateKey(const NATIVE_KEY_TYPE os_key, KEY *out_key) +bool LLKeyboard::translateKey(const NATIVE_KEY_TYPE os_key, KEY *out_key) { // Only translate keys in the map, ignore all other keys for now @@ -203,12 +203,12 @@ BOOL LLKeyboard::translateKey(const NATIVE_KEY_TYPE os_key, KEY *out_key) { //LL_WARNS() << "Unknown virtual key " << os_key << LL_ENDL; *out_key = 0; - return FALSE; + return false; } else { *out_key = iter->second; - return TRUE; + return true; } } @@ -226,47 +226,47 @@ LLKeyboard::NATIVE_KEY_TYPE LLKeyboard::inverseTranslateKey(const KEY translated } -BOOL LLKeyboard::handleTranslatedKeyDown(KEY translated_key, U32 translated_mask) +bool LLKeyboard::handleTranslatedKeyDown(KEY translated_key, U32 translated_mask) { - BOOL handled = FALSE; - BOOL repeated = FALSE; + bool handled = false; + bool repeated = false; // is this the first time the key went down? // if so, generate "character" message if( !mKeyLevel[translated_key] ) { - mKeyLevel[translated_key] = TRUE; + mKeyLevel[translated_key] = true; mKeyLevelTimer[translated_key].reset(); mKeyLevelFrameCount[translated_key] = 0; - mKeyRepeated[translated_key] = FALSE; + mKeyRepeated[translated_key] = false; } else { // Level is already down, assume it's repeated. - repeated = TRUE; - mKeyRepeated[translated_key] = TRUE; + repeated = true; + mKeyRepeated[translated_key] = true; } - mKeyDown[translated_key] = TRUE; + mKeyDown[translated_key] = true; mCurTranslatedKey = (KEY)translated_key; handled = mCallbacks->handleTranslatedKeyDown(translated_key, translated_mask, repeated); return handled; } -BOOL LLKeyboard::handleTranslatedKeyUp(KEY translated_key, U32 translated_mask) +bool LLKeyboard::handleTranslatedKeyUp(KEY translated_key, U32 translated_mask) { - BOOL handled = FALSE; + bool handled = false; if( mKeyLevel[translated_key] ) { - mKeyLevel[translated_key] = FALSE; + mKeyLevel[translated_key] = false; // Only generate key up events if the key is thought to // be down. This allows you to call resetKeys() in the // middle of a frame and ignore subsequent KEY_UP // messages in the same frame. This was causing the // sequence W<return> in chat to move agents forward. JC - mKeyUp[translated_key] = TRUE; + mKeyUp[translated_key] = true; handled = mCallbacks->handleTranslatedKeyUp(translated_key, translated_mask); } @@ -302,14 +302,14 @@ S32 LLKeyboard::getKeyElapsedFrameCount(KEY key) } // static -BOOL LLKeyboard::keyFromString(const std::string& str, KEY *key) +bool LLKeyboard::keyFromString(const std::string& str, KEY *key) { std::string instring(str); size_t length = instring.size(); if (length < 1) { - return FALSE; + return false; } if (length == 1) { @@ -322,7 +322,7 @@ BOOL LLKeyboard::keyFromString(const std::string& str, KEY *key) ('{' <= ch && ch <= '~')) // {|}~ { *key = ch; - return TRUE; + return true; } } @@ -331,10 +331,10 @@ BOOL LLKeyboard::keyFromString(const std::string& str, KEY *key) if (res != 0) { *key = res; - return TRUE; + return true; } LL_WARNS() << "keyFromString failed: " << str << LL_ENDL; - return FALSE; + return false; } @@ -482,52 +482,52 @@ std::string LLKeyboard::stringFromAccelerator(MASK accel_mask, EMouseClickType c } //static -BOOL LLKeyboard::maskFromString(const std::string& str, MASK *mask) +bool LLKeyboard::maskFromString(const std::string& str, MASK *mask) { std::string instring(str); if (instring == "NONE") { *mask = MASK_NONE; - return TRUE; + return true; } else if (instring == "SHIFT") { *mask = MASK_SHIFT; - return TRUE; + return true; } else if (instring == "CTL") { *mask = MASK_CONTROL; - return TRUE; + return true; } else if (instring == "ALT") { *mask = MASK_ALT; - return TRUE; + return true; } else if (instring == "CTL_SHIFT") { *mask = MASK_CONTROL | MASK_SHIFT; - return TRUE; + return true; } else if (instring == "ALT_SHIFT") { *mask = MASK_ALT | MASK_SHIFT; - return TRUE; + return true; } else if (instring == "CTL_ALT") { *mask = MASK_CONTROL | MASK_ALT; - return TRUE; + return true; } else if (instring == "CTL_ALT_SHIFT") { *mask = MASK_CONTROL | MASK_ALT | MASK_SHIFT; - return TRUE; + return true; } else { - return FALSE; + return false; } } diff --git a/indra/llwindow/llkeyboard.h b/indra/llwindow/llkeyboard.h index 2800b9fb60..83ce6e5b04 100644 --- a/indra/llwindow/llkeyboard.h +++ b/indra/llwindow/llkeyboard.h @@ -69,19 +69,19 @@ public: F32 getCurKeyElapsedTime() { return getKeyDown(mCurScanKey) ? getKeyElapsedTime( mCurScanKey ) : 0.f; } F32 getCurKeyElapsedFrameCount() { return getKeyDown(mCurScanKey) ? (F32)getKeyElapsedFrameCount( mCurScanKey ) : 0.f; } - BOOL getKeyDown(const KEY key) { return mKeyLevel[key]; } - BOOL getKeyRepeated(const KEY key) { return mKeyRepeated[key]; } + bool getKeyDown(const KEY key) { return mKeyLevel[key]; } + bool getKeyRepeated(const KEY key) { return mKeyRepeated[key]; } - BOOL translateKey(const NATIVE_KEY_TYPE os_key, KEY *translated_key); + bool translateKey(const NATIVE_KEY_TYPE os_key, KEY *translated_key); NATIVE_KEY_TYPE inverseTranslateKey(const KEY translated_key); - BOOL handleTranslatedKeyUp(KEY translated_key, U32 translated_mask); // Translated into "Linden" keycodes - BOOL handleTranslatedKeyDown(KEY translated_key, U32 translated_mask); // Translated into "Linden" keycodes + bool handleTranslatedKeyUp(KEY translated_key, U32 translated_mask); // Translated into "Linden" keycodes + bool handleTranslatedKeyDown(KEY translated_key, U32 translated_mask); // Translated into "Linden" keycodes - virtual BOOL handleKeyUp(const NATIVE_KEY_TYPE key, MASK mask) = 0; - virtual BOOL handleKeyDown(const NATIVE_KEY_TYPE key, MASK mask) = 0; + virtual bool handleKeyUp(const NATIVE_KEY_TYPE key, MASK mask) = 0; + virtual bool handleKeyDown(const NATIVE_KEY_TYPE key, MASK mask) = 0; #if defined(LL_DARWIN) && !defined(LL_SDL) - // We only actually use this for OS X. + // We only actually use this for macOS. virtual void handleModifier(MASK mask) = 0; #endif // LL_DARWIN @@ -91,14 +91,14 @@ public: virtual void scanKeyboard() = 0; // scans keyboard, calls functions as necessary // Mac must differentiate between Command = Control for keyboard events // and Command != Control for mouse events. - virtual MASK currentMask(BOOL for_mouse_event) = 0; + virtual MASK currentMask(bool for_mouse_event) = 0; virtual KEY currentKey() { return mCurTranslatedKey; } EKeyboardInsertMode getInsertMode() { return mInsertMode; } void toggleInsertMode(); - static BOOL maskFromString(const std::string& str, MASK *mask); // False on failure - static BOOL keyFromString(const std::string& str, KEY *key); // False on failure + static bool maskFromString(const std::string& str, MASK *mask); // False on failure + static bool keyFromString(const std::string& str, KEY *key); // False on failure static std::string stringFromKey(KEY key, bool translate = true); static std::string stringFromMouse(EMouseClickType click, bool translate = true); static std::string stringFromAccelerator( MASK accel_mask ); // separated for convinience, returns with "+": "Shift+" or "Shift+Alt+"... @@ -121,10 +121,10 @@ protected: LLTimer mKeyLevelTimer[KEY_COUNT]; // Time since level was set S32 mKeyLevelFrameCount[KEY_COUNT]; // Frames since level was set - BOOL mKeyLevel[KEY_COUNT]; // Levels - BOOL mKeyRepeated[KEY_COUNT]; // Key was repeated - BOOL mKeyUp[KEY_COUNT]; // Up edge - BOOL mKeyDown[KEY_COUNT]; // Down edge + bool mKeyLevel[KEY_COUNT]; // Levels + bool mKeyRepeated[KEY_COUNT]; // Key was repeated + bool mKeyUp[KEY_COUNT]; // Up edge + bool mKeyDown[KEY_COUNT]; // Down edge KEY mCurTranslatedKey; KEY mCurScanKey; // Used during the scanKeyboard() diff --git a/indra/llwindow/llkeyboardheadless.cpp b/indra/llwindow/llkeyboardheadless.cpp index 265d7e6c76..6f8c829dd5 100644 --- a/indra/llwindow/llkeyboardheadless.cpp +++ b/indra/llwindow/llkeyboardheadless.cpp @@ -38,7 +38,7 @@ void LLKeyboardHeadless::resetMaskKeys() -MASK LLKeyboardHeadless::currentMask(BOOL for_mouse_event) +MASK LLKeyboardHeadless::currentMask(bool for_mouse_event) { return MASK_NONE; } #ifdef LL_DARWIN @@ -65,8 +65,8 @@ void LLKeyboardHeadless::scanKeyboard() // Reset edges for next frame for (S32 key = 0; key < KEY_COUNT; key++) { - mKeyUp[key] = FALSE; - mKeyDown[key] = FALSE; + mKeyUp[key] = false; + mKeyDown[key] = false; if (mKeyLevel[key]) { mKeyLevelFrameCount[key]++; diff --git a/indra/llwindow/llkeyboardheadless.h b/indra/llwindow/llkeyboardheadless.h index 595f824872..439abaf25b 100644 --- a/indra/llwindow/llkeyboardheadless.h +++ b/indra/llwindow/llkeyboardheadless.h @@ -36,14 +36,14 @@ public: /*virtual*/ ~LLKeyboardHeadless() {}; #ifndef LL_SDL - /*virtual*/ BOOL handleKeyUp(const U16 key, MASK mask) { return FALSE; } - /*virtual*/ BOOL handleKeyDown(const U16 key, MASK mask) { return FALSE; } + /*virtual*/ bool handleKeyUp(const U16 key, MASK mask) { return false; } + /*virtual*/ bool handleKeyDown(const U16 key, MASK mask) { return false; } #else - /*virtual*/ BOOL handleKeyUp(const U32 key, MASK mask) { return FALSE; } - /*virtual*/ BOOL handleKeyDown(const U32 key, MASK mask) { return FALSE; } + /*virtual*/ bool handleKeyUp(const U32 key, MASK mask) { return false; } + /*virtual*/ bool handleKeyDown(const U32 key, MASK mask) { return false; } #endif /*virtual*/ void resetMaskKeys(); - /*virtual*/ MASK currentMask(BOOL for_mouse_event); + /*virtual*/ MASK currentMask(bool for_mouse_event); /*virtual*/ void scanKeyboard(); #ifdef LL_DARWIN /*virtual*/ void handleModifier(MASK mask); diff --git a/indra/llwindow/llkeyboardmacosx.cpp b/indra/llwindow/llkeyboardmacosx.cpp index a1aeb2e5e4..89ff7c6d3f 100644 --- a/indra/llwindow/llkeyboardmacosx.cpp +++ b/indra/llwindow/llkeyboardmacosx.cpp @@ -172,22 +172,22 @@ void LLKeyboardMacOSX::resetMaskKeys() if(mask & MAC_SHIFT_KEY) { - mKeyLevel[KEY_SHIFT] = TRUE; + mKeyLevel[KEY_SHIFT] = true; } if(mask & MAC_CTRL_KEY) { - mKeyLevel[KEY_CONTROL] = TRUE; + mKeyLevel[KEY_CONTROL] = true; } if(mask & MAC_ALT_KEY) { - mKeyLevel[KEY_ALT] = TRUE; + mKeyLevel[KEY_ALT] = true; } } /* -static BOOL translateKeyMac(const U16 key, const U32 mask, KEY &outKey, U32 &outMask) +static bool translateKeyMac(const U16 key, const U32 mask, KEY &outKey, U32 &outMask) { // Translate the virtual keycode into the keycodes the keyboard system expects. U16 virtualKey = (mask >> 24) & 0x0000007F; @@ -226,11 +226,11 @@ MASK LLKeyboardMacOSX::updateModifiers(const U32 mask) return out_mask; } -BOOL LLKeyboardMacOSX::handleKeyDown(const U16 key, const U32 mask) +bool LLKeyboardMacOSX::handleKeyDown(const U16 key, const U32 mask) { KEY translated_key = 0; U32 translated_mask = 0; - BOOL handled = FALSE; + bool handled = false; translated_mask = updateModifiers(mask); @@ -243,11 +243,11 @@ BOOL LLKeyboardMacOSX::handleKeyDown(const U16 key, const U32 mask) } -BOOL LLKeyboardMacOSX::handleKeyUp(const U16 key, const U32 mask) +bool LLKeyboardMacOSX::handleKeyUp(const U16 key, const U32 mask) { KEY translated_key = 0; U32 translated_mask = 0; - BOOL handled = FALSE; + bool handled = false; translated_mask = updateModifiers(mask); @@ -259,7 +259,7 @@ BOOL LLKeyboardMacOSX::handleKeyUp(const U16 key, const U32 mask) return handled; } -MASK LLKeyboardMacOSX::currentMask(BOOL for_mouse_event) +MASK LLKeyboardMacOSX::currentMask(bool for_mouse_event) { MASK result = MASK_NONE; U32 mask = getModifiers(); @@ -295,8 +295,8 @@ void LLKeyboardMacOSX::scanKeyboard() // Reset edges for next frame for (key = 0; key < KEY_COUNT; key++) { - mKeyUp[key] = FALSE; - mKeyDown[key] = FALSE; + mKeyUp[key] = false; + mKeyDown[key] = false; if (mKeyLevel[key]) { mKeyLevelFrameCount[key]++; @@ -304,7 +304,7 @@ void LLKeyboardMacOSX::scanKeyboard() } } -BOOL LLKeyboardMacOSX::translateNumpadKey( const U16 os_key, KEY *translated_key ) +bool LLKeyboardMacOSX::translateNumpadKey( const U16 os_key, KEY *translated_key ) { return translateKey(os_key, translated_key); } diff --git a/indra/llwindow/llkeyboardmacosx.h b/indra/llwindow/llkeyboardmacosx.h index d6895f684d..92ab5c9a85 100644 --- a/indra/llwindow/llkeyboardmacosx.h +++ b/indra/llwindow/llkeyboardmacosx.h @@ -44,17 +44,17 @@ public: LLKeyboardMacOSX(); /*virtual*/ ~LLKeyboardMacOSX() {}; - /*virtual*/ BOOL handleKeyUp(const U16 key, MASK mask); - /*virtual*/ BOOL handleKeyDown(const U16 key, MASK mask); + /*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*/ MASK currentMask(bool for_mouse_event); /*virtual*/ void scanKeyboard(); /*virtual*/ void handleModifier(MASK mask); protected: MASK updateModifiers(const U32 mask); - void setModifierKeyLevel( KEY key, BOOL new_state ); - BOOL translateNumpadKey( const U16 os_key, KEY *translated_key ); + void setModifierKeyLevel( KEY key, bool new_state ); + bool translateNumpadKey( const U16 os_key, KEY *translated_key ); U16 inverseTranslateNumpadKey(const KEY translated_key); private: std::map<U16, KEY> mTranslateNumpadMap; // special map for translating OS keys to numpad keys diff --git a/indra/llwindow/llkeyboardsdl.cpp b/indra/llwindow/llkeyboardsdl.cpp index cb6df9401d..72b4577276 100644 --- a/indra/llwindow/llkeyboardsdl.cpp +++ b/indra/llwindow/llkeyboardsdl.cpp @@ -162,7 +162,7 @@ void LLKeyboardSDL::resetMaskKeys() if(mask & KMOD_SHIFT) { - mKeyLevel[KEY_SHIFT] = TRUE; + mKeyLevel[KEY_SHIFT] = true; } if(mask & (KMOD_CTRL @@ -171,12 +171,12 @@ void LLKeyboardSDL::resetMaskKeys() #endif )) { - mKeyLevel[KEY_CONTROL] = TRUE; + mKeyLevel[KEY_CONTROL] = true; } if(mask & KMOD_ALT) { - mKeyLevel[KEY_ALT] = TRUE; + mKeyLevel[KEY_ALT] = true; } } @@ -234,12 +234,12 @@ static U32 adjustNativekeyFromUnhandledMask(const U32 key, const U32 mask) } -BOOL LLKeyboardSDL::handleKeyDown(const U32 key, const U32 mask) +bool LLKeyboardSDL::handleKeyDown(const U32 key, const U32 mask) { U32 adjusted_nativekey; KEY translated_key = 0; U32 translated_mask = MASK_NONE; - BOOL handled = FALSE; + bool handled = false; adjusted_nativekey = adjustNativekeyFromUnhandledMask(key, mask); @@ -254,12 +254,12 @@ BOOL LLKeyboardSDL::handleKeyDown(const U32 key, const U32 mask) } -BOOL LLKeyboardSDL::handleKeyUp(const U32 key, const U32 mask) +bool LLKeyboardSDL::handleKeyUp(const U32 key, const U32 mask) { U32 adjusted_nativekey; KEY translated_key = 0; U32 translated_mask = MASK_NONE; - BOOL handled = FALSE; + bool handled = false; adjusted_nativekey = adjustNativekeyFromUnhandledMask(key, mask); @@ -273,7 +273,7 @@ BOOL LLKeyboardSDL::handleKeyUp(const U32 key, const U32 mask) return handled; } -MASK LLKeyboardSDL::currentMask(BOOL for_mouse_event) +MASK LLKeyboardSDL::currentMask(bool for_mouse_event) { MASK result = MASK_NONE; SDL_Keymod mask = SDL_GetModState(); @@ -312,8 +312,8 @@ void LLKeyboardSDL::scanKeyboard() // Reset edges for next frame for (S32 key = 0; key < KEY_COUNT; key++) { - mKeyUp[key] = FALSE; - mKeyDown[key] = FALSE; + mKeyUp[key] = false; + mKeyDown[key] = false; if (mKeyLevel[key]) { mKeyLevelFrameCount[key]++; @@ -322,7 +322,7 @@ void LLKeyboardSDL::scanKeyboard() } -BOOL LLKeyboardSDL::translateNumpadKey( const U32 os_key, KEY *translated_key) +bool LLKeyboardSDL::translateNumpadKey( const U32 os_key, KEY *translated_key) { return translateKey(os_key, translated_key); } diff --git a/indra/llwindow/llkeyboardsdl.h b/indra/llwindow/llkeyboardsdl.h index 962ff5884b..3af098c4d1 100644 --- a/indra/llwindow/llkeyboardsdl.h +++ b/indra/llwindow/llkeyboardsdl.h @@ -38,16 +38,16 @@ public: LLKeyboardSDL(); /*virtual*/ ~LLKeyboardSDL() {}; - /*virtual*/ BOOL handleKeyUp(const U32 key, MASK mask); - /*virtual*/ BOOL handleKeyDown(const U32 key, MASK mask); + /*virtual*/ bool handleKeyUp(const U32 key, MASK mask); + /*virtual*/ bool handleKeyDown(const U32 key, MASK mask); /*virtual*/ void resetMaskKeys(); - /*virtual*/ MASK currentMask(BOOL for_mouse_event); + /*virtual*/ MASK currentMask(bool for_mouse_event); /*virtual*/ void scanKeyboard(); protected: MASK updateModifiers(const U32 mask); - void setModifierKeyLevel( KEY key, BOOL new_state ); - BOOL translateNumpadKey( const U32 os_key, KEY *translated_key ); + void setModifierKeyLevel( KEY key, bool new_state ); + bool translateNumpadKey( const U32 os_key, KEY *translated_key ); U16 inverseTranslateNumpadKey(const KEY translated_key); private: std::map<U32, KEY> mTranslateNumpadMap; // special map for translating OS keys to numpad keys diff --git a/indra/llwindow/llkeyboardwin32.cpp b/indra/llwindow/llkeyboardwin32.cpp index 4934e21d55..ec0055fe60 100644 --- a/indra/llwindow/llkeyboardwin32.cpp +++ b/indra/llwindow/llkeyboardwin32.cpp @@ -152,22 +152,22 @@ void LLKeyboardWin32::resetMaskKeys() // bit to indicate that the key is down. if (GetAsyncKeyState(VK_SHIFT) & 0x8000) { - mKeyLevel[KEY_SHIFT] = TRUE; + mKeyLevel[KEY_SHIFT] = true; } if (GetAsyncKeyState(VK_CONTROL) & 0x8000) { - mKeyLevel[KEY_CONTROL] = TRUE; + mKeyLevel[KEY_CONTROL] = true; } if (GetAsyncKeyState(VK_MENU) & 0x8000) { - mKeyLevel[KEY_ALT] = TRUE; + mKeyLevel[KEY_ALT] = true; } } -//void LLKeyboardWin32::setModifierKeyLevel( KEY key, BOOL new_state ) +//void LLKeyboardWin32::setModifierKeyLevel( KEY key, bool new_state ) //{ // if( mKeyLevel[key] != new_state ) // { @@ -191,17 +191,17 @@ MASK LLKeyboardWin32::updateModifiers() // (keydown encoded in high order bit of short) mKeyLevel[KEY_CAPSLOCK] = (GetKeyState(VK_CAPITAL) & 0x0001) != 0; // Low order bit carries the toggle state. // Get mask for keyboard events - MASK mask = currentMask(FALSE); + MASK mask = currentMask(false); return mask; } // mask is ignored, except for extended flag -- we poll the modifier keys for the other flags -BOOL LLKeyboardWin32::handleKeyDown(const U16 key, MASK mask) +bool LLKeyboardWin32::handleKeyDown(const U16 key, MASK mask) { KEY translated_key; U32 translated_mask; - BOOL handled = FALSE; + bool handled = false; translated_mask = updateModifiers(); @@ -214,11 +214,11 @@ BOOL LLKeyboardWin32::handleKeyDown(const U16 key, MASK mask) } // mask is ignored, except for extended flag -- we poll the modifier keys for the other flags -BOOL LLKeyboardWin32::handleKeyUp(const U16 key, MASK mask) +bool LLKeyboardWin32::handleKeyUp(const U16 key, MASK mask) { KEY translated_key; U32 translated_mask; - BOOL handled = FALSE; + bool handled = false; translated_mask = updateModifiers(); @@ -231,7 +231,7 @@ BOOL LLKeyboardWin32::handleKeyUp(const U16 key, MASK mask) } -MASK LLKeyboardWin32::currentMask(BOOL) +MASK LLKeyboardWin32::currentMask(bool) { MASK mask = MASK_NONE; @@ -263,8 +263,8 @@ void LLKeyboardWin32::scanKeyboard() // Reset edges for next frame for (key = 0; key < KEY_COUNT; key++) { - mKeyUp[key] = FALSE; - mKeyDown[key] = FALSE; + mKeyUp[key] = false; + mKeyDown[key] = false; if (mKeyLevel[key]) { mKeyLevelFrameCount[key]++; @@ -272,7 +272,7 @@ void LLKeyboardWin32::scanKeyboard() } } -BOOL LLKeyboardWin32::translateExtendedKey(const U16 os_key, const MASK mask, KEY *translated_key) +bool LLKeyboardWin32::translateExtendedKey(const U16 os_key, const MASK mask, KEY *translated_key) { return translateKey(os_key, translated_key); } diff --git a/indra/llwindow/llkeyboardwin32.h b/indra/llwindow/llkeyboardwin32.h index 838566d69c..d0dfc5cfdd 100644 --- a/indra/llwindow/llkeyboardwin32.h +++ b/indra/llwindow/llkeyboardwin32.h @@ -39,17 +39,17 @@ public: LLKeyboardWin32(); /*virtual*/ ~LLKeyboardWin32() {}; - /*virtual*/ BOOL handleKeyUp(const U16 key, MASK mask); - /*virtual*/ BOOL handleKeyDown(const U16 key, MASK mask); + /*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*/ MASK currentMask(bool for_mouse_event); /*virtual*/ void scanKeyboard(); - BOOL translateExtendedKey(const U16 os_key, const MASK mask, KEY *translated_key); + bool translateExtendedKey(const U16 os_key, const MASK mask, KEY *translated_key); U16 inverseTranslateExtendedKey(const KEY translated_key); protected: MASK updateModifiers(); - //void setModifierKeyLevel( KEY key, BOOL new_state ); + //void setModifierKeyLevel( KEY key, bool new_state ); private: std::map<U16, KEY> mTranslateNumpadMap; std::map<KEY, U16> mInvTranslateNumpadMap; diff --git a/indra/llwindow/llmousehandler.cpp b/indra/llwindow/llmousehandler.cpp index 62ad406967..eeceab502a 100644 --- a/indra/llwindow/llmousehandler.cpp +++ b/indra/llwindow/llmousehandler.cpp @@ -27,9 +27,9 @@ #include "llmousehandler.h" //virtual -BOOL LLMouseHandler::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down) +bool LLMouseHandler::handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, bool down) { - BOOL handled = FALSE; + bool handled = false; if (down) { switch (clicktype) diff --git a/indra/llwindow/llmousehandler.h b/indra/llwindow/llmousehandler.h index dea28a0fc3..565d7bed70 100644 --- a/indra/llwindow/llmousehandler.h +++ b/indra/llwindow/llmousehandler.h @@ -47,19 +47,19 @@ public: SHOW_ALWAYS, } EShowToolTip; - virtual BOOL handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, BOOL down); - virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask) = 0; - virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask) = 0; - virtual BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask) = 0; - virtual BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask) = 0; - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) = 0; - virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask) = 0; - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask) = 0; + virtual bool handleAnyMouseClick(S32 x, S32 y, MASK mask, EMouseClickType clicktype, bool down); + virtual bool handleMouseDown(S32 x, S32 y, MASK mask) = 0; + virtual bool handleMouseUp(S32 x, S32 y, MASK mask) = 0; + virtual bool handleMiddleMouseDown(S32 x, S32 y, MASK mask) = 0; + virtual bool handleMiddleMouseUp(S32 x, S32 y, MASK mask) = 0; + virtual bool handleRightMouseDown(S32 x, S32 y, MASK mask) = 0; + virtual bool handleRightMouseUp(S32 x, S32 y, MASK mask) = 0; + virtual bool handleDoubleClick(S32 x, S32 y, MASK mask) = 0; - virtual BOOL handleHover(S32 x, S32 y, MASK mask) = 0; - virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) = 0; - virtual BOOL handleScrollHWheel(S32 x, S32 y, S32 clicks) = 0; - virtual BOOL handleToolTip(S32 x, S32 y, MASK mask) = 0; + virtual bool handleHover(S32 x, S32 y, MASK mask) = 0; + virtual bool handleScrollWheel(S32 x, S32 y, S32 clicks) = 0; + virtual bool handleScrollHWheel(S32 x, S32 y, S32 clicks) = 0; + virtual bool handleToolTip(S32 x, S32 y, MASK mask) = 0; virtual const std::string& getName() const = 0; virtual void onMouseCaptureLost() = 0; @@ -67,7 +67,7 @@ public: virtual void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const = 0; virtual void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const = 0; - virtual BOOL hasMouseCapture() = 0; + virtual bool hasMouseCapture() = 0; }; #endif diff --git a/indra/llwindow/llpreeditor.h b/indra/llwindow/llpreeditor.h index 943d70c3dd..492a3e9e88 100644 --- a/indra/llwindow/llpreeditor.h +++ b/indra/llwindow/llpreeditor.h @@ -34,7 +34,7 @@ class LLPreeditor public: typedef std::vector<S32> segment_lengths_t; - typedef std::vector<BOOL> standouts_t; + typedef std::deque<bool> standouts_t; // We don't delete against LLPreeditor, but compilers complain without this... @@ -79,7 +79,7 @@ public: // Locations are relative to the app window and measured in GL coordinate space (before scaling.) // query_position is IN argument, and other three are OUT. - virtual BOOL getPreeditLocation(S32 query_position, LLCoordGL *coord, LLRect *bounds, LLRect *control) const = 0; + virtual bool getPreeditLocation(S32 query_position, LLCoordGL *coord, LLRect *bounds, LLRect *control) const = 0; // Get the size (height) of the current font used in this preeditor. @@ -93,9 +93,9 @@ public: // 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. - // called_from_parent should be set to FALSE if calling through LLPreeditor. + // called_from_parent should be set to false if calling through LLPreeditor. - virtual BOOL handleUnicodeCharHere(llwchar uni_char) = 0; + virtual bool handleUnicodeCharHere(llwchar uni_char) = 0; }; #endif diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index 6556bc09c6..325f1280b9 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -46,8 +46,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,10 +63,10 @@ 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(); } @@ -97,9 +97,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 +109,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 +127,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 +178,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 +189,7 @@ void *LLWindow::getMediaWindow() return getPlatformWindow(); } -BOOL LLWindow::setSize(LLCoordScreen size) +bool LLWindow::setSize(LLCoordScreen size) { if (!getMaximized()) { @@ -199,7 +199,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 +241,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 @@ -336,7 +336,7 @@ void LLWindow::handleUnicodeUTF16(U16 utf16, MASK mask) // static bool LLSplashScreen::isVisible() { - return gSplashScreenp ? true: false; + return gSplashScreenp; } // static @@ -402,14 +402,13 @@ 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 = nullptr; @@ -427,7 +426,7 @@ LLWindow* LLWindowManager::createWindow( #elif 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, @@ -441,7 +440,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,13 +450,13 @@ 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(); @@ -466,10 +465,10 @@ BOOL LLWindowManager::destroyWindow(LLWindow* window) delete window; - return TRUE; + return true; } -BOOL LLWindowManager::isWindowValid(LLWindow *window) +bool LLWindowManager::isWindowValid(LLWindow *window) { return sWindowList.find(window) != sWindowList.end(); } diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index aff9334cb6..5e06e665f3 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -63,21 +63,21 @@ public: virtual void show() = 0; virtual void hide() = 0; virtual void close() = 0; - virtual BOOL getVisible() = 0; - virtual BOOL getMinimized() = 0; - virtual BOOL getMaximized() = 0; - virtual BOOL maximize() = 0; + virtual bool getVisible() = 0; + 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; - virtual BOOL getSize(LLCoordWindow *size) = 0; - virtual BOOL setPosition(LLCoordScreen position) = 0; - BOOL setSize(LLCoordScreen size); - BOOL setSize(LLCoordWindow size); + bool getFullscreen() { return mFullscreen; }; + virtual bool getPosition(LLCoordScreen *position) = 0; + virtual bool getSize(LLCoordScreen *size) = 0; + virtual bool getSize(LLCoordWindow *size) = 0; + virtual bool setPosition(LLCoordScreen position) = 0; + bool setSize(LLCoordScreen size); + bool setSize(LLCoordWindow size); virtual void setMinSize(U32 min_width, U32 min_height, bool enforce_immediately = true); - virtual BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL enable_vsync, const LLCoordScreen * const posp = NULL) = 0; + virtual bool switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, const LLCoordScreen * const posp = NULL) = 0; //create a new GL context that shares a namespace with this Window's main GL context and make it current on the current thread // returns a pointer to be handed back to destroySharedConext/makeContextCurrent @@ -90,14 +90,14 @@ public: virtual void toggleVSync(bool enable_vsync) = 0; - virtual BOOL setCursorPosition(LLCoordWindow position) = 0; - virtual BOOL getCursorPosition(LLCoordWindow *position) = 0; + virtual bool setCursorPosition(LLCoordWindow position) = 0; + virtual bool getCursorPosition(LLCoordWindow *position) = 0; #if LL_WINDOWS - virtual BOOL getCursorDelta(LLCoordCommon* delta) = 0; + virtual bool getCursorDelta(LLCoordCommon* delta) = 0; #endif virtual void showCursor() = 0; virtual void hideCursor() = 0; - virtual BOOL isCursorHidden() = 0; + virtual bool isCursorHidden() = 0; virtual void showCursorFromMouseMove() = 0; virtual void hideCursorUntilMouseMove() = 0; @@ -124,22 +124,22 @@ public: virtual void captureMouse() = 0; virtual void releaseMouse() = 0; - virtual void setMouseClipping( BOOL b ) = 0; + virtual void setMouseClipping( bool b ) = 0; - virtual BOOL isClipboardTextAvailable() = 0; - virtual BOOL pasteTextFromClipboard(LLWString &dst) = 0; - virtual BOOL copyTextToClipboard(const LLWString &src) = 0; + virtual bool isClipboardTextAvailable() = 0; + virtual bool pasteTextFromClipboard(LLWString &dst) = 0; + virtual bool copyTextToClipboard(const LLWString &src) = 0; - virtual BOOL isPrimaryTextAvailable(); - virtual BOOL pasteTextFromPrimary(LLWString &dst); - virtual BOOL copyTextToPrimary(const LLWString &src); + virtual bool isPrimaryTextAvailable(); + virtual bool pasteTextFromPrimary(LLWString &dst); + virtual bool copyTextToPrimary(const LLWString &src); virtual void flashIcon(F32 seconds) = 0; virtual F32 getGamma() = 0; - virtual BOOL setGamma(const F32 gamma) = 0; // Set the gamma + virtual bool setGamma(const F32 gamma) = 0; // Set the gamma virtual void setFSAASamples(const U32 fsaa_samples) = 0; //set number of FSAA samples virtual U32 getFSAASamples() = 0; - virtual BOOL restoreGamma() = 0; // Restore original gamma table (before updating gamma) + virtual bool restoreGamma() = 0; // Restore original gamma table (before updating gamma) virtual ESwapMethod getSwapMethod() { return mSwapMethod; } virtual void processMiscNativeEvents(); virtual void gatherInput() = 0; @@ -151,12 +151,12 @@ public: // handy coordinate space conversion routines // NB: screen to window and vice verse won't work on width/height coordinate pairs, // as the conversion must take into account left AND right border widths, etc. - virtual BOOL convertCoords( LLCoordScreen from, LLCoordWindow *to) = 0; - virtual BOOL convertCoords( LLCoordWindow from, LLCoordScreen *to) = 0; - virtual BOOL convertCoords( LLCoordWindow from, LLCoordGL *to) = 0; - virtual BOOL convertCoords( LLCoordGL from, LLCoordWindow *to) = 0; - virtual BOOL convertCoords( LLCoordScreen from, LLCoordGL *to) = 0; - virtual BOOL convertCoords( LLCoordGL from, LLCoordScreen *to) = 0; + virtual bool convertCoords( LLCoordScreen from, LLCoordWindow *to) = 0; + virtual bool convertCoords( LLCoordWindow from, LLCoordScreen *to) = 0; + virtual bool convertCoords( LLCoordWindow from, LLCoordGL *to) = 0; + virtual bool convertCoords( LLCoordGL from, LLCoordWindow *to) = 0; + virtual bool convertCoords( LLCoordScreen from, LLCoordGL *to) = 0; + virtual bool convertCoords( LLCoordGL from, LLCoordScreen *to) = 0; // query supported resolutions virtual LLWindowResolution* getSupportedResolutions(S32 &num_resolutions) = 0; @@ -164,15 +164,12 @@ public: virtual F32 getPixelAspectRatio() = 0; virtual void setNativeAspectRatio(F32 aspect) = 0; - // query VRAM usage - virtual U32 getAvailableVRAMMegabytes() = 0; - 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, modally - // Returns TRUE if valid color selected - virtual BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b); + // 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; @@ -181,7 +178,7 @@ public: virtual void *getMediaWindow(); // control platform's Language Text Input mechanisms. - virtual void allowLanguageTextInput(LLPreeditor *preeditor, BOOL b) {} + virtual void allowLanguageTextInput(LLPreeditor *preeditor, bool b) {} virtual void setLanguageTextInput( const LLCoordGL & pos ) {}; virtual void updateLanguageTextInputArea() {} virtual void interruptLanguageTextInput() {} @@ -209,21 +206,21 @@ public: virtual S32 getRefreshRate() { return mRefreshRate; } protected: - LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags); + LLWindow(LLWindowCallbacks* callbacks, bool fullscreen, U32 flags); virtual ~LLWindow(); // Defaults to true - virtual BOOL isValid(); + virtual bool isValid(); // Defaults to true - virtual BOOL canDelete(); + virtual bool canDelete(); - virtual BOOL setSizeImpl(LLCoordScreen size) = 0; - virtual BOOL setSizeImpl(LLCoordWindow size) = 0; + virtual bool setSizeImpl(LLCoordScreen size) = 0; + virtual bool setSizeImpl(LLCoordWindow size) = 0; protected: LLWindowCallbacks* mCallbacks; - BOOL mPostQuit; // should this window post a quit message when destroyed? - BOOL mFullscreen; + bool mPostQuit; // should this window post a quit message when destroyed? + bool mFullscreen; S32 mFullscreenWidth; S32 mFullscreenHeight; S32 mFullscreenBits; @@ -232,11 +229,11 @@ protected: S32 mNumSupportedResolutions; ECursorType mCurrentCursor; ECursorType mNextCursor; - BOOL mCursorHidden; + bool mCursorHidden; S32 mBusyCount; // how deep is the "cursor busy" stack? - BOOL mIsMouseClipping; // Is this window currently clipping the mouse + bool mIsMouseClipping; // Is this window currently clipping the mouse ESwapMethod mSwapMethod; - BOOL mHideCursorPermanent; + bool mHideCursorPermanent; U32 mFlags; U16 mHighSurrogate; S32 mMinWindowWidth; @@ -281,20 +278,20 @@ protected: virtual void updateImpl(const std::string& string) = 0; virtual void hideImpl() = 0; - static BOOL sVisible; + static bool sVisible; }; // Platform-neutral for accessing the platform specific message box S32 OSMessageBox(const std::string& text, const std::string& caption, U32 type); -const U32 OSMB_OK = 0; -const U32 OSMB_OKCANCEL = 1; -const U32 OSMB_YESNO = 2; +constexpr U32 OSMB_OK = 0; +constexpr U32 OSMB_OKCANCEL = 1; +constexpr U32 OSMB_YESNO = 2; -const S32 OSBTN_YES = 0; -const S32 OSBTN_NO = 1; -const S32 OSBTN_OK = 2; -const S32 OSBTN_CANCEL = 3; +constexpr S32 OSBTN_YES = 0; +constexpr S32 OSBTN_NO = 1; +constexpr S32 OSBTN_OK = 2; +constexpr S32 OSBTN_CANCEL = 3; // // LLWindowManager @@ -307,29 +304,26 @@ public: LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, U32 flags = 0, - BOOL fullscreen = FALSE, - BOOL clearBg = FALSE, - BOOL enable_vsync = FALSE, - BOOL use_gl = TRUE, - BOOL ignore_pixel_depth = FALSE, + bool fullscreen = false, + bool clearBg = false, + bool enable_vsync = false, + bool use_gl = true, + bool ignore_pixel_depth = false, U32 fsaa_samples = 0, U32 max_cores = 0, - U32 max_vram = 0, F32 max_gl_version = 4.6f); - static BOOL destroyWindow(LLWindow* window); - static BOOL isWindowValid(LLWindow *window); + static bool destroyWindow(LLWindow* window); + static bool isWindowValid(LLWindow *window); }; // // helper funcs // -extern BOOL gDebugWindowProc; +extern bool gDebugWindowProc; // Protocols, like "http" and "https" we support in URLs extern const S32 gURLProtocolWhitelistCount; extern const std::string gURLProtocolWhitelist[]; //extern const std::string gURLProtocolWhitelistHandler[]; -void simpleEscapeString ( std::string& stringIn ); - #endif // _LL_window_h_ diff --git a/indra/llwindow/llwindowcallbacks.cpp b/indra/llwindow/llwindowcallbacks.cpp index ddf913045f..624ecd5030 100644 --- a/indra/llwindow/llwindowcallbacks.cpp +++ b/indra/llwindow/llwindowcallbacks.cpp @@ -32,39 +32,39 @@ // LLWindowCallbacks // -BOOL LLWindowCallbacks::handleTranslatedKeyDown(const KEY key, const MASK mask, BOOL repeated) +bool LLWindowCallbacks::handleTranslatedKeyDown(const KEY key, const MASK mask, bool repeated) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleTranslatedKeyUp(const KEY key, const MASK mask) +bool LLWindowCallbacks::handleTranslatedKeyUp(const KEY key, const MASK mask) { - return FALSE; + return false; } -void LLWindowCallbacks::handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level) +void LLWindowCallbacks::handleScanKey(KEY key, bool key_down, bool key_up, bool key_level) { } -BOOL LLWindowCallbacks::handleUnicodeChar(llwchar uni_char, MASK mask) +bool LLWindowCallbacks::handleUnicodeChar(llwchar uni_char, MASK mask) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleUnicodeString(char *uni_str, bool editing) +bool LLWindowCallbacks::handleUnicodeString(char *uni_str, bool editing) { return FALSE; } -BOOL LLWindowCallbacks::handleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask) +bool LLWindowCallbacks::handleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask) +bool LLWindowCallbacks::handleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask) { - return FALSE; + return false; } void LLWindowCallbacks::handleMouseLeave(LLWindow *window) @@ -72,54 +72,54 @@ void LLWindowCallbacks::handleMouseLeave(LLWindow *window) return; } -BOOL LLWindowCallbacks::handleCloseRequest(LLWindow *window) +bool LLWindowCallbacks::handleCloseRequest(LLWindow *window) { //allow the window to close - return TRUE; + return true; } void LLWindowCallbacks::handleQuit(LLWindow *window) { } -BOOL LLWindowCallbacks::handleRightMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask) +bool LLWindowCallbacks::handleRightMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleRightMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask) +bool LLWindowCallbacks::handleRightMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleMiddleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask) +bool LLWindowCallbacks::handleMiddleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleMiddleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask) +bool LLWindowCallbacks::handleMiddleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleOtherMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask, S32 button) +bool LLWindowCallbacks::handleOtherMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask, S32 button) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleOtherMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask, S32 button) +bool LLWindowCallbacks::handleOtherMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask, S32 button) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleActivate(LLWindow *window, BOOL activated) +bool LLWindowCallbacks::handleActivate(LLWindow *window, bool activated) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleActivateApp(LLWindow *window, BOOL activating) +bool LLWindowCallbacks::handleActivateApp(LLWindow *window, bool activating) { - return FALSE; + return false; } void LLWindowCallbacks::handleMouseMove(LLWindow *window, const LLCoordGL pos, MASK mask) @@ -155,15 +155,15 @@ void LLWindowCallbacks::handleMenuSelect(LLWindow *window, const S32 menu_item) { } -BOOL LLWindowCallbacks::handlePaint(LLWindow *window, const S32 x, const S32 y, +bool LLWindowCallbacks::handlePaint(LLWindow *window, const S32 x, const S32 y, const S32 width, const S32 height) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleDoubleClick(LLWindow *window, const LLCoordGL pos, MASK mask) +bool LLWindowCallbacks::handleDoubleClick(LLWindow *window, const LLCoordGL pos, MASK mask) { - return FALSE; + return false; } void LLWindowCallbacks::handleWindowBlock(LLWindow *window) @@ -183,24 +183,24 @@ LLWindowCallbacks::DragNDropResult LLWindowCallbacks::handleDragNDrop(LLWindow * return LLWindowCallbacks::DND_NONE; } -BOOL LLWindowCallbacks::handleTimerEvent(LLWindow *window) +bool LLWindowCallbacks::handleTimerEvent(LLWindow *window) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleDeviceChange(LLWindow *window) +bool LLWindowCallbacks::handleDeviceChange(LLWindow *window) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height) +bool LLWindowCallbacks::handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height) { - return FALSE; + return false; } -BOOL LLWindowCallbacks::handleWindowDidChangeScreen(LLWindow *window) +bool LLWindowCallbacks::handleWindowDidChangeScreen(LLWindow *window) { - return FALSE; + return false; } void LLWindowCallbacks::handlePingWatchdog(LLWindow *window, const char * msg) diff --git a/indra/llwindow/llwindowcallbacks.h b/indra/llwindow/llwindowcallbacks.h index b7a843e748..74660e1705 100644 --- a/indra/llwindow/llwindowcallbacks.h +++ b/indra/llwindow/llwindowcallbacks.h @@ -33,27 +33,27 @@ 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 handleUnicodeString(char *uni_str, bool editing); + 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 handleUnicodeString(char *uni_str, bool editing); - virtual BOOL handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); - virtual BOOL handleMouseUp(LLWindow *window, LLCoordGL pos, 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); + // 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 handleOtherMouseDown(LLWindow *window, LLCoordGL pos, MASK mask, S32 button); - virtual BOOL handleOtherMouseUp(LLWindow *window, LLCoordGL pos, MASK mask, S32 button); - virtual BOOL handleActivate(LLWindow *window, BOOL activated); - virtual BOOL handleActivateApp(LLWindow *window, BOOL activating); + 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 handleOtherMouseDown(LLWindow *window, LLCoordGL pos, MASK mask, S32 button); + virtual bool handleOtherMouseUp(LLWindow *window, LLCoordGL pos, MASK mask, S32 button); + 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 handleMouseDragged(LLWindow *window, LLCoordGL pos, MASK mask); virtual void handleScrollWheel(LLWindow *window, S32 clicks); @@ -62,15 +62,15 @@ public: 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 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 BOOL handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height); - virtual BOOL handleWindowDidChangeScreen(LLWindow *window); + virtual bool handleTimerEvent(LLWindow *window); + virtual bool handleDeviceChange(LLWindow *window); + virtual bool handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height); + virtual bool handleWindowDidChangeScreen(LLWindow *window); enum DragNDropAction { DNDA_START_TRACKING = 0,// Start tracking an incoming drag diff --git a/indra/llwindow/llwindowheadless.cpp b/indra/llwindow/llwindowheadless.cpp index bbeb710445..55e5cfd51e 100644 --- a/indra/llwindow/llwindowheadless.cpp +++ b/indra/llwindow/llwindowheadless.cpp @@ -34,8 +34,8 @@ // LLWindowHeadless // 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 enable_vsync, BOOL use_gl, BOOL ignore_pixel_depth) + U32 flags, bool fullscreen, bool clear_background, + bool enable_vsync, bool use_gl, bool ignore_pixel_depth) : LLWindow(callbacks, fullscreen, flags) { // Initialize a headless keyboard. diff --git a/indra/llwindow/llwindowheadless.h b/indra/llwindow/llwindowheadless.h index af2cdb63fa..5696b69a59 100644 --- a/indra/llwindow/llwindowheadless.h +++ b/indra/llwindow/llwindowheadless.h @@ -35,10 +35,10 @@ public: /*virtual*/ void show() override {} /*virtual*/ void hide() override {} /*virtual*/ void close() override {} - /*virtual*/ BOOL getVisible() override {return FALSE;} - /*virtual*/ BOOL getMinimized() override {return FALSE;} - /*virtual*/ BOOL getMaximized() override {return FALSE;} - /*virtual*/ BOOL maximize() override {return FALSE;} + /*virtual*/ bool getVisible() override {return false;} + /*virtual*/ bool getMinimized() override {return false;} + /*virtual*/ bool getMaximized() override {return false;} + /*virtual*/ bool maximize() override {return false;} /*virtual*/ void minimize() override {} /*virtual*/ void restore() override {} // TODO: LLWindow::getFullscreen() is (intentionally?) NOT virtual. @@ -46,42 +46,42 @@ public: // mistake to shadow the base-class method with an LLWindowHeadless // override when called on the subclass, yet call the base-class method // when indirecting through a polymorphic pointer or reference? - BOOL getFullscreen() {return FALSE;} - /*virtual*/ BOOL getPosition(LLCoordScreen *position) override {return FALSE;} - /*virtual*/ BOOL getSize(LLCoordScreen *size) override {return FALSE;} - /*virtual*/ BOOL getSize(LLCoordWindow *size) override {return FALSE;} - /*virtual*/ BOOL setPosition(LLCoordScreen position) override {return FALSE;} - /*virtual*/ BOOL setSizeImpl(LLCoordScreen size) override {return FALSE;} - /*virtual*/ BOOL setSizeImpl(LLCoordWindow size) override {return FALSE;} - /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL enable_vsync, const LLCoordScreen * const posp = NULL) override {return FALSE;} + bool getFullscreen() {return false;} + /*virtual*/ bool getPosition(LLCoordScreen *position) override {return false;} + /*virtual*/ bool getSize(LLCoordScreen *size) override {return false;} + /*virtual*/ bool getSize(LLCoordWindow *size) override {return false;} + /*virtual*/ bool setPosition(LLCoordScreen position) override {return false;} + /*virtual*/ bool setSizeImpl(LLCoordScreen size) override {return false;} + /*virtual*/ bool setSizeImpl(LLCoordWindow size) override {return false;} + /*virtual*/ bool switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, const LLCoordScreen * const posp = NULL) override {return false;} void* createSharedContext() override { return nullptr; } void makeContextCurrent(void*) override {} void destroySharedContext(void*) override {} /*virtual*/ void toggleVSync(bool enable_vsync) override { } - /*virtual*/ BOOL setCursorPosition(LLCoordWindow position) override {return FALSE;} - /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) override {return FALSE;} + /*virtual*/ bool setCursorPosition(LLCoordWindow position) override {return false;} + /*virtual*/ bool getCursorPosition(LLCoordWindow *position) override {return false;} #if LL_WINDOWS - /*virtual*/ BOOL getCursorDelta(LLCoordCommon* delta) override { return FALSE; } + /*virtual*/ bool getCursorDelta(LLCoordCommon* delta) override { return false; } #endif /*virtual*/ void showCursor() override {} /*virtual*/ void hideCursor() override {} /*virtual*/ void showCursorFromMouseMove() override {} /*virtual*/ void hideCursorUntilMouseMove() override {} - /*virtual*/ BOOL isCursorHidden() override {return FALSE;} + /*virtual*/ bool isCursorHidden() override {return false;} /*virtual*/ void updateCursor() override {} //virtual ECursorType getCursor() override { return mCurrentCursor; } /*virtual*/ void captureMouse() override {} /*virtual*/ void releaseMouse() override {} - /*virtual*/ void setMouseClipping( BOOL b ) override {} - /*virtual*/ BOOL isClipboardTextAvailable() override {return FALSE; } - /*virtual*/ BOOL pasteTextFromClipboard(LLWString &dst) override {return FALSE; } - /*virtual*/ BOOL copyTextToClipboard(const LLWString &src) override {return FALSE; } + /*virtual*/ void setMouseClipping( bool b ) override {} + /*virtual*/ bool isClipboardTextAvailable() override {return false; } + /*virtual*/ bool pasteTextFromClipboard(LLWString &dst) override {return false; } + /*virtual*/ bool copyTextToClipboard(const LLWString &src) override {return false; } /*virtual*/ void flashIcon(F32 seconds) override {} /*virtual*/ F32 getGamma() override {return 1.0f; } - /*virtual*/ BOOL setGamma(const F32 gamma) override {return FALSE; } // Set the gamma + /*virtual*/ bool setGamma(const F32 gamma) override {return false; } // Set the gamma /*virtual*/ void setFSAASamples(const U32 fsaa_samples) override { } /*virtual*/ U32 getFSAASamples() override { return 0; } - /*virtual*/ BOOL restoreGamma() override {return FALSE; } // Restore original gamma table (before updating gamma) + /*virtual*/ bool restoreGamma() override {return false; } // Restore original gamma table (before updating gamma) //virtual ESwapMethod getSwapMethod() override { return mSwapMethod; } /*virtual*/ void gatherInput() override {} /*virtual*/ void delayInputProcessing() override {} @@ -89,20 +89,18 @@ public: // handy coordinate space conversion routines - /*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to) override { return FALSE; } - /*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to) override { return FALSE; } - /*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordGL *to) override { return FALSE; } - /*virtual*/ BOOL convertCoords(LLCoordGL from, LLCoordWindow *to) override { return FALSE; } - /*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordGL *to) override { return FALSE; } - /*virtual*/ BOOL convertCoords(LLCoordGL from, LLCoordScreen *to) override { return FALSE; } + /*virtual*/ bool convertCoords(LLCoordScreen from, LLCoordWindow *to) override { return false; } + /*virtual*/ bool convertCoords(LLCoordWindow from, LLCoordScreen *to) override { return false; } + /*virtual*/ bool convertCoords(LLCoordWindow from, LLCoordGL *to) override { return false; } + /*virtual*/ bool convertCoords(LLCoordGL from, LLCoordWindow *to) override { return false; } + /*virtual*/ bool convertCoords(LLCoordScreen from, LLCoordGL *to) override { return false; } + /*virtual*/ bool convertCoords(LLCoordGL from, LLCoordScreen *to) override { return false; } /*virtual*/ LLWindowResolution* getSupportedResolutions(S32 &num_resolutions) override { return NULL; } /*virtual*/ F32 getNativeAspectRatio() override { return 1.0f; } /*virtual*/ F32 getPixelAspectRatio() override { return 1.0f; } /*virtual*/ void setNativeAspectRatio(F32 ratio) override {} - U32 getAvailableVRAMMegabytes() override { return 4096; } - /*virtual*/ void *getPlatformWindow() override { return 0; } /*virtual*/ void bringToFront() override {} @@ -110,8 +108,8 @@ public: const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, - U32 flags, BOOL fullscreen, BOOL clear_background, - BOOL enable_vsync, BOOL use_gl, BOOL ignore_pixel_depth); + U32 flags, bool fullscreen, bool clear_background, + bool enable_vsync, bool use_gl, bool ignore_pixel_depth); virtual ~LLWindowHeadless(); private: diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index 31dc83493e..d9d8bfce1f 100644 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -30,6 +30,7 @@ #include <map> #include <vector> +#include <deque> //fir CGSize #include <CoreGraphics/CGGeometry.h> @@ -37,7 +38,7 @@ typedef std::vector<std::pair<int, bool> > segment_t; typedef std::vector<int> segment_lengths; -typedef std::vector<int> segment_standouts; +typedef std::deque<bool> segment_standouts; struct attributedStringInfo { segment_lengths seg_lengths; diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 842a41427e..3cfc9d7c84 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -51,10 +51,8 @@ #include <IOKit/hid/IOHIDLib.h> #include <IOKit/usb/IOUSBLib.h> - - -extern BOOL gDebugWindowProc; -BOOL gHiDPISupport = TRUE; +extern bool gDebugWindowProc; +bool gHiDPISupport = true; const S32 BITS_PER_PIXEL = 32; const S32 MAX_NUM_RESOLUTIONS = 32; @@ -69,11 +67,11 @@ namespace // LLWindowMacOSX // -BOOL LLWindowMacOSX::sUseMultGL = FALSE; +bool LLWindowMacOSX::sUseMultGL = false; // Cross-platform bits: -BOOL check_for_card(const char* RENDERER, const char* bad_card) +bool check_for_card(const char* RENDERER, const char* bad_card) { if (!strnicmp(RENDERER, bad_card, strlen(bad_card))) { @@ -94,15 +92,15 @@ BOOL check_for_card(const char* RENDERER, const char* bad_card) S32 button = OSMessageBox(buffer.c_str(), "Unsupported video card", OSMB_YESNO); if (OSBTN_YES == button) { - return FALSE; + return false; } else { - return TRUE; + return true; } } - return FALSE; + return false; } // Switch to determine whether we capture all displays, or just the main one. @@ -122,9 +120,9 @@ static LLWindowMacOSX *gWindowImplementation = NULL; 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 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) : LLWindow(NULL, fullscreen, flags) { @@ -146,21 +144,21 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks, mContext = NULL; mPixelFormat = NULL; mDisplay = CGMainDisplayID(); - mSimulatedRightClick = FALSE; + mSimulatedRightClick = false; mLastModifiers = 0; - mHandsOffEvents = FALSE; - mCursorDecoupled = FALSE; + mHandsOffEvents = false; + mCursorDecoupled = false; mCursorLastEventDeltaX = 0; mCursorLastEventDeltaY = 0; - mCursorIgnoreNextDelta = FALSE; - mNeedsResize = FALSE; + mCursorIgnoreNextDelta = false; + mNeedsResize = false; mOverrideAspectRatio = 0.f; - mMaximized = FALSE; - mMinimized = FALSE; - mLanguageTextInputAllowed = FALSE; + mMaximized = false; + mMinimized = false; + mLanguageTextInputAllowed = false; mPreeditor = NULL; mFSAASamples = fsaa_samples; - mForceRebuild = FALSE; + mForceRebuild = false; // Get the original aspect ratio of the main device. mOriginalAspectRatio = (double)CGDisplayPixelsWide(mDisplay) / (double)CGDisplayPixelsHigh(mDisplay); @@ -200,7 +198,7 @@ LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks, initCursors(); setCursor( UI_CURSOR_ARROW ); - allowLanguageTextInput(NULL, FALSE); + allowLanguageTextInput(NULL, false); } mCallbacks = callbacks; @@ -292,7 +290,7 @@ void callRightMouseDown(float *pos, MASK mask) LLCoordGL outCoords; outCoords.mX = ll_round(pos[0]); outCoords.mY = ll_round(pos[1]); - gWindowImplementation->getCallbacks()->handleRightMouseDown(gWindowImplementation, outCoords, gKeyboard->currentMask(TRUE)); + gWindowImplementation->getCallbacks()->handleRightMouseDown(gWindowImplementation, outCoords, gKeyboard->currentMask(true)); } void callRightMouseUp(float *pos, MASK mask) @@ -305,7 +303,7 @@ void callRightMouseUp(float *pos, MASK mask) LLCoordGL outCoords; outCoords.mX = ll_round(pos[0]); outCoords.mY = ll_round(pos[1]); - gWindowImplementation->getCallbacks()->handleRightMouseUp(gWindowImplementation, outCoords, gKeyboard->currentMask(TRUE)); + gWindowImplementation->getCallbacks()->handleRightMouseUp(gWindowImplementation, outCoords, gKeyboard->currentMask(true)); } void callLeftMouseDown(float *pos, MASK mask) @@ -318,7 +316,7 @@ void callLeftMouseDown(float *pos, MASK mask) LLCoordGL outCoords; outCoords.mX = ll_round(pos[0]); outCoords.mY = ll_round(pos[1]); - gWindowImplementation->getCallbacks()->handleMouseDown(gWindowImplementation, outCoords, gKeyboard->currentMask(TRUE)); + gWindowImplementation->getCallbacks()->handleMouseDown(gWindowImplementation, outCoords, gKeyboard->currentMask(true)); } void callLeftMouseUp(float *pos, MASK mask) @@ -331,7 +329,7 @@ void callLeftMouseUp(float *pos, MASK mask) LLCoordGL outCoords; outCoords.mX = ll_round(pos[0]); outCoords.mY = ll_round(pos[1]); - gWindowImplementation->getCallbacks()->handleMouseUp(gWindowImplementation, outCoords, gKeyboard->currentMask(TRUE)); + gWindowImplementation->getCallbacks()->handleMouseUp(gWindowImplementation, outCoords, gKeyboard->currentMask(true)); } @@ -345,7 +343,7 @@ void callDoubleClick(float *pos, MASK mask) LLCoordGL outCoords; outCoords.mX = ll_round(pos[0]); outCoords.mY = ll_round(pos[1]); - gWindowImplementation->getCallbacks()->handleDoubleClick(gWindowImplementation, outCoords, gKeyboard->currentMask(TRUE)); + gWindowImplementation->getCallbacks()->handleDoubleClick(gWindowImplementation, outCoords, gKeyboard->currentMask(true)); } void callResize(unsigned int width, unsigned int height) @@ -365,7 +363,7 @@ void callMouseMoved(float *pos, MASK mask) gWindowImplementation->getMouseDeltas(deltas); outCoords.mX += deltas[0]; outCoords.mY += deltas[1]; - gWindowImplementation->getCallbacks()->handleMouseMove(gWindowImplementation, outCoords, gKeyboard->currentMask(TRUE)); + gWindowImplementation->getCallbacks()->handleMouseMove(gWindowImplementation, outCoords, gKeyboard->currentMask(true)); //gWindowImplementation->getCallbacks()->handleScrollWheel(gWindowImplementation, 0); } @@ -378,7 +376,7 @@ void callMouseDragged(float *pos, MASK mask) gWindowImplementation->getMouseDeltas(deltas); outCoords.mX += deltas[0]; outCoords.mY += deltas[1]; - gWindowImplementation->getCallbacks()->handleMouseDragged(gWindowImplementation, outCoords, gKeyboard->currentMask(TRUE)); + gWindowImplementation->getCallbacks()->handleMouseDragged(gWindowImplementation, outCoords, gKeyboard->currentMask(true)); } void callScrollMoved(float deltaX, float deltaY) @@ -620,7 +618,7 @@ void LLWindowMacOSX::updateMouseDeltas(float* deltas) { mCursorLastEventDeltaX = 0; mCursorLastEventDeltaY = 0; - mCursorIgnoreNextDelta = FALSE; + mCursorIgnoreNextDelta = false; } } else { mCursorLastEventDeltaX = 0; @@ -634,7 +632,7 @@ void LLWindowMacOSX::getMouseDeltas(float* delta) delta[1] = mCursorLastEventDeltaY; } -BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL enable_vsync) +bool LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits, bool fullscreen, bool enable_vsync) { mFullscreen = fullscreen; @@ -693,7 +691,7 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits if (err != kCGLNoError) { setupFailure("Can't activate GL rendering context", "Error", OSMB_OK); - return FALSE; + return false; } } @@ -726,15 +724,15 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits } makeFirstResponder(mWindow, mGLView); - return TRUE; + return true; } // We only support OS X 10.7's fullscreen app mode which is literally a full screen window that fills a virtual desktop. // This makes this method obsolete. -BOOL LLWindowMacOSX::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL enable_vsync, const LLCoordScreen * const posp) +bool LLWindowMacOSX::switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, const LLCoordScreen * const posp) { - return FALSE; + return false; } void LLWindowMacOSX::destroyContext() @@ -804,13 +802,13 @@ void LLWindowMacOSX::show() void LLWindowMacOSX::hide() { - setMouseClipping(FALSE); + setMouseClipping(false); } //virtual void LLWindowMacOSX::minimize() { - setMouseClipping(FALSE); + setMouseClipping(false); showCursor(); } @@ -832,48 +830,48 @@ void LLWindowMacOSX::close() // } // Make sure cursor is visible and we haven't mangled the clipping state. - setMouseClipping(FALSE); + setMouseClipping(false); showCursor(); destroyContext(); } -BOOL LLWindowMacOSX::isValid() +bool LLWindowMacOSX::isValid() { if(mFullscreen) { - return(TRUE); + return(true); } return (mWindow != NULL); } -BOOL LLWindowMacOSX::getVisible() +bool LLWindowMacOSX::getVisible() { - BOOL result = FALSE; + bool result = false; if(mFullscreen) { - result = TRUE; + result = true; }if (mWindow) { - result = TRUE; + result = true; } return(result); } -BOOL LLWindowMacOSX::getMinimized() +bool LLWindowMacOSX::getMinimized() { return mMinimized; } -BOOL LLWindowMacOSX::getMaximized() +bool LLWindowMacOSX::getMaximized() { return mMaximized; } -BOOL LLWindowMacOSX::maximize() +bool LLWindowMacOSX::maximize() { if (mWindow && !mMaximized) { @@ -882,7 +880,7 @@ BOOL LLWindowMacOSX::maximize() return mMaximized; } -BOOL LLWindowMacOSX::getFullscreen() +bool LLWindowMacOSX::getFullscreen() { return mFullscreen; } @@ -892,7 +890,7 @@ void LLWindowMacOSX::gatherInput() updateCursor(); } -BOOL LLWindowMacOSX::getPosition(LLCoordScreen *position) +bool LLWindowMacOSX::getPosition(LLCoordScreen *position) { S32 err = -1; @@ -919,7 +917,7 @@ BOOL LLWindowMacOSX::getPosition(LLCoordScreen *position) return (err == noErr); } -BOOL LLWindowMacOSX::getSize(LLCoordScreen *size) +bool LLWindowMacOSX::getSize(LLCoordScreen *size) { S32 err = -1; @@ -945,7 +943,7 @@ BOOL LLWindowMacOSX::getSize(LLCoordScreen *size) return (err == noErr); } -BOOL LLWindowMacOSX::getSize(LLCoordWindow *size) +bool LLWindowMacOSX::getSize(LLCoordWindow *size) { S32 err = -1; @@ -973,7 +971,7 @@ BOOL LLWindowMacOSX::getSize(LLCoordWindow *size) return (err == noErr); } -BOOL LLWindowMacOSX::setPosition(const LLCoordScreen position) +bool LLWindowMacOSX::setPosition(const LLCoordScreen position) { if(mWindow) { @@ -981,32 +979,32 @@ BOOL LLWindowMacOSX::setPosition(const LLCoordScreen position) setWindowPos(mWindow, pos); } - return TRUE; + return true; } -BOOL LLWindowMacOSX::setSizeImpl(const LLCoordScreen size) +bool LLWindowMacOSX::setSizeImpl(const LLCoordScreen size) { if(mWindow) { LLCoordWindow to; convertCoords(size, &to); setWindowSize(mWindow, to.mX, to.mY); - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLWindowMacOSX::setSizeImpl(const LLCoordWindow size) +bool LLWindowMacOSX::setSizeImpl(const LLCoordWindow size) { if (mWindow) { const int titlePadding = 22; setWindowSize(mWindow, size.mX, size.mY + titlePadding); - return TRUE; + return true; } - return FALSE; + return false; } void LLWindowMacOSX::swapBuffers() @@ -1061,16 +1059,16 @@ U32 LLWindowMacOSX::getFSAASamples() void LLWindowMacOSX::setFSAASamples(const U32 samples) { mFSAASamples = samples; - mForceRebuild = TRUE; + mForceRebuild = true; } -BOOL LLWindowMacOSX::restoreGamma() +bool LLWindowMacOSX::restoreGamma() { CGDisplayRestoreColorSyncSettings(); return true; } -BOOL LLWindowMacOSX::setGamma(const F32 gamma) +bool LLWindowMacOSX::setGamma(const F32 gamma) { CGGammaValue redMin; CGGammaValue redMax; @@ -1118,7 +1116,7 @@ BOOL LLWindowMacOSX::setGamma(const F32 gamma) return true; } -BOOL LLWindowMacOSX::isCursorHidden() +bool LLWindowMacOSX::isCursorHidden() { return mCursorHidden; } @@ -1126,31 +1124,31 @@ BOOL LLWindowMacOSX::isCursorHidden() // Constrains the mouse to the window. -void LLWindowMacOSX::setMouseClipping( BOOL b ) +void LLWindowMacOSX::setMouseClipping( bool b ) { // Just stash the requested state. We'll simulate this when the cursor is hidden by decoupling. mIsMouseClipping = b; if(b) { - // LL_INFOS() << "setMouseClipping(TRUE)" << LL_ENDL; + // LL_INFOS() << "setMouseClipping(true)" << LL_ENDL; } else { - // LL_INFOS() << "setMouseClipping(FALSE)" << LL_ENDL; + // LL_INFOS() << "setMouseClipping(false)" << LL_ENDL; } adjustCursorDecouple(); } -BOOL LLWindowMacOSX::setCursorPosition(const LLCoordWindow position) +bool LLWindowMacOSX::setCursorPosition(const LLCoordWindow position) { - BOOL result = FALSE; + bool result = false; LLCoordScreen screen_pos; if (!convertCoords(position, &screen_pos)) { - return FALSE; + return false; } CGPoint newPosition; @@ -1163,7 +1161,7 @@ BOOL LLWindowMacOSX::setCursorPosition(const LLCoordWindow position) CGSetLocalEventsSuppressionInterval(0.0); if(CGWarpMouseCursorPosition(newPosition) == noErr) { - result = TRUE; + result = true; } // Under certain circumstances, this will trigger us to decouple the cursor. @@ -1180,13 +1178,13 @@ BOOL LLWindowMacOSX::setCursorPosition(const LLCoordWindow position) return result; } -BOOL LLWindowMacOSX::getCursorPosition(LLCoordWindow *position) +bool LLWindowMacOSX::getCursorPosition(LLCoordWindow *position) { float cursor_point[2]; LLCoordScreen screen_pos; if(mWindow == NULL) - return FALSE; + return false; getCursorPos(mWindow, cursor_point); @@ -1209,7 +1207,7 @@ BOOL LLWindowMacOSX::getCursorPosition(LLCoordWindow *position) position->mX = cursor_point[0] * scale; position->mY = cursor_point[1] * scale; - return TRUE; + return true; } void LLWindowMacOSX::adjustCursorDecouple(bool warpingMouse) @@ -1224,7 +1222,7 @@ void LLWindowMacOSX::adjustCursorDecouple(bool warpingMouse) // LL_INFOS() << "adjustCursorDecouple: decoupling cursor" << LL_ENDL; CGAssociateMouseAndMouseCursorPosition(false); mCursorDecoupled = true; - mCursorIgnoreNextDelta = TRUE; + mCursorIgnoreNextDelta = true; } } } @@ -1262,20 +1260,10 @@ F32 LLWindowMacOSX::getNativeAspectRatio() F32 LLWindowMacOSX::getPixelAspectRatio() { - //OS X always enforces a 1:1 pixel aspect ratio, regardless of video mode + //macOS always enforces a 1:1 pixel aspect ratio, regardless of video mode return 1.f; } -U32 LLWindowMacOSX::getAvailableVRAMMegabytes() { - // MTL (and MoltenVK) has some additional gpu data, such as recommendedMaxWorkingSetSize and currentAllocatedSize. - // But these are not available for OpenGL and/or our current mimimum OS version. - // So we will estimate. - static const U32 mb = 1024*1024; - // We're asked for total available gpu memory, but we only have allocation info on texture usage. So estimate by doubling that. - static const U32 total_factor = 2; // estimated total/textures - return gGLManager.mVRAM - (LLImageGL::getTextureBytesAllocated() * total_factor/mb); -} - //static SInt32 oldWindowLevel; // MBW -- XXX -- There's got to be a better way than this. Find it, please... @@ -1294,17 +1282,17 @@ void LLWindowMacOSX::afterDialog() void LLWindowMacOSX::flashIcon(F32 seconds) { - // For consistency with OS X conventions, the number of seconds given is ignored and + // For consistency with macOS conventions, the number of seconds given is ignored and // left up to the OS (which will actually bounce it for one second). requestUserAttention(); } -BOOL LLWindowMacOSX::isClipboardTextAvailable() +bool LLWindowMacOSX::isClipboardTextAvailable() { return pasteBoardAvailable(); } -BOOL LLWindowMacOSX::pasteTextFromClipboard(LLWString &dst) +bool LLWindowMacOSX::pasteTextFromClipboard(LLWString &dst) { unsigned short* pboard_data = copyFromPBoard(); // must free returned data llutf16string str(pboard_data); @@ -1319,9 +1307,9 @@ BOOL LLWindowMacOSX::pasteTextFromClipboard(LLWString &dst) } } -BOOL LLWindowMacOSX::copyTextToClipboard(const LLWString &s) +bool LLWindowMacOSX::copyTextToClipboard(const LLWString &s) { - BOOL result = false; + bool result = false; llutf16string utf16str = wstring_to_utf16str(s); result = copyToPBoard(utf16str.data(), utf16str.length()); @@ -1331,7 +1319,7 @@ BOOL LLWindowMacOSX::copyTextToClipboard(const LLWString &s) // protected -BOOL LLWindowMacOSX::resetDisplayResolution() +bool LLWindowMacOSX::resetDisplayResolution() { // This is only called from elsewhere in this class, and it's not used by the Mac implementation. return true; @@ -1364,13 +1352,13 @@ LLWindow::LLWindowResolution* LLWindowMacOSX::getSupportedResolutions(S32 &num_r if(bits == BITS_PER_PIXEL && width >= 800 && height >= 600) { - BOOL resolution_exists = FALSE; + bool resolution_exists = false; for(S32 i = 0; i < mNumSupportedResolutions; i++) { if (mSupportedResolutions[i].mWidth == width && mSupportedResolutions[i].mHeight == height) { - resolution_exists = TRUE; + resolution_exists = true; } } if (!resolution_exists) @@ -1389,21 +1377,21 @@ LLWindow::LLWindowResolution* LLWindowMacOSX::getSupportedResolutions(S32 &num_r return mSupportedResolutions; } -BOOL LLWindowMacOSX::convertCoords(LLCoordGL from, LLCoordWindow *to) +bool LLWindowMacOSX::convertCoords(LLCoordGL from, LLCoordWindow *to) { to->mX = from.mX; to->mY = from.mY; - return TRUE; + return true; } -BOOL LLWindowMacOSX::convertCoords(LLCoordWindow from, LLCoordGL* to) +bool LLWindowMacOSX::convertCoords(LLCoordWindow from, LLCoordGL* to) { to->mX = from.mX; to->mY = from.mY; - return TRUE; + return true; } -BOOL LLWindowMacOSX::convertCoords(LLCoordScreen from, LLCoordWindow* to) +bool LLWindowMacOSX::convertCoords(LLCoordScreen from, LLCoordWindow* to) { if(mWindow) { @@ -1417,12 +1405,12 @@ BOOL LLWindowMacOSX::convertCoords(LLCoordScreen from, LLCoordWindow* to) to->mX = mouse_point[0]; to->mY = mouse_point[1]; - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLWindowMacOSX::convertCoords(LLCoordWindow from, LLCoordScreen *to) +bool LLWindowMacOSX::convertCoords(LLCoordWindow from, LLCoordScreen *to) { if(mWindow) { @@ -1436,19 +1424,19 @@ BOOL LLWindowMacOSX::convertCoords(LLCoordWindow from, LLCoordScreen *to) to->mX = mouse_point[0]; to->mY = mouse_point[1]; - return TRUE; + return true; } - return FALSE; + return false; } -BOOL LLWindowMacOSX::convertCoords(LLCoordScreen from, LLCoordGL *to) +bool LLWindowMacOSX::convertCoords(LLCoordScreen from, LLCoordGL *to) { LLCoordWindow window_coord; return(convertCoords(from, &window_coord) && convertCoords(window_coord, to)); } -BOOL LLWindowMacOSX::convertCoords(LLCoordGL from, LLCoordScreen *to) +bool LLWindowMacOSX::convertCoords(LLCoordGL from, LLCoordScreen *to) { LLCoordWindow window_coord; @@ -1710,8 +1698,8 @@ void LLWindowMacOSX::hideCursor() if(!mCursorHidden) { // LL_INFOS() << "hideCursor: hiding" << LL_ENDL; - mCursorHidden = TRUE; - mHideCursorPermanent = TRUE; + mCursorHidden = true; + mHideCursorPermanent = true; hideNSCursor(); } else @@ -1727,8 +1715,8 @@ void LLWindowMacOSX::showCursor() if(mCursorHidden || !isCGCursorVisible()) { // LL_INFOS() << "showCursor: showing" << LL_ENDL; - mCursorHidden = FALSE; - mHideCursorPermanent = FALSE; + mCursorHidden = false; + mHideCursorPermanent = false; showNSCursor(); } else @@ -1752,7 +1740,7 @@ void LLWindowMacOSX::hideCursorUntilMouseMove() if (!mHideCursorPermanent) { hideCursor(); - mHideCursorPermanent = FALSE; + mHideCursorPermanent = false; } } @@ -2353,9 +2341,9 @@ LLSD LLWindowMacOSX::getNativeKeyData() return result; } -BOOL LLWindowMacOSX::dialogColorPicker( F32 *r, F32 *g, F32 *b) +bool LLWindowMacOSX::dialogColorPicker( F32 *r, F32 *g, F32 *b) { - BOOL retval = FALSE; + bool retval = false; OSErr error = noErr; NColorPickerInfo info; @@ -2412,12 +2400,12 @@ static long getDictLong (CFDictionaryRef refDict, CFStringRef key) return int_value; // otherwise return the long value } -void LLWindowMacOSX::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b) +void LLWindowMacOSX::allowLanguageTextInput(LLPreeditor *preeditor, bool b) { if (preeditor != mPreeditor && !b) { // This condition may occur by a call to - // setEnabled(BOOL) against LLTextEditor or LLLineEditor + // setEnabled(bool) against LLTextEditor or LLLineEditor // when the control is not focused. // We need to silently ignore the case so that // the language input status of the focused control diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index 5e09e58a99..f5b6441746 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -47,71 +47,68 @@ public: void show() override; void hide() override; void close() override; - BOOL getVisible() override; - BOOL getMinimized() override; - BOOL getMaximized() override; - BOOL maximize() override; + bool getVisible() override; + bool getMinimized() override; + bool getMaximized() override; + bool maximize() override; void minimize() override; void restore() override; - BOOL getFullscreen(); - BOOL getPosition(LLCoordScreen *position) override; - BOOL getSize(LLCoordScreen *size) override; - BOOL getSize(LLCoordWindow *size) override; - BOOL setPosition(LLCoordScreen position) override; - BOOL setSizeImpl(LLCoordScreen size) override; - BOOL setSizeImpl(LLCoordWindow size) override; - BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL enable_vsync, const LLCoordScreen * const posp = NULL) override; - BOOL setCursorPosition(LLCoordWindow position) override; - BOOL getCursorPosition(LLCoordWindow *position) override; + bool getFullscreen(); + bool getPosition(LLCoordScreen *position) override; + bool getSize(LLCoordScreen *size) override; + bool getSize(LLCoordWindow *size) override; + bool setPosition(LLCoordScreen position) override; + bool setSizeImpl(LLCoordScreen size) override; + bool setSizeImpl(LLCoordWindow size) override; + bool switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, const LLCoordScreen * const posp = NULL) override; + bool setCursorPosition(LLCoordWindow position) override; + bool getCursorPosition(LLCoordWindow *position) override; void showCursor() override; void hideCursor() override; void showCursorFromMouseMove() override; void hideCursorUntilMouseMove() override; - BOOL isCursorHidden() override; + bool isCursorHidden() override; void updateCursor() override; ECursorType getCursor() const override; void captureMouse() override; void releaseMouse() override; - void setMouseClipping( BOOL b ) override; - BOOL isClipboardTextAvailable() override; - BOOL pasteTextFromClipboard(LLWString &dst) override; - BOOL copyTextToClipboard(const LLWString & src) override; + void setMouseClipping( bool b ) override; + bool isClipboardTextAvailable() override; + bool pasteTextFromClipboard(LLWString &dst) override; + bool copyTextToClipboard(const LLWString & src) override; void flashIcon(F32 seconds) override; F32 getGamma() override; - BOOL setGamma(const F32 gamma) override; // Set the gamma + bool setGamma(const F32 gamma) override; // Set the gamma U32 getFSAASamples() override; void setFSAASamples(const U32 fsaa_samples) override; - BOOL restoreGamma() override; // Restore original gamma table (before updating gamma) + bool restoreGamma() override; // Restore original gamma table (before updating gamma) ESwapMethod getSwapMethod() override { return mSwapMethod; } void gatherInput() override; void delayInputProcessing() override {}; void swapBuffers() override; // handy coordinate space conversion routines - BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to) override; - BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to) override; - BOOL convertCoords(LLCoordWindow from, LLCoordGL *to) override; - BOOL convertCoords(LLCoordGL from, LLCoordWindow *to) override; - BOOL convertCoords(LLCoordScreen from, LLCoordGL *to) override; - BOOL convertCoords(LLCoordGL from, LLCoordScreen *to) override; + bool convertCoords(LLCoordScreen from, LLCoordWindow *to) override; + bool convertCoords(LLCoordWindow from, LLCoordScreen *to) override; + bool convertCoords(LLCoordWindow from, LLCoordGL *to) override; + bool convertCoords(LLCoordGL from, LLCoordWindow *to) override; + bool convertCoords(LLCoordScreen from, LLCoordGL *to) override; + bool convertCoords(LLCoordGL from, LLCoordScreen *to) override; LLWindowResolution* getSupportedResolutions(S32 &num_resolutions) override; F32 getNativeAspectRatio() override; F32 getPixelAspectRatio() override; void setNativeAspectRatio(F32 ratio) override { mOverrideAspectRatio = ratio; } - // query VRAM usage - /*virtual*/ U32 getAvailableVRAMMegabytes() override; - void beforeDialog() override; void afterDialog() override; - BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b) override; + bool dialogColorPicker(F32 *r, F32 *g, F32 *b) override; void *getPlatformWindow() override; void bringToFront() override {}; - void allowLanguageTextInput(LLPreeditor *preeditor, BOOL b) override; + void allowLanguageTextInput(LLPreeditor *preeditor, bool b) override; void interruptLanguageTextInput() override; void spawnWebBrowser(const std::string& escaped_url, bool async) override; F32 getSystemUISize() override; @@ -153,26 +150,26 @@ public: protected: 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 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); ~LLWindowMacOSX(); void initCursors(); - BOOL isValid() override; + bool isValid() override; 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); + bool setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh); // Go back to last fullscreen display resolution. - BOOL setFullscreenResolution(); + bool setFullscreenResolution(); // Restore the display resolution to its value before we ran the app. - BOOL resetDisplayResolution(); + bool resetDisplayResolution(); - BOOL shouldPostQuit() { return mPostQuit; } + bool shouldPostQuit() { return mPostQuit; } //Satisfy MAINT-3135 and MAINT-3288 with a flag. /*virtual */ void setOldResize(bool oldresize) override {setResizeMode(oldresize, mGLView); } @@ -186,7 +183,7 @@ protected: // // create or re-create the GL context/window. Called from the constructor and switchContext(). - BOOL createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL enable_vsync); + bool createContext(int x, int y, int width, int height, int bits, bool fullscreen, bool enable_vsync); void destroyContext(); void setupFailure(const std::string& text, const std::string& caption, U32 type); void adjustCursorDecouple(bool warpingMouse = false); @@ -214,30 +211,30 @@ protected: LLRect mOldMouseClip; // Screen rect to which the mouse cursor was globally constrained before we changed it in clipMouse() std::string mWindowTitle; double mOriginalAspectRatio; - BOOL mSimulatedRightClick; + bool mSimulatedRightClick; U32 mLastModifiers; - BOOL mHandsOffEvents; // When true, temporarially disable CarbonEvent processing. + bool mHandsOffEvents; // When true, temporarially disable CarbonEvent processing. // Used to allow event processing when putting up dialogs in fullscreen mode. - BOOL mCursorDecoupled; + bool mCursorDecoupled; S32 mCursorLastEventDeltaX; S32 mCursorLastEventDeltaY; - BOOL mCursorIgnoreNextDelta; - BOOL mNeedsResize; // Constructor figured out the window is too big, it needs a resize. + bool mCursorIgnoreNextDelta; + bool mNeedsResize; // Constructor figured out the window is too big, it needs a resize. LLCoordScreen mNeedsResizeSize; F32 mOverrideAspectRatio; - BOOL mMaximized; - BOOL mMinimized; + bool mMaximized; + bool mMinimized; U32 mFSAASamples; - BOOL mForceRebuild; + bool mForceRebuild; S32 mDragOverrideCursor; // Input method management through Text Service Manager. - BOOL mLanguageTextInputAllowed; + bool mLanguageTextInputAllowed; LLPreeditor* mPreeditor; public: - static BOOL sUseMultGL; + static bool sUseMultGL; friend class LLWindowManager; diff --git a/indra/llwindow/llwindowmesaheadless.cpp b/indra/llwindow/llwindowmesaheadless.cpp index 58f8f80d2d..6cbd737ed2 100644 --- a/indra/llwindow/llwindowmesaheadless.cpp +++ b/indra/llwindow/llwindowmesaheadless.cpp @@ -40,8 +40,8 @@ U16 *gMesaBuffer = NULL; // 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) + U32 flags, bool fullscreen, bool clearBg, + bool disable_vsync, bool use_gl, bool ignore_pixel_depth) : LLWindow(callbacks, fullscreen, flags) { if (use_gl) diff --git a/indra/llwindow/llwindowmesaheadless.h b/indra/llwindow/llwindowmesaheadless.h index 9aa376a6db..0bf8c46a30 100644 --- a/indra/llwindow/llwindowmesaheadless.h +++ b/indra/llwindow/llwindowmesaheadless.h @@ -39,38 +39,38 @@ 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 getVisible() {return false;}; + /*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;}; - /*virtual*/ BOOL getSize(LLCoordWindow *size) {return FALSE;}; - /*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;}; - /*virtual*/ BOOL setSizeImpl(LLCoordScreen size) {return FALSE;}; - /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) {return FALSE;}; - /*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;}; - /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {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 setSizeImpl(LLCoordScreen size) {return false;}; + /*virtual*/ bool switchContext(bool fullscreen, const LLCoordScreen &size, bool disable_vsync, const LLCoordScreen * const posp = NULL) {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*/ bool isCursorHidden() {return false;}; /*virtual*/ void updateCursor() {}; //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 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*/ bool setGamma(const F32 gamma) {return false; }; // Set the gamma + /*virtual*/ bool restoreGamma() {return false; }; // Restore original gamma table (before updating gamma) /*virtual*/ void setFSAASamples(const U32 fsaa_samples) { /* FSAA not supported yet on Mesa headless.*/ } /*virtual*/ U32 getFSAASamples() { return 0; } //virtual ESwapMethod getSwapMethod() { return mSwapMethod; } @@ -80,12 +80,12 @@ public: /*virtual*/ void restoreGLContext() {}; // 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*/ 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; }; @@ -97,8 +97,8 @@ public: 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); + U32 flags, bool fullscreen, bool clearBg, + bool disable_vsync, bool use_gl, bool ignore_pixel_depth); ~LLWindowMesaHeadless(); private: diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index eb689dc48c..8c90f917b8 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -57,7 +57,7 @@ extern "C" { # include <stdio.h> #endif // LL_LINUX -extern BOOL gDebugWindowProc; +extern bool gDebugWindowProc; const S32 MAX_NUM_RESOLUTIONS = 200; @@ -70,7 +70,7 @@ static bool ATIbug = false; #include <CoreGraphics/CGDirectDisplay.h> #include <CoreServices/CoreServices.h> -BOOL gHiDPISupport = TRUE; +bool gHiDPISupport = true; namespace { @@ -95,11 +95,11 @@ namespace // LLWindowMacOSX // -BOOL LLWindowSDL::sUseMultGL = FALSE; +bool LLWindowSDL::sUseMultGL = false; #endif -BOOL hasHIDPI = 0; +bool hasHIDPI = 0; // // LLWindowSDL @@ -397,9 +397,9 @@ Display* LLWindowSDL::getSDLDisplay() 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) + bool fullscreen, bool clearBg, + bool disable_vsync, bool use_gl, + bool ignore_pixel_depth, U32 fsaa_samples) : LLWindow(callbacks, fullscreen, flags), Lock_Display(NULL), //Unlock_Display(NULL), mGamma(1.0f) @@ -417,7 +417,7 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks, // Ignore use_gl for now, only used for drones on PC mWindow = NULL; mContext = {}; - mNeedsResize = FALSE; + mNeedsResize = false; mOverrideAspectRatio = 0.f; mGrabbyKeyFlags = 0; mReallyCapturedCount = 0; @@ -454,7 +454,7 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks, gWindowImplementation = this; #if LL_X11 - mFlashing = FALSE; + mFlashing = false; initialiseX11Clipboard(); #endif // LL_X11 @@ -675,7 +675,7 @@ void LLWindowSDL::tryFindFullscreenSize( int &width, int &height ) } } -BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL disable_vsync) +bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, bool fullscreen, bool disable_vsync) { //bool glneedsinit = false; @@ -794,7 +794,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B { LL_WARNS() << "Cannot create GL context " << SDL_GetError() << LL_ENDL; setupFailure("GL Context creation error creation error", "Error", OSMB_OK); - return FALSE; + return false; } // SDL_GL_SetSwapInterval(1); } @@ -804,7 +804,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B { if (mWindow) { - mFullscreen = TRUE; + mFullscreen = true; /* mFullscreenWidth = mSurface->w; mFullscreenHeight = mSurface->h; @@ -823,7 +823,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B { LL_WARNS() << "createContext: fullscreen creation failure. SDL: " << SDL_GetError() << LL_ENDL; // No fullscreen support - mFullscreen = FALSE; + mFullscreen = false; mFullscreenWidth = -1; mFullscreenHeight = -1; mFullscreenBits = -1; @@ -831,7 +831,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B std::string error = llformat("Unable to run fullscreen at %d x %d.\nRunning in window.", width, height); OSMessageBox(error, "Error", OSMB_OK); - return FALSE; + return false; } } else @@ -840,7 +840,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B { LL_WARNS() << "createContext: window creation failure. SDL: " << SDL_GetError() << LL_ENDL; setupFailure("Window creation error", "Error", OSMB_OK); - return FALSE; + return false; } } @@ -939,7 +939,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B "will automatically adjust the screen each time it runs.", "Error", OSMB_OK); - return FALSE; + return false; #endif } @@ -976,15 +976,15 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B #endif // Don't need to get the current gamma, since there's a call that restores it to the system defaults. - return TRUE; + return true; } // changing fullscreen resolution, or switching between windowed and fullscreen mode. -BOOL LLWindowSDL::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp) +bool LLWindowSDL::switchContext(bool fullscreen, const LLCoordScreen &size, bool disable_vsync, const LLCoordScreen * const posp) { - const BOOL needsRebuild = TRUE; // Just nuke the context and start over. - BOOL result = true; + const bool needsRebuild = true; // Just nuke the context and start over. + bool result = true; LL_INFOS() << "switchContext, fullscreen=" << fullscreen << LL_ENDL; stop_glerror(); @@ -1092,86 +1092,86 @@ void LLWindowSDL::close() // } // Make sure cursor is visible and we haven't mangled the clipping state. - setMouseClipping(FALSE); + setMouseClipping(false); showCursor(); destroyContext(); } -BOOL LLWindowSDL::isValid() +bool LLWindowSDL::isValid() { return (mWindow != NULL); } -BOOL LLWindowSDL::getVisible() +bool LLWindowSDL::getVisible() { - BOOL result = FALSE; + bool result = false; // *FIX: This isn't really right... // Then what is? if (mWindow) { - if( SDL_GetWindowFlags(mWindow) & SDL_WINDOW_SHOWN ) result = TRUE; + if( SDL_GetWindowFlags(mWindow) & SDL_WINDOW_SHOWN ) result = true; } return(result); } -BOOL LLWindowSDL::getMinimized() +bool LLWindowSDL::getMinimized() { - BOOL result = FALSE; + bool result = false; if (mWindow/*&& (1 == mIsMinimized)*/) { - if( SDL_GetWindowFlags(mWindow) & SDL_WINDOW_MINIMIZED ) result = TRUE; + if( SDL_GetWindowFlags(mWindow) & SDL_WINDOW_MINIMIZED ) result = true; } mIsMinimized = result; return(result); } -BOOL LLWindowSDL::getMaximized() +bool LLWindowSDL::getMaximized() { - BOOL result = FALSE; + bool result = false; if (mWindow) { // TODO - if( SDL_GetWindowFlags(mWindow) & SDL_WINDOW_MAXIMIZED ) result = TRUE; - else result = FALSE; + if( SDL_GetWindowFlags(mWindow) & SDL_WINDOW_MAXIMIZED ) result = true; + else result = false; } return(result); } -BOOL LLWindowSDL::maximize() +bool LLWindowSDL::maximize() { // TODO - BOOL result = FALSE; + bool result = false; if (mWindow) { SDL_MaximizeWindow(mWindow); - result = TRUE; + result = true; } return result; } -BOOL LLWindowSDL::getFullscreen() +bool LLWindowSDL::getFullscreen() { return mFullscreen; } -BOOL LLWindowSDL::getPosition(LLCoordScreen *position) +bool LLWindowSDL::getPosition(LLCoordScreen *position) { // *FIX: can anything be done with this? position->mX = 0; position->mY = 0; - return TRUE; + return true; } -BOOL LLWindowSDL::getSize(LLCoordScreen *size) +bool LLWindowSDL::getSize(LLCoordScreen *size) { if (mWindow) { @@ -1181,13 +1181,13 @@ BOOL LLWindowSDL::getSize(LLCoordScreen *size) else */ SDL_GetWindowSize(mWindow, &size->mX, &size->mY); - return (TRUE); + return (true); } - return (FALSE); + return (false); } -BOOL LLWindowSDL::getSize(LLCoordWindow *size) +bool LLWindowSDL::getSize(LLCoordWindow *size) { if (mWindow) { @@ -1195,22 +1195,22 @@ BOOL LLWindowSDL::getSize(LLCoordWindow *size) SDL_GL_GetDrawableSize(mWindow, &size->mX, &size->mY); else SDL_GetWindowSize(mWindow, &size->mX, &size->mY); - return (TRUE); + return (true); } - return (FALSE); + return (false); } -BOOL LLWindowSDL::setPosition(const LLCoordScreen position) +bool LLWindowSDL::setPosition(const LLCoordScreen position) { - BOOL result = FALSE; + bool result = false; if(mWindow) { // *FIX: (?) //MacMoveWindow(mWindow, position.mX, position.mY, false); SDL_SetWindowPosition(mWindow, position.mX, position.mY); - result = TRUE; + result = true; } return result; @@ -1239,12 +1239,12 @@ template< typename T > bool setSizeImpl( const T& newSize, SDL_Window *pWin ) return true; } -BOOL LLWindowSDL::setSizeImpl(const LLCoordScreen size) +bool LLWindowSDL::setSizeImpl(const LLCoordScreen size) { return ::setSizeImpl( size, mWindow ); } -BOOL LLWindowSDL::setSizeImpl(const LLCoordWindow size) +bool LLWindowSDL::setSizeImpl(const LLCoordWindow size) { return ::setSizeImpl( size, mWindow ); } @@ -1273,7 +1273,7 @@ F32 LLWindowSDL::getGamma() return 1/mGamma; } -BOOL LLWindowSDL::restoreGamma() +bool LLWindowSDL::restoreGamma() { //CGDisplayRestoreColorSyncSettings(); // SDL_SetGamma(1.0f, 1.0f, 1.0f); @@ -1283,7 +1283,7 @@ BOOL LLWindowSDL::restoreGamma() return true; } -BOOL LLWindowSDL::setGamma(const F32 gamma) +bool LLWindowSDL::setGamma(const F32 gamma) { mGamma = gamma; if (mGamma == 0) mGamma = 0.1f; @@ -1295,7 +1295,7 @@ BOOL LLWindowSDL::setGamma(const F32 gamma) return true; } -BOOL LLWindowSDL::isCursorHidden() +bool LLWindowSDL::isCursorHidden() { return mCursorHidden; } @@ -1303,7 +1303,7 @@ BOOL LLWindowSDL::isCursorHidden() // Constrains the mouse to the window. -void LLWindowSDL::setMouseClipping( BOOL b ) +void LLWindowSDL::setMouseClipping( bool b ) { //SDL_WM_GrabInput(b ? SDL_GRAB_ON : SDL_GRAB_OFF); } @@ -1327,14 +1327,14 @@ void LLWindowSDL::setMinSize(U32 min_width, U32 min_height, bool enforce_immedia #endif } -BOOL LLWindowSDL::setCursorPosition(const LLCoordWindow position) +bool LLWindowSDL::setCursorPosition(const LLCoordWindow position) { - BOOL result = TRUE; + bool result = true; LLCoordScreen screen_pos; if (!convertCoords(position, &screen_pos)) { - return FALSE; + return false; } //LL_INFOS() << "setCursorPosition(" << screen_pos.mX << ", " << screen_pos.mY << ")" << LL_ENDL; @@ -1354,7 +1354,7 @@ BOOL LLWindowSDL::setCursorPosition(const LLCoordWindow position) return result; } -BOOL LLWindowSDL::getCursorPosition(LLCoordWindow *position) +bool LLWindowSDL::getCursorPosition(LLCoordWindow *position) { //Point cursor_point; LLCoordScreen screen_pos; @@ -1429,7 +1429,7 @@ void LLWindowSDL::beforeDialog() LL_INFOS() << "LLWindowSDL::beforeDialog()" << LL_ENDL; - if (SDLReallyCaptureInput(FALSE)) // must ungrab input so popup works! + if (SDLReallyCaptureInput(false)) // must ungrab input so popup works! { if (mFullscreen) { @@ -1482,7 +1482,7 @@ void LLWindowSDL::afterDialog() #if LL_X11 // set/reset the XWMHints flag for 'urgency' that usually makes the icon flash -void LLWindowSDL::x11_set_urgent(BOOL urgent) +void LLWindowSDL::x11_set_urgent(bool urgent) { if (mSDL_Display && !mFullscreen) { @@ -1523,13 +1523,13 @@ void LLWindowSDL::flashIcon(F32 seconds) mFlashTimer.reset(); mFlashTimer.setTimerExpirySec(remaining_time); - x11_set_urgent(TRUE); - mFlashing = TRUE; + x11_set_urgent(true); + mFlashing = true; #endif // LL_X11 } } -BOOL LLWindowSDL::isClipboardTextAvailable() +bool LLWindowSDL::isClipboardTextAvailable() { #if LL_X11 return mSDL_Display && XGetSelectionOwner(mSDL_Display, XA_CLIPBOARD) != None; @@ -1538,7 +1538,7 @@ BOOL LLWindowSDL::isClipboardTextAvailable() #endif } -BOOL LLWindowSDL::pasteTextFromClipboard(LLWString &dst) +bool LLWindowSDL::pasteTextFromClipboard(LLWString &dst) { #if LL_X11 return getSelectionText(XA_CLIPBOARD, dst); @@ -1548,13 +1548,13 @@ BOOL LLWindowSDL::pasteTextFromClipboard(LLWString &dst) { dst = LLWString(utf8str_to_wstring(data)); SDL_free(data); - return TRUE; + return true; } - return FALSE; + return false; #endif } -BOOL LLWindowSDL::copyTextToClipboard(const LLWString &s) +bool LLWindowSDL::copyTextToClipboard(const LLWString &s) { #if LL_X11 return setSelectionText(XA_CLIPBOARD, s); @@ -1563,31 +1563,31 @@ BOOL LLWindowSDL::copyTextToClipboard(const LLWString &s) #endif } -BOOL LLWindowSDL::isPrimaryTextAvailable() +bool LLWindowSDL::isPrimaryTextAvailable() { #if LL_X11 LLWString text; return getSelectionText(XA_PRIMARY, text) && !text.empty(); #else - return FALSE; // unsupported + return false; // unsupported #endif } -BOOL LLWindowSDL::pasteTextFromPrimary(LLWString &dst) +bool LLWindowSDL::pasteTextFromPrimary(LLWString &dst) { #if LL_X11 return getSelectionText(XA_PRIMARY, dst); #else - return FALSE; // unsupported + return false; // unsupported #endif } -BOOL LLWindowSDL::copyTextToPrimary(const LLWString &s) +bool LLWindowSDL::copyTextToPrimary(const LLWString &s) { #if LL_X11 return setSelectionText(XA_PRIMARY, s); #else - return FALSE; // unsupported + return false; // unsupported #endif } @@ -1631,62 +1631,62 @@ LLWindow::LLWindowResolution* LLWindowSDL::getSupportedResolutions(S32 &num_reso return mSupportedResolutions; } -BOOL LLWindowSDL::convertCoords(LLCoordGL from, LLCoordWindow *to) +bool LLWindowSDL::convertCoords(LLCoordGL from, LLCoordWindow *to) { if (!to) - return FALSE; + return false; to->mX = from.mX; int h; SDL_GetWindowSize(mWindow, nullptr, &h); to->mY = h - from.mY - 1; - return TRUE; + return true; } -BOOL LLWindowSDL::convertCoords(LLCoordWindow from, LLCoordGL* to) +bool LLWindowSDL::convertCoords(LLCoordWindow from, LLCoordGL* to) { if (!to) - return FALSE; + return false; to->mX = from.mX; int h; SDL_GetWindowSize(mWindow, nullptr, &h); to->mY = h - from.mY - 1; - return TRUE; + return true; } -BOOL LLWindowSDL::convertCoords(LLCoordScreen from, LLCoordWindow* to) +bool LLWindowSDL::convertCoords(LLCoordScreen from, LLCoordWindow* to) { if (!to) - return FALSE; + return false; // In the fullscreen case, window and screen coordinates are the same. to->mX = from.mX; to->mY = from.mY; - return (TRUE); + return (true); } -BOOL LLWindowSDL::convertCoords(LLCoordWindow from, LLCoordScreen *to) +bool LLWindowSDL::convertCoords(LLCoordWindow from, LLCoordScreen *to) { if (!to) - return FALSE; + return false; // In the fullscreen case, window and screen coordinates are the same. to->mX = from.mX; to->mY = from.mY; - return (TRUE); + return (true); } -BOOL LLWindowSDL::convertCoords(LLCoordScreen from, LLCoordGL *to) +bool LLWindowSDL::convertCoords(LLCoordScreen from, LLCoordGL *to) { LLCoordWindow window_coord; return(convertCoords(from, &window_coord) && convertCoords(window_coord, to)); } -BOOL LLWindowSDL::convertCoords(LLCoordGL from, LLCoordScreen *to) +bool LLWindowSDL::convertCoords(LLCoordGL from, LLCoordScreen *to) { LLCoordWindow window_coord; @@ -1703,7 +1703,7 @@ void LLWindowSDL::setupFailure(const std::string& text, const std::string& capti OSMessageBox(text, caption, type); } -BOOL LLWindowSDL::SDLReallyCaptureInput(BOOL capture) +bool LLWindowSDL::SDLReallyCaptureInput(bool capture) { // note: this used to be safe to call nestedly, but in the // end that's not really a wise usage pattern, so don't. @@ -1775,7 +1775,7 @@ BOOL LLWindowSDL::SDLReallyCaptureInput(BOOL capture) return capture == newGrab; } -U32 LLWindowSDL::SDLCheckGrabbyKeys(U32 keysym, BOOL gain) +U32 LLWindowSDL::SDLCheckGrabbyKeys(U32 keysym, bool gain) { /* part of the fix for SL-13243: Some popular window managers like to totally eat alt-drag for the purposes of moving windows. We @@ -1923,7 +1923,7 @@ void LLWindowSDL::processMiscNativeEvents() pump_timer.setTimerExpirySec(1.0f / 15.0f); do { - g_main_context_iteration(g_main_context_default(), FALSE); + g_main_context_iteration(g_main_context_default(), false); } while( g_main_context_pending(g_main_context_default()) && !pump_timer.hasExpired()); #endif @@ -1964,7 +1964,7 @@ void LLWindowSDL::gatherInput() //LL_INFOS() << "SDL_MOUSEMOTION " << event.button.x << " " << event.button.y << " gl " << openGlCoord.mX << " " << openGlCoord.mY << LL_ENDL; - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); mCallbacks->handleMouseMove(this, openGlCoord, mask); break; } @@ -1972,7 +1972,7 @@ void LLWindowSDL::gatherInput() case SDL_TEXTINPUT: { auto string = utf8str_to_utf16str( event.text.text ); - mKeyModifiers = gKeyboard->currentMask( FALSE ); + mKeyModifiers = gKeyboard->currentMask( false ); mInputType = "textinput"; for( auto key: string ) { @@ -2010,8 +2010,8 @@ void LLWindowSDL::gatherInput() } // part of the fix for SL-13243 - if (SDLCheckGrabbyKeys(event.key.keysym.sym, TRUE) != 0) - SDLReallyCaptureInput(TRUE); + if (SDLCheckGrabbyKeys(event.key.keysym.sym, true) != 0) + SDLReallyCaptureInput(true); break; @@ -2026,8 +2026,8 @@ void LLWindowSDL::gatherInput() mKeyVirtualKey = SDLK_RETURN; } - if (SDLCheckGrabbyKeys(mKeyVirtualKey, FALSE) == 0) - SDLReallyCaptureInput(FALSE); // part of the fix for SL-13243 + if (SDLCheckGrabbyKeys(mKeyVirtualKey, false) == 0) + SDLReallyCaptureInput(false); // part of the fix for SL-13243 gKeyboard->handleKeyUp(mKeyVirtualKey,mKeyModifiers); break; @@ -2042,7 +2042,7 @@ void LLWindowSDL::gatherInput() openGlCoord.mX *= getSystemUISize(); openGlCoord.mY *= getSystemUISize(); - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); if (event.button.button == SDL_BUTTON_LEFT) // SDL doesn't manage double clicking... { @@ -2109,7 +2109,7 @@ void LLWindowSDL::gatherInput() openGlCoord.mX *= getSystemUISize(); openGlCoord.mY *= getSystemUISize(); - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); if (event.button.button == SDL_BUTTON_LEFT) // left mCallbacks->handleMouseUp(this, openGlCoord, mask); @@ -2143,13 +2143,13 @@ void LLWindowSDL::gatherInput() { LL_INFOS() << "SDL_WINDOWEVENT_ENTER" << LL_ENDL; if(!mHaveInputFocus) mCallbacks->handleFocus(this); - mHaveInputFocus = TRUE; + mHaveInputFocus = true; } else if(event.window.event == SDL_WINDOWEVENT_LEAVE) { LL_INFOS() << "SDL_WINDOWEVENT_LEAVE" << LL_ENDL; if(mHaveInputFocus) mCallbacks->handleFocusLost(this); - mHaveInputFocus = FALSE; + mHaveInputFocus = false; } else if( event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED ) // <FS:ND> What about SDL_WINDOWEVENT_ENTER (mouse focus) { @@ -2176,14 +2176,14 @@ void LLWindowSDL::gatherInput() else if(event.window.event == SDL_WINDOWEVENT_MINIMIZED) { LL_INFOS() << "SDL_WINDOWEVENT_MINIMIZED" << LL_ENDL; - if(!mIsMinimized) mCallbacks->handleActivate(this,FALSE); - mIsMinimized = TRUE; + if(!mIsMinimized) mCallbacks->handleActivate(this,false); + mIsMinimized = true; } else if(event.window.event == SDL_WINDOWEVENT_MAXIMIZED) { LL_INFOS() << "SDL_WINDOWEVENT_MAXIMIZED" << LL_ENDL; - if(mIsMinimized) mCallbacks->handleActivate(this,TRUE); - mIsMinimized = FALSE; + if(mIsMinimized) mCallbacks->handleActivate(this,true); + mIsMinimized = false; } */ else if (event.window.event == SDL_WINDOWEVENT_EXPOSED) @@ -2228,8 +2228,8 @@ void LLWindowSDL::gatherInput() // expired. if (mFlashing && mFlashTimer.hasExpired()) { - x11_set_urgent(FALSE); - mFlashing = FALSE; + x11_set_urgent(false); + mFlashing = false; } #endif // LL_X11 } @@ -2280,10 +2280,10 @@ static SDL_Cursor *makeSDLCursorFromBMP(const char *filename, int hotx, int hoty U8 srcred = pixelp[0]; U8 srcgreen = pixelp[1]; U8 srcblue = pixelp[2]; - BOOL mask_bit = (srcred != 200) + bool mask_bit = (srcred != 200) || (srcgreen != 200) || (srcblue != 200); - BOOL data_bit = mask_bit && (srcgreen <= 80);//not 0x80 + bool data_bit = mask_bit && (srcgreen <= 80);//not 0x80 unsigned char bit_offset = (cursurface->w/8) * i + j/8; cursor_data[bit_offset] |= (data_bit) << (7 - (j&7)); @@ -2442,8 +2442,8 @@ void LLWindowSDL::hideCursor() if(!mCursorHidden) { // LL_INFOS() << "hideCursor: hiding" << LL_ENDL; - mCursorHidden = TRUE; - mHideCursorPermanent = TRUE; + mCursorHidden = true; + mHideCursorPermanent = true; SDL_ShowCursor(0); } else @@ -2457,8 +2457,8 @@ void LLWindowSDL::showCursor() if(mCursorHidden) { // LL_INFOS() << "showCursor: showing" << LL_ENDL; - mCursorHidden = FALSE; - mHideCursorPermanent = FALSE; + mCursorHidden = false; + mHideCursorPermanent = false; SDL_ShowCursor(1); } else @@ -2480,7 +2480,7 @@ void LLWindowSDL::hideCursorUntilMouseMove() if (!mHideCursorPermanent) { hideCursor(); - mHideCursorPermanent = FALSE; + mHideCursorPermanent = false; } } @@ -2541,9 +2541,9 @@ S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 typ return OSBTN_CANCEL; } -BOOL LLWindowSDL::dialogColorPicker( F32 *r, F32 *g, F32 *b) +bool LLWindowSDL::dialogColorPicker( F32 *r, F32 *g, F32 *b) { - return (FALSE); + return (false); } #if LL_DARWIN @@ -2743,7 +2743,7 @@ void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async) void LLWindowSDL::openFile(const std::string& file_name) { - spawnWebBrowser("file://"+file_name,TRUE); + spawnWebBrowser("file://"+file_name,true); } void *LLWindowSDL::getPlatformWindow() @@ -2916,17 +2916,6 @@ void LLWindowSDL::toggleVSync(bool enable_vsync) } } -U32 LLWindowSDL::getAvailableVRAMMegabytes() -{ -#if LL_DARWIN - static const U32 mb = 1024*1024; - static const U32 total_factor = 2; - return gGLManager.mVRAM - (LLImageGL::getTextureBytesAllocated() * total_factor/mb); -#else - return 4096; -#endif -} - void LLWindowSDL::setLanguageTextInput(const LLCoordGL& position) { LLCoordWindow win_pos; diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index 87a3e15731..3ed2811572 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -58,38 +58,38 @@ public: void close() override; - BOOL getVisible() override; + bool getVisible() override; - BOOL getMinimized() override; + bool getMinimized() override; - BOOL getMaximized() override; + bool getMaximized() override; - BOOL maximize() override; + bool maximize() override; void minimize() override; void restore() override; - BOOL getFullscreen(); + bool getFullscreen(); - BOOL getPosition(LLCoordScreen *position) override; + bool getPosition(LLCoordScreen *position) override; - BOOL getSize(LLCoordScreen *size) override; + bool getSize(LLCoordScreen *size) override; - BOOL getSize(LLCoordWindow *size) override; + bool getSize(LLCoordWindow *size) override; - BOOL setPosition(LLCoordScreen position) override; + bool setPosition(LLCoordScreen position) override; - BOOL setSizeImpl(LLCoordScreen size) override; + bool setSizeImpl(LLCoordScreen size) override; - BOOL setSizeImpl(LLCoordWindow size) override; + bool setSizeImpl(LLCoordWindow size) override; - BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, + bool switchContext(bool fullscreen, const LLCoordScreen &size, bool disable_vsync, const LLCoordScreen *const posp = NULL) override; - BOOL setCursorPosition(LLCoordWindow position) override; + bool setCursorPosition(LLCoordWindow position) override; - BOOL getCursorPosition(LLCoordWindow *position) override; + bool getCursorPosition(LLCoordWindow *position) override; void showCursor() override; @@ -99,7 +99,7 @@ public: void hideCursorUntilMouseMove() override; - BOOL isCursorHidden() override; + bool isCursorHidden() override; void updateCursor() override; @@ -107,32 +107,32 @@ public: void releaseMouse() override; - void setMouseClipping(BOOL b) override; + void setMouseClipping(bool b) override; void setMinSize(U32 min_width, U32 min_height, bool enforce_immediately = true) override; - BOOL isClipboardTextAvailable() override; + bool isClipboardTextAvailable() override; - BOOL pasteTextFromClipboard(LLWString &dst) override; + bool pasteTextFromClipboard(LLWString &dst) override; - BOOL copyTextToClipboard(const LLWString &src) override; + bool copyTextToClipboard(const LLWString &src) override; - BOOL isPrimaryTextAvailable() override; + bool isPrimaryTextAvailable() override; - BOOL pasteTextFromPrimary(LLWString &dst) override; + bool pasteTextFromPrimary(LLWString &dst) override; - BOOL copyTextToPrimary(const LLWString &src) override; + bool copyTextToPrimary(const LLWString &src) override; void flashIcon(F32 seconds) override; F32 getGamma() override; - BOOL setGamma(const F32 gamma) override; // Set the gamma + bool setGamma(const F32 gamma) override; // Set the gamma U32 getFSAASamples() override; void setFSAASamples(const U32 samples) override; - BOOL restoreGamma() override; // Restore original gamma table (before updating gamma) + bool restoreGamma() override; // Restore original gamma table (before updating gamma) ESwapMethod getSwapMethod() override { return mSwapMethod; } void processMiscNativeEvents() override; @@ -146,17 +146,17 @@ public: void delayInputProcessing() override {}; // handy coordinate space conversion routines - BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to) override; + bool convertCoords(LLCoordScreen from, LLCoordWindow *to) override; - BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to) override; + bool convertCoords(LLCoordWindow from, LLCoordScreen *to) override; - BOOL convertCoords(LLCoordWindow from, LLCoordGL *to) override; + bool convertCoords(LLCoordWindow from, LLCoordGL *to) override; - BOOL convertCoords(LLCoordGL from, LLCoordWindow *to) override; + bool convertCoords(LLCoordGL from, LLCoordWindow *to) override; - BOOL convertCoords(LLCoordScreen from, LLCoordGL *to) override; + bool convertCoords(LLCoordScreen from, LLCoordGL *to) override; - BOOL convertCoords(LLCoordGL from, LLCoordScreen *to) override; + bool convertCoords(LLCoordGL from, LLCoordScreen *to) override; LLWindowResolution *getSupportedResolutions(S32 &num_resolutions) override; @@ -172,7 +172,7 @@ public: void afterDialog() override; - BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b) override; + bool dialogColorPicker(F32 *r, F32 *g, F32 *b) override; void *getPlatformWindow() override; @@ -208,7 +208,7 @@ public: #endif // LL_X11 #if LL_DARWIN - static BOOL sUseMultGL; + static bool sUseMultGL; #endif void *createSharedContext() override; @@ -219,17 +219,15 @@ public: void toggleVSync(bool enable_vsync) override; - U32 getAvailableVRAMMegabytes() override; - 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 fullscreen, bool clearBg, bool disable_vsync, bool use_gl, + bool ignore_pixel_depth, U32 fsaa_samples); ~LLWindowSDL(); - BOOL isValid() override; + bool isValid() override; LLSD getNativeKeyData() override; @@ -240,12 +238,12 @@ protected: 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); + bool setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh); // Go back to last fullscreen display resolution. - BOOL setFullscreenResolution(); + bool setFullscreenResolution(); - BOOL shouldPostQuit() { return mPostQuit; } + bool shouldPostQuit() { return mPostQuit; } protected: // @@ -253,7 +251,7 @@ protected: // // create or re-create the GL context/window. Called from the constructor and switchContext(). - BOOL createContext(int x, int y, int width, int height, int bits, BOOL fullscreen, BOOL disable_vsync); + bool createContext(int x, int y, int width, int height, int bits, bool fullscreen, bool disable_vsync); void destroyContext(); @@ -261,9 +259,9 @@ protected: void fixWindowSize(void); - U32 SDLCheckGrabbyKeys(U32 keysym, BOOL gain); + U32 SDLCheckGrabbyKeys(U32 keysym, bool gain); - BOOL SDLReallyCaptureInput(BOOL capture); + bool SDLReallyCaptureInput(bool capture); // // Platform specific variables @@ -277,7 +275,7 @@ protected: std::string mWindowTitle; double mOriginalAspectRatio; - BOOL mNeedsResize; // Constructor figured out the window is too big, it needs a resize. + bool mNeedsResize; // Constructor figured out the window is too big, it needs a resize. LLCoordScreen mNeedsResizeSize; F32 mOverrideAspectRatio; F32 mGamma; @@ -294,9 +292,9 @@ protected: private: #if LL_X11 - void x11_set_urgent(BOOL urgent); + void x11_set_urgent(bool urgent); - BOOL mFlashing; + bool mFlashing; LLTimer mFlashTimer; #endif //LL_X11 diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 12cd5320b8..fee0de7739 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -92,7 +92,7 @@ const F32 ICON_FLASH_TIME = 0.5f; const UINT WM_DUMMY_(WM_USER + 0x0017); const UINT WM_POST_FUNCTION_(WM_USER + 0x0018); -extern BOOL gDebugWindowProc; +extern bool gDebugWindowProc; static std::thread::id sWindowThreadId; static std::thread::id sMainThreadId; @@ -167,10 +167,10 @@ GLuint SafeChoosePixelFormat(HDC &hdc, const PIXELFORMATDESCRIPTOR *ppfd) } //static -BOOL LLWindowWin32::sIsClassRegistered = FALSE; +bool LLWindowWin32::sIsClassRegistered = false; -BOOL LLWindowWin32::sLanguageTextInputAllowed = TRUE; -BOOL LLWindowWin32::sWinIMEOpened = FALSE; +bool LLWindowWin32::sLanguageTextInputAllowed = true; +bool LLWindowWin32::sWinIMEOpened = false; HKL LLWindowWin32::sWinInputLocale = 0; DWORD LLWindowWin32::sWinIMEConversionMode = IME_CMODE_NATIVE; DWORD LLWindowWin32::sWinIMESentenceMode = IME_SMODE_AUTOMATIC; @@ -189,24 +189,24 @@ public: public: // Wrappers for IMM API. - static BOOL isIME(HKL hkl); + static bool isIME(HKL hkl); static HIMC getContext(HWND hwnd); - static BOOL releaseContext(HWND hwnd, HIMC himc); - static BOOL getOpenStatus(HIMC himc); - static BOOL setOpenStatus(HIMC himc, BOOL status); - static BOOL getConversionStatus(HIMC himc, LPDWORD conversion, LPDWORD sentence); - static BOOL setConversionStatus(HIMC himc, DWORD conversion, DWORD sentence); - static BOOL getCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form); - static BOOL setCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form); + static bool releaseContext(HWND hwnd, HIMC himc); + static bool getOpenStatus(HIMC himc); + static bool setOpenStatus(HIMC himc, bool status); + static bool getConversionStatus(HIMC himc, LPDWORD conversion, LPDWORD sentence); + static bool setConversionStatus(HIMC himc, DWORD conversion, DWORD sentence); + static bool getCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form); + static bool setCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form); static LONG getCompositionString(HIMC himc, DWORD index, LPVOID data, DWORD length); - static BOOL setCompositionString(HIMC himc, DWORD index, LPVOID pComp, DWORD compLength, LPVOID pRead, DWORD readLength); - static BOOL setCompositionFont(HIMC himc, LPLOGFONTW logfont); - static BOOL setCandidateWindow(HIMC himc, LPCANDIDATEFORM candidate_form); - static BOOL notifyIME(HIMC himc, DWORD action, DWORD index, DWORD value); + static bool setCompositionString(HIMC himc, DWORD index, LPVOID pComp, DWORD compLength, LPVOID pRead, DWORD readLength); + static bool setCompositionFont(HIMC himc, LPLOGFONTW logfont); + static bool setCandidateWindow(HIMC himc, LPCANDIDATEFORM candidate_form); + static bool notifyIME(HIMC himc, DWORD action, DWORD index, DWORD value); }; // static -BOOL LLWinImm::isIME(HKL hkl) +bool LLWinImm::isIME(HKL hkl) { return ImmIsIME(hkl); } @@ -218,43 +218,43 @@ HIMC LLWinImm::getContext(HWND hwnd) } //static -BOOL LLWinImm::releaseContext(HWND hwnd, HIMC himc) +bool LLWinImm::releaseContext(HWND hwnd, HIMC himc) { return ImmReleaseContext(hwnd, himc); } // static -BOOL LLWinImm::getOpenStatus(HIMC himc) +bool LLWinImm::getOpenStatus(HIMC himc) { return ImmGetOpenStatus(himc); } // static -BOOL LLWinImm::setOpenStatus(HIMC himc, BOOL status) +bool LLWinImm::setOpenStatus(HIMC himc, bool status) { return ImmSetOpenStatus(himc, status); } // static -BOOL LLWinImm::getConversionStatus(HIMC himc, LPDWORD conversion, LPDWORD sentence) +bool LLWinImm::getConversionStatus(HIMC himc, LPDWORD conversion, LPDWORD sentence) { return ImmGetConversionStatus(himc, conversion, sentence); } // static -BOOL LLWinImm::setConversionStatus(HIMC himc, DWORD conversion, DWORD sentence) +bool LLWinImm::setConversionStatus(HIMC himc, DWORD conversion, DWORD sentence) { return ImmSetConversionStatus(himc, conversion, sentence); } // static -BOOL LLWinImm::getCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form) +bool LLWinImm::getCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form) { return ImmGetCompositionWindow(himc, form); } // static -BOOL LLWinImm::setCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form) +bool LLWinImm::setCompositionWindow(HIMC himc, LPCOMPOSITIONFORM form) { return ImmSetCompositionWindow(himc, form); } @@ -268,25 +268,25 @@ LONG LLWinImm::getCompositionString(HIMC himc, DWORD index, LPVOID data, // static -BOOL LLWinImm::setCompositionString(HIMC himc, DWORD index, LPVOID pComp, DWORD compLength, LPVOID pRead, DWORD readLength) +bool LLWinImm::setCompositionString(HIMC himc, DWORD index, LPVOID pComp, DWORD compLength, LPVOID pRead, DWORD readLength) { return ImmSetCompositionString(himc, index, pComp, compLength, pRead, readLength); } // static -BOOL LLWinImm::setCompositionFont(HIMC himc, LPLOGFONTW pFont) +bool LLWinImm::setCompositionFont(HIMC himc, LPLOGFONTW pFont) { return ImmSetCompositionFont(himc, pFont); } // static -BOOL LLWinImm::setCandidateWindow(HIMC himc, LPCANDIDATEFORM form) +bool LLWinImm::setCandidateWindow(HIMC himc, LPCANDIDATEFORM form) { return ImmSetCandidateWindow(himc, form); } // static -BOOL LLWinImm::notifyIME(HIMC himc, DWORD action, DWORD index, DWORD value) +bool LLWinImm::notifyIME(HIMC himc, DWORD action, DWORD index, DWORD value) { return ImmNotifyIME(himc, action, index, value); } @@ -350,22 +350,8 @@ struct LLWindowWin32::LLWindowWin32Thread : public LL::ThreadPool mGLReady = true; } - // initialzie DXGI adapter (for querying available VRAM) - void initDX(); - - // initialize D3D (if DXGI cannot be used) - void initD3D(); - - //clean up DXGI/D3D resources - void cleanupDX(); - - // call periodically to update available VRAM - void updateVRAMUsage(); - - U32 getAvailableVRAMMegabytes() - { - return mAvailableVRAM; - } + // Use DXGI to check memory (because WMI doesn't report more than 4Gb) + void checkDXMem(); /// called by main thread to post work to this window thread template <typename CALLABLE> @@ -407,33 +393,24 @@ struct LLWindowWin32::LLWindowWin32Thread : public LL::ThreadPool using FuncType = std::function<void()>; // call GetMessage() and pull enqueue messages for later processing - void gatherInput(); HWND mWindowHandleThrd = NULL; HDC mhDCThrd = 0; // *HACK: Attempt to prevent startup crashes by deferring memory accounting // until after some graphics setup. See SL-20177. -Cosmic,2023-09-18 bool mGLReady = false; - // best guess at available video memory in MB - std::atomic<U32> mAvailableVRAM; - - U32 mMaxVRAM = 0; // maximum amount of vram to allow in the "budget", or 0 for no maximum (see updateVRAMUsage) - - IDXGIAdapter3* mDXGIAdapter = nullptr; - LPDIRECT3D9 mD3D = nullptr; - LPDIRECT3DDEVICE9 mD3DDevice = nullptr; + bool mGotGLBuffer = false; }; 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 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(callbacks, fullscreen, flags), @@ -442,7 +419,6 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, { sMainThreadId = LLThread::currentID(); mWindowThread = new LLWindowWin32Thread(); - mWindowThread->mMaxVRAM = max_vram; //MAINT-516 -- force a load of opengl32.dll just in case windows went sideways LoadLibrary(L"opengl32.dll"); @@ -454,7 +430,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, mMaxCores = llmin(mMaxCores, (U32) 64); DWORD_PTR mask = 0; - for (int i = 0; i < mMaxCores; ++i) + for (U32 i = 0; i < mMaxCores; ++i) { mask |= ((DWORD_PTR) 1) << i; } @@ -523,7 +499,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, mIconResource = gIconResource; mOverrideAspectRatio = 0.f; mNativeAspectRatio = 0.f; - mInputProcessingPaused = FALSE; + mInputProcessingPaused = false; mPreeditor = NULL; mKeyCharCode = 0; mKeyScanCode = 0; @@ -532,7 +508,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, mhRC = NULL; memset(mCurrentGammaRamp, 0, sizeof(mCurrentGammaRamp)); memset(mPrevGammaRamp, 0, sizeof(mPrevGammaRamp)); - mCustomGammaSet = FALSE; + mCustomGammaSet = false; mWindowHandle = NULL; mRect = {0, 0, 0, 0}; @@ -540,7 +516,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, if (!SystemParametersInfo(SPI_GETMOUSEVANISH, 0, &mMouseVanish, 0)) { - mMouseVanish = TRUE; + mMouseVanish = true; } // Initialize the keyboard @@ -552,7 +528,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, // Initialize (boot strap) the Language text input management, // based on the system's (user's) default settings. - allowLanguageTextInput(mPreeditor, FALSE); + allowLanguageTextInput(mPreeditor, false); WNDCLASS wc; RECT window_rect; @@ -670,7 +646,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, mCallbacks->translateString("MBError"), OSMB_OK); return; } - sIsClassRegistered = TRUE; + sIsClassRegistered = true; } //----------------------------------------------------------------------- @@ -698,7 +674,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, //----------------------------------------------------------------------- if (mFullscreen) { - BOOL success = FALSE; + bool success = false; DWORD closest_refresh = 0; for (S32 mode_num = 0;; mode_num++) @@ -712,7 +688,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, dev_mode.dmPelsHeight == height && dev_mode.dmBitsPerPel == BITS_PER_PIXEL) { - success = TRUE; + success = true; if ((dev_mode.dmDisplayFrequency - current_refresh) < (closest_refresh - current_refresh)) { @@ -724,11 +700,11 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, 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; + //success = false; if (!EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode)) { - success = FALSE; + success = false; } else { @@ -737,12 +713,12 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, 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; + success = true; } else { LL_WARNS("Window") << "Current BBP is BAD" << LL_ENDL; - success = FALSE; + success = false; } } } @@ -760,7 +736,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, // If it failed, we don't want to run fullscreen if (success) { - mFullscreen = TRUE; + mFullscreen = true; mFullscreenWidth = dev_mode.dmPelsWidth; mFullscreenHeight = dev_mode.dmPelsHeight; mFullscreenBits = dev_mode.dmBitsPerPel; @@ -774,7 +750,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, } else { - mFullscreen = FALSE; + mFullscreen = false; mFullscreenWidth = -1; mFullscreenHeight = -1; mFullscreenBits = -1; @@ -855,7 +831,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, // Initialize (boot strap) the Language text input management, // based on the system's (or user's) default settings. - allowLanguageTextInput(NULL, FALSE); + allowLanguageTextInput(NULL, false); } @@ -885,14 +861,14 @@ void LLWindowWin32::show() void LLWindowWin32::hide() { - setMouseClipping(FALSE); + setMouseClipping(false); ShowWindow(mWindowHandle, SW_HIDE); } //virtual void LLWindowWin32::minimize() { - setMouseClipping(FALSE); + setMouseClipping(false); showCursor(); ShowWindow(mWindowHandle, SW_MINIMIZE); } @@ -949,7 +925,7 @@ void LLWindowWin32::close() // Make sure cursor is visible and we haven't mangled the clipping state. showCursor(); - setMouseClipping(FALSE); + setMouseClipping(false); if (gKeyboard) { gKeyboard->resetKeys(); @@ -989,29 +965,29 @@ void LLWindowWin32::close() mWindowThread->wakeAndDestroy(); } -BOOL LLWindowWin32::isValid() +bool LLWindowWin32::isValid() { return (mWindowHandle != NULL); } -BOOL LLWindowWin32::getVisible() +bool LLWindowWin32::getVisible() { return (mWindowHandle && IsWindowVisible(mWindowHandle)); } -BOOL LLWindowWin32::getMinimized() +bool LLWindowWin32::getMinimized() { return (mWindowHandle && IsIconic(mWindowHandle)); } -BOOL LLWindowWin32::getMaximized() +bool LLWindowWin32::getMaximized() { return (mWindowHandle && IsZoomed(mWindowHandle)); } -BOOL LLWindowWin32::maximize() +bool LLWindowWin32::maximize() { - BOOL success = FALSE; + bool success = false; if (!mWindowHandle) return success; mWindowThread->post([=] @@ -1026,56 +1002,56 @@ BOOL LLWindowWin32::maximize() } }); - return TRUE; + return true; } -BOOL LLWindowWin32::getFullscreen() +bool LLWindowWin32::getFullscreen() { return mFullscreen; } -BOOL LLWindowWin32::getPosition(LLCoordScreen *position) +bool LLWindowWin32::getPosition(LLCoordScreen *position) { position->mX = mRect.left; position->mY = mRect.top; - return TRUE; + return true; } -BOOL LLWindowWin32::getSize(LLCoordScreen *size) +bool LLWindowWin32::getSize(LLCoordScreen *size) { size->mX = mRect.right - mRect.left; size->mY = mRect.bottom - mRect.top; - return TRUE; + return true; } -BOOL LLWindowWin32::getSize(LLCoordWindow *size) +bool LLWindowWin32::getSize(LLCoordWindow *size) { size->mX = mClientRect.right - mClientRect.left; size->mY = mClientRect.bottom - mClientRect.top; - return TRUE; + return true; } -BOOL LLWindowWin32::setPosition(const LLCoordScreen position) +bool LLWindowWin32::setPosition(const LLCoordScreen position) { LLCoordScreen size; if (!mWindowHandle) { - return FALSE; + return false; } getSize(&size); moveWindow(position, size); - return TRUE; + return true; } -BOOL LLWindowWin32::setSizeImpl(const LLCoordScreen size) +bool LLWindowWin32::setSizeImpl(const LLCoordScreen size) { LLCoordScreen position; getPosition(&position); if (!mWindowHandle) { - return FALSE; + return false; } mWindowThread->post([=]() @@ -1091,10 +1067,10 @@ BOOL LLWindowWin32::setSizeImpl(const LLCoordScreen size) }); moveWindow(position, size); - return TRUE; + return true; } -BOOL LLWindowWin32::setSizeImpl(const LLCoordWindow size) +bool LLWindowWin32::setSizeImpl(const LLCoordWindow size) { RECT window_rect = {0, 0, size.mX, size.mY }; DWORD dw_ex_style = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; @@ -1106,7 +1082,7 @@ BOOL LLWindowWin32::setSizeImpl(const LLCoordWindow size) } // changing fullscreen resolution -BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BOOL enable_vsync, const LLCoordScreen* const posp) +bool LLWindowWin32::switchContext(bool fullscreen, const LLCoordScreen& size, bool enable_vsync, const LLCoordScreen* const posp) { //called from main thread GLuint pixel_format; @@ -1119,11 +1095,11 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO RECT window_rect = { 0, 0, 0, 0 }; S32 width = size.mX; S32 height = size.mY; - BOOL auto_show = FALSE; + bool auto_show = false; if (mhRC) { - auto_show = TRUE; + auto_show = true; resetDisplayResolution(); } @@ -1156,8 +1132,8 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO if (fullscreen) { - mFullscreen = TRUE; - BOOL success = FALSE; + mFullscreen = true; + bool success = false; DWORD closest_refresh = 0; for (S32 mode_num = 0;; mode_num++) @@ -1171,7 +1147,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO dev_mode.dmPelsHeight == height && dev_mode.dmBitsPerPel == BITS_PER_PIXEL) { - success = TRUE; + success = true; if ((dev_mode.dmDisplayFrequency - current_refresh) < (closest_refresh - current_refresh)) { @@ -1183,7 +1159,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO if (closest_refresh == 0) { LL_WARNS("Window") << "Couldn't find display mode " << width << " by " << height << " at " << BITS_PER_PIXEL << " bits per pixel" << LL_ENDL; - return FALSE; + return false; } // If we found a good resolution, use it. @@ -1198,7 +1174,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO if (success) { - mFullscreen = TRUE; + mFullscreen = true; mFullscreenWidth = dev_mode.dmPelsWidth; mFullscreenHeight = dev_mode.dmPelsHeight; mFullscreenBits = dev_mode.dmBitsPerPel; @@ -1224,19 +1200,19 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO // If it failed, we don't want to run fullscreen else { - mFullscreen = FALSE; + mFullscreen = false; mFullscreenWidth = -1; mFullscreenHeight = -1; mFullscreenBits = -1; mFullscreenRefresh = -1; LL_INFOS("Window") << "Unable to run fullscreen at " << width << "x" << height << LL_ENDL; - return FALSE; + return false; } } else { - mFullscreen = FALSE; + mFullscreen = false; window_rect.left = (long)(posp ? posp->mX : 0); window_rect.right = (long)width + window_rect.left; // Windows GDI rects don't include rightmost pixel window_rect.top = (long)(posp ? posp->mY : 0); @@ -1248,7 +1224,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO // don't post quit messages when destroying old windows - mPostQuit = FALSE; + mPostQuit = false; // create window @@ -1298,7 +1274,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO close(); OSMessageBox(mCallbacks->translateString("MBDevContextErr"), mCallbacks->translateString("MBError"), OSMB_OK); - return FALSE; + return false; } LL_INFOS("Window") << "Device context retrieved." << LL_ENDL ; @@ -1312,7 +1288,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO OSMessageBox(mCallbacks->translateString("MBPixelFmtErr"), mCallbacks->translateString("MBError"), OSMB_OK); close(); - return FALSE; + return false; } } catch (...) @@ -1321,7 +1297,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO OSMessageBox(mCallbacks->translateString("MBPixelFmtErr"), mCallbacks->translateString("MBError"), OSMB_OK); close(); - return FALSE; + return false; } LL_INFOS("Window") << "Pixel format chosen." << LL_ENDL ; @@ -1333,7 +1309,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO OSMessageBox(mCallbacks->translateString("MBPixelFmtDescErr"), mCallbacks->translateString("MBError"), OSMB_OK); close(); - return FALSE; + return false; } // (EXP-1765) dump pixel data to see if there is a pattern that leads to unreproducible crash @@ -1372,7 +1348,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO OSMessageBox(mCallbacks->translateString("MBPixelFmtSetErr"), mCallbacks->translateString("MBError"), OSMB_OK); close(); - return FALSE; + return false; } @@ -1381,7 +1357,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO OSMessageBox(mCallbacks->translateString("MBGLContextErr"), mCallbacks->translateString("MBError"), OSMB_OK); close(); - return FALSE; + return false; } if (!wglMakeCurrent(mhDC, mhRC)) @@ -1389,7 +1365,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO OSMessageBox(mCallbacks->translateString("MBGLContextActErr"), mCallbacks->translateString("MBError"), OSMB_OK); close(); - return FALSE; + return false; } LL_INFOS("Window") << "Drawing context is created." << LL_ENDL ; @@ -1481,7 +1457,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO close(); show_window_creation_error("Error after wglChoosePixelFormatARB 32-bit"); - return FALSE; + return false; } if (!num_formats) @@ -1496,7 +1472,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO { close(); show_window_creation_error("Error after wglChoosePixelFormatARB 32-bit no AA"); - return FALSE; + return false; } } @@ -1510,7 +1486,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO { close(); show_window_creation_error("Error after wglChoosePixelFormatARB 24-bit"); - return FALSE; + return false; } if (!num_formats) @@ -1522,7 +1498,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO { close(); show_window_creation_error("Error after wglChoosePixelFormatARB 16-bit"); - return FALSE; + return false; } } } @@ -1595,7 +1571,7 @@ const S32 max_format = (S32)num_formats - 1; { OSMessageBox(mCallbacks->translateString("MBDevContextErr"), mCallbacks->translateString("MBError"), OSMB_OK); close(); - return FALSE; + return false; } if (!SetPixelFormat(mhDC, pixel_format, &pfd)) @@ -1603,7 +1579,7 @@ const S32 max_format = (S32)num_formats - 1; OSMessageBox(mCallbacks->translateString("MBPixelFmtSetErr"), mCallbacks->translateString("MBError"), OSMB_OK); close(); - return FALSE; + return false; } if (wglGetPixelFormatAttribivARB(mhDC, pixel_format, 0, 1, &swap_query, &swap_method)) @@ -1642,7 +1618,7 @@ const S32 max_format = (S32)num_formats - 1; { OSMessageBox(mCallbacks->translateString("MBPixelFmtDescErr"), mCallbacks->translateString("MBError"), OSMB_OK); close(); - return FALSE; + return false; } LL_INFOS("Window") << "GL buffer: Color Bits " << S32(pfd.cColorBits) @@ -1656,7 +1632,7 @@ const S32 max_format = (S32)num_formats - 1; mhRC = (HGLRC) createSharedContext(); if (!mhRC) { - return FALSE; + return false; } } @@ -1664,14 +1640,14 @@ const S32 max_format = (S32)num_formats - 1; { OSMessageBox(mCallbacks->translateString("MBGLContextActErr"), mCallbacks->translateString("MBError"), OSMB_OK); close(); - return FALSE; + return false; } if (!gGLManager.initGL()) { OSMessageBox(mCallbacks->translateString("MBVideoDrvErr"), mCallbacks->translateString("MBError"), OSMB_OK); close(); - return FALSE; + return false; } // Disable vertical sync for swap @@ -1688,7 +1664,7 @@ const S32 max_format = (S32)num_formats - 1; SetTimer( mWindowHandle, 0, 1000 / 30, NULL ); // 30 fps timer // ok to post quit messages now - mPostQuit = TRUE; + mPostQuit = true; // *HACK: Attempt to prevent startup crashes by deferring memory accounting // until after some graphics setup. See SL-20177. -Cosmic,2023-09-18 @@ -1707,7 +1683,7 @@ const S32 max_format = (S32)num_formats - 1; LL_PROFILER_GPU_CONTEXT; - return TRUE; + return true; } void LLWindowWin32::recreateWindow(RECT window_rect, DWORD dw_ex_style, DWORD dw_style) @@ -1936,13 +1912,13 @@ void LLWindowWin32::setTitle(const std::string title) }); } -BOOL LLWindowWin32::setCursorPosition(const LLCoordWindow position) +bool LLWindowWin32::setCursorPosition(const LLCoordWindow position) { ASSERT_MAIN_THREAD(); if (!mWindowHandle) { - return FALSE; + return false; } LLCoordScreen screen_pos(position.convert()); @@ -1962,31 +1938,31 @@ BOOL LLWindowWin32::setCursorPosition(const LLCoordWindow position) SetCursorPos(screen_pos.mX, screen_pos.mY); }); - return TRUE; + return true; } -BOOL LLWindowWin32::getCursorPosition(LLCoordWindow *position) +bool LLWindowWin32::getCursorPosition(LLCoordWindow *position) { ASSERT_MAIN_THREAD(); if (!position) { - return FALSE; + return false; } *position = mCursorPosition; - return TRUE; + return true; } -BOOL LLWindowWin32::getCursorDelta(LLCoordCommon* delta) +bool LLWindowWin32::getCursorDelta(LLCoordCommon* delta) { if (delta == nullptr) { - return FALSE; + return false; } *delta = mMouseFrameDelta; - return TRUE; + return true; } void LLWindowWin32::hideCursor() @@ -2001,8 +1977,8 @@ void LLWindowWin32::hideCursor() } }); - mCursorHidden = TRUE; - mHideCursorPermanent = TRUE; + mCursorHidden = true; + mHideCursorPermanent = true; } void LLWindowWin32::showCursor() @@ -2020,8 +1996,8 @@ void LLWindowWin32::showCursor() } }); - mCursorHidden = FALSE; - mHideCursorPermanent = FALSE; + mCursorHidden = false; + mHideCursorPermanent = false; } void LLWindowWin32::showCursorFromMouseMove() @@ -2037,11 +2013,11 @@ void LLWindowWin32::hideCursorUntilMouseMove() if (!mHideCursorPermanent && mMouseVanish) { hideCursor(); - mHideCursorPermanent = FALSE; + mHideCursorPermanent = false; } } -BOOL LLWindowWin32::isCursorHidden() +bool LLWindowWin32::isCursorHidden() { return mCursorHidden; } @@ -2161,7 +2137,7 @@ void LLWindowWin32::releaseMouse() void LLWindowWin32::delayInputProcessing() { - mInputProcessingPaused = TRUE; + mInputProcessingPaused = true; } @@ -2242,7 +2218,7 @@ void LLWindowWin32::gatherInput() } } - mInputProcessingPaused = FALSE; + mInputProcessingPaused = false; updateCursor(); } @@ -2287,7 +2263,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ // pass along extended flag in mask MASK mask = (l_param >> 16 & KF_EXTENDED) ? MASK_EXTENDED : 0x0; - BOOL eat_keystroke = TRUE; + bool eat_keystroke = true; switch (u_msg) { @@ -2309,7 +2285,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ { WINDOW_IMP_POST(window_imp->mCallbacks->handleDeviceChange(window_imp)); - return TRUE; + return 1; } break; } @@ -2466,8 +2442,9 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ { LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_SYSKEYDOWN"); // allow system keys, such as ALT-F4 to be processed by Windows - eat_keystroke = FALSE; + eat_keystroke = false; // intentional fall-through here + [[fallthrough]]; } case WM_KEYDOWN: { @@ -2487,8 +2464,9 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ break; } case WM_SYSKEYUP: - eat_keystroke = FALSE; + eat_keystroke = false; // intentional fall-through here + [[fallthrough]]; case WM_KEYUP: { LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_KEYUP"); @@ -2579,9 +2557,9 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ // characters. We just need to take care of surrogate pairs sent as two WM_CHAR's // by ourselves. It is not that tough. -- Alissa Sabre @ SL - // Even if LLWindowCallbacks::handleUnicodeChar(llwchar, BOOL) returned FALSE, + // Even if LLWindowCallbacks::handleUnicodeChar(llwchar, bool) returned false, // we *did* processed the event, so I believe we should not pass it to DefWindowProc... - window_imp->handleUnicodeUTF16((U16)w_param, gKeyboard->currentMask(FALSE)); + window_imp->handleUnicodeUTF16((U16)w_param, gKeyboard->currentMask(false)); }); return 0; } @@ -2612,7 +2590,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ window_imp->interruptLanguageTextInput(); } - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); auto gl_coord = window_imp->mCursorPosition.convert(); window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask); window_imp->mCallbacks->handleMouseDown(window_imp, gl_coord, mask); @@ -2635,7 +2613,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ sHandleDoubleClick = true; return; } - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); // generate move event to update mouse coordinates window_imp->mCursorPosition = window_coord; @@ -2659,7 +2637,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ sHandleDoubleClick = true; - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); // generate move event to update mouse coordinates window_imp->mCursorPosition = window_coord; window_imp->mCallbacks->handleMouseUp(window_imp, window_imp->mCursorPosition.convert(), mask); @@ -2680,7 +2658,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ WINDOW_IMP_POST(window_imp->interruptLanguageTextInput()); } - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); // generate move event to update mouse coordinates auto gl_coord = window_imp->mCursorPosition.convert(); window_imp->mCallbacks->handleMouseMove(window_imp, gl_coord, mask); @@ -2698,7 +2676,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER); window_imp->postMouseButtonEvent([=]() { - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); window_imp->mCallbacks->handleRightMouseUp(window_imp, window_imp->mCursorPosition.convert(), mask); }); } @@ -2718,7 +2696,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ window_imp->interruptLanguageTextInput(); } - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); window_imp->mCallbacks->handleMiddleMouseDown(window_imp, window_imp->mCursorPosition.convert(), mask); }); } @@ -2732,7 +2710,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER); window_imp->postMouseButtonEvent([=]() { - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); window_imp->mCallbacks->handleMiddleMouseUp(window_imp, window_imp->mCursorPosition.convert(), mask); }); } @@ -2750,7 +2728,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ window_imp->interruptLanguageTextInput(); } - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); // Windows uses numbers 1 and 2 for buttons, remap to 4, 5 window_imp->mCallbacks->handleOtherMouseDown(window_imp, window_imp->mCursorPosition.convert(), mask, button + 3); }); @@ -2767,7 +2745,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ LL_RECORD_BLOCK_TIME(FTM_MOUSEHANDLER); S32 button = GET_XBUTTON_WPARAM(w_param); - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); // Windows uses numbers 1 and 2 for buttons, remap to 4, 5 window_imp->mCallbacks->handleOtherMouseUp(window_imp, window_imp->mCursorPosition.convert(), mask, button + 3); }); @@ -2877,7 +2855,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ { LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("mwp - WM_MOUSEMOVE lambda"); - MASK mask = gKeyboard->currentMask(TRUE); + MASK mask = gKeyboard->currentMask(true); window_imp->mMouseMask = mask; window_imp->mCursorPosition = window_coord; }); @@ -2914,19 +2892,19 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ // means that the window was un-minimized. if (w_param == SIZE_RESTORED && window_imp->mLastSizeWParam != SIZE_RESTORED) { - WINDOW_IMP_POST(window_imp->mCallbacks->handleActivate(window_imp, TRUE)); + WINDOW_IMP_POST(window_imp->mCallbacks->handleActivate(window_imp, true)); } // handle case of window being maximized from fully minimized state if (w_param == SIZE_MAXIMIZED && window_imp->mLastSizeWParam != SIZE_MAXIMIZED) { - WINDOW_IMP_POST(window_imp->mCallbacks->handleActivate(window_imp, TRUE)); + WINDOW_IMP_POST(window_imp->mCallbacks->handleActivate(window_imp, true)); } // Also handle the minimization case if (w_param == SIZE_MINIMIZED && window_imp->mLastSizeWParam != SIZE_MINIMIZED) { - WINDOW_IMP_POST(window_imp->mCallbacks->handleActivate(window_imp, FALSE)); + WINDOW_IMP_POST(window_imp->mCallbacks->handleActivate(window_imp, false)); } // Actually resize all of our views @@ -2995,8 +2973,6 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ }); }; return 0; - - break; } case WM_SETTINGCHANGE: { @@ -3005,7 +2981,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ { if (!SystemParametersInfo(SPI_GETMOUSEVANISH, 0, &window_imp->mMouseVanish, 0)) { - WINDOW_IMP_POST(window_imp->mMouseVanish = TRUE); + WINDOW_IMP_POST(window_imp->mMouseVanish = true); } } } @@ -3081,6 +3057,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ } } } + break; //list of messages we get often that we don't care to log about case WM_NCHITTEST: @@ -3114,7 +3091,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ return ret; } -BOOL LLWindowWin32::convertCoords(LLCoordGL from, LLCoordWindow *to) +bool LLWindowWin32::convertCoords(LLCoordGL from, LLCoordWindow *to) { S32 client_height; RECT client_rect; @@ -3124,17 +3101,17 @@ BOOL LLWindowWin32::convertCoords(LLCoordGL from, LLCoordWindow *to) !GetClientRect(mWindowHandle, &client_rect) || NULL == to) { - return FALSE; + return false; } to->mX = from.mX; client_height = client_rect.bottom - client_rect.top; to->mY = client_height - from.mY - 1; - return TRUE; + return true; } -BOOL LLWindowWin32::convertCoords(LLCoordWindow from, LLCoordGL* to) +bool LLWindowWin32::convertCoords(LLCoordWindow from, LLCoordGL* to) { S32 client_height; RECT client_rect; @@ -3143,23 +3120,23 @@ BOOL LLWindowWin32::convertCoords(LLCoordWindow from, LLCoordGL* to) !GetClientRect(mWindowHandle, &client_rect) || NULL == to) { - return FALSE; + return false; } to->mX = from.mX; client_height = client_rect.bottom - client_rect.top; to->mY = client_height - from.mY - 1; - return TRUE; + return true; } -BOOL LLWindowWin32::convertCoords(LLCoordScreen from, LLCoordWindow* to) +bool LLWindowWin32::convertCoords(LLCoordScreen from, LLCoordWindow* to) { POINT mouse_point; mouse_point.x = from.mX; mouse_point.y = from.mY; - BOOL result = ScreenToClient(mWindowHandle, &mouse_point); + bool result = ScreenToClient(mWindowHandle, &mouse_point); if (result) { @@ -3170,13 +3147,13 @@ BOOL LLWindowWin32::convertCoords(LLCoordScreen from, LLCoordWindow* to) return result; } -BOOL LLWindowWin32::convertCoords(LLCoordWindow from, LLCoordScreen *to) +bool LLWindowWin32::convertCoords(LLCoordWindow from, LLCoordScreen *to) { POINT mouse_point; mouse_point.x = from.mX; mouse_point.y = from.mY; - BOOL result = ClientToScreen(mWindowHandle, &mouse_point); + bool result = ClientToScreen(mWindowHandle, &mouse_point); if (result) { @@ -3187,44 +3164,44 @@ BOOL LLWindowWin32::convertCoords(LLCoordWindow from, LLCoordScreen *to) return result; } -BOOL LLWindowWin32::convertCoords(LLCoordScreen from, LLCoordGL *to) +bool LLWindowWin32::convertCoords(LLCoordScreen from, LLCoordGL *to) { LLCoordWindow window_coord; if (!mWindowHandle || (NULL == to)) { - return FALSE; + return false; } convertCoords(from, &window_coord); convertCoords(window_coord, to); - return TRUE; + return true; } -BOOL LLWindowWin32::convertCoords(LLCoordGL from, LLCoordScreen *to) +bool LLWindowWin32::convertCoords(LLCoordGL from, LLCoordScreen *to) { LLCoordWindow window_coord; if (!mWindowHandle || (NULL == to)) { - return FALSE; + return false; } convertCoords(from, &window_coord); convertCoords(window_coord, to); - return TRUE; + return true; } -BOOL LLWindowWin32::isClipboardTextAvailable() +bool LLWindowWin32::isClipboardTextAvailable() { return IsClipboardFormatAvailable(CF_UNICODETEXT); } -BOOL LLWindowWin32::pasteTextFromClipboard(LLWString &dst) +bool LLWindowWin32::pasteTextFromClipboard(LLWString &dst) { - BOOL success = FALSE; + bool success = false; if (IsClipboardFormatAvailable(CF_UNICODETEXT)) { @@ -3239,7 +3216,7 @@ BOOL LLWindowWin32::pasteTextFromClipboard(LLWString &dst) dst = utf16str_to_wstring(utf16str); LLWStringUtil::removeWindowsCR(dst); GlobalUnlock(h_data); - success = TRUE; + success = true; } } CloseClipboard(); @@ -3250,9 +3227,9 @@ BOOL LLWindowWin32::pasteTextFromClipboard(LLWString &dst) } -BOOL LLWindowWin32::copyTextToClipboard(const LLWString& wstr) +bool LLWindowWin32::copyTextToClipboard(const LLWString& wstr) { - BOOL success = FALSE; + bool success = false; if (OpenClipboard(mWindowHandle)) { @@ -3276,7 +3253,7 @@ BOOL LLWindowWin32::copyTextToClipboard(const LLWString& wstr) if (SetClipboardData(CF_UNICODETEXT, hglobal_copy_utf16)) { - success = TRUE; + success = true; } } } @@ -3288,13 +3265,13 @@ BOOL LLWindowWin32::copyTextToClipboard(const LLWString& wstr) } // Constrains the mouse to the window. -void LLWindowWin32::setMouseClipping( BOOL b ) +void LLWindowWin32::setMouseClipping( bool b ) { LL_PROFILE_ZONE_SCOPED_CATEGORY_WIN32; ASSERT_MAIN_THREAD(); if( b != mIsMouseClipping ) { - BOOL success = FALSE; + bool success = false; if( b ) { @@ -3320,9 +3297,9 @@ void LLWindowWin32::setMouseClipping( BOOL b ) } } -BOOL LLWindowWin32::getClientRectInScreenSpace( RECT* rectp ) +bool LLWindowWin32::getClientRectInScreenSpace( RECT* rectp ) { - BOOL success = FALSE; + bool success = false; RECT client_rect; if (mWindowHandle && GetClientRect(mWindowHandle, &client_rect)) @@ -3343,7 +3320,7 @@ BOOL LLWindowWin32::getClientRectInScreenSpace( RECT* rectp ) bottom_right.x, bottom_right.y); - success = TRUE; + success = true; } return success; @@ -3369,36 +3346,36 @@ F32 LLWindowWin32::getGamma() return mCurrentGamma; } -BOOL LLWindowWin32::restoreGamma() +bool LLWindowWin32::restoreGamma() { ASSERT_MAIN_THREAD(); - if (mCustomGammaSet != FALSE) + if (mCustomGammaSet) { LL_DEBUGS("Window") << "Restoring gamma" << LL_ENDL; - mCustomGammaSet = FALSE; + mCustomGammaSet = false; return SetDeviceGammaRamp(mhDC, mPrevGammaRamp); } - return TRUE; + return true; } -BOOL LLWindowWin32::setGamma(const F32 gamma) +bool LLWindowWin32::setGamma(const F32 gamma) { ASSERT_MAIN_THREAD(); mCurrentGamma = gamma; //Get the previous gamma ramp to restore later. - if (mCustomGammaSet == FALSE) + if (!mCustomGammaSet) { if (!gGLManager.mIsIntel) // skip for Intel GPUs (see SL-11341) { LL_DEBUGS("Window") << "Getting the previous gamma ramp to restore later" << LL_ENDL; - if(GetDeviceGammaRamp(mhDC, mPrevGammaRamp) == FALSE) + if (!GetDeviceGammaRamp(mhDC, mPrevGammaRamp)) { LL_WARNS("Window") << "Failed to get the previous gamma ramp" << LL_ENDL; - return FALSE; + return false; } } - mCustomGammaSet = TRUE; + mCustomGammaSet = true; } LL_DEBUGS("Window") << "Setting gamma to " << gamma << LL_ENDL; @@ -3453,13 +3430,13 @@ LLWindow::LLWindowResolution* LLWindowWin32::getSupportedResolutions(S32 &num_re dev_mode.dmPelsWidth >= 800 && dev_mode.dmPelsHeight >= 600) { - BOOL resolution_exists = FALSE; + bool resolution_exists = false; for(S32 i = 0; i < mNumSupportedResolutions; i++) { if (mSupportedResolutions[i].mWidth == dev_mode.dmPelsWidth && mSupportedResolutions[i].mHeight == dev_mode.dmPelsHeight) { - resolution_exists = TRUE; + resolution_exists = true; } } if (!resolution_exists) @@ -3512,12 +3489,12 @@ F32 LLWindowWin32::getPixelAspectRatio() // Change display resolution. Returns true if successful. // protected -BOOL LLWindowWin32::setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh) +bool LLWindowWin32::setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh) { DEVMODE dev_mode; ::ZeroMemory(&dev_mode, sizeof(DEVMODE)); dev_mode.dmSize = sizeof(DEVMODE); - BOOL success = FALSE; + bool success = false; // Don't change anything if we don't have to if (EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dev_mode)) @@ -3528,7 +3505,7 @@ BOOL LLWindowWin32::setDisplayResolution(S32 width, S32 height, S32 bits, S32 re dev_mode.dmDisplayFrequency == refresh ) { // ...display mode identical, do nothing - return TRUE; + return true; } } @@ -3555,7 +3532,7 @@ BOOL LLWindowWin32::setDisplayResolution(S32 width, S32 height, S32 bits, S32 re } // protected -BOOL LLWindowWin32::setFullscreenResolution() +bool LLWindowWin32::setFullscreenResolution() { if (mFullscreen) { @@ -3563,18 +3540,18 @@ BOOL LLWindowWin32::setFullscreenResolution() } else { - return FALSE; + return false; } } // protected -BOOL LLWindowWin32::resetDisplayResolution() +bool LLWindowWin32::resetDisplayResolution() { LL_DEBUGS("Window") << "resetDisplayResolution START" << LL_ENDL; LONG cds_result = ChangeDisplaySettings(NULL, 0); - BOOL success = (DISP_CHANGE_SUCCESSFUL == cds_result); + bool success = (DISP_CHANGE_SUCCESSFUL == cds_result); if (!success) { @@ -3632,13 +3609,13 @@ void LLSplashScreenWin32::updateImpl(const std::string& mesg) { if (!mWindow) return; - int output_str_len = MultiByteToWideChar(CP_UTF8, 0, mesg.c_str(), mesg.length(), NULL, 0); + int output_str_len = MultiByteToWideChar(CP_UTF8, 0, mesg.c_str(), static_cast<int>(mesg.length()), NULL, 0); if( output_str_len>1024 ) return; WCHAR w_mesg[1025];//big enought to keep null terminatos - MultiByteToWideChar (CP_UTF8, 0, mesg.c_str(), mesg.length(), w_mesg, output_str_len); + MultiByteToWideChar (CP_UTF8, 0, mesg.c_str(), static_cast<int>(mesg.length()), w_mesg, output_str_len); //looks like MultiByteToWideChar didn't add null terminator to converted string, see EXT-4858 w_mesg[output_str_len] = 0; @@ -3784,9 +3761,9 @@ LLSD LLWindowWin32::getNativeKeyData() return result; } -BOOL LLWindowWin32::dialogColorPicker( F32 *r, F32 *g, F32 *b ) +bool LLWindowWin32::dialogColorPicker( F32 *r, F32 *g, F32 *b ) { - BOOL retval = FALSE; + bool retval = false; static CHOOSECOLOR cc; static COLORREF crCustColors[16]; @@ -3839,7 +3816,7 @@ void LLWindowWin32::focusClient() }); } -void LLWindowWin32::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b) +void LLWindowWin32::allowLanguageTextInput(LLPreeditor *preeditor, bool b) { if (b == sLanguageTextInputAllowed || !LLWinImm::isAvailable()) { @@ -3849,7 +3826,7 @@ void LLWindowWin32::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b) if (preeditor != mPreeditor && !b) { // This condition may occur with a call to - // setEnabled(BOOL) from LLTextEditor or LLLineEditor + // setEnabled(bool) from LLTextEditor or LLLineEditor // when the control is not focused. // We need to silently ignore the case so that // the language input status of the focused control @@ -3879,7 +3856,7 @@ void LLWindowWin32::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b) if (sWinIMEOpened && GetKeyboardLayout(0) == sWinInputLocale) { HIMC himc = LLWinImm::getContext(mWindowHandle); - LLWinImm::setOpenStatus(himc, TRUE); + LLWinImm::setOpenStatus(himc, true); LLWinImm::setConversionStatus(himc, sWinIMEConversionMode, sWinIMESentenceMode); LLWinImm::releaseContext(mWindowHandle, himc); } @@ -3905,7 +3882,7 @@ void LLWindowWin32::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b) // We need both ImmSetConversionStatus and ImmSetOpenStatus here to surely disable IME's // keyboard hooking, because Some IME reacts only on the former and some other on the latter... LLWinImm::setConversionStatus(himc, IME_CMODE_NOCONVERSION, sWinIMESentenceMode); - LLWinImm::setOpenStatus(himc, FALSE); + LLWinImm::setOpenStatus(himc, false); } LLWinImm::releaseContext(mWindowHandle, himc); } @@ -4032,14 +4009,14 @@ U32 LLWindowWin32::fillReconvertString(const LLWString &text, S32 focus, S32 focus_length, RECONVERTSTRING *reconvert_string) { const llutf16string text_utf16 = wstring_to_utf16str(text); - const DWORD required_size = sizeof(RECONVERTSTRING) + (text_utf16.length() + 1) * sizeof(WCHAR); + const DWORD required_size = sizeof(RECONVERTSTRING) + (static_cast<DWORD>(text_utf16.length()) + 1) * sizeof(WCHAR); if (reconvert_string && reconvert_string->dwSize >= required_size) { const DWORD focus_utf16_at = wstring_utf16_length(text, 0, focus); const DWORD focus_utf16_length = wstring_utf16_length(text, focus, focus_length); reconvert_string->dwVersion = 0; - reconvert_string->dwStrLen = text_utf16.length(); + reconvert_string->dwStrLen = static_cast<DWORD>(text_utf16.length()); reconvert_string->dwStrOffset = sizeof(RECONVERTSTRING); reconvert_string->dwCompStrLen = focus_utf16_length; reconvert_string->dwCompStrOffset = focus_utf16_at * sizeof(WCHAR); @@ -4111,7 +4088,7 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes) { return; } - BOOL needs_update = FALSE; + bool needs_update = false; LLWString result_string; LLWString preedit_string; S32 preedit_string_utf16_length = 0; @@ -4134,7 +4111,7 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes) result_string = utf16str_to_wstring(llutf16string(data, size / sizeof(WCHAR))); } delete[] data; - needs_update = TRUE; + needs_update = true; } } @@ -4151,7 +4128,7 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes) preedit_string = utf16str_to_wstring(llutf16string(data, size / sizeof(WCHAR))); } delete[] data; - needs_update = TRUE; + needs_update = true; } } @@ -4187,13 +4164,13 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes) size = LLWinImm::getCompositionString(himc, GCS_COMPATTR, data, size); if (size == preedit_string_utf16_length) { - preedit_standouts.assign(preedit_segment_lengths.size(), FALSE); + preedit_standouts.assign(preedit_segment_lengths.size(), false); S32 offset = 0; for (U32 i = 0; i < preedit_segment_lengths.size(); i++) { if (ATTR_TARGET_CONVERTED == data[offset] || ATTR_TARGET_NOTCONVERTED == data[offset]) { - preedit_standouts[i] = TRUE; + preedit_standouts[i] = true; } offset += wstring_utf16_length(preedit_string, offset, preedit_segment_lengths[i]); } @@ -4202,7 +4179,7 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes) } } - S32 caret_position = preedit_string.length(); + S32 caret_position = static_cast<S32>(preedit_string.length()); if (indexes & GCS_CURSORPOS) { const S32 caret_position_utf16 = LLWinImm::getCompositionString(himc, GCS_CURSORPOS, NULL, 0); @@ -4217,7 +4194,7 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes) // I'm not sure this condition really happens, but // Windows SDK document says it is an indication // of "reset everything." - needs_update = TRUE; + needs_update = true; } LLWinImm::releaseContext(mWindowHandle, himc); @@ -4248,11 +4225,11 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes) { if (preedit_segment_lengths.size() == 0) { - preedit_segment_lengths.assign(1, preedit_string.length()); + preedit_segment_lengths.assign(1, static_cast<S32>(preedit_string.length())); } if (preedit_standouts.size() == 0) { - preedit_standouts.assign(preedit_segment_lengths.size(), FALSE); + preedit_standouts.assign(preedit_segment_lengths.size(), false); } } mPreeditor->updatePreedit(preedit_string, preedit_segment_lengths, preedit_standouts, caret_position); @@ -4299,11 +4276,11 @@ LLWindowCallbacks::DragNDropResult LLWindowWin32::completeDragNDropRequest( cons } // Handle WM_IME_REQUEST message. -// If it handled the message, returns TRUE. Otherwise, FALSE. +// If it handled the message, returns true. Otherwise, false. // When it handled the message, the value to be returned from // the Window Procedure is set to *result. -BOOL LLWindowWin32::handleImeRequests(WPARAM request, LPARAM param, LRESULT *result) +bool LLWindowWin32::handleImeRequests(WPARAM request, LPARAM param, LRESULT *result) { if ( mPreeditor ) { @@ -4321,7 +4298,7 @@ BOOL LLWindowWin32::handleImeRequests(WPARAM request, LPARAM param, LRESULT *res form->dwIndex = dwIndex; *result = 1; - return TRUE; + return true; } case IMR_QUERYCHARPOSITION: { @@ -4341,20 +4318,20 @@ BOOL LLWindowWin32::handleImeRequests(WPARAM request, LPARAM param, LRESULT *res if (!mPreeditor->getPreeditLocation(position, &caret_coord, &preedit_bounds, &text_control)) { LL_WARNS("Window") << "*** IMR_QUERYCHARPOSITON called but getPreeditLocation failed." << LL_ENDL; - return FALSE; + return false; } fillCharPosition(caret_coord, preedit_bounds, text_control, char_position); *result = 1; - return TRUE; + return true; } case IMR_COMPOSITIONFONT: { fillCompositionLogfont((LOGFONT *)param); *result = 1; - return TRUE; + return true; } case IMR_RECONVERTSTRING: { @@ -4375,7 +4352,7 @@ BOOL LLWindowWin32::handleImeRequests(WPARAM request, LPARAM param, LRESULT *res // Let the IME to decide the reconversion range, and // adjust the reconvert_string structure accordingly. HIMC himc = LLWinImm::getContext(mWindowHandle); - const BOOL adjusted = LLWinImm::setCompositionString(himc, + const bool adjusted = LLWinImm::setCompositionString(himc, SCS_QUERYRECONVERTSTRING, reconvert_string, size, NULL, 0); LLWinImm::releaseContext(mWindowHandle, himc); if (adjusted) @@ -4392,12 +4369,12 @@ BOOL LLWindowWin32::handleImeRequests(WPARAM request, LPARAM param, LRESULT *res } *result = size; - return TRUE; + return true; } case IMR_CONFIRMRECONVERTSTRING: { - *result = FALSE; - return TRUE; + *result = 0; + return true; } case IMR_DOCUMENTFEED: { @@ -4419,14 +4396,14 @@ BOOL LLWindowWin32::handleImeRequests(WPARAM request, LPARAM param, LRESULT *res RECONVERTSTRING *reconvert_string = (RECONVERTSTRING *)param; *result = fillReconvertString(context, preedit, 0, reconvert_string); - return TRUE; + return true; } default: - return FALSE; + return false; } } - return FALSE; + return false; } //static @@ -4552,12 +4529,6 @@ std::vector<std::string> LLWindowWin32::getDynamicFallbackFontList() // Fonts previously in getFontListSans() have moved to fonts.xml. return std::vector<std::string>(); } - -U32 LLWindowWin32::getAvailableVRAMMegabytes() -{ - return mWindowThread ? mWindowThread->getAvailableVRAMMegabytes() : 0; -} - #endif // LL_WINDOWS inline LLWindowWin32::LLWindowWin32Thread::LLWindowWin32Thread() @@ -4626,39 +4597,55 @@ private: std::string mPrev; }; -// Print hardware debug info about available graphics adapters in ordinal order -void debugEnumerateGraphicsAdapters() +void LLWindowWin32::LLWindowWin32Thread::checkDXMem() { - LL_INFOS("Window") << "Enumerating graphics adapters..." << LL_ENDL; + if (!mGLReady || mGotGLBuffer) { return; } + + IDXGIFactory4* p_factory = nullptr; + + HRESULT res = CreateDXGIFactory1(__uuidof(IDXGIFactory4), (void**)&p_factory); - IDXGIFactory1* factory; - HRESULT res = CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)&factory); - if (FAILED(res) || !factory) + if (FAILED(res)) { LL_WARNS() << "CreateDXGIFactory1 failed: 0x" << std::hex << res << LL_ENDL; } else { + IDXGIAdapter3* p_dxgi_adapter = nullptr; UINT graphics_adapter_index = 0; - IDXGIAdapter3* dxgi_adapter; while (true) { - res = factory->EnumAdapters(graphics_adapter_index, reinterpret_cast<IDXGIAdapter**>(&dxgi_adapter)); + res = p_factory->EnumAdapters(graphics_adapter_index, reinterpret_cast<IDXGIAdapter**>(&p_dxgi_adapter)); if (FAILED(res)) { if (graphics_adapter_index == 0) { LL_WARNS() << "EnumAdapters failed: 0x" << std::hex << res << LL_ENDL; } - else - { - LL_INFOS("Window") << "Done enumerating graphics adapters" << LL_ENDL; - } } else { + if (graphics_adapter_index == 0) // Should it check largest one isntead of first? + { + DXGI_QUERY_VIDEO_MEMORY_INFO info; + p_dxgi_adapter->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_LOCAL, &info); + + // Alternatively use GetDesc from below to get adapter's memory + UINT64 budget_mb = info.Budget / (1024 * 1024); + if (gGLManager.mVRAM < (S32)budget_mb) + { + gGLManager.mVRAM = (S32)budget_mb; + LL_INFOS("RenderInit") << "New VRAM Budget (DX9): " << gGLManager.mVRAM << " MB" << LL_ENDL; + } + else + { + LL_INFOS("RenderInit") << "VRAM Budget (DX9): " << budget_mb + << " MB, current (WMI): " << gGLManager.mVRAM << " MB" << LL_ENDL; + } + } + DXGI_ADAPTER_DESC desc; - dxgi_adapter->GetDesc(&desc); + p_dxgi_adapter->GetDesc(&desc); std::wstring description_w((wchar_t*)desc.Description); std::string description(description_w.begin(), description_w.end()); LL_INFOS("Window") << "Graphics adapter index: " << graphics_adapter_index << ", " @@ -4671,10 +4658,10 @@ void debugEnumerateGraphicsAdapters() << "SharedSystemMemory: " << desc.SharedSystemMemory / 1024 / 1024 << LL_ENDL; } - if (dxgi_adapter) + if (p_dxgi_adapter) { - dxgi_adapter->Release(); - dxgi_adapter = NULL; + p_dxgi_adapter->Release(); + p_dxgi_adapter = NULL; } else { @@ -4685,168 +4672,12 @@ void debugEnumerateGraphicsAdapters() } } - if (factory) - { - factory->Release(); - } -} - -void LLWindowWin32::LLWindowWin32Thread::initDX() -{ - if (!mGLReady) { return; } - - if (mDXGIAdapter == NULL) - { - debugEnumerateGraphicsAdapters(); - - IDXGIFactory4* pFactory = nullptr; - - HRESULT res = CreateDXGIFactory1(__uuidof(IDXGIFactory4), (void**)&pFactory); - - if (FAILED(res)) - { - LL_WARNS() << "CreateDXGIFactory1 failed: 0x" << std::hex << res << LL_ENDL; - } - else - { - res = pFactory->EnumAdapters(0, reinterpret_cast<IDXGIAdapter**>(&mDXGIAdapter)); - if (FAILED(res)) - { - LL_WARNS() << "EnumAdapters failed: 0x" << std::hex << res << LL_ENDL; - } - else - { - LL_INFOS() << "EnumAdapters success" << LL_ENDL; - } - } - - if (pFactory) - { - pFactory->Release(); - } - } -} - -void LLWindowWin32::LLWindowWin32Thread::initD3D() -{ - if (!mGLReady) { return; } - - if (mDXGIAdapter == NULL && mD3DDevice == NULL && mWindowHandleThrd != 0) - { - mD3D = Direct3DCreate9(D3D_SDK_VERSION); - - D3DPRESENT_PARAMETERS d3dpp; - - ZeroMemory(&d3dpp, sizeof(d3dpp)); - d3dpp.Windowed = TRUE; - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - - HRESULT res = mD3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, mWindowHandleThrd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &mD3DDevice); - - if (FAILED(res)) - { - LL_WARNS() << "(fallback) CreateDevice failed: 0x" << std::hex << res << LL_ENDL; - } - else - { - LL_INFOS() << "(fallback) CreateDevice success" << LL_ENDL; - } - } -} - -void LLWindowWin32::LLWindowWin32Thread::cleanupDX() -{ - //clean up DXGI/D3D resources - if (mDXGIAdapter) - { - mDXGIAdapter->Release(); - mDXGIAdapter = nullptr; - } - - if (mD3DDevice) - { - mD3DDevice->Release(); - mD3DDevice = nullptr; - } - - if (mD3D) + if (p_factory) { - mD3D->Release(); - mD3D = nullptr; + p_factory->Release(); } -} - -void LLWindowWin32::LLWindowWin32Thread::updateVRAMUsage() -{ - LL_PROFILE_ZONE_SCOPED; - if (!mGLReady) { return; } - - if (mDXGIAdapter != nullptr) - { - // NOTE: what lies below is hand wavy math based on compatibility testing and observation against a variety of hardware - // It doesn't make sense, but please don't refactor it to make sense. -- davep - DXGI_QUERY_VIDEO_MEMORY_INFO info; - mDXGIAdapter->QueryVideoMemoryInfo(0, DXGI_MEMORY_SEGMENT_GROUP_LOCAL, &info); -#if 0 // debug 0 budget and 0 CU - info.Budget = 0; - info.CurrentUsage = 0; -#endif - - U32 budget_mb = info.Budget / 1024 / 1024; - gGLManager.mVRAM = llmax(gGLManager.mVRAM, (S32) budget_mb); - - U32 afr_mb = info.AvailableForReservation / 1024 / 1024; - // correct for systems that misreport budget - if (budget_mb == 0) - { - // fall back to available for reservation clamped between 512MB and 2GB - budget_mb = llclamp(afr_mb, (U32) 512, (U32) 2048); - } - - if ( mMaxVRAM != 0) - { - budget_mb = llmin(budget_mb, mMaxVRAM); - } - - U32 cu_mb = info.CurrentUsage / 1024 / 1024; - - // get an estimated usage based on texture bytes allocated - U32 eu_mb = LLImageGL::getTextureBytesAllocated() * 2 / 1024 / 1024; - - if (cu_mb == 0) - { // current usage is sometimes unreliable on Intel GPUs, fall back to estimated usage - cu_mb = llmax((U32)1, eu_mb); - } - U32 target_mb = budget_mb; - - if (target_mb > 4096) // if 4GB are installed, try to leave 2GB free - { - target_mb -= 2048; - } - else // if less than 4GB are installed, try not to use more than half of it - { - target_mb /= 2; - } - - mAvailableVRAM = cu_mb < target_mb ? target_mb - cu_mb : 0; - -#if 0 - - F32 eu_error = (F32)((S32)eu_mb - (S32)cu_mb) / (F32)cu_mb; - LL_INFOS("Window") << "\nLocal\nAFR: " << info.AvailableForReservation / 1024 / 1024 - << "\nBudget: " << info.Budget / 1024 / 1024 - << "\nCR: " << info.CurrentReservation / 1024 / 1024 - << "\nCU: " << info.CurrentUsage / 1024 / 1024 - << "\nEU: " << eu_mb << llformat(" (%.2f)", eu_error) - << "\nTU: " << target_mb - << "\nAM: " << mAvailableVRAM << LL_ENDL; -#endif - } - else if (mD3DDevice != NULL) - { // fallback to D3D9 - mAvailableVRAM = mD3DDevice->GetAvailableTextureMem() / 1024 / 1024; - } + mGotGLBuffer = true; } void LLWindowWin32::LLWindowWin32Thread::run() @@ -4866,15 +4697,11 @@ void LLWindowWin32::LLWindowWin32Thread::run() { LL_PROFILE_ZONE_SCOPED_CATEGORY_WIN32; - // lazily call initD3D inside this loop to catch when mGLReady has been set to true - initDX(); + // Check memory budget using DirectX + checkDXMem(); if (mWindowHandleThrd != 0) { - // lazily call initD3D inside this loop to catch when mWindowHandle has been set, and mGLReady has been set to true - // *TODO: Shutdown if this fails when mWindowHandle exists - initD3D(); - MSG msg; BOOL status; if (mhDCThrd == 0) @@ -4907,13 +4734,6 @@ void LLWindowWin32::LLWindowWin32Thread::run() getQueue().runPending(); } - // update available vram once every 3 seconds - static LLFrameTimer vramTimer; - if (vramTimer.getElapsedTimeF32() > 3.f) - { - updateVRAMUsage(); - vramTimer.reset(); - } #if 0 { LL_PROFILE_ZONE_NAMED_CATEGORY_WIN32("w32t - Sleep"); @@ -4922,8 +4742,6 @@ void LLWindowWin32::LLWindowWin32Thread::run() } #endif } - - cleanupDX(); } void LLWindowWin32::LLWindowWin32Thread::wakeAndDestroy() @@ -5023,7 +4841,6 @@ void LLWindowWin32::LLWindowWin32Thread::wakeAndDestroy() // very unsafe TerminateThread(pair.second.native_handle(), 0); pair.second.detach(); - cleanupDX(); } } LL_DEBUGS("Window") << "thread pool shutdown complete" << LL_ENDL; diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 33fa67ba50..287402faa0 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -48,47 +48,47 @@ public: /*virtual*/ void show(); /*virtual*/ void hide(); /*virtual*/ void close(); - /*virtual*/ BOOL getVisible(); - /*virtual*/ BOOL getMinimized(); - /*virtual*/ BOOL getMaximized(); - /*virtual*/ BOOL maximize(); + /*virtual*/ bool getVisible(); + /*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); - /*virtual*/ BOOL getSize(LLCoordWindow *size); - /*virtual*/ BOOL setPosition(LLCoordScreen position); - /*virtual*/ BOOL setSizeImpl(LLCoordScreen size); - /*virtual*/ BOOL setSizeImpl(LLCoordWindow size); - /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL enable_vsync, const LLCoordScreen * const posp = NULL); + /*virtual*/ bool getFullscreen(); + /*virtual*/ bool getPosition(LLCoordScreen *position); + /*virtual*/ bool getSize(LLCoordScreen *size); + /*virtual*/ bool getSize(LLCoordWindow *size); + /*virtual*/ bool setPosition(LLCoordScreen position); + /*virtual*/ bool setSizeImpl(LLCoordScreen size); + /*virtual*/ bool setSizeImpl(LLCoordWindow size); + /*virtual*/ bool switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, const LLCoordScreen * const posp = NULL); /*virtual*/ void setTitle(const std::string title); void* createSharedContext() override; void makeContextCurrent(void* context) override; void destroySharedContext(void* context) override; /*virtual*/ void toggleVSync(bool enable_vsync); - /*virtual*/ BOOL setCursorPosition(LLCoordWindow position); - /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position); - /*virtual*/ BOOL getCursorDelta(LLCoordCommon* delta); + /*virtual*/ bool setCursorPosition(LLCoordWindow position); + /*virtual*/ bool getCursorPosition(LLCoordWindow *position); + /*virtual*/ bool getCursorDelta(LLCoordCommon* delta); /*virtual*/ void showCursor(); /*virtual*/ void hideCursor(); /*virtual*/ void showCursorFromMouseMove(); /*virtual*/ void hideCursorUntilMouseMove(); - /*virtual*/ BOOL isCursorHidden(); + /*virtual*/ bool isCursorHidden(); /*virtual*/ void updateCursor(); /*virtual*/ ECursorType getCursor() const; /*virtual*/ void captureMouse(); /*virtual*/ void releaseMouse(); - /*virtual*/ void setMouseClipping( BOOL b ); - /*virtual*/ BOOL isClipboardTextAvailable(); - /*virtual*/ BOOL pasteTextFromClipboard(LLWString &dst); - /*virtual*/ BOOL copyTextToClipboard(const LLWString &src); + /*virtual*/ void setMouseClipping( bool b ); + /*virtual*/ bool isClipboardTextAvailable(); + /*virtual*/ bool pasteTextFromClipboard(LLWString &dst); + /*virtual*/ bool copyTextToClipboard(const LLWString &src); /*virtual*/ void flashIcon(F32 seconds); /*virtual*/ F32 getGamma(); - /*virtual*/ BOOL setGamma(const F32 gamma); // Set the gamma + /*virtual*/ bool setGamma(const F32 gamma); // Set the gamma /*virtual*/ void setFSAASamples(const U32 fsaa_samples); /*virtual*/ U32 getFSAASamples(); - /*virtual*/ BOOL restoreGamma(); // Restore original gamma table (before updating gamma) + /*virtual*/ bool restoreGamma(); // Restore original gamma table (before updating gamma) /*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; } /*virtual*/ void gatherInput(); /*virtual*/ void delayInputProcessing(); @@ -96,27 +96,25 @@ public: /*virtual*/ void restoreGLContext() {}; // handy coordinate space conversion routines - /*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to); - /*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordScreen *to); - /*virtual*/ BOOL convertCoords(LLCoordWindow from, LLCoordGL *to); - /*virtual*/ BOOL convertCoords(LLCoordGL from, LLCoordWindow *to); - /*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordGL *to); - /*virtual*/ BOOL convertCoords(LLCoordGL from, LLCoordScreen *to); + /*virtual*/ bool convertCoords(LLCoordScreen from, LLCoordWindow *to); + /*virtual*/ bool convertCoords(LLCoordWindow from, LLCoordScreen *to); + /*virtual*/ bool convertCoords(LLCoordWindow from, LLCoordGL *to); + /*virtual*/ bool convertCoords(LLCoordGL from, LLCoordWindow *to); + /*virtual*/ bool convertCoords(LLCoordScreen from, LLCoordGL *to); + /*virtual*/ bool convertCoords(LLCoordGL from, LLCoordScreen *to); /*virtual*/ LLWindowResolution* getSupportedResolutions(S32 &num_resolutions); /*virtual*/ F32 getNativeAspectRatio(); /*virtual*/ F32 getPixelAspectRatio(); /*virtual*/ void setNativeAspectRatio(F32 ratio) { mOverrideAspectRatio = ratio; } - U32 getAvailableVRAMMegabytes() override; - - /*virtual*/ BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b ); + /*virtual*/ bool dialogColorPicker(F32 *r, F32 *g, F32 *b ); /*virtual*/ void *getPlatformWindow(); /*virtual*/ void bringToFront(); /*virtual*/ void focusClient(); - /*virtual*/ void allowLanguageTextInput(LLPreeditor *preeditor, BOOL b); + /*virtual*/ void allowLanguageTextInput(LLPreeditor *preeditor, bool b); /*virtual*/ void setLanguageTextInput( const LLCoordGL & pos ); /*virtual*/ void updateLanguageTextInputArea(); /*virtual*/ void interruptLanguageTextInput(); @@ -141,47 +139,43 @@ public: 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 enable_vsync, BOOL use_gl, - BOOL ignore_pixel_depth, U32 fsaa_samples, U32 max_cores, U32 max_vram, F32 max_gl_version); + bool fullscreen, bool clearBg, bool enable_vsync, bool use_gl, + bool ignore_pixel_depth, U32 fsaa_samples, U32 max_cores, F32 max_gl_version); ~LLWindowWin32(); void initCursors(); - void initInputDevices(); HCURSOR loadColorCursor(LPCTSTR name); - BOOL isValid(); + bool isValid(); void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size); virtual LLSD getNativeKeyData(); // Changes display resolution. Returns true if successful - BOOL setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh); + bool setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh); // Go back to last fullscreen display resolution. - BOOL setFullscreenResolution(); + bool setFullscreenResolution(); // Restore the display resolution to its value before we ran the app. - BOOL resetDisplayResolution(); + bool resetDisplayResolution(); - BOOL shouldPostQuit() { return mPostQuit; } + bool shouldPostQuit() { return mPostQuit; } - void fillCompositionForm(const LLRect& bounds, COMPOSITIONFORM *form); void fillCandidateForm(const LLCoordGL& caret, const LLRect& bounds, CANDIDATEFORM *form); void fillCharPosition(const LLCoordGL& caret, const LLRect& bounds, const LLRect& control, IMECHARPOSITION *char_position); void fillCompositionLogfont(LOGFONT *logfont); U32 fillReconvertString(const LLWString &text, S32 focus, S32 focus_length, RECONVERTSTRING *reconvert_string); void handleStartCompositionMessage(); void handleCompositionMessage(U32 indexes); - BOOL handleImeRequests(WPARAM request, LPARAM param, LRESULT *result); + bool handleImeRequests(WPARAM request, LPARAM param, LRESULT *result); protected: // // Platform specific methods // - BOOL getClientRectInScreenSpace(RECT* rectp); - void updateJoystick( ); + bool getClientRectInScreenSpace(RECT* rectp); static LRESULT CALLBACK mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_param, LPARAM l_param); - static BOOL CALLBACK enumChildWindows(HWND h_wnd, LPARAM l_param); // @@ -209,7 +203,7 @@ protected: MASK mMouseMask; - static BOOL sIsClassRegistered; // has the window class been registered? + static bool sIsClassRegistered; // has the window class been registered? F32 mCurrentGamma; U32 mFSAASamples; @@ -217,16 +211,16 @@ protected: F32 mMaxGLVersion; // maximum OpenGL version to attempt to use (clamps to 3.2 - 4.6) WORD mPrevGammaRamp[3][256]; WORD mCurrentGammaRamp[3][256]; - BOOL mCustomGammaSet; + bool mCustomGammaSet; LPWSTR mIconResource; - BOOL mInputProcessingPaused; + bool mInputProcessingPaused; // The following variables are for Language Text Input control. // They are all static, since one context is shared by all LLWindowWin32 // instances. - static BOOL sLanguageTextInputAllowed; - static BOOL sWinIMEOpened; + static bool sLanguageTextInputAllowed; + static bool sWinIMEOpened; static HKL sWinInputLocale; static DWORD sWinIMEConversionMode; static DWORD sWinIMESentenceMode; @@ -245,7 +239,7 @@ protected: U32 mRawWParam; U32 mRawLParam; - BOOL mMouseVanish; + bool mMouseVanish; // Cached values of GetWindowRect and GetClientRect to be used by app thread void updateWindowRect(); @@ -288,8 +282,6 @@ private: extern LLW32MsgCallback gAsyncMsgCallback; extern LPWSTR gIconResource; -static void handleMessage( const MSG& msg ); - S32 OSMessageBoxWin32(const std::string& text, const std::string& caption, U32 type); #endif //LL_LLWINDOWWIN32_H |