From 1ef7170f2b1b8c48fababc112673afa17729033f Mon Sep 17 00:00:00 2001

From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= jaakko.keranen@iki.fi

Date: Sat, 19 Feb 2022 08:15:43 +0200

Subject: [PATCH 1/1] App: Save multiple window rectangles


src/app.c | 127 +++++++++++++++++++++++++++++++-------------------

src/ui/root.c | 11 +++++

src/ui/root.h | 1 +

3 files changed, 92 insertions(+), 47 deletions(-)

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

index 850a9706..ec8b59b3 100644

--- a/src/app.c

+++ b/src/app.c

@@ -154,7 +154,8 @@ struct Impl_App {

 /* Preferences: */

 iBool        commandEcho;         /* --echo */

 iBool        forceSoftwareRender; /* --sw */

 iPrefs       prefs;

};

@@ -200,33 +201,43 @@ static iString *serializePrefs_App_(const iApp *d) {

 appendFormat_String(str, "window.retain arg:%d\n", d->prefs.retainWindowSize);

 if (d->prefs.retainWindowSize) {

     int w, h, x, y;

#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)

         }

#elif !defined (iPlatformApple)

#endif

 }

 appendFormat_String(str, "uilang id:%s\n", cstr_String(&d->prefs.strings[uiLanguage_PrefsString]));

 appendFormat_String(str, "uiscale arg:%f\n", uiScale_Window(as_Window(d->window)));

@@ -404,9 +415,14 @@ static void loadPrefs_App_(iApp *d) {

             d->prefs.customFrame = arg_Command(cmd);

         }

         else if (equal_Command(cmd, "window.setrect") && !argLabel_Command(cmd, "snap")) {

                 pos.x, pos.y, argLabel_Command(cmd, "width"), argLabel_Command(cmd, "height"));

         }

         else if (equal_Command(cmd, "fontpack.disable")) {

             insert_StringSet(d->prefs.disabledFontPacks,

@@ -483,6 +499,28 @@ enum iWindowStateFlag {

 current_WindowStateFlag = iBit(9),

};

+static iRect initialWindowRect_App_(const iApp *d, size_t windowIndex) {

+#if defined (iPlatformMsys)

+#endif

+#if defined (iPlatformLinux) && !defined (iPlatformAndroid)

+#endif

+}

static iBool loadState_App_(iApp *d) {

 iUnused(d);

 const char *oldPath = concatPath_CStr(dataDir_App_(), oldStateFileName_App_);

@@ -525,7 +563,7 @@ static iBool loadState_App_(iApp *d) {

                 win = d->window;

             }

             else {

                 addWindow_App(win);

             }

             pushBack_Array(currentTabs, &(iCurrentTabs){ { NULL, NULL } });

@@ -819,6 +857,7 @@ static void init_App_(iApp *d, int argc, char **argv) {

 d->isDarkSystemTheme = iTrue; /* will be updated by system later on, if supported */

 d->isSuspended = iFalse;

 d->tempFilesPendingDeletion = new_StringSet();

 init_CommandLine(&d->args, argc, argv);

 /* Where was the app started from? We ask SDL first because the command line alone

    cannot be relied on (behavior differs depending on OS). */ {

@@ -953,20 +992,6 @@ static void init_App_(iApp *d, int argc, char **argv) {

 d->elapsedSinceLastTicker = 0;

 d->commandEcho            = iClob(checkArgument_CommandLine(&d->args, "echo;E")) != NULL;

 d->forceSoftwareRender    = iClob(checkArgument_CommandLine(&d->args, "sw")) != NULL;

-#if defined (iPlatformMsys)

-#endif

-#if defined (iPlatformLinux) && !defined (iPlatformAndroid)

-#endif

 init_Prefs(&d->prefs);

 init_SiteSpec(dataDir_App_());

 setCStr_String(&d->prefs.strings[downloadDir_PrefsString], downloadDir_App_());

@@ -988,22 +1013,29 @@ static void init_App_(iApp *d, int argc, char **argv) {

 init_Fonts(dataDir_App_());

 loadPalette_Color(dataDir_App_());

 setThemePalette_Color(d->prefs.theme); /* default UI colors */

 updateActive_Fonts();

 load_Keys(dataDir_App_());

 /* See if the user wants to override the window size. */ {

     iCommandLineArg *arg = iClob(checkArgument_CommandLine(&d->args, windowWidth_CommandLineOption));

     if (arg) {

     }

     arg = iClob(checkArgument_CommandLine(&d->args, windowHeight_CommandLineOption));

     if (arg) {

     }

 }

 init_PtrArray(&d->mainWindows);

 init_PtrArray(&d->popupWindows);

 addWindow_App(d->window);

 load_Visited(d->visited, dataDir_App_());

 load_Bookmarks(d->bookmarks, dataDir_App_());

@@ -1101,7 +1133,8 @@ static void deinit_App(iApp *d) {

 /* Delete all temporary files created while running. */

 iConstForEach(StringSet, tmp, d->tempFilesPendingDeletion) {

     remove(cstr_String(tmp.value));

-}

 iRelease(d->tempFilesPendingDeletion);

}

@@ -3132,7 +3165,7 @@ iBool handleCommand_App(const char *cmd) {

     return iFalse;

 }

 else if (equal_Command(cmd, "window.new")) {

     addWindow_App(newWin); /* takes ownership */

     SDL_ShowWindow(newWin->base.win);

     setCurrent_Window(newWin);

diff --git a/src/ui/root.c b/src/ui/root.c

index eeb5956f..7e4b4863 100644

--- a/src/ui/root.c

+++ b/src/ui/root.c

@@ -468,6 +468,10 @@ static iBool handleRootCommands_(iWidget *root, const char *cmd) {

     return iFalse;

 }

 else if (equal_Command(cmd, "window.setrect")) {

     const int snap = argLabel_Command(cmd, "snap");

     if (snap) {

         iMainWindow *window = get_MainWindow();

@@ -1776,6 +1780,13 @@ void showToolbar_Root(iRoot *d, iBool show) {

 }

}

+size_t windowIndex_Root(const iRoot *d) {

+}

iInt2 size_Root(const iRoot *d) {

 return d && d->widget ? d->widget->rect.size : zero_I2();

}

diff --git a/src/ui/root.h b/src/ui/root.h

index a81ebdf7..3b053c9e 100644

--- a/src/ui/root.h

+++ b/src/ui/root.h

@@ -47,6 +47,7 @@ void showOrHideNewTabButton_Root (iRoot *);

void notifyVisualOffsetChange_Root (iRoot *);

+size_t windowIndex_Root (const iRoot *);

iInt2 size_Root (const iRoot *);

iRect rect_Root (const iRoot *);

iRect safeRect_Root (const iRoot *);

--

2.25.1

Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/work%2Fv1.11/patch/1ef7170f2b1b8c48fababc112673afa17729033f.patch
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
94.940294 milliseconds
Gemini-to-HTML Time
2.872 milliseconds

This content has been proxied by September (ba2dc).