This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: SETUP: default to mintty


On Jul 27 17:52, Corinna Vinschen wrote:
> On Jul 27 16:15, Andy Koppe wrote:
> > On 27 July 2011 10:43, Corinna Vinschen wrote:
> > > On Jul 27 09:07, Andy Koppe wrote:
> > >> On 27 July 2011 08:46, Corinna Vinschen wrote:
> > >> > On Jul 27 08:24, Andy Koppe wrote:
> > >> >> On 26 July 2011 20:52, Charles Wilson wrote:
> > >> >> > On 7/26/2011 3:36 PM, Andy Koppe wrote:
> > >> >> >>> What about modernizing the Cygwin icon?
> > >> >> >>
> > >> >> >> I quite like Chuck's take on this.
> > >> >> >
> > >> >> > Err...what's my take, again? <g>
> > >> >>
> > >> >> I meant cygicons-0.dll,9.
> > >> >
> > >> > Yes, I like that one, too. Âwe could use it as the default 48x48 and
> > >> > 64x64 icons. ÂPer the MSFT guidelines in
> > >> > http://msdn.microsoft.com/en-us/library/aa511280.aspx#size, smaller
> > >> > sizes should stick to a 2D look. ÂMaybe we can simply use the old
> > >> > icon for these sizes?
> > >>
> > >> The way I understand it, I think it's just that they shouldn't use
> > >> perspective. Compare for example the drive icons in the "Computer"
> > >> window, where they appear tilted in the main part of the window, but
> > >> straight-on at 16x16 in the sidebar. The small icons do still have
> > >> some depth to them.
> > >
> > > Well, ok. ÂI was just thinking that at 16x16 there's no such thing
> > > as edginess. ÂAnd at that size an icon should make a rather clear,
> > > simple impression.
> > 
> > FWIW, 'cygicons-0.dll,9' looks better to me even at 16x16, not least
> > because of the anti-aliasing. Also, it's this size that appears in the
> > upper-left corner of windows, and I think it's good to have this
> > correspond closely to the 32x32 icon appearing in the Windows 7
> > taskbar.
> 
> Fine with me.

Ok, here's my final(?) patch to make setup install mintty as "Cygwin
Terminal" desktop and start menu entries.  Apart from the cygwin.ico
file, there's now also a cygwin-terminal.ico file and a cygwin-setup.ico
file.  The latter is used as the default application icon.  Only the
first two are installed into / as Cygwin.ico and Cygwin-Terminal.ico.

See below for the patch.  Attached are the new ico files for the setup
repository.  If that's fine with everybody, Andy will also have to
change the mintty postinstall script so that the mintty entry is not
added to the start menu anymore.


Corinna


	* cygwin-setup.ico: New file.
	* cygwin-terminal.ico: New file.
	* cygwin.ico: New icon.
	* desktop.cc (make_link): Add argument parameter.  Create
	link string adding additional argument.
	(start_menu): Add argument parameter.  Add in call to make_link.
	(desktop_icon): Ditto.
	(save_icon): Replace fixed strings with arguments for filename
	and resource name.  Check if Cygwin.ico is the old icon.  If so,
	replace it with new icon.
	(do_desktop_setup): Call save_icon for /Cygwin.ico and
	/Cygwin-Terminal.ico.  In non-legacy mode, use mintty as
	target for desktop and start menu items.
	(DesktopSetupPage::OnActivate): In non-legacy mode, check for
	/bin/mintty.
	* res.rc: Use IDI_CYGWIN_SETUP as icon in start dialog.
	Add IDI_CYGWIN_SETUP, IDI_CYGWIN_TERMINAL, CYGWIN-SETUP.ICON
	and CYGWIN-TERMINAL.ICON entries.
	* resource.h (IDI_CYGWIN_SETUP): Define.
	(IDI_CYGWIN_TERMINAL): Define.


Index: desktop.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/desktop.cc,v
retrieving revision 2.56
diff -u -p -r2.56 desktop.cc
--- desktop.cc	25 Jul 2011 08:59:15 -0000	2.56
+++ desktop.cc	3 Aug 2011 14:37:27 -0000
@@ -20,7 +20,7 @@
 
 #if 0
 static const char *cvsid =
