073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.459
073263
Fcc: outbox
073263
From: Bram Moolenaar <Bram@moolenaar.net>
073263
Mime-Version: 1.0
073263
Content-Type: text/plain; charset=UTF-8
073263
Content-Transfer-Encoding: 8bit
073263
------------
073263
073263
Patch 7.4.459
073263
Problem:    Can't change the icon after building Vim.
073263
Solution:   Load the icon from a file on startup. (Yasuhiro Matsumoto)
073263
Files:      src/gui_w32.c, src/os_mswin.c, src/os_win32.c, 
073263
            src/proto/os_mswin.pro
073263
073263
073263
*** ../vim-7.4.458/src/gui_w32.c	2014-09-19 16:13:48.358419065 +0200
073263
--- src/gui_w32.c	2014-09-23 21:53:17.382849313 +0200
073263
***************
073263
*** 1662,1667 ****
073263
--- 1662,1675 ----
073263
      if (s_textArea == NULL)
073263
  	return FAIL;
073263
  
073263
+     /* Try loading an icon from $RUNTIMEPATH/bitmaps/vim.ico. */
073263
+     {
073263
+ 	HANDLE	hIcon = NULL;
073263
+ 
073263
+ 	if (mch_icon_load(&hIcon) == OK && hIcon != NULL)
073263
+ 	    SendMessage(s_hwnd, WM_SETICON, ICON_SMALL, hIcon);
073263
+     }
073263
+ 
073263
  #ifdef FEAT_MENU
073263
      s_menuBar = CreateMenu();
073263
  #endif
073263
*** ../vim-7.4.458/src/os_mswin.c	2014-09-09 12:25:27.768501863 +0200
073263
--- src/os_mswin.c	2014-09-23 21:52:50.582849254 +0200
073263
***************
073263
*** 928,933 ****
073263
--- 928,960 ----
073263
  }
073263
  # endif
073263
  
073263
+ /*
073263
+  * Passed to do_in_runtimepath() to load a vim.ico file.
073263
+  */
073263
+     static void
073263
+ mch_icon_load_cb(char_u *fname, void *cookie)
073263
+ {
073263
+     HANDLE *h = (HANDLE *)cookie;
073263
+ 
073263
+     *h = LoadImage(NULL,
073263
+ 		   fname,
073263
+ 		   IMAGE_ICON,
073263
+ 		   64,
073263
+ 		   64,
073263
+ 		   LR_LOADFROMFILE | LR_LOADMAP3DCOLORS);
073263
+ }
073263
+ 
073263
+ /*
073263
+  * Try loading an icon file from 'runtimepath'.
073263
+  */
073263
+     int
073263
+ mch_icon_load(iconp)
073263
+     HANDLE *iconp;
073263
+ {
073263
+     return do_in_runtimepath((char_u *)"bitmaps/vim.ico",
073263
+ 					      FALSE, mch_icon_load_cb, iconp);
073263
+ }
073263
+ 
073263
      int
073263
  mch_libcall(
073263
      char_u	*libname,
073263
*** ../vim-7.4.458/src/os_win32.c	2014-09-09 12:25:27.764501863 +0200
073263
--- src/os_win32.c	2014-09-23 21:47:03.318848496 +0200
073263
***************
073263
*** 2446,2452 ****
073263
  	return;
073263
  
073263
      /* Extract the first icon contained in the Vim executable. */
073263
!     g_hVimIcon = ExtractIcon(NULL, exe_name, 0);
073263
      if (g_hVimIcon != NULL)
073263
  	g_fCanChangeIcon = TRUE;
073263
  }
073263
--- 2446,2453 ----
073263
  	return;
073263
  
073263
      /* Extract the first icon contained in the Vim executable. */
073263
!     if (mch_icon_load((HANDLE *)&g_hVimIcon) == FAIL || g_hVimIcon == NULL)
073263
! 	g_hVimIcon = ExtractIcon(NULL, exe_name, 0);
073263
      if (g_hVimIcon != NULL)
073263
  	g_fCanChangeIcon = TRUE;
073263
  }
073263
*** ../vim-7.4.458/src/proto/os_mswin.pro	2013-08-10 13:37:39.000000000 +0200
073263
--- src/proto/os_mswin.pro	2014-09-23 21:49:29.746848816 +0200
073263
***************
073263
*** 21,26 ****
073263
--- 21,27 ----
073263
  int mch_chdir __ARGS((char *path));
073263
  int can_end_termcap_mode __ARGS((int give_msg));
073263
  int mch_screenmode __ARGS((char_u *arg));
073263
+ int mch_icon_load __ARGS((HANDLE *iconp));
073263
  int mch_libcall __ARGS((char_u *libname, char_u *funcname, char_u *argstring, int argint, char_u **string_result, int *number_result));
073263
  void DumpPutS __ARGS((const char *psz));
073263
  int mch_get_winpos __ARGS((int *x, int *y));
073263
*** ../vim-7.4.458/src/version.c	2014-09-23 18:37:52.426823701 +0200
073263
--- src/version.c	2014-09-23 21:36:07.806847064 +0200
073263
***************
073263
*** 743,744 ****
073263
--- 743,746 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     459,
073263
  /**/
073263
073263
-- 
073263
If Microsoft would build a car...
073263
... You'd have to press the "Start" button to turn the engine off.
073263
073263
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
073263
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
073263
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
073263
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///