aboutsummaryrefslogtreecommitdiffstats
path: root/nt
diff options
context:
space:
mode:
authorEli Zaretskii2015-07-08 19:16:49 +0300
committerEli Zaretskii2015-07-08 19:16:49 +0300
commitcd2e23e06f503ec6d7240ddd5e8ff8e315cd1536 (patch)
tree4ae5cc7c186549276558b7a145d5943b5116c1f3 /nt
parentb953882a75068e079a99cfc86a5c0e9796d604bd (diff)
downloademacs-cd2e23e06f503ec6d7240ddd5e8ff8e315cd1536.tar.gz
emacs-cd2e23e06f503ec6d7240ddd5e8ff8e315cd1536.zip
Support "maximized" property of runemacs's shortcut
* nt/runemacs.c (WinMain): If runemacs is invoked "maximized", pass the '--maximized' switch to Emacs.
Diffstat (limited to 'nt')
-rw-r--r--nt/runemacs.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/nt/runemacs.c b/nt/runemacs.c
index 905ef30a5d1..86644b4dfe7 100644
--- a/nt/runemacs.c
+++ b/nt/runemacs.c
@@ -59,7 +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 static const char iconic_opt[] = "--iconic ", maximized_opt[] = "--maximized ";
63 63
64 if (!ensure_unicows_dll ()) 64 if (!ensure_unicows_dll ())
65 goto error; 65 goto error;
@@ -74,7 +74,10 @@ WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow)
74 74
75 new_cmdline = alloca (MAX_PATH 75 new_cmdline = alloca (MAX_PATH
76 + strlen (cmdline) 76 + strlen (cmdline)
77 + (nShow == SW_SHOWMINNOACTIVE) * strlen (iconic_opt) 77 + ((nShow == SW_SHOWMINNOACTIVE
78 || nShow == SW_SHOWMAXIMIZED)
79 ? max (sizeof (iconic_opt), sizeof (maximized_opt))
80 : 0)
78 + 3); 81 + 3);
79 /* Quote executable name in case of spaces in the path. */ 82 /* Quote executable name in case of spaces in the path. */
80 *new_cmdline = '"'; 83 *new_cmdline = '"';
@@ -146,9 +149,12 @@ WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow)
146 149
147 /* If the desktop shortcut properties tell to invoke runemacs 150 /* If the desktop shortcut properties tell to invoke runemacs
148 minimized, or if they invoked runemacs via "start /min", pass 151 minimized, or if they invoked runemacs via "start /min", pass
149 '--iconic' to Emacs, as that's what users will expect. */ 152 '--iconic' to Emacs, as that's what users will expect. Likewise
153 with invoking runemacs maximized: pass '--maximized' to Emacs. */
150 if (nShow == SW_SHOWMINNOACTIVE) 154 if (nShow == SW_SHOWMINNOACTIVE)
151 strcat (new_cmdline, iconic_opt); 155 strcat (new_cmdline, iconic_opt);
156 else if (nShow == SW_SHOWMAXIMIZED)
157 strcat (new_cmdline, maximized_opt);
152 strcat (new_cmdline, cmdline); 158 strcat (new_cmdline, cmdline);
153 159
154 /* Set emacs_dir variable if runemacs was in "%emacs_dir%\bin". */ 160 /* Set emacs_dir variable if runemacs was in "%emacs_dir%\bin". */