Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Sat, 14 Feb 2004 13:10:33 -0600 From: Joshua Daniel Franklin To: Dick Repasky , cygwin AT cygwin DOT com Subject: Re: cygutils: mkshortcut patch - show window norm, min, max Message-ID: <20040214131033.B27955@ns1.iocc.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Dxnq1zWXvFF0Q93v" Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: ; from rrepasky@lack.ucs.indiana.edu on Fri, Feb 13, 2004 at 09:12:59PM -0500 --Dxnq1zWXvFF0Q93v Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Doh! And here's the diff. --Dxnq1zWXvFF0Q93v Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="mkshortcut.diff" Index: mkshortcut.1 =================================================================== RCS file: /cvs/cygwin-apps/cygutils/src/mkshortcut/mkshortcut.1,v retrieving revision 1.4 diff -u -p -r1.4 mkshortcut.1 --- mkshortcut.1 24 Oct 2003 05:12:47 -0000 1.4 +++ mkshortcut.1 14 Feb 2004 19:04:20 -0000 @@ -12,6 +12,7 @@ mkshortcut \- create a Windows shortcut .RB "[\-\fBa\fP \fIARGS\fP]" .RB "[\-\fBi\fP \fIiconfile\fP [\-\fBj\fP \fIINT\fP] ]" .RB "[\-\fBn\fP \fINAME\fP ]" +.RB "[\-\fBs\fP \fInorm|min|max\fP ]" .RB "[\-\fBw\fP \fIPATH\fP ]" .RB "[\-A] [\-D|\-P] \fITARGET\fP" .br @@ -43,6 +44,15 @@ to 0. Name to use for the shortcut file. Note that \fI"NAME"\fP can contain spaces, but in that case must be enclosed in quotes. The Windows extention \fB.lnk\fP is automatically appended to \fI"NAME"\fP if not present. + +.TP +\fB\-s\fR, \fB\-\-show\fR=\fInorm|min|max\fP +For norm, min, and max the new window will be normal, minimized, and +maximized, respectively. Note that if you use the properties dialog to +inspect properties of shortcuts for which you request minimized windows +the dialog may indicate that normal windows will be displayed. Fortunately, +that indicator is often wrong. + .TP \fB\-w\fR, \fB\-\-workingdir\fR=\fI"PATH"\fP Index: mkshortcut.c =================================================================== RCS file: /cvs/cygwin-apps/cygutils/src/mkshortcut/mkshortcut.c,v retrieving revision 1.5 diff -u -p -r1.5 mkshortcut.c --- mkshortcut.c 6 Feb 2003 07:31:06 -0000 1.5 +++ mkshortcut.c 14 Feb 2004 19:04:21 -0000 @@ -58,6 +58,7 @@ typedef struct optvals_s { int allusers_flag; int desktop_flag; int smprograms_flag; + int show_flag; int offset; char * name_arg; char * dir_name_arg; @@ -112,6 +113,8 @@ main (int argc, const char **argv) "offset of icon in icon file (default is 0)", NULL}, { "name", 'n', POPT_ARG_STRING, NULL, 'n', \ "name for link (defaults to TARGET)", "NAME"}, + { "show", 's', POPT_ARG_STRING, NULL, 's', \ + "window to show: normal, minimized, maximized", "norm|min|max"}, { "workingdir", 'w', POPT_ARG_STRING, NULL, 'w', \ "set working directory (defaults to directory path of TARGET)", "PATH"}, { "allusers", 'A', POPT_ARG_VAL, &(opts.allusers_flag), 1, \ @@ -154,6 +157,7 @@ main (int argc, const char **argv) opts.allusers_flag = 0; opts.desktop_flag = 0; opts.smprograms_flag = 0; + opts.show_flag = SW_SHOWNORMAL; opts.target_arg = NULL; opts.argument_arg = NULL; opts.name_arg = NULL; @@ -193,6 +197,21 @@ main (int argc, const char **argv) } } break; + case 's': if (arg = poptGetOptArg(optCon)) { + if (strcmp(arg, "min") == 0) { + opts.show_flag = SW_SHOWMINNOACTIVE; + } else if (strcmp(arg, "max") == 0) { + opts.show_flag = SW_SHOWMAXIMIZED; + } else if (strcmp(arg, "norm") == 0) { + opts.show_flag = SW_SHOWNORMAL; + } else { + fprintf(stderr, "%s: %s not valid for show window\n", + program_name, arg); + ec=2; + goto exit; + } + } + break; case 'w': if (arg = poptGetOptArg(optCon)) { if ((opts.dir_name_arg = strdup(arg)) == NULL ) { fprintf(stderr, "%s: memory allocation error\n", program_name); @@ -460,6 +479,9 @@ int mkshortcut(optvals opts, poptContext if (opts.icon_flag) shell_link->lpVtbl->SetIconLocation (shell_link, opts.icon_name_arg, opts.offset); + if (opts.show_flag != SW_SHOWNORMAL) + shell_link->lpVtbl->SetShowCmd(shell_link, opts.show_flag); + /* Make link name Unicode-compliant */ hres = --Dxnq1zWXvFF0Q93v Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ --Dxnq1zWXvFF0Q93v--