diff options
Diffstat (limited to 'indra/llwindow/llwindowwin32.cpp')
-rw-r--r-- | indra/llwindow/llwindowwin32.cpp | 429 |
1 files changed, 219 insertions, 210 deletions
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 54e5f43e87..1ed801a85a 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; @@ -178,10 +178,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; @@ -200,24 +200,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); } @@ -229,43 +229,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); } @@ -279,25 +279,25 @@ LONG LLWinImm::getCompositionString(HIMC himc, DWORD index, LPVOID data, DWORD // 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); } @@ -439,9 +439,9 @@ struct LLWindowWin32::LLWindowWin32Thread : public LL::ThreadPool 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, @@ -534,7 +534,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, mIconResource = gIconResource; mOverrideAspectRatio = 0.f; mNativeAspectRatio = 0.f; - mInputProcessingPaused = FALSE; + mInputProcessingPaused = false; mPreeditor = NULL; mKeyCharCode = 0; mKeyScanCode = 0; @@ -543,7 +543,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}; @@ -551,7 +551,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, if (!SystemParametersInfo(SPI_GETMOUSEVANISH, 0, &mMouseVanish, 0)) { - mMouseVanish = TRUE; + mMouseVanish = true; } // Initialize the keyboard @@ -563,7 +563,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; @@ -681,7 +681,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, mCallbacks->translateString("MBError"), OSMB_OK); return; } - sIsClassRegistered = TRUE; + sIsClassRegistered = true; } //----------------------------------------------------------------------- @@ -709,7 +709,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, //----------------------------------------------------------------------- if (mFullscreen) { - BOOL success = FALSE; + bool success = false; DWORD closest_refresh = 0; for (S32 mode_num = 0;; mode_num++) @@ -723,7 +723,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)) { @@ -735,11 +735,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 { @@ -748,12 +748,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; } } } @@ -771,7 +771,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; @@ -785,7 +785,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, } else { - mFullscreen = FALSE; + mFullscreen = false; mFullscreenWidth = -1; mFullscreenHeight = -1; mFullscreenBits = -1; @@ -866,7 +866,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); } @@ -896,14 +896,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); } @@ -960,7 +960,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(); @@ -1000,29 +1000,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([=] @@ -1037,56 +1037,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([=]() @@ -1102,10 +1102,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; @@ -1117,7 +1117,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; @@ -1130,11 +1130,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(); } @@ -1167,8 +1167,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++) @@ -1182,7 +1182,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)) { @@ -1194,7 +1194,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. @@ -1209,7 +1209,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; @@ -1235,19 +1235,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); @@ -1259,7 +1259,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 @@ -1309,7 +1309,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 ; @@ -1323,7 +1323,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 (...) @@ -1332,7 +1332,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 ; @@ -1344,7 +1344,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 @@ -1383,7 +1383,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO OSMessageBox(mCallbacks->translateString("MBPixelFmtSetErr"), mCallbacks->translateString("MBError"), OSMB_OK); close(); - return FALSE; + return false; } @@ -1392,7 +1392,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)) @@ -1400,7 +1400,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 ; @@ -1492,7 +1492,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) @@ -1507,7 +1507,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; } } @@ -1521,7 +1521,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) @@ -1533,7 +1533,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen& size, BO { close(); show_window_creation_error("Error after wglChoosePixelFormatARB 16-bit"); - return FALSE; + return false; } } } @@ -1606,7 +1606,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)) @@ -1614,7 +1614,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)) @@ -1651,7 +1651,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) @@ -1665,7 +1665,7 @@ const S32 max_format = (S32)num_formats - 1; mhRC = (HGLRC) createSharedContext(); if (!mhRC) { - return FALSE; + return false; } } @@ -1673,14 +1673,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 @@ -1697,7 +1697,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 @@ -1716,7 +1716,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) @@ -1941,13 +1941,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()); @@ -1967,31 +1967,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() @@ -2006,8 +2006,8 @@ void LLWindowWin32::hideCursor() } }); - mCursorHidden = TRUE; - mHideCursorPermanent = TRUE; + mCursorHidden = true; + mHideCursorPermanent = true; } void LLWindowWin32::showCursor() @@ -2025,8 +2025,8 @@ void LLWindowWin32::showCursor() } }); - mCursorHidden = FALSE; - mHideCursorPermanent = FALSE; + mCursorHidden = false; + mHideCursorPermanent = false; } void LLWindowWin32::showCursorFromMouseMove() @@ -2042,11 +2042,11 @@ void LLWindowWin32::hideCursorUntilMouseMove() if (!mHideCursorPermanent && mMouseVanish) { hideCursor(); - mHideCursorPermanent = FALSE; + mHideCursorPermanent = false; } } -BOOL LLWindowWin32::isCursorHidden() +bool LLWindowWin32::isCursorHidden() { return mCursorHidden; } @@ -2166,7 +2166,7 @@ void LLWindowWin32::releaseMouse() void LLWindowWin32::delayInputProcessing() { - mInputProcessingPaused = TRUE; + mInputProcessingPaused = true; } @@ -2247,7 +2247,7 @@ void LLWindowWin32::gatherInput() } } - mInputProcessingPaused = FALSE; + mInputProcessingPaused = false; updateCursor(); } @@ -2292,7 +2292,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) { @@ -2314,7 +2314,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; } @@ -2471,8 +2471,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: { @@ -2492,8 +2493,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"); @@ -2584,9 +2586,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; } @@ -2617,7 +2619,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); @@ -2640,7 +2642,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; @@ -2664,7 +2666,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); @@ -2685,7 +2687,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); @@ -2703,7 +2705,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); }); } @@ -2723,7 +2725,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); }); } @@ -2737,7 +2739,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); }); } @@ -2755,7 +2757,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); }); @@ -2772,7 +2774,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); }); @@ -2882,7 +2884,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; }); @@ -2919,19 +2921,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 @@ -3000,8 +3002,6 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ }); }; return 0; - - break; } case WM_SETTINGCHANGE: { @@ -3010,7 +3010,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); } } } @@ -3086,6 +3086,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: @@ -3119,7 +3120,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; @@ -3129,17 +3130,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; @@ -3148,23 +3149,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) { @@ -3175,13 +3176,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) { @@ -3192,44 +3193,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)) { @@ -3244,7 +3245,7 @@ BOOL LLWindowWin32::pasteTextFromClipboard(LLWString &dst) dst = utf16str_to_wstring(utf16str); LLWStringUtil::removeWindowsCR(dst); GlobalUnlock(h_data); - success = TRUE; + success = true; } } CloseClipboard(); @@ -3255,9 +3256,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)) { @@ -3281,7 +3282,7 @@ BOOL LLWindowWin32::copyTextToClipboard(const LLWString& wstr) if (SetClipboardData(CF_UNICODETEXT, hglobal_copy_utf16)) { - success = TRUE; + success = true; } } } @@ -3293,13 +3294,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 ) { @@ -3325,9 +3326,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)) @@ -3348,7 +3349,7 @@ BOOL LLWindowWin32::getClientRectInScreenSpace( RECT* rectp ) bottom_right.x, bottom_right.y); - success = TRUE; + success = true; } return success; @@ -3374,25 +3375,25 @@ F32 LLWindowWin32::getGamma() return mCurrentGamma; } -BOOL LLWindowWin32::restoreGamma() +bool LLWindowWin32::restoreGamma() { ASSERT_MAIN_THREAD(); - if (mCustomGammaSet != FALSE) + if (mCustomGammaSet != false) { 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 == false) { if (!gGLManager.mIsIntel) // skip for Intel GPUs (see SL-11341) { @@ -3400,10 +3401,10 @@ BOOL LLWindowWin32::setGamma(const F32 gamma) if(GetDeviceGammaRamp(mhDC, mPrevGammaRamp) == FALSE) { 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; @@ -3458,13 +3459,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) @@ -3517,12 +3518,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)) @@ -3533,7 +3534,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; } } @@ -3560,7 +3561,7 @@ BOOL LLWindowWin32::setDisplayResolution(S32 width, S32 height, S32 bits, S32 re } // protected -BOOL LLWindowWin32::setFullscreenResolution() +bool LLWindowWin32::setFullscreenResolution() { if (mFullscreen) { @@ -3568,18 +3569,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) { @@ -3789,9 +3790,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]; @@ -3844,7 +3845,7 @@ void LLWindowWin32::focusClient() }); } -void LLWindowWin32::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b) +void LLWindowWin32::allowLanguageTextInput(LLPreeditor *preeditor, bool b) { if (b == sLanguageTextInputAllowed || !LLWinImm::isAvailable()) { @@ -3854,7 +3855,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 @@ -3884,7 +3885,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); } @@ -3910,7 +3911,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); } @@ -4116,7 +4117,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; @@ -4139,7 +4140,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; } } @@ -4156,7 +4157,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; } } @@ -4192,13 +4193,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]); } @@ -4222,7 +4223,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); @@ -4257,7 +4258,7 @@ void LLWindowWin32::handleCompositionMessage(const U32 indexes) } 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); @@ -4304,11 +4305,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 ) { @@ -4326,7 +4327,7 @@ BOOL LLWindowWin32::handleImeRequests(WPARAM request, LPARAM param, LRESULT *res form->dwIndex = dwIndex; *result = 1; - return TRUE; + return true; } case IMR_QUERYCHARPOSITION: { @@ -4346,20 +4347,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: { @@ -4380,7 +4381,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) @@ -4397,12 +4398,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: { @@ -4424,14 +4425,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 @@ -4560,6 +4561,14 @@ U32 LLWindowWin32::getAvailableVRAMMegabytes() return mWindowThread ? mWindowThread->getAvailableVRAMMegabytes() : 0; } +void LLWindowWin32::setMaxVRAMMegabytes(U32 max_vram) +{ + if (mWindowThread) + { + mWindowThread->mMaxVRAM = max_vram; + } +} + #endif // LL_WINDOWS inline LLWindowWin32::LLWindowWin32Thread::LLWindowWin32Thread() |