1
0
forked from aniani/vim

updated for version 7.1-091

This commit is contained in:
Bram Moolenaar
2007-08-30 10:26:19 +00:00
parent 1a3d086c84
commit 78e1762c48
7 changed files with 81 additions and 20 deletions

View File

@@ -1,4 +1,4 @@
*gui_w32.txt* For Vim version 7.1. Last change: 2007 May 03 *gui_w32.txt* For Vim version 7.1. Last change: 2007 Aug 14
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -53,6 +53,16 @@ vimrc or gvimrc file: >
There is a specific version of gvim.exe that runs under the Win32s subsystem There is a specific version of gvim.exe that runs under the Win32s subsystem
of Windows 3.1 or 3.11. See |win32s|. of Windows 3.1 or 3.11. See |win32s|.
Using Vim as a plugin *gui-w32-windowid*
When gvim starts up normally, it creates its own top level window. If you
pass Vim the command-line option |--windowid| with a decimal or hexadecimal
value, Vim will create a window that is a child of the window with the given
ID. This enables Vim to act as a plugin in another application. This really
is a programmer's interface, and is of no use without a supporting application
to spawn Vim correctly.
============================================================================== ==============================================================================
2. Vim as default editor *vim-default-editor* 2. Vim as default editor *vim-default-editor*

View File

@@ -1,4 +1,4 @@
*starting.txt* For Vim version 7.1. Last change: 2007 May 12 *starting.txt* For Vim version 7.1. Last change: 2007 Aug 14
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -548,6 +548,11 @@ a slash. Thus "-R" means recovery and "-/R" readonly.
that it runs inside another window. See |gui-gtk-socketid| that it runs inside another window. See |gui-gtk-socketid|
for details. {not in Vi} for details. {not in Vi}
--windowid {id} *--windowid*
Win32 GUI Vim only. Make gvim try to use the window {id} as a
parent, so that it runs inside that window. See
|gui-w32-windowid| for details. {not in Vi}
--echo-wid *--echo-wid* --echo-wid *--echo-wid*
GTK+ GUI Vim only. Make gvim echo the Window ID on stdout, GTK+ GUI Vim only. Make gvim echo the Window ID on stdout,
which can be used to run gvim in a kpart widget. The format which can be used to run gvim in a kpart widget. The format

View File

@@ -1,4 +1,4 @@
*vi_diff.txt* For Vim version 7.1. Last change: 2007 May 07 *vi_diff.txt* For Vim version 7.1. Last change: 2007 Aug 14
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -827,6 +827,8 @@ Only Vim is able to accept options in between and after the file names.
--socketid {id} Vim: GTK window socket to run Vim in --socketid {id} Vim: GTK window socket to run Vim in
--windowid {id} Vim: Win32 window ID to run Vim in
--version Vim: show version message and exit. --version Vim: show version message and exit.
-? Vile: print usage summary and exit. -? Vile: print usage summary and exit.

View File

@@ -876,7 +876,7 @@ EXTERN int Exec_reg INIT(= FALSE); /* TRUE when executing a register */
EXTERN int no_mapping INIT(= FALSE); /* currently no mapping allowed */ EXTERN int no_mapping INIT(= FALSE); /* currently no mapping allowed */
EXTERN int no_zero_mapping INIT(= 0); /* mapping zero not allowed */ EXTERN int no_zero_mapping INIT(= 0); /* mapping zero not allowed */
EXTERN int allow_keys INIT(= FALSE); /* allow key codes when no_mapping EXTERN int allow_keys INIT(= FALSE); /* allow key codes when no_mapping
* is set */ * is set */
EXTERN int no_u_sync INIT(= 0); /* Don't call u_sync() */ EXTERN int no_u_sync INIT(= 0); /* Don't call u_sync() */
EXTERN int restart_edit INIT(= 0); /* call edit when next cmd finished */ EXTERN int restart_edit INIT(= 0); /* call edit when next cmd finished */
@@ -1252,6 +1252,14 @@ EXTERN guint32 gtk_socket_id INIT(= 0);
EXTERN int echo_wid_arg INIT(= FALSE); /* --echo-wid argument */ EXTERN int echo_wid_arg INIT(= FALSE); /* --echo-wid argument */
#endif #endif
#ifdef FEAT_GUI_W32
/*
* The value of the --windowid argument.
* For embedding gvim inside another application.
*/
EXTERN int win_socket_id INIT(= 0);
#endif
#if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL) #if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL)
EXTERN int typebuf_was_filled INIT(= FALSE); /* received text from client EXTERN int typebuf_was_filled INIT(= FALSE); /* received text from client
or from feedkeys() */ or from feedkeys() */

View File

