diff options
| author | Eli Zaretskii | 2015-07-08 17:22:15 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2015-07-08 17:22:15 +0300 |
| commit | b953882a75068e079a99cfc86a5c0e9796d604bd (patch) | |
| tree | a980c2b1f37c0df6df8e11aa64b4edd0be85b473 | |
| parent | 7da7a9774cbb4d8991bd002c1c31bf49b27fb521 (diff) | |
| download | emacs-b953882a75068e079a99cfc86a5c0e9796d604bd.tar.gz emacs-b953882a75068e079a99cfc86a5c0e9796d604bd.zip | |
Support "minimized" property of runemacs's shortcut
* nt/runemacs.c (WinMain): If runemacs is invoked "minimized",
pass the '--iconic' switch to Emacs. (Bug#20991)
| -rw-r--r-- | nt/runemacs.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/nt/runemacs.c b/nt/runemacs.c index 3fcf405f6d4..905ef30a5d1 100644 --- a/nt/runemacs.c +++ b/nt/runemacs.c | |||
| @@ -59,6 +59,7 @@ WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow) | |||
| 59 | char *new_cmdline; | 59 | char *new_cmdline; |
| 60 | char *p; | 60 | char *p; |
| 61 | char modname[MAX_PATH]; | 61 | char modname[MAX_PATH]; |
| 62 | static const char iconic_opt[] = "--iconic "; | ||
| 62 | 63 | ||
| 63 | if (!ensure_unicows_dll ()) | 64 | if (!ensure_unicows_dll ()) |
| 64 | goto error; | 65 | goto error; |
| @@ -71,7 +72,10 @@ WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow) | |||
| 71 | goto error; | 72 | goto error; |
| 72 | *p = 0; | 73 | *p = 0; |
| 73 | 74 | ||
| 74 | new_cmdline = alloca (MAX_PATH + strlen (cmdline) + 3); | 75 | new_cmdline = alloca (MAX_PATH |
| 76 | + strlen (cmdline) | ||
| 77 | + (nShow == SW_SHOWMINNOACTIVE) * strlen (iconic_opt) | ||
| 78 | + 3); | ||
| 75 | /* Quote executable name in case of spaces in the path. */ | 79 | /* Quote executable name in case of spaces in the path. */ |
| 76 | *new_cmdline = '"'; | 80 | *new_cmdline = '"'; |
| 77 | strcpy (new_cmdline + 1, modname); | 81 | strcpy (new_cmdline + 1, modname); |
| @@ -140,6 +144,11 @@ WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow) | |||
| 140 | while (*++cmdline == ' '); | 144 | while (*++cmdline == ' '); |
| 141 | } | 145 | } |
| 142 | 146 | ||
| 147 | /* If the desktop shortcut properties tell to invoke runemacs | ||
| 148 | minimized, or if they invoked runemacs via "start /min", pass | ||
| 149 | '--iconic' to Emacs, as that's what users will expect. */ | ||
| 150 | if (nShow == SW_SHOWMINNOACTIVE) | ||
| 151 | strcat (new_cmdline, iconic_opt); | ||
| 143 | strcat (new_cmdline, cmdline); | 152 | strcat (new_cmdline, cmdline); |
| 144 | 153 | ||
| 145 | /* Set emacs_dir variable if runemacs was in "%emacs_dir%\bin". */ | 154 | /* Set emacs_dir variable if runemacs was in "%emacs_dir%\bin". */ |