mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-20 14:23:08 +01:00
Fix #20631: IME window not positioned correctly
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
- Fix: [#20255] Images from the last hovered-over coaster in the object selection are not freed.
|
- Fix: [#20255] Images from the last hovered-over coaster in the object selection are not freed.
|
||||||
- Fix: [#20616] Confirmation button in the track designer’s quit prompt has the wrong text.
|
- Fix: [#20616] Confirmation button in the track designer’s quit prompt has the wrong text.
|
||||||
- Fix: [#20628] Moving caret using Ctrl+left can move too far when using a multibyte grapheme.
|
- Fix: [#20628] Moving caret using Ctrl+left can move too far when using a multibyte grapheme.
|
||||||
|
- Fix: [#20631] IME window not positioned correctly.
|
||||||
- Fix: [#20845] Trying to save under a folder with no write permissions causes a crash.
|
- Fix: [#20845] Trying to save under a folder with no write permissions causes a crash.
|
||||||
- Fix: [#21054] “No entrance” style is selected by default in the track designer.
|
- Fix: [#21054] “No entrance” style is selected by default in the track designer.
|
||||||
- Fix: [#21145] [Plugin] setInterval/setTimeout handle conflict.
|
- Fix: [#21145] [Plugin] setInterval/setTimeout handle conflict.
|
||||||
|
|||||||
@@ -38,11 +38,7 @@ bool TextComposition::IsActive()
|
|||||||
|
|
||||||
TextInputSession* TextComposition::Start(u8string& buffer, size_t maxLength)
|
TextInputSession* TextComposition::Start(u8string& buffer, size_t maxLength)
|
||||||
{
|
{
|
||||||
// TODO This doesn't work, and position could be improved to where text entry is
|
|
||||||
SDL_Rect rect = { 10, 10, 100, 100 };
|
|
||||||
SDL_SetTextInputRect(&rect);
|
|
||||||
SDL_StartTextInput();
|
SDL_StartTextInput();
|
||||||
|
|
||||||
_session.Buffer = &buffer;
|
_session.Buffer = &buffer;
|
||||||
_session.MaxLength = maxLength;
|
_session.MaxLength = maxLength;
|
||||||
_session.SelectionStart = buffer.size();
|
_session.SelectionStart = buffer.size();
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include <SDL.h>
|
||||||
#include <SDL_keycode.h>
|
#include <SDL_keycode.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
@@ -291,7 +292,7 @@ public:
|
|||||||
// IME composition
|
// IME composition
|
||||||
if (!String::IsNullOrEmpty(gTextInput->ImeBuffer))
|
if (!String::IsNullOrEmpty(gTextInput->ImeBuffer))
|
||||||
{
|
{
|
||||||
DrawIMEComposition(dpi, cursorX, cursorY);
|
IMEComposition(cursorX, cursorY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,18 +317,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void DrawIMEComposition(DrawPixelInfo& dpi, int32_t cursorX, int32_t cursorY)
|
static void IMEComposition(int32_t cursorX, int32_t cursorY)
|
||||||
{
|
{
|
||||||
int compositionWidth = GfxGetStringWidth(gTextInput->ImeBuffer, FontStyle::Medium);
|
SDL_Rect rect = { cursorX, cursorY, 100, 100 };
|
||||||
ScreenCoordsXY screenCoords(cursorX - (compositionWidth / 2), cursorY + 13);
|
SDL_SetTextInputRect(&rect);
|
||||||
int width = compositionWidth;
|
|
||||||
int height = 10;
|
|
||||||
|
|
||||||
GfxFillRect(
|
|
||||||
dpi, { screenCoords - ScreenCoordsXY{ 1, 1 }, screenCoords + ScreenCoordsXY{ width + 1, height + 1 } },
|
|
||||||
PALETTE_INDEX_12);
|
|
||||||
GfxFillRect(dpi, { screenCoords, screenCoords + ScreenCoordsXY{ width, height } }, PALETTE_INDEX_0);
|
|
||||||
GfxDrawString(dpi, screenCoords, static_cast<const char*>(gTextInput->ImeBuffer), { COLOUR_DARK_GREEN });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExecuteCallback(bool hasValue)
|
void ExecuteCallback(bool hasValue)
|
||||||
|
|||||||
Reference in New Issue
Block a user