Fix ubuntu 20.04 pipelines
By not using SDL_RenderLogicalToWindow if it's not available. Because of course ubuntu 20.04 has sdl 2.0.10, which of course doesn't yet have SDL_RenderLogicalToWindow which was added in 2.0.18, which is of course needed because of course SDL_SetTextInputRect takes window coordinates rather than logical coordinates. At least official static linux builds are not affected because tpt-libs uses much newer sdl.
This commit is contained in:
parent
79760f5c89
commit
bb8605fa3b
@ -43,14 +43,23 @@ 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???
|
// Why does SDL_SetTextInputRect not take logical coordinates???
|
||||||
|
SDL_Rect rect;
|
||||||
|
#if SDL_VERSION_ATLEAST(2, 0, 18)
|
||||||
int wx, wy, wwx, why;
|
int wx, wy, wwx, why;
|
||||||
SDL_RenderLogicalToWindow(sdl_renderer, x, y, &wx, &wy);
|
SDL_RenderLogicalToWindow(sdl_renderer, x, y, &wx, &wy);
|
||||||
SDL_RenderLogicalToWindow(sdl_renderer, x + w, y + h, &wwx, &why);
|
SDL_RenderLogicalToWindow(sdl_renderer, x + w, y + h, &wwx, &why);
|
||||||
SDL_Rect rect;
|
|
||||||
rect.x = wx;
|
rect.x = wx;
|
||||||
rect.y = wy;
|
rect.y = wy;
|
||||||
rect.w = wwx - wx;
|
rect.w = wwx - wx;
|
||||||
rect.h = why - wy;
|
rect.h = why - wy;
|
||||||
|
#else
|
||||||
|
// TODO: use SDL_RenderLogicalToWindow when ubuntu deigns to update to sdl 2.0.18
|
||||||
|
auto scale = ui::Engine::Ref().windowFrameOps.scale;
|
||||||
|
rect.x = x * scale;
|
||||||
|
rect.y = y * scale;
|
||||||
|
rect.w = w * scale;
|
||||||
|
rect.h = h * scale;
|
||||||
|
#endif
|
||||||
SDL_SetTextInputRect(&rect);
|
SDL_SetTextInputRect(&rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user