diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-02 09:10:12 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-02 09:10:12 +0300 |
commit | f512c021c702125e8234256a25eec7606d648f34 (patch) | |
tree | cbc039bf81788cfe9618d99e9b717dd7685bbb55 /src/app.c | |
parent | 01b7e1da311b7b235305203c1791cfc73b14ac3d (diff) |
Window: Added split swapping; cleanup
Diffstat (limited to 'src/app.c')
-rw-r--r-- | src/app.c | 21 |
1 files changed, 14 insertions, 7 deletions
@@ -1177,9 +1177,7 @@ static int run_App_(iApp *d) { | |||
1177 | runTickers_App_(d); | 1177 | runTickers_App_(d); |
1178 | refresh_App(); | 1178 | refresh_App(); |
1179 | /* Change the widget tree while we are not iterating through it. */ | 1179 | /* Change the widget tree while we are not iterating through it. */ |
1180 | if (d->window->splitMode != d->window->pendingSplitMode) { | 1180 | checkPendingSplit_Window(d->window); |
1181 | setSplitMode_Window(d->window, d->window->pendingSplitMode); | ||
1182 | } | ||
1183 | recycle_Garbage(); | 1181 | recycle_Garbage(); |
1184 | } | 1182 | } |
1185 | SDL_DelEventWatch(resizeWatcher_, d); | 1183 | SDL_DelEventWatch(resizeWatcher_, d); |
@@ -1691,14 +1689,16 @@ iBool handleCommand_App(const char *cmd) { | |||
1691 | return iTrue; | 1689 | return iTrue; |
1692 | } | 1690 | } |
1693 | else if (equal_Command(cmd, "ui.split")) { | 1691 | else if (equal_Command(cmd, "ui.split")) { |
1692 | if (argLabel_Command(cmd, "swap")) { | ||
1693 | swapRoots_Window(d->window); | ||
1694 | return iTrue; | ||
1695 | } | ||
1694 | d->window->pendingSplitMode = | 1696 | d->window->pendingSplitMode = |
1695 | (argLabel_Command(cmd, "axis") ? vertical_WindowSplit : 0) | (arg_Command(cmd) << 1); | 1697 | (argLabel_Command(cmd, "axis") ? vertical_WindowSplit : 0) | (arg_Command(cmd) << 1); |
1698 | const char *url = suffixPtr_Command(cmd, "url"); | ||
1699 | setCStr_String(get_Window()->pendingSplitUrl, url ? url : ""); | ||
1696 | return iTrue; | 1700 | return iTrue; |
1697 | } | 1701 | } |
1698 | // else if (equal_Command(cmd, "window.updatelayout")) { | ||
1699 | // resize_Window(d->window, -1, -1); | ||
1700 | // return iTrue; | ||
1701 | // } | ||
1702 | else if (equal_Command(cmd, "window.retain")) { | 1702 | else if (equal_Command(cmd, "window.retain")) { |
1703 | d->prefs.retainWindowSize = arg_Command(cmd); | 1703 | d->prefs.retainWindowSize = arg_Command(cmd); |
1704 | return iTrue; | 1704 | return iTrue; |
@@ -1993,6 +1993,13 @@ iBool handleCommand_App(const char *cmd) { | |||
1993 | return iTrue; | 1993 | return iTrue; |
1994 | } | 1994 | } |
1995 | const int newTab = argLabel_Command(cmd, "newtab"); | 1995 | const int newTab = argLabel_Command(cmd, "newtab"); |
1996 | if (newTab & otherRoot_OpenTabFlag && numRoots_Window(get_Window()) == 1) { | ||
1997 | /* Need to split first. */ | ||
1998 | postCommandf_App("ui.split arg:3 newtab:%d url:%s", | ||
1999 | newTab & ~otherRoot_OpenTabFlag, | ||
2000 | cstr_String(url)); | ||
2001 | return iTrue; | ||
2002 | } | ||
1996 | iRoot *root = get_Root(); | 2003 | iRoot *root = get_Root(); |
1997 | iRoot *oldRoot = root; | 2004 | iRoot *oldRoot = root; |
1998 | if (newTab & otherRoot_OpenTabFlag) { | 2005 | if (newTab & otherRoot_OpenTabFlag) { |