home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.1 / 7.1.091 < prev    next >
Encoding:
Internet Message Format  |  2007-11-19  |  10.2 KB

  1. To: vim-dev@vim.org
  2. Subject: patch 7.1.091 (extra)
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.1.091 (extra)
  11. Problem:    Win32: Can't embed Vim inside another application.
  12. Solution:   Add the --windowid argument. (Nageshwar)
  13. Files:        runtime/doc/gui_w32.txt, runtime/doc/starting.txt,
  14.         runtime/doc/vi_diff.txt, src/globals.h, src/gui_w32.c, src/main.c
  15.  
  16.  
  17. *** ../vim-7.1.090/runtime/doc/gui_w32.txt    Sat May 12 15:35:53 2007
  18. --- runtime/doc/gui_w32.txt    Tue Aug 14 17:32:27 2007
  19. ***************
  20. *** 1,4 ****
  21. ! *gui_w32.txt*   For Vim version 7.1.  Last change: 2007 May 03
  22.   
  23.   
  24.             VIM REFERENCE MANUAL    by Bram Moolenaar
  25. --- 1,4 ----
  26. ! *gui_w32.txt*   For Vim version 7.1.  Last change: 2007 Aug 14
  27.   
  28.   
  29.             VIM REFERENCE MANUAL    by Bram Moolenaar
  30. ***************
  31. *** 52,57 ****
  32. --- 52,67 ----
  33.                                   *gui-w32s*
  34.   There is a specific version of gvim.exe that runs under the Win32s subsystem
  35.   of Windows 3.1 or 3.11.  See |win32s|.
  36. + Using Vim as a plugin                    *gui-w32-windowid*
  37. + When gvim starts up normally, it creates its own top level window.  If you
  38. + pass Vim the command-line option |--windowid| with a decimal or hexadecimal
  39. + value, Vim will create a window that is a child of the window with the given
  40. + ID.  This enables Vim to act as a plugin in another application.  This really
  41. + is a programmer's interface, and is of no use without a supporting application
  42. + to spawn Vim correctly.
  43.   
  44.   ==============================================================================
  45.   2. Vim as default editor                *vim-default-editor*
  46. *** ../vim-7.1.090/runtime/doc/starting.txt    Sat May 12 16:56:17 2007
  47. --- runtime/doc/starting.txt    Tue Aug 14 17:34:22 2007
  48. ***************
  49. *** 1,4 ****
  50. ! *starting.txt*  For Vim version 7.1.  Last change: 2007 May 12
  51.   
  52.   
  53.             VIM REFERENCE MANUAL    by Bram Moolenaar
  54. --- 1,4 ----
  55. ! *starting.txt*  For Vim version 7.1.  Last change: 2007 Aug 14
  56.   
  57.   
  58.             VIM REFERENCE MANUAL    by Bram Moolenaar
  59. ***************
  60. *** 547,552 ****
  61. --- 547,557 ----
  62.           GTK+ GUI Vim only.  Make gvim try to use GtkPlug mechanism, so
  63.           that it runs inside another window.  See |gui-gtk-socketid|
  64.           for details. {not in Vi}
  65. + --windowid {id}                        *--windowid*
  66. +         Win32 GUI Vim only.  Make gvim try to use the window {id} as a
  67. +         parent, so that it runs inside that window.  See
  68. +         |gui-w32-windowid| for details. {not in Vi}
  69.   
  70.   --echo-wid                        *--echo-wid*
  71.           GTK+ GUI Vim only.  Make gvim echo the Window ID on stdout,
  72. *** ../vim-7.1.090/runtime/doc/vi_diff.txt    Sat May 12 14:54:28 2007
  73. --- runtime/doc/vi_diff.txt    Tue Aug 14 17:35:10 2007
  74. ***************
  75. *** 1,4 ****
  76. ! *vi_diff.txt*   For Vim version 7.1.  Last change: 2007 May 07
  77.   
  78.   
  79.             VIM REFERENCE MANUAL    by Bram Moolenaar
  80. --- 1,4 ----
  81. ! *vi_diff.txt*   For Vim version 7.1.  Last change: 2007 Aug 14
  82.   
  83.   
  84.             VIM REFERENCE MANUAL    by Bram Moolenaar
  85. ***************
  86. *** 826,831 ****
  87. --- 826,833 ----
  88.   --servername {name}    Vim: Specify Vim server name
  89.   
  90.   --socketid {id}        Vim: GTK window socket to run Vim in
  91. + --windowid {id}        Vim: Win32 window ID to run Vim in
  92.   
  93.   --version    Vim: show version message and exit.
  94.   
  95. *** ../vim-7.1.090/src/globals.h    Thu May 10 19:26:02 2007
  96. --- src/globals.h    Wed Aug 29 22:27:45 2007
  97. ***************
  98. *** 876,882 ****
  99.   EXTERN int no_mapping INIT(= FALSE);    /* currently no mapping allowed */
  100.   EXTERN int no_zero_mapping INIT(= 0);    /* mapping zero not allowed */
  101.   EXTERN int allow_keys INIT(= FALSE);    /* allow key codes when no_mapping
  102. !                          * is set */
  103.   EXTERN int no_u_sync INIT(= 0);        /* Don't call u_sync() */
  104.   
  105.   EXTERN int restart_edit INIT(= 0);    /* call edit when next cmd finished */
  106. --- 876,882 ----
  107.   EXTERN int no_mapping INIT(= FALSE);    /* currently no mapping allowed */
  108.   EXTERN int no_zero_mapping INIT(= 0);    /* mapping zero not allowed */
  109.   EXTERN int allow_keys INIT(= FALSE);    /* allow key codes when no_mapping
  110. !                      * is set */
  111.   EXTERN int no_u_sync INIT(= 0);        /* Don't call u_sync() */
  112.   
  113.   EXTERN int restart_edit INIT(= 0);    /* call edit when next cmd finished */
  114. ***************
  115. *** 1250,1255 ****
  116. --- 1250,1263 ----
  117.   #ifdef FEAT_GUI_GTK
  118.   EXTERN guint32    gtk_socket_id INIT(= 0);
  119.   EXTERN int    echo_wid_arg INIT(= FALSE);    /* --echo-wid argument */
  120. + #endif
  121. + #ifdef FEAT_GUI_W32
  122. + /*
  123. +  * The value of the --windowid argument.
  124. +  * For embedding gvim inside another application.
  125. +  */
  126. + EXTERN int    win_socket_id INIT(= 0);
  127.   #endif
  128.   
  129.   #if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL)
  130. *** ../vim-7.1.090/src/gui_w32.c    Tue Aug 14 16:57:04 2007
  131. --- src/gui_w32.c    Tue Aug 14 17:13:41 2007
  132. ***************
  133. *** 23,28 ****
  134. --- 23,30 ----
  135.    * e.g., replace LONG with LONG_PTR, etc.
  136.    */
  137.   
  138. + #include "vim.h"
  139.   /*
  140.    * These are new in Windows ME/XP, only defined in recent compilers.
  141.    */
  142. ***************
  143. *** 1432,1447 ****
  144.       }
  145.       }
  146.       else
  147. !     /* Open toplevel window. */
  148.       s_hwnd = CreateWindow(
  149. !         szVimWndClass, "Vim MSWindows GUI",
  150. !         WS_OVERLAPPEDWINDOW,
  151. !         gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x,
  152. !         gui_win_y == -1 ? CW_USEDEFAULT : gui_win_y,
  153. !         100,                /* Any value will do */
  154. !         100,                /* Any value will do */
  155. !         NULL, NULL,
  156. !         s_hinst, NULL);
  157.   
  158.       if (s_hwnd == NULL)
  159.       return FAIL;
  160. --- 1434,1462 ----
  161.       }
  162.       }
  163.       else
  164. !     {
  165. !     /* If the provided windowid is not valid reset it to zero, so that it
  166. !      * is ignored and we open our own window. */
  167. !     if (IsWindow((HWND)win_socket_id) <= 0)
  168. !         win_socket_id = 0;
  169. !     /* Create a window.  If win_socket_id is not zero without border and
  170. !      * titlebar, it will be reparented below. */
  171.       s_hwnd = CreateWindow(
  172. !         szVimWndClass, "Vim MSWindows GUI",
  173. !         win_socket_id == 0 ? WS_OVERLAPPEDWINDOW : WS_POPUP,
  174. !         gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x,
  175. !         gui_win_y == -1 ? CW_USEDEFAULT : gui_win_y,
  176. !         100,                /* Any value will do */
  177. !         100,                /* Any value will do */
  178. !         NULL, NULL,
  179. !         s_hinst, NULL);
  180. !     if (s_hwnd != NULL && win_socket_id != 0)
  181. !     {
  182. !         SetParent(s_hwnd, (HWND)win_socket_id);
  183. !         ShowWindow(s_hwnd, SW_SHOWMAXIMIZED);
  184. !     }
  185. !     }
  186.   
  187.       if (s_hwnd == NULL)
  188.       return FAIL;
  189. *** ../vim-7.1.090/src/main.c    Fri Aug 10 21:32:41 2007
  190. --- src/main.c    Tue Aug 14 17:22:52 2007
  191. ***************
  192. *** 275,280 ****
  193. --- 275,281 ----
  194.        *   -display or --display
  195.        *   --server...
  196.        *   --socketid
  197. +      *   --windowid
  198.        */
  199.       early_arg_scan(¶ms);
  200.   
  201. ***************
  202. *** 1489,1495 ****
  203.    * Get the name of the display, before gui_prepare() removes it from
  204.    * argv[].  Used for the xterm-clipboard display.
  205.    *
  206. !  * Also find the --server... arguments and --socketid
  207.    */
  208.   /*ARGSUSED*/
  209.       static void
  210. --- 1490,1496 ----
  211.    * Get the name of the display, before gui_prepare() removes it from
  212.    * argv[].  Used for the xterm-clipboard display.
  213.    *
  214. !  * Also find the --server... arguments and --socketid and --windowid
  215.    */
  216.   /*ARGSUSED*/
  217.       static void
  218. ***************
  219. *** 1536,1559 ****
  220.   #  endif
  221.       }
  222.   # endif
  223. ! # ifdef FEAT_GUI_GTK
  224.       else if (STRICMP(argv[i], "--socketid") == 0)
  225.       {
  226. !         unsigned int    socket_id;
  227.           int            count;
  228.   
  229.           if (i == argc - 1)
  230.           mainerr_arg_missing((char_u *)argv[i]);
  231.           if (STRNICMP(argv[i+1], "0x", 2) == 0)
  232. !         count = sscanf(&(argv[i + 1][2]), "%x", &socket_id);
  233.           else
  234. !         count = sscanf(argv[i+1], "%u", &socket_id);
  235.           if (count != 1)
  236.           mainerr(ME_INVALID_ARG, (char_u *)argv[i]);
  237.           else
  238. !         gtk_socket_id = socket_id;
  239.           i++;
  240.       }
  241.       else if (STRICMP(argv[i], "--echo-wid") == 0)
  242.           echo_wid_arg = TRUE;
  243.   # endif
  244. --- 1537,1571 ----
  245.   #  endif
  246.       }
  247.   # endif
  248. ! # if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_W32)
  249. ! #  ifdef FEAT_GUI_W32
  250. !     else if (STRICMP(argv[i], "--windowid") == 0)
  251. ! #  else
  252.       else if (STRICMP(argv[i], "--socketid") == 0)
  253. + #  endif
  254.       {
  255. !         unsigned int    id;
  256.           int            count;
  257.   
  258.           if (i == argc - 1)
  259.           mainerr_arg_missing((char_u *)argv[i]);
  260.           if (STRNICMP(argv[i+1], "0x", 2) == 0)
  261. !         count = sscanf(&(argv[i + 1][2]), "%x", &id);
  262.           else
  263. !         count = sscanf(argv[i+1], "%u", &id);
  264.           if (count != 1)
  265.           mainerr(ME_INVALID_ARG, (char_u *)argv[i]);
  266.           else
  267. ! #  ifdef FEAT_GUI_W32
  268. !         win_socket_id = id;
  269. ! #  else
  270. !         gtk_socket_id = id;
  271. ! #  endif
  272.           i++;
  273.       }
  274. + # endif
  275. + # ifdef FEAT_GUI_GTK
  276.       else if (STRICMP(argv[i], "--echo-wid") == 0)
  277.           echo_wid_arg = TRUE;
  278.   # endif
  279. ***************
  280. *** 1683,1690 ****
  281.               }
  282.           }
  283.   #endif
  284. ! #ifdef FEAT_GUI_GTK
  285.           else if (STRNICMP(argv[0] + argv_idx, "socketid", 8) == 0)
  286.           {
  287.               /* already processed -- snatch the following arg */
  288.               if (argc > 1)
  289. --- 1695,1706 ----
  290.               }
  291.           }
  292.   #endif
  293. ! #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_W32)
  294. ! # ifdef FEAT_GUI_GTK
  295.           else if (STRNICMP(argv[0] + argv_idx, "socketid", 8) == 0)
  296. + # else
  297. +         else if (STRNICMP(argv[0] + argv_idx, "windowid", 8) == 0)
  298. + # endif
  299.           {
  300.               /* already processed -- snatch the following arg */
  301.               if (argc > 1)
  302. ***************
  303. *** 1693,1698 ****
  304. --- 1709,1716 ----
  305.               ++argv;
  306.               }
  307.           }
  308. + #endif
  309. + #ifdef FEAT_GUI_GTK
  310.           else if (STRNICMP(argv[0] + argv_idx, "echo-wid", 8) == 0)
  311.           {
  312.               /* already processed, skip */
  313. ***************
  314. *** 3120,3125 ****
  315. --- 3138,3144 ----
  316.   #endif
  317.   #ifdef FEAT_GUI_W32
  318.       main_msg(_("-P <parent title>\tOpen Vim inside parent application"));
  319. +     main_msg(_("--windowid <HWND>\tOpen Vim inside another win32 widget"));
  320.   #endif
  321.   
  322.   #ifdef FEAT_GUI_GNOME
  323. *** ../vim-7.1.090/src/version.c    Thu Aug 30 11:46:46 2007
  324. --- src/version.c    Thu Aug 30 12:21:02 2007
  325. ***************
  326. *** 668,669 ****
  327. --- 668,671 ----
  328.   {   /* Add new patch number below this line */
  329. + /**/
  330. +     91,
  331.   /**/
  332.  
  333. -- 
  334.        We're knights of the Round Table
  335.        Our shows are formidable
  336.        But many times
  337.        We're given rhymes
  338.        That are quite unsingable
  339.        We're opera mad in Camelot
  340.        We sing from the diaphragm a lot.
  341.                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
  342.  
  343.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  344. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  345. \\\        download, build and distribute -- http://www.A-A-P.org        ///
  346.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  347.