summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/window.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index 6c7775ee..19432691 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -597,6 +597,15 @@ SDL_Renderer *renderer_Window(const iWindow *d) {
597 return d->render; 597 return d->render;
598} 598}
599 599
600static iBool isMaximized_Window_(const iWindow *d) {
601#if !defined (iPlatformApple)
602 return (SDL_GetWindowFlags(d->win) & (SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED)) != 0;
603#else
604 iUnused(d);
605 return iFalse; /* There is fullscreen mode but that is not handled at the moment. */
606#endif
607}
608
600static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) { 609static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) {
601 switch (ev->event) { 610 switch (ev->event) {
602#if defined (LAGRANGE_ENABLE_WINDOWPOS_FIX) 611#if defined (LAGRANGE_ENABLE_WINDOWPOS_FIX)
@@ -610,10 +619,10 @@ static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) {
610 return iFalse; 619 return iFalse;
611#endif 620#endif
612 case SDL_WINDOWEVENT_MOVED: { 621 case SDL_WINDOWEVENT_MOVED: {
613 if (!(SDL_GetWindowFlags(d->win) & (SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED))) { 622 if (!isMaximized_Window_(d)) {
614 d->lastRect.pos = init_I2(ev->data1, ev->data2); 623 d->lastRect.pos = init_I2(ev->data1, ev->data2);
615 iInt2 border = zero_I2(); 624 iInt2 border = zero_I2();
616#if defined (iPlatformMsys) || defined (iPlatformLinux) 625#if !defined (iPlatformApple)
617 SDL_GetWindowBordersSize(d->win, &border.y, &border.x, NULL, NULL); 626 SDL_GetWindowBordersSize(d->win, &border.y, &border.x, NULL, NULL);
618#endif 627#endif
619 d->lastRect.pos = max_I2(zero_I2(), sub_I2(d->lastRect.pos, border)); 628 d->lastRect.pos = max_I2(zero_I2(), sub_I2(d->lastRect.pos, border));
@@ -622,7 +631,7 @@ static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) {
622 } 631 }
623 case SDL_WINDOWEVENT_RESIZED: 632 case SDL_WINDOWEVENT_RESIZED:
624 case SDL_WINDOWEVENT_SIZE_CHANGED: 633 case SDL_WINDOWEVENT_SIZE_CHANGED:
625 if (!(SDL_GetWindowFlags(d->win) & (SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED))) { 634 if (!isMaximized_Window_(d)) {
626 d->lastRect.size = init_I2(ev->data1, ev->data2); 635 d->lastRect.size = init_I2(ev->data1, ev->data2);
627 } 636 }
628 updateRootSize_Window_(d); 637 updateRootSize_Window_(d);