diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 5f6f80813022e8d983afa277f9fad096b4bc885e..8c12d04e86acd8569f9b961a105572190ff9b2c7 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -1665,7 +1665,6 @@ BOOL LLWindowSDL::SDLReallyCaptureInput(BOOL capture) } bool newGrab = wantGrab; -#if LL_X11 if (!mFullscreen) /* only bother if we're windowed anyway */ { if (mSDL_Display) @@ -1696,7 +1695,6 @@ BOOL LLWindowSDL::SDLReallyCaptureInput(BOOL capture) } } } -#endif // LL_X11 // pretend we got what we wanted, when really we don't care. // return boolean success for whether we ended up in the desired state @@ -2730,6 +2728,48 @@ void LLWindowSDL::allowLanguageTextInput(LLPreeditor *preeditor, BOOL b) } } +void LLWindowSDL::updateLanguageTextInputArea() +{ + if (mLanguageTextInputAllowed && mPreeditor) + { + LLCoordGL caret_coord; + LLRect preedit_bounds; + if (mPreeditor->getPreeditLocation(-1, &caret_coord, &preedit_bounds, NULL)) + { + LLCoordWindow window_pos; + convertCoords(caret_coord, &window_pos); + + SDL_Rect coords; + coords.x = window_pos.mX; + coords.y = window_pos.mY; + coords.w = preedit_bounds.getWidth() - coords.x; + coords.h = preedit_bounds.getHeight() - coords.y; + SDL_SetTextInputRect(&coords); + } + } +} + +void LLWindowSDL::setLanguageTextInput( const LLCoordGL & pos ) +{ + if (mLanguageTextInputAllowed && mPreeditor) + { + LLCoordGL caret_coord; + LLRect preedit_bounds; + if (mPreeditor->getPreeditLocation(-1, &caret_coord, &preedit_bounds, NULL)) + { + LLCoordWindow window_pos; + convertCoords(pos, &window_pos); + + SDL_Rect coords; + coords.x = window_pos.mX; + coords.y = window_pos.mY; + coords.w = preedit_bounds.getWidth() - coords.x; + coords.h = preedit_bounds.getHeight() - coords.y; + SDL_SetTextInputRect(&coords); + } + } +} + //static std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList() { diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index e293707dda7dbaa601151ece4d3cb04e4e0ca8a0..ab6e757c85b39f5f1f4492ac6232a0ea3ddc5c1b 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -31,6 +31,7 @@ #include "llwindow.h" #include "lltimer.h" +#include "llpreeditor.h" #ifndef SDL_MAIN_HANDLED #define SDL_MAIN_HANDLED 1 @@ -127,6 +128,8 @@ class LLWindowSDL final : public LLWindow /*virtual*/ void bringToFront(); void allowLanguageTextInput(LLPreeditor *preeditor, BOOL b) override; + /*virtual*/ void updateLanguageTextInputArea() override; + /*virtual*/ void setLanguageTextInput( const LLCoordGL & pos ) override; /*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async);