diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-09-18 16:05:14 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-09-18 16:05:14 +0300 |
commit | b7da52ec5711e999963df218d4fad69a8025daeb (patch) | |
tree | f196680c65574195b528d9382cf9c4c2755bd6f5 /src/ui/window.c | |
parent | ebee2c2cd7741c5174cbea7190bad94556bd7362 (diff) |
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.
Diffstat (limited to 'src/ui/window.c')
-rw-r--r-- | src/ui/window.c | 11 |
1 files changed, 11 insertions, 0 deletions
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) { | |||
506 | void init_Window(iWindow *d, iRect rect) { | 506 | void init_Window(iWindow *d, iRect rect) { |
507 | theWindow_ = d; | 507 | theWindow_ = d; |
508 | iZap(d->cursors); | 508 | iZap(d->cursors); |
509 | d->initialPos = rect.pos; | ||
509 | d->pendingCursor = NULL; | 510 | d->pendingCursor = NULL; |
510 | d->isDrawFrozen = iTrue; | 511 | d->isDrawFrozen = iTrue; |
511 | uint32_t flags = 0; | 512 | uint32_t flags = 0; |
@@ -597,6 +598,16 @@ SDL_Renderer *renderer_Window(const iWindow *d) { | |||
597 | 598 | ||
598 | static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) { | 599 | static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) { |
599 | switch (ev->event) { | 600 | switch (ev->event) { |
601 | #if defined (LAGRANGE_ENABLE_WINDOWPOS_FIX) | ||
602 | case SDL_WINDOWEVENT_EXPOSED: | ||
603 | if (d->initialPos.x >= 0) { | ||
604 | int bx, by; | ||
605 | SDL_GetWindowBordersSize(d->win, &by, &bx, NULL, NULL); | ||
606 | SDL_SetWindowPosition(d->win, d->initialPos.x + bx, d->initialPos.y + by); | ||
607 | d->initialPos = init1_I2(-1); | ||
608 | } | ||
609 | return iFalse; | ||
610 | #endif | ||
600 | case SDL_WINDOWEVENT_MOVED: | 611 | case SDL_WINDOWEVENT_MOVED: |
601 | /* No need to do anything. */ | 612 | /* No need to do anything. */ |
602 | return iTrue; | 613 | return iTrue; |