-  "\n%%% $Id: desktop.cc,v 2.56 2011/07/25 08:59:15 corinna Exp $\n";
+  "\n%%% $Id: desktop.cc,v 2.55 2010/11/19 15:49:54 cgf Exp $\n";
 #endif
 
 #include "win32.h"
@@ -78,7 +78,8 @@ DesktopSetupPage::DesktopSetupPage ()
 static void
 make_link (const std::string& linkpath,
            const std::string& title,
-           const std::string& target)
+           const std::string& target,
+           const std::string& arg)
 {
   std::string fname = linkpath + "/" + title + ".lnk";
 
@@ -96,7 +97,7 @@ make_link (const std::string& linkpath,
   if (IsWindowsNT ())
     {
       exepath = target;
-      argbuf = " ";
+      argbuf = arg;
     }
   else
     {
@@ -105,6 +106,8 @@ make_link (const std::string& linkpath,
       GetWindowsDirectory (windir, sizeof (windir));
       exepath = std::string(windir) + "\\command.com";
       argbuf = "/E:4096 /c " + target;
+      if (arg.size ())
+	argbuf += " " + arg;
     }
 
   msg ("make_link_2 (%s, %s, %s, %s)",
@@ -115,7 +118,8 @@ make_link (const std::string& linkpath,
 }
 
 static void
-start_menu (const std::string& title, const std::string& target)
+start_menu (const std::string& title, const std::string& target,
+	    const std::string& arg)
 {
   LPITEMIDLIST id;
   int issystem = (root_scope == IDC_ROOT_SYSTEM) ? 1 : 0;
@@ -137,11 +141,12 @@ start_menu (const std::string& title, co
     }
 // end of Win95 addition
   path += "/Cygwin";
-  make_link (path, title, target);
+  make_link (path, title, target, arg);
 }
 
 static void
-desktop_icon (const std::string& title, const std::string& target)
+desktop_icon (const std::string& title, const std::string& target,
+	      const std::string& arg)
 {
   char path[MAX_PATH];
   LPITEMIDLIST id;
@@ -161,7 +166,7 @@ desktop_icon (const std::string& title, 
       msg ("Desktop directory for deskop link changed to: %s", path);
     }
 // end of Win95 addition
-  make_link (path, title, target);
+  make_link (path, title, target, arg);
 }
 
 static void
@@ -204,11 +209,11 @@ make_cygwin_bat ()
 }
 
 static void
-save_icon ()
+save_icon (const char *path, const char *resource_name)
 {
-  iconname = backslash (cygpath ("/Cygwin.ico"));
+  iconname = backslash (cygpath (path));
 
-  HRSRC rsrc = FindResource (NULL, "CYGWIN.ICON", "FILE");
+  HRSRC rsrc = FindResource (NULL, resource_name, "FILE");
   if (rsrc == NULL)
     {
       fatal ("FindResource failed");
@@ -220,10 +225,14 @@ save_icon ()
   FILE *f;
   if (!is_legacy)
     {
+      WIN32_FILE_ATTRIBUTE_DATA attr;
+
       size_t ilen = iconname.size () + 7;
       WCHAR wname[ilen];
       mklongpath (wname, iconname.c_str (), ilen);
-      if (GetFileAttributesW (wname) != INVALID_FILE_ATTRIBUTES)
+      if (GetFileAttributesExW (wname, GetFileExInfoStandard, &attr)
+	  && attr.dwFileAttributes != INVALID_FILE_ATTRIBUTES
+	  && attr.nFileSizeLow > 7022)	/* Size of old icon */
 	return;
       f = nt_wfopen (wname, "wb", 0644);
     }
@@ -239,19 +248,22 @@ save_icon ()
 static void
 do_desktop_setup ()
 {
-  save_icon ();
+  save_icon ("/Cygwin.ico", "CYGWIN.ICON");
+  save_icon ("/Cygwin-Terminal.ico", "CYGWIN-TERMINAL.ICON");
 
   make_cygwin_bat ();
 
+  std::string target;
+
+  target = is_legacy ? batname : backslash (cygpath ("/bin/mintty"));
+
   if (root_menu)
-    {
-      start_menu ("Cygwin Bash Shell", batname);
-    }
+    start_menu (is_legacy ? "Cygwin Bash Shell" : "Cygwin Terminal", target,
+    		is_legacy ? "" : "-i /Cygwin-Terminal.ico -");
 
   if (root_desktop)
-    {
-      desktop_icon ("Cygwin", batname);
-    }
+    desktop_icon (is_legacy ? "Cygwin" : "Cygwin Terminal", target,
+		  is_legacy ? "" : "-i /Cygwin-Terminal.ico -");
 }
 
 static int da[] = { IDC_ROOT_DESKTOP, 0 };
@@ -425,8 +437,11 @@ DesktopSetupPage::OnActivate ()
       else
 	{
 	  root_menu =
-	    check_startmenu ("Cygwin Bash Shell",
-			     backslash (cygpath ("/cygwin.bat")));
+	    is_legacy
+	    ? check_startmenu ("Cygwin Bash Shell",
+			       backslash (cygpath ("/cygwin.bat")))
+	    : check_startmenu ("Cygwin Terminal",
+			       backslash (cygpath ("/bin/mintty")));
 	}
 
       if (NoDesktopOption) 
@@ -436,7 +451,10 @@ DesktopSetupPage::OnActivate ()
       else
 	{
 	  root_desktop =
-	    check_desktop ("Cygwin", backslash (cygpath ("/cygwin.bat")));
+	    is_legacy
+	    ? check_desktop ("Cygwin", backslash (cygpath ("/cygwin.bat")))
+	    : check_desktop ("Cygwin Terminal",
+			     backslash (cygpath ("/bin/mintty")));
 	}
     }
 
Index: res.rc
===================================================================
RCS file: /cvs/cygwin-apps/setup/res.rc,v
retrieving revision 2.92
diff -u -p -r2.92 res.rc
--- res.rc	20 Jul 2011 19:26:08 -0000	2.92
+++ res.rc	3 Aug 2011 14:37:27 -0000
@@ -270,7 +270,7 @@ BEGIN
                     "default.  You can always run this program at any time in "
                     "the future to add, remove, or upgrade packages as "
                     "necessary.",IDC_SPLASH_TEXT,115,25,195,90
-    ICON            IDI_CYGWIN,IDC_SPLASH_ICON,114,114,21,20,WS_GROUP
+    ICON            IDI_CYGWIN_SETUP,IDC_SPLASH_ICON,114,114,21,20,WS_GROUP
     LTEXT           "Version (unknown)",IDC_VERSION,115,137,195,10
     LTEXT           "Copyright 2000-2010",IDC_SPLASH_COPYR,115,150,195,8
     LTEXT           "http://www.cygwin.com/",IDC_SPLASH_URL,115,162,90,8
@@ -454,14 +454,18 @@ CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MA
 
 // Icon with lowest ID value placed first to ensure application icon
 // remains consistent on all systems.
+IDI_CYGWIN_SETUP        ICON    DISCARDABLE     "cygwin-setup.ico"
 IDI_CYGWIN              ICON    DISCARDABLE     "cygwin.ico"
+IDI_CYGWIN_TERMINAL     ICON    DISCARDABLE     "cygwin-terminal.ico"
 
 /////////////////////////////////////////////////////////////////////////////
 //
 // FILE
 //
 
+CYGWIN-SETUP.ICON       FILE    DISCARDABLE     "cygwin-setup.ico"
 CYGWIN.ICON             FILE    DISCARDABLE     "cygwin.ico"
+CYGWIN-TERMINAL.ICON    FILE    DISCARDABLE     "cygwin-terminal.ico"
 
 /////////////////////////////////////////////////////////////////////////////
 //
Index: resource.h
===================================================================
RCS file: /cvs/cygwin-apps/setup/resource.h,v
retrieving revision 2.42
diff -u -p -r2.42 resource.h
--- resource.h	20 Jul 2011 19:26:08 -0000	2.42
+++ resource.h	3 Aug 2011 14:37:27 -0000
@@ -77,7 +77,9 @@
 // icons
 
 #define IDI_SPIN                          400
-#define IDI_CYGWIN                        401
+#define IDI_CYGWIN_SETUP                  401
+#define IDI_CYGWIN                        402
+#define IDI_CYGWIN_TERMINAL               403
 
 // controls
 


-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

Attachment: cygwin.ico
Description: image/vnd.microsoft.icon

Attachment: cygwin-setup.ico
Description: image/vnd.microsoft.icon

Attachment: cygwin-terminal.ico
Description: image/vnd.microsoft.icon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]