diff --git a/src/app.c b/src/app.c

index ee8bccb4..04928b84 100644

--- a/src/app.c

+++ b/src/app.c

@@ -142,25 +142,15 @@ static iString *serializePrefs_App_(const iApp *d) {

     y = d->window->lastRect.pos.y;

     w = d->window->lastRect.size.x;

     h = d->window->lastRect.size.y;

-#if 0

- SDL_GetWindowSize(d->window->win, &w, &h);

- SDL_GetWindowPosition(d->window->win, &x, &y);

-#i f defined (iPlatformLinux)

- /* Workaround for window position being unaffected by decorations on creation. */ {

- int bl, bt;

- SDL_GetWindowBordersSize(d->window->win, &bt, &bl, NULL, NULL);

- x -= bl;

- y -= bt;

- x = iMax(0, x);

- y = iMax(0, y);

- }

- }

-#endif

     appendFormat_String(str, "window.setrect width:%d height:%d coord:%d %d\n", w, h, x, y);

     appendFormat_String(str, "sidebar.width arg:%d\n", width_SidebarWidget(sidebar));

+ /* On macOS, maximization should be applied at creation time or the window will take

+ a moment to animate to its maximized size. */

+#if !defined (iPlatformApple)

     if (isMaximized) {

         appendFormat_String(str, "~window.maximize\n");

     }

+#endif

 }

 if (isVisible_Widget(sidebar)) {

     appendCStr_String(str, "sidebar.toggle\n");

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) {

 return d->render;

}



+static iBool isMaximized_Window_(const iWindow *d) {

+#if !defined (iPlatformApple)

+ return (SDL_GetWindowFlags(d->win) & (SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED)) != 0;

+#else

+ iUnused(d);

+ return iFalse; /* There is fullscreen mode but that is not handled at the moment. */

+#endif

+}

+

static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) {

 switch (ev->event) {

#if defined (LAGRANGE_ENABLE_WINDOWPOS_FIX)

@@ -610,10 +619,10 @@ static iBool handleWindowEvent_Window_(iWindow *d, const SDL_WindowEvent *ev) {

         return iFalse;

#endif

     case SDL_WINDOWEVENT_MOVED: {

- if (!(SDL_GetWindowFlags(d->win) & (SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED))) {

+ if (!isMaximized_Window_(d)) {

             d->lastRect.pos = init_I2(ev->data1, ev->data2);

             iInt2 border = zero_I2();

-#if defined (iPlatformMsys) || defined (iPlatformLinux)

+#if !defined (iPlatformApple)

             SDL_GetWindowBordersSize(d->win, &border.y, &border.x, NULL, NULL);

#endif

             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) {

     }

     case SDL_WINDOWEVENT_RESIZED:

     case SDL_WINDOWEVENT_SIZE_CHANGED:

- if (!(SDL_GetWindowFlags(d->win) & (SDL_WINDOW_MINIMIZED | SDL_WINDOW_MAXIMIZED))) {

+ if (!isMaximized_Window_(d)) {

             d->lastRect.size = init_I2(ev->data1, ev->data2);

         }

         updateRootSize_Window_(d);

Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.7/pcdiff/ce928050f3f48db8c1dc46030f36fefc705de987
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
67.148346 milliseconds
Gemini-to-HTML Time
1.381033 milliseconds

This content has been proxied by September (ba2dc).