summaryrefslogtreecommitdiff
path: root/src/app.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-05-14 15:09:54 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-05-14 15:09:54 +0300
commit21b16be87fec3ec163fb52b94619ba5f3b5df6d2 (patch)
tree73df8c1469f9d7f4186b40ea7b8d34c5b6dfd7bf /src/app.c
parent7f737f1b88448a8a2ccca716a09e3b37fb0c08f9 (diff)
Mobile and iOS: Various fixes and cleanup
Several regressions occurred when the split view mode was implemented.
Diffstat (limited to 'src/app.c')
-rw-r--r--src/app.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/app.c b/src/app.c
index 6d172c02..b80953a1 100644
--- a/src/app.c
+++ b/src/app.c
@@ -146,6 +146,7 @@ iDeclareType(Ticker)
146 146
147struct Impl_Ticker { 147struct Impl_Ticker {
148 iAny *context; 148 iAny *context;
149 iRoot *root;
149 void (*callback)(iAny *); 150 void (*callback)(iAny *);
150}; 151};
151 152
@@ -411,15 +412,17 @@ static iBool loadState_App_(iApp *d) {
411 const uint8_t rootIndex = bits & 0xff; 412 const uint8_t rootIndex = bits & 0xff;
412 const uint8_t flags = bits >> 8; 413 const uint8_t flags = bits >> 8;
413 iRoot *root = d->window->roots[rootIndex]; 414 iRoot *root = d->window->roots[rootIndex];
414 if (root && deviceType_App() != phone_AppDeviceType) { 415 if (root) {
415 iSidebarWidget *sidebar = findChild_Widget(root->widget, "sidebar"); 416 iSidebarWidget *sidebar = findChild_Widget(root->widget, "sidebar");
416 iSidebarWidget *sidebar2 = findChild_Widget(root->widget, "sidebar2"); 417 iSidebarWidget *sidebar2 = findChild_Widget(root->widget, "sidebar2");
417 setWidth_SidebarWidget(sidebar, widths[0]);
418 setWidth_SidebarWidget(sidebar2, widths[1]);
419 postCommandf_Root(root, "sidebar.mode arg:%u", modes & 0xf); 418 postCommandf_Root(root, "sidebar.mode arg:%u", modes & 0xf);
420 postCommandf_Root(root, "sidebar2.mode arg:%u", modes >> 4); 419 postCommandf_Root(root, "sidebar2.mode arg:%u", modes >> 4);
421 if (flags & 1) postCommand_Root(root, "sidebar.toggle"); 420 if (deviceType_App() != phone_AppDeviceType) {
422 if (flags & 2) postCommand_Root(root, "sidebar2.toggle"); 421 setWidth_SidebarWidget(sidebar, widths[0]);
422 setWidth_SidebarWidget(sidebar2, widths[1]);
423 if (flags & 1) postCommand_Root(root, "sidebar.toggle");
424 if (flags & 2) postCommand_Root(root, "sidebar2.toggle");
425 }
423 } 426 }
424 } 427 }
425 else if (!memcmp(magic, magicTabDocument_App_, 4)) { 428 else if (!memcmp(magic, magicTabDocument_App_, 4)) {
@@ -776,6 +779,10 @@ static void init_App_(iApp *d, int argc, char **argv) {
776 iRelease(openCmds); 779 iRelease(openCmds);
777 } 780 }
778 fetchRemote_Bookmarks(d->bookmarks); 781 fetchRemote_Bookmarks(d->bookmarks);
782 if (deviceType_App() != desktop_AppDeviceType) {
783 /* HACK: Force a resize so widgets update their state. */
784 resize_Window(d->window, -1, -1);
785 }
779} 786}
780 787
781static void deinit_App(iApp *d) { 788static void deinit_App(iApp *d) {
@@ -1175,7 +1182,7 @@ static void runTickers_App_(iApp *d) {
1175 iConstForEach(Array, i, &pending->values) { 1182 iConstForEach(Array, i, &pending->values) {
1176 const iTicker *ticker = i.value; 1183 const iTicker *ticker = i.value;
1177 if (ticker->callback) { 1184 if (ticker->callback) {
1178 setCurrent_Root(findRoot_Window(d->window, ticker->context)); /* root might be NULL */ 1185 setCurrent_Root(ticker->root); /* root might be NULL */
1179 ticker->callback(ticker->context); 1186 ticker->callback(ticker->context);
1180 } 1187 }
1181 } 1188 }
@@ -1406,13 +1413,19 @@ iAny *findWidget_App(const char *id) {
1406 1413
1407void addTicker_App(iTickerFunc ticker, iAny *context) { 1414void addTicker_App(iTickerFunc ticker, iAny *context) {
1408 iApp *d = &app_; 1415 iApp *d = &app_;
1409 insert_SortedArray(&d->tickers, &(iTicker){ context, ticker }); 1416 insert_SortedArray(&d->tickers, &(iTicker){ context, get_Root(), ticker });
1417 postRefresh_App();
1418}
1419
1420void addTickerRoot_App(iTickerFunc ticker, iRoot *root, iAny *context) {
1421 iApp *d = &app_;
1422 insert_SortedArray(&d->tickers, &(iTicker){ context, root, ticker });
1410 postRefresh_App(); 1423 postRefresh_App();
1411} 1424}
1412 1425
1413void removeTicker_App(iTickerFunc ticker, iAny *context) { 1426void removeTicker_App(iTickerFunc ticker, iAny *context) {
1414 iApp *d = &app_; 1427 iApp *d = &app_;
1415 remove_SortedArray(&d->tickers, &(iTicker){ context, ticker }); 1428 remove_SortedArray(&d->tickers, &(iTicker){ context, NULL, ticker });
1416} 1429}
1417 1430
1418iMimeHooks *mimeHooks_App(void) { 1431iMimeHooks *mimeHooks_App(void) {