diff options
-rw-r--r-- | src/app.c | 38 | ||||
-rw-r--r-- | src/ui/widget.c | 3 | ||||
-rw-r--r-- | src/ui/window.c | 1 |
3 files changed, 22 insertions, 20 deletions
@@ -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_()); |
@@ -635,7 +636,6 @@ static void init_App_(iApp *d, int argc, char **argv) { | |||
635 | 0x1f306); | 636 | 0x1f306); |
636 | fetchRemote_Bookmarks(d->bookmarks); | 637 | fetchRemote_Bookmarks(d->bookmarks); |
637 | } | 638 | } |
638 | d->window = new_Window(d->initialWindowRect); | ||
639 | init_Feeds(dataDir_App_()); | 639 | init_Feeds(dataDir_App_()); |
640 | /* Widget state init. */ | 640 | /* Widget state init. */ |
641 | processEvents_App(postedEventsOnly_AppEventMode); | 641 | processEvents_App(postedEventsOnly_AppEventMode); |
@@ -645,6 +645,11 @@ static void init_App_(iApp *d, int argc, char **argv) { | |||
645 | postCommand_App("window.unfreeze"); | 645 | postCommand_App("window.unfreeze"); |
646 | d->autoReloadTimer = SDL_AddTimer(60 * 1000, postAutoReloadCommand_App_, NULL); | 646 | d->autoReloadTimer = SDL_AddTimer(60 * 1000, postAutoReloadCommand_App_, NULL); |
647 | postCommand_App("document.autoreload"); | 647 | postCommand_App("document.autoreload"); |
648 | #if defined (LAGRANGE_IDLE_SLEEP) | ||
649 | d->isIdling = iFalse; | ||
650 | d->lastEventTime = 0; | ||
651 | d->sleepTimer = SDL_AddTimer(1000, checkAsleep_App_, d); | ||
652 | #endif | ||
648 | d->isFinishedLaunching = iTrue; | 653 | d->isFinishedLaunching = iTrue; |
649 | /* Run any commands that were pending completion of launch. */ { | 654 | /* Run any commands that were pending completion of launch. */ { |
650 | iForEach(StringList, i, d->launchCommands) { | 655 | iForEach(StringList, i, d->launchCommands) { |
@@ -977,7 +982,7 @@ static int resizeWatcher_(void *user, SDL_Event *event) { | |||
977 | SDL_Event u = { .type = SDL_USEREVENT }; | 982 | SDL_Event u = { .type = SDL_USEREVENT }; |
978 | u.user.code = command_UserEventCode; | 983 | u.user.code = command_UserEventCode; |
979 | u.user.data1 = strdup("theme.changed"); | 984 | u.user.data1 = strdup("theme.changed"); |
980 | u.user.windowID = id_Window(d->window); | 985 | /*u.user.windowID = id_Window(d->window);*/ |
981 | dispatchEvent_Widget(d->window->root, &u); | 986 | dispatchEvent_Widget(d->window->root, &u); |
982 | } | 987 | } |
983 | #endif | 988 | #endif |
@@ -1068,12 +1073,9 @@ void postRefresh_App(void) { | |||
1068 | #endif | 1073 | #endif |
1069 | const iBool wasPending = exchange_Atomic(&d->pendingRefresh, iTrue); | 1074 | const iBool wasPending = exchange_Atomic(&d->pendingRefresh, iTrue); |
1070 | if (!wasPending) { | 1075 | if (!wasPending) { |
1071 | SDL_Event ev; | 1076 | SDL_Event ev = { .type = SDL_USEREVENT }; |
1072 | ev.user.type = SDL_USEREVENT; | 1077 | ev.user.code = refresh_UserEventCode; |
1073 | ev.user.code = refresh_UserEventCode; | 1078 | //ev.user.windowID = id_Window(get_Window()); |
1074 | ev.user.windowID = id_Window(get_Window()); | ||
1075 | ev.user.data1 = NULL; | ||
1076 | ev.user.data2 = NULL; | ||
1077 | SDL_PushEvent(&ev); | 1079 | SDL_PushEvent(&ev); |
1078 | } | 1080 | } |
1079 | } | 1081 | } |
@@ -1084,7 +1086,6 @@ void postCommand_App(const char *command) { | |||
1084 | if (strlen(command) == 0) { | 1086 | if (strlen(command) == 0) { |
1085 | return; | 1087 | return; |
1086 | } | 1088 | } |
1087 | SDL_Event ev; | ||
1088 | if (*command == '!') { | 1089 | if (*command == '!') { |
1089 | /* Global command; this is global context so just ignore. */ | 1090 | /* Global command; this is global context so just ignore. */ |
1090 | command++; | 1091 | command++; |
@@ -1097,11 +1098,10 @@ void postCommand_App(const char *command) { | |||
1097 | return; | 1098 | return; |
1098 | } | 1099 | } |
1099 | } | 1100 | } |
1100 | ev.user.type = SDL_USEREVENT; | 1101 | SDL_Event ev = { .type = SDL_USEREVENT }; |
1101 | ev.user.code = command_UserEventCode; | 1102 | ev.user.code = command_UserEventCode; |
1102 | ev.user.windowID = id_Window(get_Window()); | 1103 | /*ev.user.windowID = id_Window(get_Window());*/ |
1103 | ev.user.data1 = strdup(command); | 1104 | ev.user.data1 = strdup(command); |
1104 | ev.user.data2 = NULL; | ||
1105 | SDL_PushEvent(&ev); | 1105 | SDL_PushEvent(&ev); |
1106 | if (app_.commandEcho) { | 1106 | if (app_.commandEcho) { |
1107 | printf("[command] %s\n", command); fflush(stdout); | 1107 | printf("[command] %s\n", command); fflush(stdout); |
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 | ||