@@ -23,6 +23,8 @@
* e.g., replace LONG with LONG_PTR, etc. * e.g., replace LONG with LONG_PTR, etc.
*/ */
#include "vim.h"
/* /*
* These are new in Windows ME/XP, only defined in recent compilers. * These are new in Windows ME/XP, only defined in recent compilers.
*/ */
@@ -1432,16 +1434,29 @@ gui_mch_init(void)
} }
} }
else else
/* Open toplevel window. */ {
/* If the provided windowid is not valid reset it to zero, so that it
* is ignored and we open our own window. */
if (IsWindow((HWND)win_socket_id) <= 0)
win_socket_id = 0;
/* Create a window. If win_socket_id is not zero without border and
* titlebar, it will be reparented below. */
s_hwnd = CreateWindow( s_hwnd = CreateWindow(
szVimWndClass, "Vim MSWindows GUI", szVimWndClass, "Vim MSWindows GUI",
WS_OVERLAPPEDWINDOW, win_socket_id == 0 ? WS_OVERLAPPEDWINDOW : WS_POPUP,
gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x, gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x,
gui_win_y == -1 ? CW_USEDEFAULT : gui_win_y, gui_win_y == -1 ? CW_USEDEFAULT : gui_win_y,
100, /* Any value will do */ 100, /* Any value will do */
100, /* Any value will do */ 100, /* Any value will do */
NULL, NULL, NULL, NULL,
s_hinst, NULL); s_hinst, NULL);
if (s_hwnd != NULL && win_socket_id != 0)
{
SetParent(s_hwnd, (HWND)win_socket_id);
ShowWindow(s_hwnd, SW_SHOWMAXIMIZED);
}
}
if (s_hwnd == NULL) if (s_hwnd == NULL)
return FAIL; return FAIL;

View File

@@ -275,6 +275,7 @@ main
* -display or --display * -display or --display
* --server... * --server...
* --socketid * --socketid
* --windowid
*/ */
early_arg_scan(&params); early_arg_scan(&params);
@@ -1489,7 +1490,7 @@ parse_command_name(parmp)
* Get the name of the display, before gui_prepare() removes it from * Get the name of the display, before gui_prepare() removes it from
* argv[]. Used for the xterm-clipboard display. * argv[]. Used for the xterm-clipboard display.
* *
* Also find the --server... arguments and --socketid * Also find the --server... arguments and --socketid and --windowid
*/ */
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
@@ -1536,24 +1537,35 @@ early_arg_scan(parmp)
# endif # endif
} }
# endif # endif
# ifdef FEAT_GUI_GTK
# if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_W32)
# ifdef FEAT_GUI_W32
else if (STRICMP(argv[i], "--windowid") == 0)
# else
else if (STRICMP(argv[i], "--socketid") == 0) else if (STRICMP(argv[i], "--socketid") == 0)
# endif
{ {
unsigned int socket_id; unsigned int id;
int count; int count;
if (i == argc - 1) if (i == argc - 1)
mainerr_arg_missing((char_u *)argv[i]); mainerr_arg_missing((char_u *)argv[i]);
if (STRNICMP(argv[i+1], "0x", 2) == 0) if (STRNICMP(argv[i+1], "0x", 2) == 0)
count = sscanf(&(argv[i + 1][2]), "%x", &socket_id); count = sscanf(&(argv[i + 1][2]), "%x", &id);
else else
count = sscanf(argv[i+1], "%u", &socket_id); count = sscanf(argv[i+1], "%u", &id);
if (count != 1) if (count != 1)
mainerr(ME_INVALID_ARG, (char_u *)argv[i]); mainerr(ME_INVALID_ARG, (char_u *)argv[i]);
else else
gtk_socket_id = socket_id; # ifdef FEAT_GUI_W32
win_socket_id = id;
# else
gtk_socket_id = id;
# endif
i++; i++;
} }
# endif
# ifdef FEAT_GUI_GTK
else if (STRICMP(argv[i], "--echo-wid") == 0) else if (STRICMP(argv[i], "--echo-wid") == 0)
echo_wid_arg = TRUE; echo_wid_arg = TRUE;
# endif # endif
@@ -1683,8 +1695,12 @@ command_line_scan(parmp)
} }
} }
#endif #endif
#ifdef FEAT_GUI_GTK #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_W32)
# ifdef FEAT_GUI_GTK
else if (STRNICMP(argv[0] + argv_idx, "socketid", 8) == 0) else if (STRNICMP(argv[0] + argv_idx, "socketid", 8) == 0)
# else
else if (STRNICMP(argv[0] + argv_idx, "windowid", 8) == 0)
# endif
{ {
/* already processed -- snatch the following arg */ /* already processed -- snatch the following arg */
if (argc > 1) if (argc > 1)
@@ -1693,6 +1709,8 @@ command_line_scan(parmp)
++argv; ++argv;
} }
} }
#endif
#ifdef FEAT_GUI_GTK
else if (STRNICMP(argv[0] + argv_idx, "echo-wid", 8) == 0) else if (STRNICMP(argv[0] + argv_idx, "echo-wid", 8) == 0)
{ {
/* already processed, skip */ /* already processed, skip */
@@ -3120,6 +3138,7 @@ usage()
#endif #endif
#ifdef FEAT_GUI_W32 #ifdef FEAT_GUI_W32
main_msg(_("-P <parent title>\tOpen Vim inside parent application")); main_msg(_("-P <parent title>\tOpen Vim inside parent application"));
main_msg(_("--windowid <HWND>\tOpen Vim inside another win32 widget"));
#endif #endif
#ifdef FEAT_GUI_GNOME #ifdef FEAT_GUI_GNOME

View File

@@ -666,6 +666,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
91,
/**/ /**/
90, 90,
/**/ /**/