]> granicus.if.org Git - vim/commitdiff
updated for version 7.4.459 v7.4.459
authorBram Moolenaar <Bram@vim.org>
Tue, 23 Sep 2014 19:53:41 +0000 (21:53 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 23 Sep 2014 19:53:41 +0000 (21:53 +0200)
Problem:    Can't change the icon after building Vim.
Solution:   Load the icon from a file on startup. (Yasuhiro Matsumoto)

src/gui_w32.c
src/os_mswin.c
src/os_win32.c
src/proto/os_mswin.pro
src/version.c

index 6948ab551c3349fe52eb5bfd39492a89bb5616f0..5e18e85175e9e4701ae4e50f1c4af5dd7a1ab412 100644 (file)
@@ -1662,6 +1662,14 @@ gui_mch_init(void)
     if (s_textArea == NULL)
        return FAIL;
 
+    /* Try loading an icon from $RUNTIMEPATH/bitmaps/vim.ico. */
+    {
+       HANDLE  hIcon = NULL;
+
+       if (mch_icon_load(&hIcon) == OK && hIcon != NULL)
+           SendMessage(s_hwnd, WM_SETICON, ICON_SMALL, hIcon);
+    }
+
 #ifdef FEAT_MENU
     s_menuBar = CreateMenu();
 #endif
index b5786800e400305f1218ca9d0f88b2b34c86a2cf..8ad3695bd4ed6834dae47e7fd0389e44b5913b5e 100644 (file)
@@ -928,6 +928,33 @@ check_str_len(char_u *str)
 }
 # endif
 
+/*
+ * Passed to do_in_runtimepath() to load a vim.ico file.
+ */
+    static void
+mch_icon_load_cb(char_u *fname, void *cookie)
+{
+    HANDLE *h = (HANDLE *)cookie;
+
+    *h = LoadImage(NULL,
+                  fname,
+                  IMAGE_ICON,
+                  64,
+                  64,
+                  LR_LOADFROMFILE | LR_LOADMAP3DCOLORS);
+}
+
+/*
+ * Try loading an icon file from 'runtimepath'.
+ */
+    int
+mch_icon_load(iconp)
+    HANDLE *iconp;
+{
+    return do_in_runtimepath((char_u *)"bitmaps/vim.ico",
+                                             FALSE, mch_icon_load_cb, iconp);
+}
+
     int
 mch_libcall(
     char_u     *libname,
index 7192c51a03c706189fc57343a90a91d9eafcc699..21c3ee9f4ea90f2f94c99a77b13fe4da08dea3b2 100644 (file)
@@ -2446,7 +2446,8 @@ SaveConsoleTitleAndIcon(void)
        return;
 
     /* Extract the first icon contained in the Vim executable. */
-    g_hVimIcon = ExtractIcon(NULL, exe_name, 0);
+    if (mch_icon_load((HANDLE *)&g_hVimIcon) == FAIL || g_hVimIcon == NULL)
+       g_hVimIcon = ExtractIcon(NULL, exe_name, 0);
     if (g_hVimIcon != NULL)
        g_fCanChangeIcon = TRUE;
 }
index 0d29979cf834590e07e93ba1abc1c7c97731cfa2..b56ee565681b7e1637ddf5ae981dacf7f8f6242f 100644 (file)
@@ -21,6 +21,7 @@ int mch_has_wildcard __ARGS((char_u *p));
 int mch_chdir __ARGS((char *path));
 int can_end_termcap_mode __ARGS((int give_msg));
 int mch_screenmode __ARGS((char_u *arg));
+int mch_icon_load __ARGS((HANDLE *iconp));
 int mch_libcall __ARGS((char_u *libname, char_u *funcname, char_u *argstring, int argint, char_u **string_result, int *number_result));
 void DumpPutS __ARGS((const char *psz));
 int mch_get_winpos __ARGS((int *x, int *y));
index 867aa7c3fd19cee2f3ffad91bee5fb73ce51c1ea..a9f83a20385839e3d737b3e7eadbcac311d52e70 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    459,
 /**/
     458,
 /**/