Fix input method candidates being aligned wrong in some cases
Namely when the main window is resizeable and its size isn't the same as it would be with the active scale mode with resizing disabled. Also fix window position not being restored when the main window is resizeable.
This commit is contained in:
parent
0fb36012a2
commit
79760f5c89
@ -42,11 +42,15 @@ void StopTextInput()
|
||||
|
||||
void SetTextInputRect(int x, int y, int w, int h)
|
||||
{
|
||||
// Why does SDL_SetTextInputRect not take logical coordinates???
|
||||
int wx, wy, wwx, why;
|
||||
SDL_RenderLogicalToWindow(sdl_renderer, x, y, &wx, &wy);
|
||||
SDL_RenderLogicalToWindow(sdl_renderer, x + w, y + h, &wwx, &why);
|
||||
SDL_Rect rect;
|
||||
rect.x = x;
|
||||
rect.y = y;
|
||||
rect.w = w;
|
||||
rect.h = h;
|
||||
rect.x = wx;
|
||||
rect.y = wy;
|
||||
rect.w = wwx - wx;
|
||||
rect.h = why - wy;
|
||||
SDL_SetTextInputRect(&rect);
|
||||
}
|
||||
|
||||
@ -241,13 +245,12 @@ void SDLSetScreen()
|
||||
//Uncomment this to enable resizing
|
||||
//SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
|
||||
//SDL_SetWindowResizable(sdl_window, SDL_TRUE);
|
||||
|
||||
LoadWindowPosition();
|
||||
UpdateFpsLimit();
|
||||
}
|
||||
|
||||
SDL_SetWindowSize(sdl_window, size.X, size.Y);
|
||||
SDL_RenderSetIntegerScale(sdl_renderer, newFrameOpsNorm.forceIntegerScaling ? SDL_TRUE : SDL_FALSE);
|
||||
LoadWindowPosition();
|
||||
UpdateFpsLimit();
|
||||
if (newFrameOpsNorm.fullscreen)
|
||||
{
|
||||
SDL_RaiseWindow(sdl_window);
|
||||
|
@ -331,6 +331,5 @@ void Engine::StopTextInput()
|
||||
|
||||
void Engine::TextInputRect(Point position, Point size)
|
||||
{
|
||||
auto scale = windowFrameOps.scale;
|
||||
::SetTextInputRect(position.X * scale, position.Y * scale, size.X * scale, size.Y * scale);
|
||||
::SetTextInputRect(position.X, position.Y, size.X, size.Y);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user