From b7da52ec5711e999963df218d4fad69a8025daeb Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Fri, 18 Sep 2020 16:05:14 +0300 Subject: Added build options for X11 Build option to use software rendering if running under X11, and another option to set the position of a window only after the window has been shown. The latter is a workaround for an SDL bug regarding window borders affecting the initial position. --- src/ui/window.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/ui/window.c') diff --git a/src/ui/window.c b/src/ui/window.c index b43e8421..8ebb67a8 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -506,6 +506,7 @@ iBool create_Window_(iWindow *d, iRect rect, uint32_t flags) { void init_Window(iWindow *d, iRect rect) { theWindow_ = d; iZap(d->cursors); + d->initialPos = rect.pos; d->pendingCursor = NULL; d->isDrawFrozen = iTrue; uint32_t flags = 0; @@ -597,6 +598,16 @@ SDL_Renderer *renderer_Window(const iWindow *d) { static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) { switch (ev->event) { +#if defined (LAGRANGE_ENABLE_WINDOWPOS_FIX) + case SDL_WINDOWEVENT_EXPOSED: + if (d->initialPos.x >= 0) { + int bx, by; + SDL_GetWindowBordersSize(d->win, &by, &bx, NULL, NULL); + SDL_SetWindowPosition(d->win, d->initialPos.x + bx, d->initialPos.y + by); + d->initialPos = init1_I2(-1); + } + return iFalse; +#endif case SDL_WINDOWEVENT_MOVED: /* No need to do anything. */ return iTrue; -- cgit v1.2.3