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