cygutils: mkshortcut patch - show window norm, min, max

Dick Repasky rrepasky@lack.ucs.indiana.edu
Sat Feb 14 02:35:00 GMT 2004


Attached is a patch to mkshortcut in the cygutils package that adds
a commandline option for specifying how the new window for the launched
application should be appear - normal, minimized or maximized.

The patch was made against cygutils version 1.2.4. I hope that it is 
included in the next release of cygutils.

Enjoy,

Dick 
-------------- next part --------------
diff -c mkshortcut-old/mkshortcut.1 mkshortcut/mkshortcut.1
*** mkshortcut-old/mkshortcut.1	Thu Feb 12 18:39:57 2004
--- mkshortcut/mkshortcut.1	Wed Feb 11 18:02:17 2004
***************
*** 12,17 ****
--- 12,18 ----
  .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
***************
*** 45,50 ****
--- 46,60 ----
  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
  PATH to use for the working directory (defaults to directory path of TARGET).
  
diff -c mkshortcut-old/mkshortcut.c mkshortcut/mkshortcut.c
*** mkshortcut-old/mkshortcut.c	Thu Feb 12 18:38:20 2004
--- mkshortcut/mkshortcut.c	Thu Feb 12 18:37:36 2004
***************
*** 58,63 ****
--- 58,64 ----
    int allusers_flag;
    int desktop_flag;
    int smprograms_flag;
+   int show_flag;
    int offset;
    char * name_arg;
    char * dir_name_arg;
***************
*** 120,125 ****
--- 121,128 ----
          "create link relative to 'Desktop' directory", NULL},
      { "smprograms", 'P', POPT_ARG_VAL, &(opts.smprograms_flag), 1, \
          "create link relative to Start Menu 'Programs' directory", NULL},
+     { "show", 's', POPT_ARG_STRING, NULL, 's', \
+         "window to show: normal, minimized, maximized", "norm|min|max"},
      { NULL, '\0', 0, NULL, 0, NULL, NULL }
    };
    
***************
*** 154,159 ****
--- 157,163 ----
    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,198 ****
--- 197,217 ----
                     }
                   }
                   break;
+       case 's':  if (arg = poptGetOptArg(optCon)) {
+                    if (strcmp(arg, "min") == 0) {
+                      opts.show_flag = SW_SHOWMINIMIZED;
+                    } 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,465 ****
--- 479,487 ----
  	  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 =
-------------- next part --------------
--
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/


More information about the Cygwin mailing list