2 Subject: patch 7.1.091 (extra)
4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
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
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
21 ! *gui_w32.txt* For Vim version 7.1. Last change: 2007 May 03
24 VIM REFERENCE MANUAL by Bram Moolenaar
26 ! *gui_w32.txt* For Vim version 7.1. Last change: 2007 Aug 14
29 VIM REFERENCE MANUAL by Bram Moolenaar
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|.
38 + Using Vim as a plugin *gui-w32-windowid*
40 + When gvim starts up normally, it creates its own top level window. If you
41 + pass Vim the command-line option |--windowid| with a decimal or hexadecimal
42 + value, Vim will create a window that is a child of the window with the given
43 + ID. This enables Vim to act as a plugin in another application. This really
44 + is a programmer's interface, and is of no use without a supporting application
45 + to spawn Vim correctly.
47 ==============================================================================
48 2. Vim as default editor *vim-default-editor*
49 *** ../vim-7.1.090/runtime/doc/starting.txt Sat May 12 16:56:17 2007
50 --- runtime/doc/starting.txt Tue Aug 14 17:34:22 2007
53 ! *starting.txt* For Vim version 7.1. Last change: 2007 May 12
56 VIM REFERENCE MANUAL by Bram Moolenaar
58 ! *starting.txt* For Vim version 7.1. Last change: 2007 Aug 14
61 VIM REFERENCE MANUAL by Bram Moolenaar
65 GTK+ GUI Vim only. Make gvim try to use GtkPlug mechanism, so
66 that it runs inside another window. See |gui-gtk-socketid|
67 for details. {not in Vi}
69 + --windowid {id} *--windowid*
70 + Win32 GUI Vim only. Make gvim try to use the window {id} as a
71 + parent, so that it runs inside that window. See
72 + |gui-w32-windowid| for details. {not in Vi}
74 --echo-wid *--echo-wid*
75 GTK+ GUI Vim only. Make gvim echo the Window ID on stdout,
76 *** ../vim-7.1.090/runtime/doc/vi_diff.txt Sat May 12 14:54:28 2007
77 --- runtime/doc/vi_diff.txt Tue Aug 14 17:35:10 2007
80 ! *vi_diff.txt* For Vim version 7.1. Last change: 2007 May 07
83 VIM REFERENCE MANUAL by Bram Moolenaar
85 ! *vi_diff.txt* For Vim version 7.1. Last change: 2007 Aug 14
88 VIM REFERENCE MANUAL by Bram Moolenaar
92 --servername {name} Vim: Specify Vim server name
94 --socketid {id} Vim: GTK window socket to run Vim in
96 + --windowid {id} Vim: Win32 window ID to run Vim in
98 --version Vim: show version message and exit.
100 *** ../vim-7.1.090/src/globals.h Thu May 10 19:26:02 2007
101 --- src/globals.h Wed Aug 29 22:27:45 2007
104 EXTERN int no_mapping INIT(= FALSE); /* currently no mapping allowed */
105 EXTERN int no_zero_mapping INIT(= 0); /* mapping zero not allowed */
106 EXTERN int allow_keys INIT(= FALSE); /* allow key codes when no_mapping
108 EXTERN int no_u_sync INIT(= 0); /* Don't call u_sync() */
110 EXTERN int restart_edit INIT(= 0); /* call edit when next cmd finished */
112 EXTERN int no_mapping INIT(= FALSE); /* currently no mapping allowed */
113 EXTERN int no_zero_mapping INIT(= 0); /* mapping zero not allowed */
114 EXTERN int allow_keys INIT(= FALSE); /* allow key codes when no_mapping
116 EXTERN int no_u_sync INIT(= 0); /* Don't call u_sync() */
118 EXTERN int restart_edit INIT(= 0); /* call edit when next cmd finished */
123 EXTERN guint32 gtk_socket_id INIT(= 0);
124 EXTERN int echo_wid_arg INIT(= FALSE); /* --echo-wid argument */
127 + #ifdef FEAT_GUI_W32
129 + * The value of the --windowid argument.
130 + * For embedding gvim inside another application.
132 + EXTERN int win_socket_id INIT(= 0);
135 #if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL)
136 *** ../vim-7.1.090/src/gui_w32.c Tue Aug 14 16:57:04 2007
137 --- src/gui_w32.c Tue Aug 14 17:13:41 2007
141 * e.g., replace LONG with LONG_PTR, etc.
147 * These are new in Windows ME/XP, only defined in recent compilers.
154 ! /* Open toplevel window. */
155 s_hwnd = CreateWindow(
156 ! szVimWndClass, "Vim MSWindows GUI",
157 ! WS_OVERLAPPEDWINDOW,
158 ! gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x,
159 ! gui_win_y == -1 ? CW_USEDEFAULT : gui_win_y,
160 ! 100, /* Any value will do */
161 ! 100, /* Any value will do */
172 ! /* If the provided windowid is not valid reset it to zero, so that it
173 ! * is ignored and we open our own window. */
174 ! if (IsWindow((HWND)win_socket_id) <= 0)
177 ! /* Create a window. If win_socket_id is not zero without border and
178 ! * titlebar, it will be reparented below. */
179 s_hwnd = CreateWindow(
180 ! szVimWndClass, "Vim MSWindows GUI",
181 ! win_socket_id == 0 ? WS_OVERLAPPEDWINDOW : WS_POPUP,
182 ! gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x,
183 ! gui_win_y == -1 ? CW_USEDEFAULT : gui_win_y,
184 ! 100, /* Any value will do */
185 ! 100, /* Any value will do */
188 ! if (s_hwnd != NULL && win_socket_id != 0)
190 ! SetParent(s_hwnd, (HWND)win_socket_id);
191 ! ShowWindow(s_hwnd, SW_SHOWMAXIMIZED);
197 *** ../vim-7.1.090/src/main.c Fri Aug 10 21:32:41 2007
198 --- src/main.c Tue Aug 14 17:22:52 2007
202 * -display or --display
207 early_arg_scan(¶ms);
211 * Get the name of the display, before gui_prepare() removes it from
212 * argv[]. Used for the xterm-clipboard display.
214 ! * Also find the --server... arguments and --socketid
219 * Get the name of the display, before gui_prepare() removes it from
220 * argv[]. Used for the xterm-clipboard display.
222 ! * Also find the --server... arguments and --socketid and --windowid
231 ! # ifdef FEAT_GUI_GTK
232 else if (STRICMP(argv[i], "--socketid") == 0)
234 ! unsigned int socket_id;
238 mainerr_arg_missing((char_u *)argv[i]);
239 if (STRNICMP(argv[i+1], "0x", 2) == 0)
240 ! count = sscanf(&(argv[i + 1][2]), "%x", &socket_id);
242 ! count = sscanf(argv[i+1], "%u", &socket_id);
244 mainerr(ME_INVALID_ARG, (char_u *)argv[i]);
246 ! gtk_socket_id = socket_id;
249 else if (STRICMP(argv[i], "--echo-wid") == 0)
257 ! # if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_W32)
258 ! # ifdef FEAT_GUI_W32
259 ! else if (STRICMP(argv[i], "--windowid") == 0)
261 else if (STRICMP(argv[i], "--socketid") == 0)
268 mainerr_arg_missing((char_u *)argv[i]);
269 if (STRNICMP(argv[i+1], "0x", 2) == 0)
270 ! count = sscanf(&(argv[i + 1][2]), "%x", &id);
272 ! count = sscanf(argv[i+1], "%u", &id);
274 mainerr(ME_INVALID_ARG, (char_u *)argv[i]);
276 ! # ifdef FEAT_GUI_W32
277 ! win_socket_id = id;
279 ! gtk_socket_id = id;
284 + # ifdef FEAT_GUI_GTK
285 else if (STRICMP(argv[i], "--echo-wid") == 0)
293 ! #ifdef FEAT_GUI_GTK
294 else if (STRNICMP(argv[0] + argv_idx, "socketid", 8) == 0)
296 /* already processed -- snatch the following arg */
302 ! #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_W32)
303 ! # ifdef FEAT_GUI_GTK
304 else if (STRNICMP(argv[0] + argv_idx, "socketid", 8) == 0)
306 + else if (STRNICMP(argv[0] + argv_idx, "windowid", 8) == 0)
309 /* already processed -- snatch the following arg */
318 + #ifdef FEAT_GUI_GTK
319 else if (STRNICMP(argv[0] + argv_idx, "echo-wid", 8) == 0)
321 /* already processed, skip */
327 main_msg(_("-P <parent title>\tOpen Vim inside parent application"));
328 + main_msg(_("--windowid <HWND>\tOpen Vim inside another win32 widget"));
331 #ifdef FEAT_GUI_GNOME
332 *** ../vim-7.1.090/src/version.c Thu Aug 30 11:46:46 2007
333 --- src/version.c Thu Aug 30 12:21:02 2007
337 { /* Add new patch number below this line */
343 We're knights of the Round Table
344 Our shows are formidable
347 That are quite unsingable
348 We're opera mad in Camelot
349 We sing from the diaphragm a lot.
350 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
352 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
353 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
354 \\\ download, build and distribute -- http://www.A-A-P.org ///
355 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///