| 44 | } |
| 45 | |
| 46 | void SetTextInputRect(int x, int y, int w, int h) |
| 47 | { |
| 48 | // Why does SDL_SetTextInputRect not take logical coordinates??? |
| 49 | SDL_Rect rect; |
| 50 | #if SDL_VERSION_ATLEAST(2, 0, 18) |
| 51 | int wx, wy, wwx, why; |
| 52 | SDL_RenderLogicalToWindow(sdl_renderer, float(x), float(y), &wx, &wy); |
| 53 | SDL_RenderLogicalToWindow(sdl_renderer, float(x + w), float(y + h), &wwx, &why); |
| 54 | rect.x = wx; |
| 55 | rect.y = wy; |
| 56 | rect.w = wwx - wx; |
| 57 | rect.h = why - wy; |
| 58 | #else |
| 59 | // TODO: use SDL_RenderLogicalToWindow when ubuntu deigns to update to sdl 2.0.18 |
| 60 | auto scale = ui::Engine::Ref().windowFrameOps.scale; |
| 61 | rect.x = x * scale; |
| 62 | rect.y = y * scale; |
| 63 | rect.w = w * scale; |
| 64 | rect.h = h * scale; |
| 65 | #endif |
| 66 | SDL_SetTextInputRect(&rect); |
| 67 | } |
| 68 | |
| 69 | void ClipboardPush(ByteString text) |
| 70 | { |