diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-09-07 22:08:22 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-09-07 22:08:22 +0300 |
commit | c10fc7a058c05edcedeb23bdcc9faae635f1780d (patch) | |
tree | 1bf4177116c12ebfa1275cf2406305c08b8f868b | |
parent | df8e4076903831fee5275ee803f874d21db7c703 (diff) |
App: Added options -w, -h for window sizing
-rw-r--r-- | res/arg-help.txt | 2 | ||||
-rw-r--r-- | src/app.c | 12 | ||||
-rw-r--r-- | src/app.h | 2 |
3 files changed, 16 insertions, 0 deletions
diff --git a/res/arg-help.txt b/res/arg-help.txt index 9f6548f2..bf6e7e97 100644 --- a/res/arg-help.txt +++ b/res/arg-help.txt | |||
@@ -6,6 +6,7 @@ separate tabs. | |||
6 | General options: | 6 | General options: |
7 | 7 | ||
8 | -E, --echo Print all internal app events to stdout. | 8 | -E, --echo Print all internal app events to stdout. |
9 | -h, --height N Set initial window height to N pixels. | ||
9 | --help Print these instructions. | 10 | --help Print these instructions. |
10 | --sw Disable hardware accelerated rendering. | 11 | --sw Disable hardware accelerated rendering. |
11 | -u, --url-or-search URL | text | 12 | -u, --url-or-search URL | text |
@@ -13,6 +14,7 @@ General options: | |||
13 | This only works if the search query URL has been | 14 | This only works if the search query URL has been |
14 | configured. | 15 | configured. |
15 | -V, --version Print the application version. | 16 | -V, --version Print the application version. |
17 | -w, --width N Set initial window width to N pixels. | ||
16 | 18 | ||
17 | Options that control a running instance of Lagrange: | 19 | Options that control a running instance of Lagrange: |
18 | 20 | ||
@@ -668,6 +668,8 @@ static void init_App_(iApp *d, int argc, char **argv) { | |||
668 | defineValues_CommandLine(&d->args, "help", 0); | 668 | defineValues_CommandLine(&d->args, "help", 0); |
669 | defineValues_CommandLine(&d->args, listTabUrls_CommandLineOption, 0); | 669 | defineValues_CommandLine(&d->args, listTabUrls_CommandLineOption, 0); |
670 | defineValues_CommandLine(&d->args, openUrlOrSearch_CommandLineOption, 1); | 670 | defineValues_CommandLine(&d->args, openUrlOrSearch_CommandLineOption, 1); |
671 | defineValues_CommandLine(&d->args, windowWidth_CommandLineOption, 1); | ||
672 | defineValues_CommandLine(&d->args, windowHeight_CommandLineOption, 1); | ||
671 | defineValuesN_CommandLine(&d->args, "new-tab", 0, 1); | 673 | defineValuesN_CommandLine(&d->args, "new-tab", 0, 1); |
672 | defineValues_CommandLine(&d->args, "tab-url", 0); | 674 | defineValues_CommandLine(&d->args, "tab-url", 0); |
673 | defineValues_CommandLine(&d->args, "sw", 0); | 675 | defineValues_CommandLine(&d->args, "sw", 0); |
@@ -787,6 +789,16 @@ static void init_App_(iApp *d, int argc, char **argv) { | |||
787 | setThemePalette_Color(d->prefs.theme); /* default UI colors */ | 789 | setThemePalette_Color(d->prefs.theme); /* default UI colors */ |
788 | loadPrefs_App_(d); | 790 | loadPrefs_App_(d); |
789 | load_Keys(dataDir_App_()); | 791 | load_Keys(dataDir_App_()); |
792 | /* See if the user wants to override the window size. */ { | ||
793 | iCommandLineArg *arg = iClob(checkArgument_CommandLine(&d->args, windowWidth_CommandLineOption)); | ||
794 | if (arg) { | ||
795 | d->initialWindowRect.size.x = toInt_String(value_CommandLineArg(arg, 0)); | ||
796 | } | ||
797 | arg = iClob(checkArgument_CommandLine(&d->args, windowHeight_CommandLineOption)); | ||
798 | if (arg) { | ||
799 | d->initialWindowRect.size.y = toInt_String(value_CommandLineArg(arg, 0)); | ||
800 | } | ||
801 | } | ||
790 | d->window = new_Window(d->initialWindowRect); | 802 | d->window = new_Window(d->initialWindowRect); |
791 | load_Visited(d->visited, dataDir_App_()); | 803 | load_Visited(d->visited, dataDir_App_()); |
792 | load_Bookmarks(d->bookmarks, dataDir_App_()); | 804 | load_Bookmarks(d->bookmarks, dataDir_App_()); |
@@ -44,6 +44,8 @@ iDeclareType(Window) | |||
44 | /* Command line options strings. */ | 44 | /* Command line options strings. */ |
45 | #define listTabUrls_CommandLineOption "list-tab-urls;L" | 45 | #define listTabUrls_CommandLineOption "list-tab-urls;L" |
46 | #define openUrlOrSearch_CommandLineOption "url-or-search;u" | 46 | #define openUrlOrSearch_CommandLineOption "url-or-search;u" |
47 | #define windowWidth_CommandLineOption "width;w" | ||
48 | #define windowHeight_CommandLineOption "height;h" | ||
47 | 49 | ||
48 | enum iAppDeviceType { | 50 | enum iAppDeviceType { |
49 | desktop_AppDeviceType, | 51 | desktop_AppDeviceType, |