diff options
m--------- | lib/the_Foundation | 0 | ||||
-rw-r--r-- | src/app.c | 40 | ||||
-rw-r--r-- | src/bookmarks.c | 1 | ||||
-rw-r--r-- | src/gmcerts.c | 2 | ||||
-rw-r--r-- | src/ui/widget.c | 3 | ||||
-rw-r--r-- | src/ui/window.c | 1 |
6 files changed, 24 insertions, 23 deletions
diff --git a/lib/the_Foundation b/lib/the_Foundation | |||
Subproject 0b40f677e2c738a0cede4d4a4bc5849f9fa0e5c | Subproject 4b5421286f3b0dc903a8c6645caa7bfb5868bf9 | ||
@@ -291,6 +291,11 @@ static void loadPrefs_App_(iApp *d) { | |||
291 | if (equal_Command(cmd, "uiscale")) { | 291 | if (equal_Command(cmd, "uiscale")) { |
292 | setUiScale_Window(get_Window(), argf_Command(cmd)); | 292 | setUiScale_Window(get_Window(), argf_Command(cmd)); |
293 | } | 293 | } |
294 | else if (equal_Command(cmd, "ca.file") || equal_Command(cmd, "ca.path")) { | ||
295 | /* Background requests may be started before these commands would get | ||
296 | handled via the event loop. */ | ||
297 | handleCommand_App(cmd); | ||
298 | } | ||
294 | else if (equal_Command(cmd, "customframe")) { | 299 | else if (equal_Command(cmd, "customframe")) { |
295 | d->prefs.customFrame = arg_Command(cmd); | 300 | d->prefs.customFrame = arg_Command(cmd); |
296 | } | 301 | } |
@@ -604,11 +609,6 @@ static void init_App_(iApp *d, int argc, char **argv) { | |||
604 | d->bookmarks = new_Bookmarks(); | 609 | d->bookmarks = new_Bookmarks(); |
605 | d->tabEnum = 0; /* generates unique IDs for tab pages */ | 610 | d->tabEnum = 0; /* generates unique IDs for tab pages */ |
606 | setThemePalette_Color(d->prefs.theme); | 611 | setThemePalette_Color(d->prefs.theme); |
607 | #if defined (LAGRANGE_IDLE_SLEEP) | ||
608 | d->isIdling = iFalse; | ||
609 | d->lastEventTime = 0; | ||
610 | d->sleepTimer = SDL_AddTimer(1000, checkAsleep_App_, d); | ||
611 | #endif | ||
612 | #if defined (iPlatformAppleDesktop) | 612 | #if defined (iPlatformAppleDesktop) |
613 | setupApplication_MacOS(); | 613 | setupApplication_MacOS(); |
614 | #endif | 614 | #endif |
@@ -618,6 +618,7 @@ static void init_App_(iApp *d, int argc, char **argv) { | |||
618 | init_Keys(); | 618 | init_Keys(); |
619 | loadPrefs_App_(d); | 619 | loadPrefs_App_(d); |
620 | load_Keys(dataDir_App_()); | 620 | load_Keys(dataDir_App_()); |
621 | d->window = new_Window(d->initialWindowRect); | ||
621 | load_Visited(d->visited, dataDir_App_()); | 622 | load_Visited(d->visited, dataDir_App_()); |
622 | load_Bookmarks(d->bookmarks, dataDir_App_()); | 623 | load_Bookmarks(d->bookmarks, dataDir_App_()); |
623 | load_MimeHooks(d->mimehooks, dataDir_App_()); | 624 | load_MimeHooks(d->mimehooks, dataDir_App_()); |
@@ -633,9 +634,7 @@ static void init_App_(iApp *d, int argc, char **argv) { | |||
633 | collectNewCStr_String("Getting Started"), | 634 | collectNewCStr_String("Getting Started"), |
634 | collectNewCStr_String("remotesource"), | 635 | collectNewCStr_String("remotesource"), |
635 | 0x1f306); | 636 | 0x1f306); |
636 | fetchRemote_Bookmarks(d->bookmarks); | ||
637 | } | 637 | } |
638 | d->window = new_Window(d->initialWindowRect); | ||
639 | init_Feeds(dataDir_App_()); | 638 | init_Feeds(dataDir_App_()); |
640 | /* Widget state init. */ | 639 | /* Widget state init. */ |
641 | processEvents_App(postedEventsOnly_AppEventMode); | 640 | processEvents_App(postedEventsOnly_AppEventMode); |
@@ -645,6 +644,11 @@ static void init_App_(iApp *d, int argc, char **argv) { | |||
645 | postCommand_App("window.unfreeze"); | 644 | postCommand_App("window.unfreeze"); |
646 | d->autoReloadTimer = SDL_AddTimer(60 * 1000, postAutoReloadCommand_App_, NULL); | 645 | d->autoReloadTimer = SDL_AddTimer(60 * 1000, postAutoReloadCommand_App_, NULL); |
647 | postCommand_App("document.autoreload"); | 646 | postCommand_App("document.autoreload"); |
647 | #if defined (LAGRANGE_IDLE_SLEEP) | ||
648 | d->isIdling = iFalse; | ||
649 | d->lastEventTime = 0; | ||
650 | d->sleepTimer = SDL_AddTimer(1000, checkAsleep_App_, d); | ||
651 | #endif | ||
648 | d->isFinishedLaunching = iTrue; | 652 | d->isFinishedLaunching = iTrue; |
649 | /* Run any commands that were pending completion of launch. */ { | 653 | /* Run any commands that were pending completion of launch. */ { |
650 | iForEach(StringList, i, d->launchCommands) { | 654 | iForEach(StringList, i, d->launchCommands) { |
@@ -657,6 +661,7 @@ static void init_App_(iApp *d, int argc, char **argv) { | |||
657 | } | 661 | } |
658 | iRelease(openCmds); | 662 | iRelease(openCmds); |
659 | } | 663 | } |
664 | fetchRemote_Bookmarks(d->bookmarks); | ||
660 | } | 665 | } |
661 | 666 | ||
662 | static void deinit_App(iApp *d) { | 667 | static void deinit_App(iApp *d) { |
@@ -1004,7 +1009,7 @@ static int resizeWatcher_(void *user, SDL_Event *event) { | |||
1004 | SDL_Event u = { .type = SDL_USEREVENT }; | 1009 | SDL_Event u = { .type = SDL_USEREVENT }; |
1005 | u.user.code = command_UserEventCode; | 1010 | u.user.code = command_UserEventCode; |
1006 | u.user.data1 = strdup("theme.changed"); | 1011 | u.user.data1 = strdup("theme.changed"); |
1007 | u.user.windowID = id_Window(d->window); | 1012 | /*u.user.windowID = id_Window(d->window);*/ |
1008 | dispatchEvent_Widget(d->window->root, &u); | 1013 | dispatchEvent_Widget(d->window->root, &u); |
1009 | } | 1014 | } |
1010 | #endif | 1015 | #endif |
@@ -1095,12 +1100,9 @@ void postRefresh_App(void) { | |||
1095 | #endif | 1100 | #endif |
1096 | const iBool wasPending = exchange_Atomic(&d->pendingRefresh, iTrue); | 1101 | const iBool wasPending = exchange_Atomic(&d->pendingRefresh, iTrue); |
1097 | if (!wasPending) { | 1102 | if (!wasPending) { |
1098 | SDL_Event ev; | 1103 | SDL_Event ev = { .type = SDL_USEREVENT }; |
1099 | ev.user.type = SDL_USEREVENT; | 1104 | ev.user.code = refresh_UserEventCode; |
1100 | ev.user.code = refresh_UserEventCode; | 1105 | //ev.user.windowID = id_Window(get_Window()); |
1101 | ev.user.windowID = id_Window(get_Window()); | ||
1102 | ev.user.data1 = NULL; | ||
1103 | ev.user.data2 = NULL; | ||
1104 | SDL_PushEvent(&ev); | 1106 | SDL_PushEvent(&ev); |
1105 | } | 1107 | } |
1106 | } | 1108 | } |
@@ -1111,7 +1113,6 @@ void postCommand_App(const char *command) { | |||
1111 | if (strlen(command) == 0) { | 1113 | if (strlen(command) == 0) { |
1112 | return; | 1114 | return; |
1113 | } | 1115 | } |
1114 | SDL_Event ev; | ||
1115 | if (*command == '!') { | 1116 | if (*command == '!') { |
1116 | /* Global command; this is global context so just ignore. */ | 1117 | /* Global command; this is global context so just ignore. */ |
1117 | command++; | 1118 | command++; |
@@ -1124,11 +1125,10 @@ void postCommand_App(const char *command) { | |||
1124 | return; | 1125 | return; |
1125 | } | 1126 | } |
1126 | } | 1127 | } |
1127 | ev.user.type = SDL_USEREVENT; | 1128 | SDL_Event ev = { .type = SDL_USEREVENT }; |
1128 | ev.user.code = command_UserEventCode; | 1129 | ev.user.code = command_UserEventCode; |
1129 | ev.user.windowID = id_Window(get_Window()); | 1130 | /*ev.user.windowID = id_Window(get_Window());*/ |
1130 | ev.user.data1 = strdup(command); | 1131 | ev.user.data1 = strdup(command); |
1131 | ev.user.data2 = NULL; | ||
1132 | SDL_PushEvent(&ev); | 1132 | SDL_PushEvent(&ev); |
1133 | if (app_.commandEcho) { | 1133 | if (app_.commandEcho) { |
1134 | printf("[command] %s\n", command); fflush(stdout); | 1134 | printf("[command] %s\n", command); fflush(stdout); |
diff --git a/src/bookmarks.c b/src/bookmarks.c index 91280f3c..cf29fc69 100644 --- a/src/bookmarks.c +++ b/src/bookmarks.c | |||
@@ -167,7 +167,6 @@ void load_Bookmarks(iBookmarks *d, const char *dirPath) { | |||
167 | } | 167 | } |
168 | } | 168 | } |
169 | iRelease(f); | 169 | iRelease(f); |
170 | fetchRemote_Bookmarks(d); | ||
171 | } | 170 | } |
172 | 171 | ||
173 | void save_Bookmarks(const iBookmarks *d, const char *dirPath) { | 172 | void save_Bookmarks(const iBookmarks *d, const char *dirPath) { |
diff --git a/src/gmcerts.c b/src/gmcerts.c index 8c011137..cf4d7d2d 100644 --- a/src/gmcerts.c +++ b/src/gmcerts.c | |||
@@ -396,7 +396,7 @@ iBool checkTrust_GmCerts(iGmCerts *d, iRangecc domain, const iTlsCertificate *ce | |||
396 | if (trust) { | 396 | if (trust) { |
397 | /* We already have it, check if it matches the one we trust for this domain (if it's | 397 | /* We already have it, check if it matches the one we trust for this domain (if it's |
398 | still valid. */ | 398 | still valid. */ |
399 | if (!isAuth && elapsedSeconds_Time(&trust->validUntil) > 0) { | 399 | if (!isAuth && elapsedSeconds_Time(&trust->validUntil) < 0) { |
400 | /* Trusted cert is still valid. */ | 400 | /* Trusted cert is still valid. */ |
401 | const iBool isTrusted = cmp_Block(fingerprint, &trust->fingerprint) == 0; | 401 | const iBool isTrusted = cmp_Block(fingerprint, &trust->fingerprint) == 0; |
402 | unlock_Mutex(d->mtx); | 402 | unlock_Mutex(d->mtx); |
diff --git a/src/ui/widget.c b/src/ui/widget.c index dca07db2..011f63d7 100644 --- a/src/ui/widget.c +++ b/src/ui/widget.c | |||
@@ -1142,7 +1142,8 @@ static void printTree_Widget_(const iWidget *d, int indent) { | |||
1142 | cstr_String(text_LabelWidget((const iLabelWidget *) d)), | 1142 | cstr_String(text_LabelWidget((const iLabelWidget *) d)), |
1143 | cstr_String(command_LabelWidget((const iLabelWidget *) d))); | 1143 | cstr_String(command_LabelWidget((const iLabelWidget *) d))); |
1144 | } | 1144 | } |
1145 | printf("size:%dx%d flags:%08llx\n", d->rect.size.x, d->rect.size.y, d->flags); | 1145 | printf("size:%dx%d flags:%08llx\n", d->rect.size.x, d->rect.size.y, |
1146 | (long long unsigned int) d->flags); | ||
1146 | iConstForEach(ObjectList, i, d->children) { | 1147 | iConstForEach(ObjectList, i, d->children) { |
1147 | printTree_Widget_(i.object, indent + 1); | 1148 | printTree_Widget_(i.object, indent + 1); |
1148 | } | 1149 | } |
diff --git a/src/ui/window.c b/src/ui/window.c index 19290ee5..038d72af 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -1833,6 +1833,7 @@ uint32_t frameTime_Window(const iWindow *d) { | |||
1833 | } | 1833 | } |
1834 | 1834 | ||
1835 | iWindow *get_Window(void) { | 1835 | iWindow *get_Window(void) { |
1836 | /* TODO: This should be thread-specific. */ | ||
1836 | return theWindow_; | 1837 | return theWindow_; |
1837 | } | 1838 | } |
1838 | 1839 | ||