diff options
Diffstat (limited to 'src/app.c')
-rw-r--r-- | src/app.c | 181 |
1 files changed, 158 insertions, 23 deletions
@@ -204,6 +204,7 @@ static iString *serializePrefs_App_(const iApp *d) { | |||
204 | appendFormat_String(str, "uiscale arg:%f\n", uiScale_Window(d->window)); | 204 | appendFormat_String(str, "uiscale arg:%f\n", uiScale_Window(d->window)); |
205 | appendFormat_String(str, "prefs.dialogtab arg:%d\n", d->prefs.dialogTab); | 205 | appendFormat_String(str, "prefs.dialogtab arg:%d\n", d->prefs.dialogTab); |
206 | appendFormat_String(str, "font.set arg:%d\n", d->prefs.font); | 206 | appendFormat_String(str, "font.set arg:%d\n", d->prefs.font); |
207 | appendFormat_String(str, "font.user path:%s\n", cstr_String(&d->prefs.symbolFontPath)); | ||
207 | appendFormat_String(str, "headingfont.set arg:%d\n", d->prefs.headingFont); | 208 | appendFormat_String(str, "headingfont.set arg:%d\n", d->prefs.headingFont); |
208 | appendFormat_String(str, "zoom.set arg:%d\n", d->prefs.zoomPercent); | 209 | appendFormat_String(str, "zoom.set arg:%d\n", d->prefs.zoomPercent); |
209 | appendFormat_String(str, "smoothscroll arg:%d\n", d->prefs.smoothScrolling); | 210 | appendFormat_String(str, "smoothscroll arg:%d\n", d->prefs.smoothScrolling); |
@@ -212,6 +213,7 @@ static iString *serializePrefs_App_(const iApp *d) { | |||
212 | appendFormat_String(str, "decodeurls arg:%d\n", d->prefs.decodeUserVisibleURLs); | 213 | appendFormat_String(str, "decodeurls arg:%d\n", d->prefs.decodeUserVisibleURLs); |
213 | appendFormat_String(str, "linewidth.set arg:%d\n", d->prefs.lineWidth); | 214 | appendFormat_String(str, "linewidth.set arg:%d\n", d->prefs.lineWidth); |
214 | /* TODO: Set up an array of booleans in Prefs and do these in a loop. */ | 215 | /* TODO: Set up an array of booleans in Prefs and do these in a loop. */ |
216 | appendFormat_String(str, "prefs.animate.changed arg:%d\n", d->prefs.uiAnimations); | ||
215 | appendFormat_String(str, "prefs.mono.gemini.changed arg:%d\n", d->prefs.monospaceGemini); | 217 | appendFormat_String(str, "prefs.mono.gemini.changed arg:%d\n", d->prefs.monospaceGemini); |
216 | appendFormat_String(str, "prefs.mono.gopher.changed arg:%d\n", d->prefs.monospaceGopher); | 218 | appendFormat_String(str, "prefs.mono.gopher.changed arg:%d\n", d->prefs.monospaceGopher); |
217 | appendFormat_String(str, "prefs.boldlink.dark.changed arg:%d\n", d->prefs.boldLinkDark); | 219 | appendFormat_String(str, "prefs.boldlink.dark.changed arg:%d\n", d->prefs.boldLinkDark); |
@@ -545,6 +547,7 @@ static void terminate_App_(int rc) { | |||
545 | static void communicateWithRunningInstance_App_(iApp *d, iProcessId instance, | 547 | static void communicateWithRunningInstance_App_(iApp *d, iProcessId instance, |
546 | const iStringList *openCmds) { | 548 | const iStringList *openCmds) { |
547 | iString *cmds = new_String(); | 549 | iString *cmds = new_String(); |
550 | iBool requestRaise = iFalse; | ||
548 | const iProcessId pid = currentId_Process(); | 551 | const iProcessId pid = currentId_Process(); |
549 | iConstForEach(CommandLine, i, &d->args) { | 552 | iConstForEach(CommandLine, i, &d->args) { |
550 | if (i.argType == value_CommandLineArgType) { | 553 | if (i.argType == value_CommandLineArgType) { |
@@ -552,6 +555,7 @@ static void communicateWithRunningInstance_App_(iApp *d, iProcessId instance, | |||
552 | } | 555 | } |
553 | if (equal_CommandLineConstIterator(&i, "go-home")) { | 556 | if (equal_CommandLineConstIterator(&i, "go-home")) { |
554 | appendCStr_String(cmds, "navigate.home\n"); | 557 | appendCStr_String(cmds, "navigate.home\n"); |
558 | requestRaise = iTrue; | ||
555 | } | 559 | } |
556 | else if (equal_CommandLineConstIterator(&i, "new-tab")) { | 560 | else if (equal_CommandLineConstIterator(&i, "new-tab")) { |
557 | iCommandLineArg *arg = argument_CommandLineConstIterator(&i); | 561 | iCommandLineArg *arg = argument_CommandLineConstIterator(&i); |
@@ -563,6 +567,7 @@ static void communicateWithRunningInstance_App_(iApp *d, iProcessId instance, | |||
563 | appendCStr_String(cmds, "tabs.new\n"); | 567 | appendCStr_String(cmds, "tabs.new\n"); |
564 | } | 568 | } |
565 | iRelease(arg); | 569 | iRelease(arg); |
570 | requestRaise = iTrue; | ||
566 | } | 571 | } |
567 | else if (equal_CommandLineConstIterator(&i, "close-tab")) { | 572 | else if (equal_CommandLineConstIterator(&i, "close-tab")) { |
568 | appendCStr_String(cmds, "tabs.close\n"); | 573 | appendCStr_String(cmds, "tabs.close\n"); |
@@ -573,13 +578,15 @@ static void communicateWithRunningInstance_App_(iApp *d, iProcessId instance, | |||
573 | } | 578 | } |
574 | if (!isEmpty_StringList(openCmds)) { | 579 | if (!isEmpty_StringList(openCmds)) { |
575 | append_String(cmds, collect_String(joinCStr_StringList(openCmds, "\n"))); | 580 | append_String(cmds, collect_String(joinCStr_StringList(openCmds, "\n"))); |
581 | requestRaise = iTrue; | ||
576 | } | 582 | } |
577 | if (isEmpty_String(cmds)) { | 583 | if (isEmpty_String(cmds)) { |
578 | /* By default open a new tab. */ | 584 | /* By default open a new tab. */ |
579 | appendCStr_String(cmds, "tabs.new\n"); | 585 | appendCStr_String(cmds, "tabs.new\n"); |
586 | requestRaise = iTrue; | ||
580 | } | 587 | } |
581 | if (!isEmpty_String(cmds)) { | 588 | if (!isEmpty_String(cmds)) { |
582 | iString *result = communicate_Ipc(cmds); | 589 | iString *result = communicate_Ipc(cmds, requestRaise); |
583 | if (result) { | 590 | if (result) { |
584 | fwrite(cstr_String(result), 1, size_String(result), stdout); | 591 | fwrite(cstr_String(result), 1, size_String(result), stdout); |
585 | fflush(stdout); | 592 | fflush(stdout); |
@@ -594,6 +601,18 @@ static void communicateWithRunningInstance_App_(iApp *d, iProcessId instance, | |||
594 | } | 601 | } |
595 | #endif /* defined (LAGRANGE_ENABLE_IPC) */ | 602 | #endif /* defined (LAGRANGE_ENABLE_IPC) */ |
596 | 603 | ||
604 | static iBool hasCommandLineOpenableScheme_(const iRangecc uri) { | ||
605 | static const char *schemes[] = { | ||
606 | "gemini:", "gopher:", "finger:", "file:", "data:", "about:" | ||
607 | }; | ||
608 | iForIndices(i, schemes) { | ||
609 | if (startsWithCase_Rangecc(uri, schemes[i])) { | ||
610 | return iTrue; | ||
611 | } | ||
612 | } | ||
613 | return iFalse; | ||
614 | } | ||
615 | |||
597 | static void init_App_(iApp *d, int argc, char **argv) { | 616 | static void init_App_(iApp *d, int argc, char **argv) { |
598 | init_CommandLine(&d->args, argc, argv); | 617 | init_CommandLine(&d->args, argc, argv); |
599 | /* Where was the app started from? We ask SDL first because the command line alone is | 618 | /* Where was the app started from? We ask SDL first because the command line alone is |
@@ -628,6 +647,7 @@ static void init_App_(iApp *d, int argc, char **argv) { | |||
628 | defineValues_CommandLine(&d->args, "go-home", 0); | 647 | defineValues_CommandLine(&d->args, "go-home", 0); |
629 | defineValues_CommandLine(&d->args, "help", 0); | 648 | defineValues_CommandLine(&d->args, "help", 0); |
630 | defineValues_CommandLine(&d->args, listTabUrls_CommandLineOption, 0); | 649 | defineValues_CommandLine(&d->args, listTabUrls_CommandLineOption, 0); |
650 | defineValues_CommandLine(&d->args, openUrlOrSearch_CommandLineOption, 1); | ||
631 | defineValuesN_CommandLine(&d->args, "new-tab", 0, 1); | 651 | defineValuesN_CommandLine(&d->args, "new-tab", 0, 1); |
632 | defineValues_CommandLine(&d->args, "sw", 0); | 652 | defineValues_CommandLine(&d->args, "sw", 0); |
633 | defineValues_CommandLine(&d->args, "version;V", 0); | 653 | defineValues_CommandLine(&d->args, "version;V", 0); |
@@ -643,30 +663,38 @@ static void init_App_(iApp *d, int argc, char **argv) { | |||
643 | terminate_App_(0); | 663 | terminate_App_(0); |
644 | } | 664 | } |
645 | /* Check for URLs. */ | 665 | /* Check for URLs. */ |
646 | iBool newTab = iFalse; | ||
647 | iConstForEach(CommandLine, i, &d->args) { | 666 | iConstForEach(CommandLine, i, &d->args) { |
648 | const iRangecc arg = i.entry; | 667 | const iRangecc arg = i.entry; |
649 | if (i.argType == value_CommandLineArgType) { | 668 | if (i.argType == value_CommandLineArgType) { |
650 | /* URLs and file paths accepted. */ | 669 | /* URLs and file paths accepted. */ |
651 | const iBool isKnownScheme = | 670 | const iBool isOpenable = hasCommandLineOpenableScheme_(arg); |
652 | startsWithCase_Rangecc(arg, "gemini:") || startsWithCase_Rangecc(arg, "gopher:") || | 671 | if (isOpenable || fileExistsCStr_FileInfo(cstr_Rangecc(arg))) { |
653 | startsWithCase_Rangecc(arg, "finger:") || startsWithCase_Rangecc(arg, "file:") || | ||
654 | startsWithCase_Rangecc(arg, "data:") || startsWithCase_Rangecc(arg, "about:"); | ||
655 | if (isKnownScheme || fileExistsCStr_FileInfo(cstr_Rangecc(arg))) { | ||
656 | iString *decUrl = | 672 | iString *decUrl = |
657 | isKnownScheme ? urlDecodeExclude_String(collectNewRange_String(arg), "/?#:") | 673 | isOpenable ? urlDecodeExclude_String(collectNewRange_String(arg), "/?#:") |
658 | : makeFileUrl_String(collectNewRange_String(arg)); | 674 | : makeFileUrl_String(collectNewRange_String(arg)); |
659 | pushBack_StringList(openCmds, | 675 | pushBack_StringList(openCmds, |
660 | collectNewFormat_String( | 676 | collectNewFormat_String( |
661 | "open newtab:%d url:%s", newTab, cstr_String(decUrl))); | 677 | "open newtab:1 url:%s", cstr_String(decUrl))); |
662 | delete_String(decUrl); | 678 | delete_String(decUrl); |
663 | newTab = iTrue; | ||
664 | } | 679 | } |
665 | else { | 680 | else { |
666 | fprintf(stderr, "Invalid URL/file: %s\n", cstr_Rangecc(arg)); | 681 | fprintf(stderr, "Invalid URL/file: %s\n", cstr_Rangecc(arg)); |
667 | terminate_App_(1); | 682 | terminate_App_(1); |
668 | } | 683 | } |
669 | } | 684 | } |
685 | else if (equal_CommandLineConstIterator(&i, openUrlOrSearch_CommandLineOption)) { | ||
686 | const iCommandLineArg *arg = iClob(argument_CommandLineConstIterator(&i)); | ||
687 | const iString *input = value_CommandLineArg(arg, 0); | ||
688 | if (startsWith_String(input, "//")) { | ||
689 | input = collectNewFormat_String("gemini:%s", cstr_String(input)); | ||
690 | } | ||
691 | if (hasCommandLineOpenableScheme_(range_String(input))) { | ||
692 | input = collect_String(urlDecodeExclude_String(input, "/?#:")); | ||
693 | } | ||
694 | pushBack_StringList( | ||
695 | openCmds, | ||
696 | collectNewFormat_String("search newtab:1 query:%s", cstr_String(input))); | ||
697 | } | ||
670 | else if (!isDefined_CommandLine(&d->args, collectNewRange_String(i.entry))) { | 698 | else if (!isDefined_CommandLine(&d->args, collectNewRange_String(i.entry))) { |
671 | fprintf(stderr, "Unknown option: %s\n", cstr_Rangecc(arg)); | 699 | fprintf(stderr, "Unknown option: %s\n", cstr_Rangecc(arg)); |
672 | terminate_App_(1); | 700 | terminate_App_(1); |
@@ -1541,24 +1569,25 @@ static iBool handlePrefsCommands_(iWidget *d, const char *cmd) { | |||
1541 | isSelected_Widget(findChild_Widget(d, "prefs.imageloadscroll"))); | 1569 | isSelected_Widget(findChild_Widget(d, "prefs.imageloadscroll"))); |
1542 | postCommandf_App("hidetoolbarscroll arg:%d", | 1570 | postCommandf_App("hidetoolbarscroll arg:%d", |
1543 | isSelected_Widget(findChild_Widget(d, "prefs.hidetoolbarscroll"))); | 1571 | isSelected_Widget(findChild_Widget(d, "prefs.hidetoolbarscroll"))); |
1544 | postCommandf_App("ostheme arg:%d", | 1572 | postCommandf_App("ostheme arg:%d", isSelected_Widget(findChild_Widget(d, "prefs.ostheme"))); |
1545 | isSelected_Widget(findChild_Widget(d, "prefs.ostheme"))); | 1573 | postCommandf_App("font.user path:%s", |
1574 | cstrText_InputWidget(findChild_Widget(d, "prefs.userfont"))); | ||
1546 | postCommandf_App("decodeurls arg:%d", | 1575 | postCommandf_App("decodeurls arg:%d", |
1547 | isSelected_Widget(findChild_Widget(d, "prefs.decodeurls"))); | 1576 | isSelected_Widget(findChild_Widget(d, "prefs.decodeurls"))); |
1548 | postCommandf_App("searchurl address:%s", | 1577 | postCommandf_App("searchurl address:%s", |
1549 | cstr_String(text_InputWidget(findChild_Widget(d, "prefs.searchurl")))); | 1578 | cstrText_InputWidget(findChild_Widget(d, "prefs.searchurl"))); |
1550 | postCommandf_App("cachesize.set arg:%d", | 1579 | postCommandf_App("cachesize.set arg:%d", |
1551 | toInt_String(text_InputWidget(findChild_Widget(d, "prefs.cachesize")))); | 1580 | toInt_String(text_InputWidget(findChild_Widget(d, "prefs.cachesize")))); |
1552 | postCommandf_App("ca.file path:%s", | 1581 | postCommandf_App("ca.file path:%s", |
1553 | cstr_String(text_InputWidget(findChild_Widget(d, "prefs.ca.file")))); | 1582 | cstrText_InputWidget(findChild_Widget(d, "prefs.ca.file"))); |
1554 | postCommandf_App("ca.path path:%s", | 1583 | postCommandf_App("ca.path path:%s", |
1555 | cstr_String(text_InputWidget(findChild_Widget(d, "prefs.ca.path")))); | 1584 | cstrText_InputWidget(findChild_Widget(d, "prefs.ca.path"))); |
1556 | postCommandf_App("proxy.gemini address:%s", | 1585 | postCommandf_App("proxy.gemini address:%s", |
1557 | cstr_String(text_InputWidget(findChild_Widget(d, "prefs.proxy.gemini")))); | 1586 | cstrText_InputWidget(findChild_Widget(d, "prefs.proxy.gemini"))); |
1558 | postCommandf_App("proxy.gopher address:%s", | 1587 | postCommandf_App("proxy.gopher address:%s", |
1559 | cstr_String(text_InputWidget(findChild_Widget(d, "prefs.proxy.gopher")))); | 1588 | cstrText_InputWidget(findChild_Widget(d, "prefs.proxy.gopher"))); |
1560 | postCommandf_App("proxy.http address:%s", | 1589 | postCommandf_App("proxy.http address:%s", |
1561 | cstr_String(text_InputWidget(findChild_Widget(d, "prefs.proxy.http")))); | 1590 | cstrText_InputWidget(findChild_Widget(d, "prefs.proxy.http"))); |
1562 | const iWidget *tabs = findChild_Widget(d, "prefs.tabs"); | 1591 | const iWidget *tabs = findChild_Widget(d, "prefs.tabs"); |
1563 | if (tabs) { | 1592 | if (tabs) { |
1564 | postCommandf_App("prefs.dialogtab arg:%u", | 1593 | postCommandf_App("prefs.dialogtab arg:%u", |
@@ -1665,12 +1694,36 @@ iDocumentWidget *newTab_App(const iDocumentWidget *duplicateOf, iBool switchToNe | |||
1665 | 1694 | ||
1666 | static iBool handleIdentityCreationCommands_(iWidget *dlg, const char *cmd) { | 1695 | static iBool handleIdentityCreationCommands_(iWidget *dlg, const char *cmd) { |
1667 | iApp *d = &app_; | 1696 | iApp *d = &app_; |
1697 | if (equal_Command(cmd, "ident.showmore")) { | ||
1698 | iForEach(ObjectList, i, children_Widget(findChild_Widget(dlg, "headings"))) { | ||
1699 | if (flags_Widget(i.object) & collapse_WidgetFlag) { | ||
1700 | setFlags_Widget(i.object, hidden_WidgetFlag, iFalse); | ||
1701 | } | ||
1702 | } | ||
1703 | iForEach(ObjectList, j, children_Widget(findChild_Widget(dlg, "values"))) { | ||
1704 | if (flags_Widget(j.object) & collapse_WidgetFlag) { | ||
1705 | setFlags_Widget(j.object, hidden_WidgetFlag, iFalse); | ||
1706 | } | ||
1707 | } | ||
1708 | setFlags_Widget(child_Widget(findChild_Widget(dlg, "dialogbuttons"), 0), disabled_WidgetFlag, | ||
1709 | iTrue); | ||
1710 | arrange_Widget(dlg); | ||
1711 | refresh_Widget(dlg); | ||
1712 | return iTrue; | ||
1713 | } | ||
1714 | if (equal_Command(cmd, "ident.scope")) { | ||
1715 | iLabelWidget *scope = findChild_Widget(dlg, "ident.scope"); | ||
1716 | setText_LabelWidget(scope, | ||
1717 | text_LabelWidget(child_Widget( | ||
1718 | findChild_Widget(as_Widget(scope), "menu"), arg_Command(cmd)))); | ||
1719 | return iTrue; | ||
1720 | } | ||
1668 | if (equal_Command(cmd, "ident.temp.changed")) { | 1721 | if (equal_Command(cmd, "ident.temp.changed")) { |
1669 | setFlags_Widget( | 1722 | setFlags_Widget( |
1670 | findChild_Widget(dlg, "ident.temp.note"), hidden_WidgetFlag, !arg_Command(cmd)); | 1723 | findChild_Widget(dlg, "ident.temp.note"), hidden_WidgetFlag, !arg_Command(cmd)); |
1671 | return iFalse; | 1724 | return iFalse; |
1672 | } | 1725 | } |
1673 | if (equal_Command(cmd, "ident.accept") || equal_Command(cmd, "cancel")) { | 1726 | if (equal_Command(cmd, "ident.accept") || equal_Command(cmd, "ident.cancel")) { |
1674 | if (equal_Command(cmd, "ident.accept")) { | 1727 | if (equal_Command(cmd, "ident.accept")) { |
1675 | const iString *commonName = text_InputWidget (findChild_Widget(dlg, "ident.common")); | 1728 | const iString *commonName = text_InputWidget (findChild_Widget(dlg, "ident.common")); |
1676 | const iString *email = text_InputWidget (findChild_Widget(dlg, "ident.email")); | 1729 | const iString *email = text_InputWidget (findChild_Widget(dlg, "ident.email")); |
@@ -1718,11 +1771,52 @@ static iBool handleIdentityCreationCommands_(iWidget *dlg, const char *cmd) { | |||
1718 | } | 1771 | } |
1719 | } | 1772 | } |
1720 | /* The input seems fine. */ | 1773 | /* The input seems fine. */ |
1721 | newIdentity_GmCerts(d->certs, isTemp ? temporary_GmIdentityFlag : 0, | 1774 | iGmIdentity *ident = newIdentity_GmCerts(d->certs, |
1722 | until, commonName, email, userId, domain, organization, country); | 1775 | isTemp ? temporary_GmIdentityFlag : 0, |
1776 | until, | ||
1777 | commonName, | ||
1778 | email, | ||
1779 | userId, | ||
1780 | domain, | ||
1781 | organization, | ||
1782 | country); | ||
1783 | /* Use in the chosen scope. */ { | ||
1784 | const iLabelWidget *scope = findChild_Widget(dlg, "ident.scope"); | ||
1785 | const iString * selLabel = text_LabelWidget(scope); | ||
1786 | int selScope = 0; | ||
1787 | iConstForEach(ObjectList, | ||
1788 | i, | ||
1789 | children_Widget(findChild_Widget(constAs_Widget(scope), "menu"))) { | ||
1790 | if (isInstance_Object(i.object, &Class_LabelWidget)) { | ||
1791 | const iLabelWidget *item = i.object; | ||
1792 | if (equal_String(text_LabelWidget(item), selLabel)) { | ||
1793 | break; | ||
1794 | } | ||
1795 | selScope++; | ||
1796 | } | ||
1797 | } | ||
1798 | const iString *docUrl = url_DocumentWidget(document_Root(dlg->root)); | ||
1799 | iString *useUrl = NULL; | ||
1800 | switch (selScope) { | ||
1801 | case 0: /* current domain */ | ||
1802 | useUrl = collectNewFormat_String("gemini://%s", | ||
1803 | cstr_Rangecc(urlHost_String(docUrl))); | ||
1804 | break; | ||
1805 | case 1: /* current page */ | ||
1806 | useUrl = collect_String(copy_String(docUrl)); | ||
1807 | break; | ||
1808 | default: /* not used */ | ||
1809 | break; | ||
1810 | } | ||
1811 | if (useUrl) { | ||
1812 | signIn_GmCerts(d->certs, ident, useUrl); | ||
1813 | postCommand_App("navigate.reload"); | ||
1814 | } | ||
1815 | } | ||
1723 | postCommandf_App("sidebar.mode arg:%d show:1", identities_SidebarMode); | 1816 | postCommandf_App("sidebar.mode arg:%d show:1", identities_SidebarMode); |
1724 | postCommand_App("idents.changed"); | 1817 | postCommand_App("idents.changed"); |
1725 | } | 1818 | } |
1819 | setupSheetTransition_Mobile(dlg, iFalse); | ||
1726 | destroy_Widget(dlg); | 1820 | destroy_Widget(dlg); |
1727 | return iTrue; | 1821 | return iTrue; |
1728 | } | 1822 | } |
@@ -1813,6 +1907,22 @@ iBool handleCommand_App(const char *cmd) { | |||
1813 | resetFonts_Text(); | 1907 | resetFonts_Text(); |
1814 | return iTrue; | 1908 | return iTrue; |
1815 | } | 1909 | } |
1910 | else if (equal_Command(cmd, "font.user")) { | ||
1911 | const char *path = suffixPtr_Command(cmd, "path"); | ||
1912 | if (cmp_String(&d->prefs.symbolFontPath, path)) { | ||
1913 | if (!isFrozen) { | ||
1914 | setFreezeDraw_Window(get_Window(), iTrue); | ||
1915 | } | ||
1916 | setCStr_String(&d->prefs.symbolFontPath, path); | ||
1917 | loadUserFonts_Text(); | ||
1918 | resetFonts_Text(); | ||
1919 | if (!isFrozen) { | ||
1920 | postCommand_App("font.changed"); | ||
1921 | postCommand_App("window.unfreeze"); | ||
1922 | } | ||
1923 | } | ||
1924 | return iTrue; | ||
1925 | } | ||
1816 | else if (equal_Command(cmd, "font.set")) { | 1926 | else if (equal_Command(cmd, "font.set")) { |
1817 | if (!isFrozen) { | 1927 | if (!isFrozen) { |
1818 | setFreezeDraw_Window(get_Window(), iTrue); | 1928 | setFreezeDraw_Window(get_Window(), iTrue); |
@@ -2011,6 +2121,10 @@ iBool handleCommand_App(const char *cmd) { | |||
2011 | d->prefs.openArchiveIndexPages = arg_Command(cmd) != 0; | 2121 | d->prefs.openArchiveIndexPages = arg_Command(cmd) != 0; |
2012 | return iTrue; | 2122 | return iTrue; |
2013 | } | 2123 | } |
2124 | else if (equal_Command(cmd, "prefs.animate.changed")) { | ||
2125 | d->prefs.uiAnimations = arg_Command(cmd) != 0; | ||
2126 | return iTrue; | ||
2127 | } | ||
2014 | else if (equal_Command(cmd, "saturation.set")) { | 2128 | else if (equal_Command(cmd, "saturation.set")) { |
2015 | d->prefs.saturation = (float) arg_Command(cmd) / 100.0f; | 2129 | d->prefs.saturation = (float) arg_Command(cmd) / 100.0f; |
2016 | if (!isFrozen) { | 2130 | if (!isFrozen) { |
@@ -2070,6 +2184,20 @@ iBool handleCommand_App(const char *cmd) { | |||
2070 | } | 2184 | } |
2071 | return iTrue; | 2185 | return iTrue; |
2072 | } | 2186 | } |
2187 | else if (equal_Command(cmd, "search")) { | ||
2188 | const int newTab = argLabel_Command(cmd, "newtab"); | ||
2189 | const iString *query = collect_String(suffix_Command(cmd, "query")); | ||
2190 | if (!isLikelyUrl_String(query)) { | ||
2191 | const iString *url = searchQueryUrl_App(query); | ||
2192 | if (!isEmpty_String(url)) { | ||
2193 | postCommandf_App("open newtab:%d url:%s", newTab, cstr_String(url)); | ||
2194 | } | ||
2195 | } | ||
2196 | else { | ||
2197 | postCommandf_App("open newtab:%d url:%s", newTab, cstr_String(query)); | ||
2198 | } | ||
2199 | return iTrue; | ||
2200 | } | ||
2073 | else if (equal_Command(cmd, "open")) { | 2201 | else if (equal_Command(cmd, "open")) { |
2074 | iString *url = collectNewCStr_String(suffixPtr_Command(cmd, "url")); | 2202 | iString *url = collectNewCStr_String(suffixPtr_Command(cmd, "url")); |
2075 | const iBool noProxy = argLabel_Command(cmd, "noproxy"); | 2203 | const iBool noProxy = argLabel_Command(cmd, "noproxy"); |
@@ -2239,6 +2367,8 @@ iBool handleCommand_App(const char *cmd) { | |||
2239 | setToggle_Widget(findChild_Widget(dlg, "prefs.archive.openindex"), d->prefs.openArchiveIndexPages); | 2367 | setToggle_Widget(findChild_Widget(dlg, "prefs.archive.openindex"), d->prefs.openArchiveIndexPages); |
2240 | setToggle_Widget(findChild_Widget(dlg, "prefs.ostheme"), d->prefs.useSystemTheme); | 2368 | setToggle_Widget(findChild_Widget(dlg, "prefs.ostheme"), d->prefs.useSystemTheme); |
2241 | setToggle_Widget(findChild_Widget(dlg, "prefs.customframe"), d->prefs.customFrame); | 2369 | setToggle_Widget(findChild_Widget(dlg, "prefs.customframe"), d->prefs.customFrame); |
2370 | setToggle_Widget(findChild_Widget(dlg, "prefs.animate"), d->prefs.uiAnimations); | ||
2371 | setText_InputWidget(findChild_Widget(dlg, "prefs.userfont"), &d->prefs.symbolFontPath); | ||
2242 | updatePrefsPinSplitButtons_(dlg, d->prefs.pinSplit); | 2372 | updatePrefsPinSplitButtons_(dlg, d->prefs.pinSplit); |
2243 | updateDropdownSelection_(findChild_Widget(dlg, "prefs.uilang"), cstr_String(&d->prefs.uiLanguage)); | 2373 | updateDropdownSelection_(findChild_Widget(dlg, "prefs.uilang"), cstr_String(&d->prefs.uiLanguage)); |
2244 | setToggle_Widget(findChild_Widget(dlg, "prefs.retainwindow"), d->prefs.retainWindowSize); | 2374 | setToggle_Widget(findChild_Widget(dlg, "prefs.retainwindow"), d->prefs.retainWindowSize); |
@@ -2454,6 +2584,11 @@ iBool handleCommand_App(const char *cmd) { | |||
2454 | return iTrue; | 2584 | return iTrue; |
2455 | } | 2585 | } |
2456 | else if (equal_Command(cmd, "ipc.signal")) { | 2586 | else if (equal_Command(cmd, "ipc.signal")) { |
2587 | if (argLabel_Command(cmd, "raise")) { | ||
2588 | if (d->window && d->window->win) { | ||
2589 | SDL_RaiseWindow(d->window->win); | ||
2590 | } | ||
2591 | } | ||
2457 | signal_Ipc(arg_Command(cmd)); | 2592 | signal_Ipc(arg_Command(cmd)); |
2458 | return iTrue; | 2593 | return iTrue; |
2459 | } | 2594 | } |