mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-29 19:00:33 +02:00
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:
@@ -42,11 +42,15 @@ void StopTextInput()
|
|||||||
|
|
||||||
void SetTextInputRect(int x, int y, int w, int h)
|
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;
|
SDL_Rect rect;
|
||||||
rect.x = x;
|
rect.x = wx;
|
||||||
rect.y = y;
|
rect.y = wy;
|
||||||
rect.w = w;
|
rect.w = wwx - wx;
|
||||||
rect.h = h;
|
rect.h = why - wy;
|
||||||
SDL_SetTextInputRect(&rect);
|
SDL_SetTextInputRect(&rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,13 +245,12 @@ void SDLSetScreen()
|
|||||||
//Uncomment this to enable resizing
|
//Uncomment this to enable resizing
|
||||||
//SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
|
//SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
|
||||||
//SDL_SetWindowResizable(sdl_window, SDL_TRUE);
|
//SDL_SetWindowResizable(sdl_window, SDL_TRUE);
|
||||||
|
|
||||||
LoadWindowPosition();
|
|
||||||
UpdateFpsLimit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_SetWindowSize(sdl_window, size.X, size.Y);
|
SDL_SetWindowSize(sdl_window, size.X, size.Y);
|
||||||
SDL_RenderSetIntegerScale(sdl_renderer, newFrameOpsNorm.forceIntegerScaling ? SDL_TRUE : SDL_FALSE);
|
SDL_RenderSetIntegerScale(sdl_renderer, newFrameOpsNorm.forceIntegerScaling ? SDL_TRUE : SDL_FALSE);
|
||||||
|
LoadWindowPosition();
|
||||||
|
UpdateFpsLimit();
|
||||||
if (newFrameOpsNorm.fullscreen)
|
if (newFrameOpsNorm.fullscreen)
|
||||||
{
|
{
|
||||||
SDL_RaiseWindow(sdl_window);
|
SDL_RaiseWindow(sdl_window);
|
||||||
|
@@ -331,6 +331,5 @@ void Engine::StopTextInput()
|
|||||||
|
|
||||||
void Engine::TextInputRect(Point position, Point size)
|
void Engine::TextInputRect(Point position, Point size)
|
||||||
{
|
{
|
||||||
auto scale = windowFrameOps.scale;
|
::SetTextInputRect(position.X, position.Y, size.X, size.Y);
|
||||||
::SetTextInputRect(position.X * scale, position.Y * scale, size.X * scale, size.Y * scale);
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user