diff options
Diffstat (limited to 'src/ui/window.c')
-rw-r--r-- | src/ui/window.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/ui/window.c b/src/ui/window.c index a7ec37dd..6c7775ee 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -507,6 +507,7 @@ 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->initialPos = rect.pos; |
510 | d->lastRect = rect; | ||
510 | d->pendingCursor = NULL; | 511 | d->pendingCursor = NULL; |
511 | d->isDrawFrozen = iTrue; | 512 | d->isDrawFrozen = iTrue; |
512 | uint32_t flags = 0; | 513 | uint32_t flags = 0; |
@@ -525,7 +526,7 @@ void init_Window(iWindow *d, iRect rect) { | |||
525 | exit(-2); | 526 | exit(-2); |
526 | } | 527 | } |
527 | } | 528 | } |
528 | if (left_Rect(rect) >= 0) { | 529 | if (left_Rect(rect) >= 0 || top_Rect(rect) >= 0) { |
529 | SDL_SetWindowPosition(d->win, left_Rect(rect), top_Rect(rect)); | 530 | SDL_SetWindowPosition(d->win, left_Rect(rect), top_Rect(rect)); |
530 | } | 531 | } |
531 | SDL_SetWindowMinimumSize(d->win, 400, 250); | 532 | SDL_SetWindowMinimumSize(d->win, 400, 250); |
@@ -608,11 +609,22 @@ static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) { | |||
608 | } | 609 | } |
609 | return iFalse; | 610 | return iFalse; |
610 | #endif | 611 | #endif |
611 | case SDL_WINDOWEVENT_MOVED: | 612 | case SDL_WINDOWEVENT_MOVED: { |
612 | /* No need to do anything. */ | 613 | if (!(SDL_GetWindowFlags(d->win) & (SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED))) { |
614 | d->lastRect.pos = init_I2(ev->data1, ev->data2); | ||
615 | iInt2 border = zero_I2(); | ||
616 | #if defined (iPlatformMsys) || defined (iPlatformLinux) | ||
617 | SDL_GetWindowBordersSize(d->win, &border.y, &border.x, NULL, NULL); | ||
618 | #endif | ||
619 | d->lastRect.pos = max_I2(zero_I2(), sub_I2(d->lastRect.pos, border)); | ||
620 | } | ||
613 | return iTrue; | 621 | return iTrue; |
622 | } | ||
614 | case SDL_WINDOWEVENT_RESIZED: | 623 | case SDL_WINDOWEVENT_RESIZED: |
615 | case SDL_WINDOWEVENT_SIZE_CHANGED: | 624 | case SDL_WINDOWEVENT_SIZE_CHANGED: |
625 | if (!(SDL_GetWindowFlags(d->win) & (SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED))) { | ||
626 | d->lastRect.size = init_I2(ev->data1, ev->data2); | ||
627 | } | ||
616 | updateRootSize_Window_(d); | 628 | updateRootSize_Window_(d); |
617 | return iTrue; | 629 | return iTrue; |
618 | case SDL_WINDOWEVENT_LEAVE: | 630 | case SDL_WINDOWEVENT_LEAVE: |