diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-10-25 18:14:57 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-10-25 18:14:57 +0200 |
commit | e2f606adc2df114a15a4052e18dedfd02e4bbf56 (patch) | |
tree | 6aadb3a84996f0171e4a56c94fa909af3a95f372 /src | |
parent | 960eb0e87bd6b763438c90f752be47a5af009f17 (diff) |
Window: Ensure window is redrawn after expose events
A window expose event should be treated as a refresh trigger.
IssueID #11
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/window.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/ui/window.c b/src/ui/window.c index 53a01d71..1599d372 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -626,17 +626,21 @@ static iBool isMaximized_Window_(const iWindow *d) { | |||
626 | 626 | ||
627 | static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) { | 627 | static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) { |
628 | switch (ev->event) { | 628 | switch (ev->event) { |
629 | #if defined (LAGRANGE_ENABLE_WINDOWPOS_FIX) | ||
630 | case SDL_WINDOWEVENT_EXPOSED: | 629 | case SDL_WINDOWEVENT_EXPOSED: |
630 | /* Since we are manually controlling when to redraw the window, we are responsible | ||
631 | for ensuring that window contents get redrawn after expose events. Under certain | ||
632 | circumstances (e.g., under openbox), not doing this would mean that the window | ||
633 | is missing contents until other events trigger a refresh. */ | ||
634 | postRefresh_App(); | ||
635 | #if defined (LAGRANGE_ENABLE_WINDOWPOS_FIX) | ||
631 | if (d->initialPos.x >= 0) { | 636 | if (d->initialPos.x >= 0) { |
632 | int bx, by; | 637 | int bx, by; |
633 | SDL_GetWindowBordersSize(d->win, &by, &bx, NULL, NULL); | 638 | SDL_GetWindowBordersSize(d->win, &by, &bx, NULL, NULL); |
634 | SDL_SetWindowPosition(d->win, d->initialPos.x + bx, d->initialPos.y + by); | 639 | SDL_SetWindowPosition(d->win, d->initialPos.x + bx, d->initialPos.y + by); |
635 | d->initialPos = init1_I2(-1); | 640 | d->initialPos = init1_I2(-1); |
636 | } | 641 | } |
637 | postRefresh_App(); | ||
638 | return iFalse; | ||
639 | #endif | 642 | #endif |
643 | return iFalse; | ||
640 | case SDL_WINDOWEVENT_MOVED: { | 644 | case SDL_WINDOWEVENT_MOVED: { |
641 | if (!isMaximized_Window_(d) && !d->isDrawFrozen) { | 645 | if (!isMaximized_Window_(d) && !d->isDrawFrozen) { |
642 | d->lastRect.pos = init_I2(ev->data1, ev->data2); | 646 | d->lastRect.pos = init_I2(ev->data1, ev->data2); |