[1mdiff --git a/src/app.c b/src/app.c[m
[1mindex ee8bccb4..04928b84 100644[m
[1m--- a/src/app.c[m
[1m+++ b/src/app.c[m
[36m@@ -142,25 +142,15 @@[m [mstatic iString *serializePrefs_App_(const iApp *d) {[m
y = d->window->lastRect.pos.y;[m
w = d->window->lastRect.size.x;[m
h = d->window->lastRect.size.y;[m
[31m-#if 0[m
[31m- SDL_GetWindowSize(d->window->win, &w, &h);[m
[31m- SDL_GetWindowPosition(d->window->win, &x, &y);[m
[31m-#i f defined (iPlatformLinux)[m
[31m- /* Workaround for window position being unaffected by decorations on creation. */ {[m
[31m- int bl, bt;[m
[31m- SDL_GetWindowBordersSize(d->window->win, &bt, &bl, NULL, NULL);[m
[31m- x -= bl;[m
[31m- y -= bt;[m
[31m- x = iMax(0, x);[m
[31m- y = iMax(0, y);[m
[31m- }[m
[31m- }[m
[31m-#endif[m
appendFormat_String(str, "window.setrect width:%d height:%d coord:%d %d\n", w, h, x, y);[m
appendFormat_String(str, "sidebar.width arg:%d\n", width_SidebarWidget(sidebar));[m
[32m+[m[32m /* On macOS, maximization should be applied at creation time or the window will take[m
[32m+[m[32m a moment to animate to its maximized size. */[m
[32m+[m[32m#if !defined (iPlatformApple)[m
if (isMaximized) {[m
appendFormat_String(str, "~window.maximize\n");[m
}[m
[32m+[m[32m#endif[m
}[m
if (isVisible_Widget(sidebar)) {[m
appendCStr_String(str, "sidebar.toggle\n");[m
[1mdiff --git a/src/ui/window.c b/src/ui/window.c[m
[1mindex 6c7775ee..19432691 100644[m
[1m--- a/src/ui/window.c[m
[1m+++ b/src/ui/window.c[m
[36m@@ -597,6 +597,15 @@[m [mSDL_Renderer *renderer_Window(const iWindow *d) {[m
return d->render;[m
}[m
[m
[32m+[m[32mstatic iBool isMaximized_Window_(const iWindow *d) {[m
[32m+[m[32m#if !defined (iPlatformApple)[m
[32m+[m[32m return (SDL_GetWindowFlags(d->win) & (SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED)) != 0;[m
[32m+[m[32m#else[m
[32m+[m[32m iUnused(d);[m
[32m+[m[32m return iFalse; /* There is fullscreen mode but that is not handled at the moment. */[m
[32m+[m[32m#endif[m
[32m+[m[32m}[m
[32m+[m
static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) {[m
switch (ev->event) {[m
#if defined (LAGRANGE_ENABLE_WINDOWPOS_FIX)[m
[36m@@ -610,10 +619,10 @@[m [mstatic iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) {[m
return iFalse;[m
#endif[m
case SDL_WINDOWEVENT_MOVED: {[m
[31m- if (!(SDL_GetWindowFlags(d->win) & (SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED))) {[m
[32m+[m[32m if (!isMaximized_Window_(d)) {[m
d->lastRect.pos = init_I2(ev->data1, ev->data2);[m
iInt2 border = zero_I2();[m
[31m-#if defined (iPlatformMsys) || defined (iPlatformLinux)[m
[32m+[m[32m#if !defined (iPlatformApple)[m
SDL_GetWindowBordersSize(d->win, &border.y, &border.x, NULL, NULL);[m
#endif[m
d->lastRect.pos = max_I2(zero_I2(), sub_I2(d->lastRect.pos, border));[m
[36m@@ -622,7 +631,7 @@[m [mstatic iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) {[m
}[m
case SDL_WINDOWEVENT_RESIZED:[m
case SDL_WINDOWEVENT_SIZE_CHANGED:[m
[31m- if (!(SDL_GetWindowFlags(d->win) & (SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED))) {[m
[32m+[m[32m if (!isMaximized_Window_(d)) {[m
d->lastRect.size = init_I2(ev->data1, ev->data2);[m
}[m
updateRootSize_Window_(d);[m
text/plain
This content has been proxied by September (ba2dc).