1
0
forked from aniani/vim

Included the patch to support netbeans in a terminal.

This commit is contained in:
Bram Moolenaar
2010-05-22 18:28:27 +02:00
parent ca7e1f2066
commit 67c5384434
18 changed files with 369 additions and 235 deletions

View File

@@ -115,9 +115,8 @@ the required features succeeds.
In case you do not want the NetBeans interface you can disable it by In case you do not want the NetBeans interface you can disable it by
uncommenting a line with "--disable-netbeans" in the Makefile. uncommenting a line with "--disable-netbeans" in the Makefile.
Currently, only GVim is supported in this integration as NetBeans does not Currently the NetBeans interface is supported by Vim running in a terminal and
have means to supply a terminal emulator for the Vim command. Furthermore, by GVim when it is run with one of the following GUIs: GTK, GNOME, and Motif.
there is only GUI support for GTK, GNOME, and Motif.
If Motif support is required the user must supply XPM libraries. See If Motif support is required the user must supply XPM libraries. See
|workshop-xpm| for details on obtaining the latest version of XPM. |workshop-xpm| for details on obtaining the latest version of XPM.
@@ -151,6 +150,12 @@ Region is guarded, cannot modify
which you cannot change. Also sets the current buffer, if which you cannot change. Also sets the current buffer, if
necessary. necessary.
*E532*
The defineAnnoType highlighting color name is too long
The maximum length of the "fg" or "bg" color argument in the
defineAnnoType command is 32 characters.
New in version 2.5.
*E656* *E656*
Writes of unmodified buffers forbidden Writes of unmodified buffers forbidden
Writes of unmodified buffers that were opened from the Writes of unmodified buffers that were opened from the
@@ -236,8 +241,8 @@ problems and has been fixed in 2.2. To decrease the likelihood of this
confusion happening again, netbeans_saved() has been renamed to confusion happening again, netbeans_saved() has been renamed to
netbeans_save_buffer(). netbeans_save_buffer().
We are now at version 2.4. For the differences between 2.3 and 2.4 search for We are now at version 2.5. For the differences between 2.4 and 2.5 search for
"2.4" below. "2.5" below.
The messages are currently sent over a socket. Since the messages are in The messages are currently sent over a socket. Since the messages are in
plain UTF-8 text this protocol could also be used with any other communication plain UTF-8 text this protocol could also be used with any other communication
@@ -304,8 +309,11 @@ boolean Argument with two possible values:
number Argument with a decimal number. number Argument with a decimal number.
optnum Argument with either a decimal number or "none" (without the color Argument with either a decimal number, "none" (without the
quotes). quotes) or the name of a color (without the quotes) defined
both in the color list in|highlight-ctermfg| and in the color
list in|gui-colors|.
New in version 2.5.
offset A number argument that indicates a byte position in a buffer. offset A number argument that indicates a byte position in a buffer.
The first byte has offset zero. Line breaks are counted for The first byte has offset zero. Line breaks are counted for
@@ -366,9 +374,14 @@ defineAnnoType typeNum typeName tooltip glyphFile fg bg
typeName string name that identifies this annotation typeName string name that identifies this annotation
tooltip string not used tooltip string not used
glyphFile string name of icon file glyphFile string name of icon file
fg optnum foreground color for line highlighting fg color foreground color for line highlighting
bg optnum background color for line highlighting bg color background color for line highlighting
Vim will define a sign for the annotation. Vim will define a sign for the annotation.
When color is a number, this is the "#rrggbb" Red, Green and
Blue values of the color (see |gui-colors|) and the
highlighting is only defined for GVim.
When color is a name, this color is defined both for Vim
running in a color terminal and for GVim.
When both "fg" and "bg" are "none" no line highlighting is When both "fg" and "bg" are "none" no line highlighting is
used (new in version 2.1). used (new in version 2.1).
When "glyphFile" is empty, no text sign is used (new in When "glyphFile" is empty, no text sign is used (new in
@@ -432,6 +445,7 @@ putBufferNumber pathname
New in version 2.1. New in version 2.1.
raise Bring the editor to the foreground. raise Bring the editor to the foreground.
Only when Vim is run with a GUI.
New in version 2.1. New in version 2.1.
removeAnno serNum removeAnno serNum
@@ -521,6 +535,7 @@ showBalloon text
Show a balloon (popup window) at the mouse pointer position, Show a balloon (popup window) at the mouse pointer position,
containing "text", a string argument. The balloon should containing "text", a string argument. The balloon should
disappear when the mouse is moved more than a few pixels. disappear when the mouse is moved more than a few pixels.
Only when Vim is run with a GUI.
New in version 2.1. New in version 2.1.
specialKeys specialKeys
@@ -654,6 +669,7 @@ balloonText text
Used when 'ballooneval' is set and the mouse pointer rests on Used when 'ballooneval' is set and the mouse pointer rests on
some text for a moment. "text" is a string, the text under some text for a moment. "text" is a string, the text under
the mouse pointer. the mouse pointer.
Only when Vim is run with a GUI.
New in version 2.1. New in version 2.1.
buttonRelease button lnum col buttonRelease button lnum col
@@ -803,6 +819,13 @@ newDotAndMark, keyCommand and keyAtPos are generated (in this order).
NUL bytes are not possible. For editor -> IDE they will appear as NL NUL bytes are not possible. For editor -> IDE they will appear as NL
characters. For IDE -> editor they cannot be inserted. characters. For IDE -> editor they cannot be inserted.
A NetBeans session may be initiated with Vim running in a terminal, and
continued later in a GUI environment after running the |:gui|command. In this
case, the highlighting defined for the NetBeans annotations may be cleared
when the ":gui" command sources .gvimrc and this file loads a colorscheme
that runs the command ":highlight clear".
New in version 2.5.
============================================================================== ==============================================================================
9. Debugging NetBeans protocol *netbeans-debugging* 9. Debugging NetBeans protocol *netbeans-debugging*

View File

@@ -3786,7 +3786,7 @@ A jump table for the options with a short description can be found at |Q_op|.
global global
{not in Vi} {not in Vi}
{only available when compiled with |+xim| and {only available when compiled with |+xim| and
|+GUI_GTK|} |+GUI_GTK|} *E599*
Specifies the key that your Input Method in X-Windows uses for Specifies the key that your Input Method in X-Windows uses for
activation. When this is specified correctly, vim can fully control activation. When this is specified correctly, vim can fully control
IM with 'imcmdline', 'iminsert' and 'imsearch'. IM with 'imcmdline', 'iminsert' and 'imsearch'.

View File

@@ -3827,6 +3827,7 @@ E529 options.txt /*E529*
E53 pattern.txt /*E53* E53 pattern.txt /*E53*
E530 options.txt /*E530* E530 options.txt /*E530*
E531 options.txt /*E531* E531 options.txt /*E531*
E532 netbeans.txt /*E532*
E533 options.txt /*E533* E533 options.txt /*E533*
E534 options.txt /*E534* E534 options.txt /*E534*
E535 options.txt /*E535* E535 options.txt /*E535*
@@ -3899,6 +3900,7 @@ E595 options.txt /*E595*
E596 options.txt /*E596* E596 options.txt /*E596*
E597 options.txt /*E597* E597 options.txt /*E597*
E598 options.txt /*E598* E598 options.txt /*E598*
E599 options.txt /*E599*
E60 pattern.txt /*E60* E60 pattern.txt /*E60*
E600 eval.txt /*E600* E600 eval.txt /*E600*
E601 eval.txt /*E601* E601 eval.txt /*E601*

View File

@@ -1082,8 +1082,12 @@ restored. (Luc St-Louis)
Vim 7.3: Vim 7.3:
Patches to include: Patches to include:
- Patch to support netbeans in Unix console Vim. (Xavier de Gaye, 2009 Apr - nbstart command patch (Xavier de Gaye)
26) Now with Mercurial repository (2010 Jan 2) Keep nbkey as the first command in ex_cmds.h
NETBEANS_CLOSED -> NETBEANS_OPEN
netbeans_closed() -> netbeans_active()
do check netbeans_active() when calling netbeans_removed() et al.
- Include conceal patch? - Include conceal patch?
http://vince.negri.googlepages.com/ http://vince.negri.googlepages.com/
http://vim.wikia.com/wiki/Patch_to_conceal_parts_of_lines http://vim.wikia.com/wiki/Patch_to_conceal_parts_of_lines

View File

@@ -7170,6 +7170,18 @@ the buffer is marked as modified.
Added *added-7.3* Added *added-7.3*
----- -----
Added the 'relativenumber' option. (Markus Heidelberg)
Support for Blowfish encryption. Added the 'cryptmethod' option.
Mostly by Moshin Ahmed.
Added support for NetBeans in a terminal. (Xavier de Gaye)
More floating point functions: acos(), asin(), atan2(), cosh(), exp(), fmod(),
log(), sinh(), tan(), tanh(). (Bill McCarthy)
gettabvar() and settabvar() functions. (Yegappan Lakshmanan)
New syntax files: New syntax files:
TODO TODO
@@ -7181,18 +7193,8 @@ TODO
Breton. (Dominique Pelle) Breton. (Dominique Pelle)
Added the 'relativenumber' option. (Markus Heidelberg)
Support for Blowfish encryption. Added the 'cryptmethod' option.
Mostly by Moshin Ahmed.
Support GDK_SUPER_MASK for GTK on Mac. (Stephan Schulz) Support GDK_SUPER_MASK for GTK on Mac. (Stephan Schulz)
More floating point functions: acos(), asin(), atan2(), cosh(), exp(), fmod(),
log(), sinh(), tan(), tanh(). (Bill McCarthy)
gettabvar() and settabvar() functions. (Yegappan Lakshmanan)
Fixed *fixed-7.3* Fixed *fixed-7.3*
----- -----

View File

@@ -9433,8 +9433,7 @@ ins_tab()
#ifdef FEAT_NETBEANS_INTG #ifdef FEAT_NETBEANS_INTG
if (usingNetbeans) if (usingNetbeans)
{ {
netbeans_removed(curbuf, fpos.lnum, cursor->col, netbeans_removed(curbuf, fpos.lnum, cursor->col, (long)(i + 1));
(long)(i + 1));
netbeans_inserted(curbuf, fpos.lnum, cursor->col, netbeans_inserted(curbuf, fpos.lnum, cursor->col,
(char_u *)"\t", 1); (char_u *)"\t", 1);
} }

View File

@@ -3815,10 +3815,10 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
DO_AUTOCHDIR DO_AUTOCHDIR
#if defined(FEAT_SUN_WORKSHOP) || defined(FEAT_NETBEANS_INTG) #if defined(FEAT_SUN_WORKSHOP) || defined(FEAT_NETBEANS_INTG)
if (gui.in_use && curbuf->b_ffname != NULL) if (curbuf->b_ffname != NULL)
{ {
# ifdef FEAT_SUN_WORKSHOP # ifdef FEAT_SUN_WORKSHOP
if (usingSunWorkShop) if (gui.in_use && usingSunWorkShop)
workshop_file_opened((char *)curbuf->b_ffname, curbuf->b_p_ro); workshop_file_opened((char *)curbuf->b_ffname, curbuf->b_p_ro);
# endif # endif
# ifdef FEAT_NETBEANS_INTG # ifdef FEAT_NETBEANS_INTG

View File

@@ -1193,11 +1193,9 @@
#endif #endif
/* /*
* The Netbeans features currently only work with Motif and GTK and Win32. * The Netbeans feature requires +listcmds and +eval.
* It also requires +listcmds and +eval.
*/ */
#if ((!defined(FEAT_GUI_MOTIF) && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_W32)) \ #if (!defined(FEAT_LISTCMDS) || !defined(FEAT_EVAL)) \
|| !defined(FEAT_LISTCMDS) || !defined(FEAT_EVAL)) \
&& defined(FEAT_NETBEANS_INTG) && defined(FEAT_NETBEANS_INTG)
# undef FEAT_NETBEANS_INTG # undef FEAT_NETBEANS_INTG
#endif #endif

View File

@@ -2941,7 +2941,8 @@ inchar(buf, maxlen, wait_time, tb_change_cnt)
#if defined(FEAT_NETBEANS_INTG) #if defined(FEAT_NETBEANS_INTG)
/* Process the queued netbeans messages. */ /* Process the queued netbeans messages. */
netbeans_parse_messages(); if (usingNetbeans)
netbeans_parse_messages();
#endif #endif
if (got_int || (script_char = getc(scriptin[curscript])) < 0) if (got_int || (script_char = getc(scriptin[curscript])) < 0)

View File

@@ -593,11 +593,6 @@ gui_init()
gui_mch_disable_beval_area(balloonEval); gui_mch_disable_beval_area(balloonEval);
#endif #endif
#ifdef FEAT_NETBEANS_INTG
if (starting == 0 && usingNetbeans)
/* Tell the client that it can start sending commands. */
netbeans_startup_done();
#endif
#if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
if (!im_xim_isvalid_imactivate()) if (!im_xim_isvalid_imactivate())
EMSG(_("E599: Value of 'imactivatekey' is invalid")); EMSG(_("E599: Value of 'imactivatekey' is invalid"));
@@ -2367,7 +2362,8 @@ gui_outstr_nowrap(s, len, flags, fg, bg, back)
if (draw_sign) if (draw_sign)
/* Draw the sign on top of the spaces. */ /* Draw the sign on top of the spaces. */
gui_mch_drawsign(gui.row, col, gui.highlight_mask); gui_mch_drawsign(gui.row, col, gui.highlight_mask);
# ifdef FEAT_NETBEANS_INTG # if defined(FEAT_NETBEANS_INTG) && (defined(FEAT_GUI_MOTIF) \
|| defined(FEAT_GUI_GTK) || defined(FEAT_GUI_W32))
if (multi_sign) if (multi_sign)
netbeans_draw_multisign_indicator(gui.row); netbeans_draw_multisign_indicator(gui.row);
# endif # endif
@@ -4784,6 +4780,10 @@ ex_gui(eap)
* of the argument ending up after the shell prompt. */ * of the argument ending up after the shell prompt. */
msg_clr_eos_force(); msg_clr_eos_force();
gui_start(); gui_start();
#ifdef FEAT_NETBEANS_INTG
if (usingNetbeans)
netbeans_gui_register();
#endif
} }
if (!ends_excmd(*eap->arg)) if (!ends_excmd(*eap->arg))
ex_next(eap); ex_next(eap);

View File

@@ -6596,7 +6596,8 @@ gui_mch_wait_for_chars(long wtime)
#if defined(FEAT_NETBEANS_INTG) #if defined(FEAT_NETBEANS_INTG)
/* Process the queued netbeans messages. */ /* Process the queued netbeans messages. */
netbeans_parse_messages(); if (usingNetbeans)
netbeans_parse_messages();
#endif #endif
/* /*

View File

@@ -1732,7 +1732,7 @@ process_message(void)
#ifdef FEAT_NETBEANS_INTG #ifdef FEAT_NETBEANS_INTG
if (msg.message == WM_NETBEANS) if (msg.message == WM_NETBEANS)
{ {
messageFromNetbeansW32(); netbeans_read();
return; return;
} }
#endif #endif
@@ -1999,7 +1999,8 @@ gui_mch_wait_for_chars(int wtime)
#ifdef FEAT_NETBEANS_INTG #ifdef FEAT_NETBEANS_INTG
/* Process the queued netbeans messages. */ /* Process the queued netbeans messages. */
netbeans_parse_messages(); if (usingNetbeans)
netbeans_parse_messages();
#endif #endif
/* /*

View File

@@ -635,8 +635,8 @@ gui_x11_expose_cb(w, dud, event, dum)
gui_mch_update(); gui_mch_update();
} }
#if (defined(FEAT_NETBEANS_INTG) || defined(FEAT_SUN_WORKSHOP)) \ #if ((defined(FEAT_NETBEANS_INTG) || defined(FEAT_SUN_WORKSHOP)) \
|| defined(PROTO) && defined(FEAT_GUI_MOTIF)) || defined(PROTO)
/* /*
* This function fills in the XRectangle object with the current x,y * This function fills in the XRectangle object with the current x,y
* coordinates and height, width so that an XtVaSetValues to the same shell of * coordinates and height, width so that an XtVaSetValues to the same shell of
@@ -709,7 +709,7 @@ gui_x11_resize_window_cb(w, dud, event, dum)
workshop_frame_moved(rec.x, rec.y, rec.width, rec.height); workshop_frame_moved(rec.x, rec.y, rec.width, rec.height);
} }
#endif #endif
#ifdef FEAT_NETBEANS_INTG #if defined(FEAT_NETBEANS_INTG) && defined(FEAT_GUI_MOTIF)
if (usingNetbeans) if (usingNetbeans)
{ {
XRectangle rec; XRectangle rec;

View File

@@ -528,10 +528,6 @@ main
* Set the default values for the options that use Rows and Columns. * Set the default values for the options that use Rows and Columns.
*/ */
ui_get_shellsize(); /* inits Rows and Columns */ ui_get_shellsize(); /* inits Rows and Columns */
#ifdef FEAT_NETBEANS_INTG
if (usingNetbeans)
Columns += 2; /* leave room for glyph gutter */
#endif
win_init_size(); win_init_size();
#ifdef FEAT_DIFF #ifdef FEAT_DIFF
/* Set the 'diff' option now, so that it can be checked for in a .vimrc /* Set the 'diff' option now, so that it can be checked for in a .vimrc
@@ -937,8 +933,20 @@ main
#ifdef FEAT_NETBEANS_INTG #ifdef FEAT_NETBEANS_INTG
if (usingNetbeans) if (usingNetbeans)
{
# ifdef FEAT_GUI
# if !defined(FEAT_GUI_MOTIF) && !defined(FEAT_GUI_GTK) \
&& !defined(FEAT_GUI_W32)
if (gui.in_use)
{
mch_errmsg(_("netbeans is not supported with this GUI\n"));
mch_exit(2);
}
# endif
# endif
/* Tell the client that it can start sending commands. */ /* Tell the client that it can start sending commands. */
netbeans_startup_done(); netbeans_startup_done();
}
#endif #endif
TIME_MSG("before starting main loop"); TIME_MSG("before starting main loop");
@@ -1616,10 +1624,10 @@ early_arg_scan(parmp)
# endif # endif
# ifndef FEAT_NETBEANS_INTG # ifndef FEAT_NETBEANS_INTG
else if (strncmp(argv[i], "-nb", (size_t)3) == 0) else if (strncmp(argv[i], "-nb", (size_t)3) == 0)
{ {
mch_errmsg(_("'-nb' cannot be used: not enabled at compile time\n")); mch_errmsg(_("'-nb' cannot be used: not enabled at compile time\n"));
mch_exit(2); mch_exit(2);
} }
# endif # endif
} }
@@ -1879,6 +1887,16 @@ command_line_scan(parmp)
break; break;
case 'n': /* "-n" no swap file */ case 'n': /* "-n" no swap file */
#ifdef FEAT_NETBEANS_INTG
/* checking for "-nb", netbeans parameters */
if (argv[0][argv_idx] == 'b')
{
++usingNetbeans;
netbeansArg = argv[0];
argv_idx = -1; /* skip to next argument */
}
else
#endif
parmp->no_swap_file = TRUE; parmp->no_swap_file = TRUE;
break; break;

View File

@@ -61,10 +61,11 @@
#define GUARDED 10000 /* typenr for "guarded" annotation */ #define GUARDED 10000 /* typenr for "guarded" annotation */
#define GUARDEDOFFSET 1000000 /* base for "guarded" sign id's */ #define GUARDEDOFFSET 1000000 /* base for "guarded" sign id's */
#define MAX_COLOR_LENGTH 32 /* max length of color name in defineAnnoType */
/* The first implementation (working only with Netbeans) returned "1.1". The /* The first implementation (working only with Netbeans) returned "1.1". The
* protocol implemented here also supports A-A-P. */ * protocol implemented here also supports A-A-P. */
static char *ExtEdProtocolVersion = "2.4"; static char *ExtEdProtocolVersion = "2.5";
static long pos2off __ARGS((buf_T *, pos_T *)); static long pos2off __ARGS((buf_T *, pos_T *));
static pos_T *off2pos __ARGS((buf_T *, long)); static pos_T *off2pos __ARGS((buf_T *, long));
@@ -90,6 +91,11 @@ static void nb_parse_cmd __ARGS((char_u *));
static int nb_do_cmd __ARGS((int, char_u *, int, int, char_u *)); static int nb_do_cmd __ARGS((int, char_u *, int, int, char_u *));
static void nb_send __ARGS((char *buf, char *fun)); static void nb_send __ARGS((char *buf, char *fun));
/* TRUE when netbeans is running with a GUI. */
#ifdef FEAT_GUI
# define NB_HAS_GUI (gui.in_use || gui.starting)
#endif
#ifdef WIN64 #ifdef WIN64
typedef __int64 NBSOCK; typedef __int64 NBSOCK;
#else #else
@@ -110,16 +116,6 @@ extern HWND s_hwnd; /* Gvim's Window handle */
static int r_cmdno; /* current command number for reply */ static int r_cmdno; /* current command number for reply */
static int haveConnection = FALSE; /* socket is connected and static int haveConnection = FALSE; /* socket is connected and
initialization is done */ initialization is done */
#ifdef FEAT_GUI_MOTIF
static void netbeans_Xt_connect __ARGS((void *context));
#endif
#ifdef FEAT_GUI_GTK
static void netbeans_gtk_connect __ARGS((void));
#endif
#ifdef FEAT_GUI_W32
static void netbeans_w32_connect __ARGS((void));
#endif
static int dosetvisible = FALSE; static int dosetvisible = FALSE;
/* /*
@@ -130,101 +126,39 @@ static int dosetvisible = FALSE;
#endif #endif
/* Connect back to Netbeans process */ /* Connect back to Netbeans process */
#ifdef FEAT_GUI_MOTIF
static void
netbeans_Xt_connect(void *context)
{
netbeans_connect();
if (sd > 0)
{
/* tell notifier we are interested in being called
* when there is input on the editor connection socket
*/
inputHandler = XtAppAddInput((XtAppContext)context, sd,
(XtPointer)(XtInputReadMask + XtInputExceptMask),
messageFromNetbeans, NULL);
}
}
static void static void
netbeans_disconnect(void) netbeans_disconnect(void)
{ {
#ifdef FEAT_GUI_MOTIF
if (inputHandler != (XtInputId)NULL) if (inputHandler != (XtInputId)NULL)
{ {
XtRemoveInput(inputHandler); XtRemoveInput(inputHandler);
inputHandler = (XtInputId)NULL; inputHandler = (XtInputId)NULL;
} }
sd = -1; #else
haveConnection = FALSE; # ifdef FEAT_GUI_GTK
# ifdef FEAT_BEVAL
bevalServers &= ~BEVAL_NETBEANS;
# endif
}
#endif /* FEAT_MOTIF_GUI */
#ifdef FEAT_GUI_GTK
static void
netbeans_gtk_connect(void)
{
netbeans_connect();
if (sd > 0)
{
/*
* Tell gdk we are interested in being called when there
* is input on the editor connection socket
*/
inputHandler = gdk_input_add((gint)sd, (GdkInputCondition)
((int)GDK_INPUT_READ + (int)GDK_INPUT_EXCEPTION),
messageFromNetbeans, NULL);
}
}
static void
netbeans_disconnect(void)
{
if (inputHandler != 0) if (inputHandler != 0)
{ {
gdk_input_remove(inputHandler); gdk_input_remove(inputHandler);
inputHandler = 0; inputHandler = 0;
} }
sd = -1; # else
haveConnection = FALSE; # ifdef FEAT_GUI_W32
# ifdef FEAT_BEVAL
bevalServers &= ~BEVAL_NETBEANS;
# endif
}
#endif /* FEAT_GUI_GTK */
#if defined(FEAT_GUI_W32) || defined(PROTO)
static void
netbeans_w32_connect(void)
{
netbeans_connect();
if (sd > 0)
{
/*
* Tell Windows we are interested in receiving message when there
* is input on the editor connection socket
*/
inputHandler = WSAAsyncSelect(sd, s_hwnd, WM_NETBEANS, FD_READ);
}
}
static void
netbeans_disconnect(void)
{
if (inputHandler == 0) if (inputHandler == 0)
{ {
WSAAsyncSelect(sd, s_hwnd, 0, 0); WSAAsyncSelect(sd, s_hwnd, 0, 0);
inputHandler = -1; inputHandler = -1;
} }
# endif
# endif
#endif
sd = -1; sd = -1;
haveConnection = FALSE; haveConnection = FALSE;
# ifdef FEAT_BEVAL #ifdef FEAT_BEVAL
bevalServers &= ~BEVAL_NETBEANS; bevalServers &= ~BEVAL_NETBEANS;
# endif #endif
} }
#endif /* FEAT_GUI_W32 */
#define NB_DEF_HOST "localhost" #define NB_DEF_HOST "localhost"
#define NB_DEF_ADDR "3219" #define NB_DEF_ADDR "3219"
@@ -240,7 +174,7 @@ netbeans_connect(void)
u_short port; u_short port;
# else # else
int port; int port;
#endif # endif
#else #else
struct sockaddr_un server; struct sockaddr_un server;
#endif #endif
@@ -709,31 +643,35 @@ netbeans_parse_messages(void)
#define MAXMSGSIZE 4096 #define MAXMSGSIZE 4096
/* /*
* Read and process a command from netbeans. * Read a command from netbeans.
*/ */
#if defined(FEAT_GUI_W32) || defined(PROTO) #ifdef FEAT_GUI_MOTIF
/* Use this one when generating prototypes, the others are static. */
void
messageFromNetbeansW32()
#else
# ifdef FEAT_GUI_MOTIF
static void static void
messageFromNetbeans(XtPointer clientData UNUSED, messageFromNetbeans(XtPointer clientData UNUSED,
int *unused1 UNUSED, int *unused1 UNUSED,
XtInputId *unused2 UNUSED) XtInputId *unused2 UNUSED)
# endif {
# ifdef FEAT_GUI_GTK netbeans_read();
}
#endif
#ifdef FEAT_GUI_GTK
static void static void
messageFromNetbeans(gpointer clientData UNUSED, messageFromNetbeans(gpointer clientData UNUSED,
gint unused1 UNUSED, gint unused1 UNUSED,
GdkInputCondition unused2 UNUSED) GdkInputCondition unused2 UNUSED)
# endif {
netbeans_read();
}
#endif #endif
void
netbeans_read()
{ {
static char_u *buf = NULL; static char_u *buf = NULL;
int len = 0; int len = 0;
int readlen = 0; int readlen = 0;
#ifndef FEAT_GUI_GTK #if defined(NB_HAS_GUI) && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_W32)
static int level = 0; static int level = 0;
#endif #endif
#ifdef HAVE_SELECT #ifdef HAVE_SELECT
@@ -751,8 +689,11 @@ messageFromNetbeans(gpointer clientData UNUSED,
return; return;
} }
#ifndef FEAT_GUI_GTK #if defined(NB_HAS_GUI) && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_W32)
++level; /* recursion guard; this will be called from the X event loop */ /* recursion guard; this will be called from the X event loop at unknown
* moments */
if (NB_HAS_GUI)
++level;
#endif #endif
/* Allocate a buffer to read into. */ /* Allocate a buffer to read into. */
@@ -770,17 +711,17 @@ messageFromNetbeans(gpointer clientData UNUSED,
{ {
#ifdef HAVE_SELECT #ifdef HAVE_SELECT
FD_ZERO(&rfds); FD_ZERO(&rfds);
FD_SET(sd, &rfds); FD_SET(sd, &rfds);
tval.tv_sec = 0; tval.tv_sec = 0;
tval.tv_usec = 0; tval.tv_usec = 0;
if (select(sd + 1, &rfds, NULL, NULL, &tval) <= 0) if (select(sd + 1, &rfds, NULL, NULL, &tval) <= 0)
break; break;
#else #else
# ifdef HAVE_POLL # ifdef HAVE_POLL
fds.fd = sd; fds.fd = sd;
fds.events = POLLIN; fds.events = POLLIN;
if (poll(&fds, 1, 0) <= 0) if (poll(&fds, 1, 0) <= 0)
break; break;
# endif # endif
#endif #endif
len = sock_read(sd, buf, MAXMSGSIZE); len = sock_read(sd, buf, MAXMSGSIZE);
@@ -807,18 +748,21 @@ messageFromNetbeans(gpointer clientData UNUSED,
return; /* don't try to parse it */ return; /* don't try to parse it */
} }
#if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_W32) #if defined(NB_HAS_GUI) && !defined(FEAT_GUI_W32)
/* Let the main loop handle messages. */ /* Let the main loop handle messages. */
if (NB_HAS_GUI)
{
# ifdef FEAT_GUI_GTK # ifdef FEAT_GUI_GTK
if (gtk_main_level() > 0) if (gtk_main_level() > 0)
gtk_main_quit(); gtk_main_quit();
# endif # else
#else /* Parse the messages now, but avoid recursion. */
/* Parse the messages now, but avoid recursion. */ if (level == 1)
if (level == 1) netbeans_parse_messages();
netbeans_parse_messages();
--level; --level;
# endif
}
#endif #endif
} }
@@ -945,7 +889,7 @@ static int globalsignmapused;
static int mapsigntype __ARGS((nbbuf_T *, int localsigntype)); static int mapsigntype __ARGS((nbbuf_T *, int localsigntype));
static void addsigntype __ARGS((nbbuf_T *, int localsigntype, char_u *typeName, static void addsigntype __ARGS((nbbuf_T *, int localsigntype, char_u *typeName,
char_u *tooltip, char_u *glyphfile, char_u *tooltip, char_u *glyphfile,
int usefg, int fg, int usebg, int bg)); char_u *fg, char_u *bg));
static void print_read_msg __ARGS((nbbuf_T *buf)); static void print_read_msg __ARGS((nbbuf_T *buf));
static void print_save_msg __ARGS((nbbuf_T *buf, long nchars)); static void print_save_msg __ARGS((nbbuf_T *buf, long nchars));
@@ -1848,7 +1792,9 @@ nb_do_cmd(
buf->bufp = curbuf; buf->bufp = curbuf;
maketitle(); maketitle();
buf->insertDone = FALSE; buf->insertDone = FALSE;
#if defined(FEAT_MENU) && defined(FEAT_GUI)
gui_update_menus(0); gui_update_menus(0);
#endif
/* =====================================================================*/ /* =====================================================================*/
} }
else if (streq((char *)cmd, "insertDone")) else if (streq((char *)cmd, "insertDone"))
@@ -2012,7 +1958,9 @@ nb_do_cmd(
netbeansReadFile = 1; netbeansReadFile = 1;
buf->bufp = curbuf; buf->bufp = curbuf;
maketitle(); maketitle();
#if defined(FEAT_MENU) && defined(FEAT_GUI)
gui_update_menus(0); gui_update_menus(0);
#endif
/* =====================================================================*/ /* =====================================================================*/
} }
else if (streq((char *)cmd, "editFile")) else if (streq((char *)cmd, "editFile"))
@@ -2034,7 +1982,9 @@ nb_do_cmd(
#if defined(FEAT_TITLE) #if defined(FEAT_TITLE)
maketitle(); maketitle();
#endif #endif
#if defined(FEAT_MENU) && defined(FEAT_GUI)
gui_update_menus(0); gui_update_menus(0);
#endif
/* =====================================================================*/ /* =====================================================================*/
} }
else if (streq((char *)cmd, "setVisible")) else if (streq((char *)cmd, "setVisible"))
@@ -2058,17 +2008,21 @@ nb_do_cmd(
doupdate = 1; doupdate = 1;
dosetvisible = FALSE; dosetvisible = FALSE;
#ifdef FEAT_GUI
/* Side effect!!!. */ /* Side effect!!!. */
if (!gui.starting) if (!gui.starting)
gui_mch_set_foreground(); gui_mch_set_foreground();
#endif
} }
/* =====================================================================*/ /* =====================================================================*/
} }
else if (streq((char *)cmd, "raise")) else if (streq((char *)cmd, "raise"))
{ {
#ifdef FEAT_GUI
/* Bring gvim to the foreground. */ /* Bring gvim to the foreground. */
if (!gui.starting) if (!gui.starting)
gui_mch_set_foreground(); gui_mch_set_foreground();
#endif
/* =====================================================================*/ /* =====================================================================*/
} }
else if (streq((char *)cmd, "setModified")) else if (streq((char *)cmd, "setModified"))
@@ -2199,8 +2153,10 @@ nb_do_cmd(
update_screen(VALID); update_screen(VALID);
setcursor(); setcursor();
out_flush(); out_flush();
#ifdef FEAT_GUI
gui_update_cursor(TRUE, FALSE); gui_update_cursor(TRUE, FALSE);
gui_mch_flush(); gui_mch_flush();
#endif
/* Quit a hit-return or more prompt. */ /* Quit a hit-return or more prompt. */
if (State == HITRETURN || State == ASKMORE) if (State == HITRETURN || State == ASKMORE)
{ {
@@ -2237,7 +2193,9 @@ nb_do_cmd(
EMSG("E649: invalid buffer identifier in close"); EMSG("E649: invalid buffer identifier in close");
} }
nbdebug((" CLOSE %d: %s\n", bufno, name)); nbdebug((" CLOSE %d: %s\n", bufno, name));
#ifdef FEAT_GUI
need_mouse_correct = TRUE; need_mouse_correct = TRUE;
#endif
if (buf->bufp != NULL) if (buf->bufp != NULL)
do_buffer(DOBUF_WIPE, DOBUF_FIRST, FORWARD, do_buffer(DOBUF_WIPE, DOBUF_FIRST, FORWARD,
buf->bufp->b_fnum, TRUE); buf->bufp->b_fnum, TRUE);
@@ -2264,10 +2222,9 @@ nb_do_cmd(
char_u *tooltip; char_u *tooltip;
char_u *p; char_u *p;
char_u *glyphFile; char_u *glyphFile;
int use_fg = 0; int parse_error = FALSE;
int use_bg = 0; char_u *fg;
int fg = -1; char_u *bg;
int bg = -1;
if (buf == NULL) if (buf == NULL)
{ {
@@ -2290,33 +2247,32 @@ nb_do_cmd(
vim_free(p); vim_free(p);
args = skipwhite(args + 1); args = skipwhite(args + 1);
if (STRNCMP(args, "none", 4) == 0) p = skiptowhite(args);
args += 5; if (*p != NUL)
else
{ {
use_fg = 1; *p = NUL;
cp = (char *)args; p = skipwhite(p + 1);
fg = strtol(cp, &cp, 10);
args = (char_u *)cp;
} }
if (STRNCMP(args, "none", 4) == 0) fg = vim_strsave(args);
args += 5; bg = vim_strsave(p);
else if (STRLEN(fg) > MAX_COLOR_LENGTH || STRLEN(bg) > MAX_COLOR_LENGTH)
{ {
use_bg = 1; EMSG("E532: highlighting color name too long in defineAnnoType");
cp = (char *)args; vim_free(typeName);
bg = strtol(cp, &cp, 10); parse_error = TRUE;
args = (char_u *)cp;
} }
if (typeName != NULL && tooltip != NULL && glyphFile != NULL) else if (typeName != NULL && tooltip != NULL && glyphFile != NULL)
addsigntype(buf, typeNum, typeName, tooltip, glyphFile, addsigntype(buf, typeNum, typeName, tooltip, glyphFile, fg, bg);
use_fg, fg, use_bg, bg);
else else
vim_free(typeName); vim_free(typeName);
/* don't free typeName; it's used directly in addsigntype() */ /* don't free typeName; it's used directly in addsigntype() */
vim_free(fg);
vim_free(bg);
vim_free(tooltip); vim_free(tooltip);
vim_free(glyphFile); vim_free(glyphFile);
if (parse_error)
return FAIL;
#endif #endif
/* =====================================================================*/ /* =====================================================================*/
@@ -2588,8 +2544,10 @@ nb_do_cmd(
update_screen(NOT_VALID); update_screen(NOT_VALID);
setcursor(); setcursor();
out_flush(); out_flush();
#ifdef FEAT_GUI
gui_update_cursor(TRUE, FALSE); gui_update_cursor(TRUE, FALSE);
gui_mch_flush(); gui_mch_flush();
#endif
/* Quit a hit-return or more prompt. */ /* Quit a hit-return or more prompt. */
if (State == HITRETURN || State == ASKMORE) if (State == HITRETURN || State == ASKMORE)
{ {
@@ -2638,8 +2596,10 @@ coloncmd(char *cmd, ...)
setcursor(); /* restore the cursor position */ setcursor(); /* restore the cursor position */
out_flush(); /* make sure output has been written */ out_flush(); /* make sure output has been written */
#ifdef FEAT_GUI
gui_update_cursor(TRUE, FALSE); gui_update_cursor(TRUE, FALSE);
gui_mch_flush(); gui_mch_flush();
#endif
} }
@@ -2707,7 +2667,8 @@ nb_init_graphics(void)
if (!did_init) if (!did_init)
{ {
coloncmd(":highlight NBGuarded guibg=Cyan guifg=Black"); coloncmd(":highlight NBGuarded guibg=Cyan guifg=Black"
" ctermbg=LightCyan ctermfg=Black");
coloncmd(":sign define %d linehl=NBGuarded", GUARDED); coloncmd(":sign define %d linehl=NBGuarded", GUARDED);
did_init = TRUE; did_init = TRUE;
@@ -2785,7 +2746,7 @@ netbeans_keyname(int key, char *buf)
strcat(buf, name); strcat(buf, name);
} }
#ifdef FEAT_BEVAL #if defined(FEAT_BEVAL) || defined(PROTO)
/* /*
* Function to be called for balloon evaluation. Grabs the text under the * Function to be called for balloon evaluation. Grabs the text under the
* cursor and sends it to the debugger for evaluation. The debugger should * cursor and sends it to the debugger for evaluation. The debugger should
@@ -2829,6 +2790,64 @@ netbeans_beval_cb(
} }
#endif #endif
/*
* Return netbeans file descriptor.
*/
int
netbeans_filedesc (void)
{
return sd;
}
#if defined(FEAT_GUI) || defined(PROTO)
/*
* Register our file descriptor with the gui event handling system.
*/
void
netbeans_gui_register(void)
{
if (!NB_HAS_GUI)
return;
if (sd > 0)
{
# ifdef FEAT_GUI_MOTIF
/* tell notifier we are interested in being called
* when there is input on the editor connection socket
*/
if (inputHandler == (XtInputId)NULL)
inputHandler = XtAppAddInput((XtAppContext)app_context, sd,
(XtPointer)(XtInputReadMask + XtInputExceptMask),
messageFromNetbeans, NULL);
# else
# ifdef FEAT_GUI_GTK
/*
* Tell gdk we are interested in being called when there
* is input on the editor connection socket
*/
if (inputHandler == 0)
inputHandler = gdk_input_add((gint)sd, (GdkInputCondition)
((int)GDK_INPUT_READ + (int)GDK_INPUT_EXCEPTION),
messageFromNetbeans, NULL);
# else
# ifdef FEAT_GUI_W32
/*
* Tell Windows we are interested in receiving message when there
* is input on the editor connection socket
*/
if (inputHandler == -1)
inputHandler = WSAAsyncSelect(sd, s_hwnd, WM_NETBEANS, FD_READ);
# endif
# endif
# endif
}
# ifdef FEAT_BEVAL
bevalServers |= BEVAL_NETBEANS;
# endif
}
#endif
/* /*
* Tell netbeans that the window was opened, ready for commands. * Tell netbeans that the window was opened, ready for commands.
*/ */
@@ -2837,24 +2856,14 @@ netbeans_startup_done(void)
{ {
char *cmd = "0:startupDone=0\n"; char *cmd = "0:startupDone=0\n";
if (usingNetbeans) if (!usingNetbeans)
#ifdef FEAT_GUI_MOTIF
netbeans_Xt_connect(app_context);
#else
# ifdef FEAT_GUI_GTK
netbeans_gtk_connect();
# else
# ifdef FEAT_GUI_W32
netbeans_w32_connect();
# endif
# endif
#endif
if (!haveConnection)
return; return;
#ifdef FEAT_BEVAL netbeans_connect();
bevalServers |= BEVAL_NETBEANS; if (!haveConnection)
return;
#ifdef FEAT_GUI
netbeans_gui_register();
#endif #endif
nbdebug(("EVT: %s", cmd)); nbdebug(("EVT: %s", cmd));
@@ -3144,7 +3153,7 @@ netbeans_button_release(int button)
if (bufno >= 0 && curwin != NULL && curwin->w_buffer == curbuf) if (bufno >= 0 && curwin != NULL && curwin->w_buffer == curbuf)
{ {
int col = mouse_col - W_WINCOL(curwin) int col = mouse_col - W_WINCOL(curwin)
- ((curwin->w_p_nu || curwin->w_p_rnu) ? 9 : 1); - ((curwin->w_p_nu || curwin->w_p_rnu) ? 9 : 1);
long off = pos2off(curbuf, &curwin->w_cursor); long off = pos2off(curbuf, &curwin->w_cursor);
/* sync the cursor position */ /* sync the cursor position */
@@ -3404,7 +3413,6 @@ netbeans_gutter_click(linenr_T lnum)
} }
} }
/* /*
* Add a sign of the requested type at the requested location. * Add a sign of the requested type at the requested location.
* *
@@ -3427,14 +3435,12 @@ addsigntype(
char_u *typeName, char_u *typeName,
char_u *tooltip UNUSED, char_u *tooltip UNUSED,
char_u *glyphFile, char_u *glyphFile,
int use_fg, char_u *fg,
int fg, char_u *bg)
int use_bg,
int bg)
{ {
char fgbuf[32];
char bgbuf[32];
int i, j; int i, j;
int use_fg = (*fg && STRCMP(fg, "none") != 0);
int use_bg = (*bg && STRCMP(bg, "none") != 0);
for (i = 0; i < globalsignmapused; i++) for (i = 0; i < globalsignmapused; i++)
if (STRCMP(typeName, globalsignmap[i]) == 0) if (STRCMP(typeName, globalsignmap[i]) == 0)
@@ -3442,12 +3448,26 @@ addsigntype(
if (i == globalsignmapused) /* not found; add it to global map */ if (i == globalsignmapused) /* not found; add it to global map */
{ {
nbdebug(("DEFINEANNOTYPE(%d,%s,%s,%s,%d,%d)\n", nbdebug(("DEFINEANNOTYPE(%d,%s,%s,%s,%s,%s)\n",
typeNum, typeName, tooltip, glyphFile, fg, bg)); typeNum, typeName, tooltip, glyphFile, fg, bg));
if (use_fg || use_bg) if (use_fg || use_bg)
{ {
sprintf(fgbuf, "guifg=#%06x", fg & 0xFFFFFF); char fgbuf[2 * (8 + MAX_COLOR_LENGTH) + 1];
sprintf(bgbuf, "guibg=#%06x", bg & 0xFFFFFF); char bgbuf[2 * (8 + MAX_COLOR_LENGTH) + 1];
char *ptr;
int value;
value = strtol((char *)fg, &ptr, 10);
if (ptr != (char *)fg)
sprintf(fgbuf, "guifg=#%06x", value & 0xFFFFFF);
else
sprintf(fgbuf, "guifg=%s ctermfg=%s", fg, fg);
value = strtol((char *)bg, &ptr, 10);
if (ptr != (char *)bg)
sprintf(bgbuf, "guibg=#%06x", value & 0xFFFFFF);
else
sprintf(bgbuf, "guibg=%s ctermbg=%s", bg, bg);
coloncmd(":highlight NB_%s %s %s", typeName, (use_fg) ? fgbuf : "", coloncmd(":highlight NB_%s %s %s", typeName, (use_fg) ? fgbuf : "",
(use_bg) ? bgbuf : ""); (use_bg) ? bgbuf : "");
@@ -3674,7 +3694,8 @@ print_read_msg(buf)
} }
if (!buf->bufp->b_start_eol) if (!buf->bufp->b_start_eol)
{ {
STRCAT(IObuff, shortmess(SHM_LAST) ? _("[noeol]") : _("[Incomplete last line]")); STRCAT(IObuff, shortmess(SHM_LAST) ? _("[noeol]")
: _("[Incomplete last line]"));
c = TRUE; c = TRUE;
} }
msg_add_lines(c, (long)lnum, nchars); msg_add_lines(c, (long)lnum, nchars);
@@ -3689,8 +3710,9 @@ print_read_msg(buf)
/* /*
* Print a message after NetBeans writes the file. This message should be identical * Print a message after NetBeans writes the file. This message should be
* to the standard message a non-netbeans user would see when writing a file. * identical to the standard message a non-netbeans user would see when
* writing a file.
*/ */
static void static void
print_save_msg(buf, nchars) print_save_msg(buf, nchars)
@@ -3702,7 +3724,8 @@ print_save_msg(buf, nchars)
if (nchars >= 0) if (nchars >= 0)
{ {
msg_add_fname(buf->bufp, buf->bufp->b_ffname); /* fname in IObuff with quotes */ /* put fname in IObuff with quotes */
msg_add_fname(buf->bufp, buf->bufp->b_ffname);
c = FALSE; c = FALSE;
msg_add_lines(c, buf->bufp->b_ml.ml_line_count, msg_add_lines(c, buf->bufp->b_ml.ml_line_count,

View File

@@ -220,7 +220,7 @@ typedef struct
{ {
SmcConn smcconn; /* The SM connection ID */ SmcConn smcconn; /* The SM connection ID */
IceConn iceconn; /* The ICE connection ID */ IceConn iceconn; /* The ICE connection ID */
char *clientid; /* The client ID for the current smc session */ char *clientid; /* The client ID for the current smc session */
Bool save_yourself; /* If we're in the middle of a save_yourself */ Bool save_yourself; /* If we're in the middle of a save_yourself */
Bool shutdown; /* If we're in shutdown mode */ Bool shutdown; /* If we're in shutdown mode */
} xsmp_config_T; } xsmp_config_T;
@@ -366,6 +366,12 @@ mch_inchar(buf, maxlen, wtime, tb_change_cnt)
{ {
int len; int len;
#ifdef FEAT_NETBEANS_INTG
/* Process the queued netbeans messages. */
if (usingNetbeans)
netbeans_parse_messages();
#endif
/* Check if window changed size while we were busy, perhaps the ":set /* Check if window changed size while we were busy, perhaps the ":set
* columns=99" command was used. */ * columns=99" command was used. */
while (do_resize) while (do_resize)
@@ -378,6 +384,11 @@ mch_inchar(buf, maxlen, wtime, tb_change_cnt)
if (!do_resize) /* return if not interrupted by resize */ if (!do_resize) /* return if not interrupted by resize */
return 0; return 0;
handle_resize(); handle_resize();
#ifdef FEAT_NETBEANS_INTG
/* Process the queued netbeans messages. */
if (usingNetbeans)
netbeans_parse_messages();
#endif
} }
} }
else /* wtime == -1 */ else /* wtime == -1 */
@@ -407,12 +418,22 @@ mch_inchar(buf, maxlen, wtime, tb_change_cnt)
{ {
while (do_resize) /* window changed size */ while (do_resize) /* window changed size */
handle_resize(); handle_resize();
#ifdef FEAT_NETBEANS_INTG
/* Process the queued netbeans messages. */
if (usingNetbeans)
netbeans_parse_messages();
#endif
/* /*
* we want to be interrupted by the winch signal * we want to be interrupted by the winch signal
* or by an event on the monitored file descriptors
*/ */
WaitForChar(-1L); if (WaitForChar(-1L) == 0)
if (do_resize) /* interrupted by SIGWINCH signal */ {
continue; if (do_resize) /* interrupted by SIGWINCH signal */
handle_resize();
return 0;
}
/* If input was put directly in typeahead buffer bail out here. */ /* If input was put directly in typeahead buffer bail out here. */
if (typebuf_changed(tb_change_cnt)) if (typebuf_changed(tb_change_cnt))
@@ -1324,7 +1345,7 @@ catch_signals(func_deadly, func_other)
* return TRUE * return TRUE
* "when" == SIGNAL_BLOCK: Going to be busy, block signals * "when" == SIGNAL_BLOCK: Going to be busy, block signals
* "when" == SIGNAL_UNBLOCK: Going to wait, unblock signals, use postponed * "when" == SIGNAL_UNBLOCK: Going to wait, unblock signals, use postponed
* signal * signal
* Returns TRUE when Vim should exit. * Returns TRUE when Vim should exit.
*/ */
int int
@@ -4766,6 +4787,9 @@ RealWaitForChar(fd, msec, check_for_gpm)
int *check_for_gpm UNUSED; int *check_for_gpm UNUSED;
{ {
int ret; int ret;
#ifdef FEAT_NETBEANS_INTG
int nb_fd = (usingNetbeans ? netbeans_filedesc() : -1);
#endif
#if defined(FEAT_XCLIPBOARD) || defined(USE_XSMP) || defined(FEAT_MZSCHEME) #if defined(FEAT_XCLIPBOARD) || defined(USE_XSMP) || defined(FEAT_MZSCHEME)
static int busy = FALSE; static int busy = FALSE;
@@ -4815,7 +4839,7 @@ RealWaitForChar(fd, msec, check_for_gpm)
# endif # endif
#endif #endif
#ifndef HAVE_SELECT #ifndef HAVE_SELECT
struct pollfd fds[5]; struct pollfd fds[6];
int nfd; int nfd;
# ifdef FEAT_XCLIPBOARD # ifdef FEAT_XCLIPBOARD
int xterm_idx = -1; int xterm_idx = -1;
@@ -4825,6 +4849,9 @@ RealWaitForChar(fd, msec, check_for_gpm)
# endif # endif
# ifdef USE_XSMP # ifdef USE_XSMP
int xsmp_idx = -1; int xsmp_idx = -1;
# endif
# ifdef FEAT_NETBEANS_INTG
int nb_idx = -1;
# endif # endif
int towait = (int)msec; int towait = (int)msec;
@@ -4876,6 +4903,15 @@ RealWaitForChar(fd, msec, check_for_gpm)
nfd++; nfd++;
} }
# endif # endif
#ifdef FEAT_NETBEANS_INTG
if (nb_fd != -1)
{
nb_idx = nfd;
fds[nfd].fd = nb_fd;
fds[nfd].events = POLLIN;
nfd++;
}
#endif
ret = poll(fds, nfd, towait); ret = poll(fds, nfd, towait);
# ifdef FEAT_MZSCHEME # ifdef FEAT_MZSCHEME
@@ -4929,6 +4965,13 @@ RealWaitForChar(fd, msec, check_for_gpm)
finished = FALSE; /* Try again */ finished = FALSE; /* Try again */
} }
# endif # endif
#ifdef FEAT_NETBEANS_INTG
if (ret > 0 && nb_idx != -1 && fds[nb_idx].revents & POLLIN)
{
netbeans_read();
--ret;
}
#endif
#else /* HAVE_SELECT */ #else /* HAVE_SELECT */
@@ -5010,6 +5053,14 @@ RealWaitForChar(fd, msec, check_for_gpm)
maxfd = xsmp_icefd; maxfd = xsmp_icefd;
} }
# endif # endif
#ifdef FEAT_NETBEANS_INTG
if (nb_fd != -1)
{
FD_SET(nb_fd, &rfds);
if (maxfd < nb_fd)
maxfd = nb_fd;
}
#endif
# ifdef OLD_VMS # ifdef OLD_VMS
/* Old VMS as v6.2 and older have broken select(). It waits more than /* Old VMS as v6.2 and older have broken select(). It waits more than
@@ -5087,6 +5138,13 @@ RealWaitForChar(fd, msec, check_for_gpm)
} }
} }
# endif # endif
#ifdef FEAT_NETBEANS_INTG
if (ret > 0 && nb_fd != -1 && FD_ISSET(nb_fd, &rfds))
{
netbeans_read();
--ret;
}
#endif
#endif /* HAVE_SELECT */ #endif /* HAVE_SELECT */

View File

@@ -181,6 +181,16 @@ void qsort __ARGS((void *base, size_t elm_count, size_t elm_size, int (*cmp)(con
# include "if_ruby.pro" # include "if_ruby.pro"
# endif # endif
/* Ugly solution for "BalloonEval" not being defined while it's used in some
* .pro files. */
# ifndef FEAT_BEVAL
# define BalloonEval int
# endif
# ifdef FEAT_NETBEANS_INTG
# include "netbeans.pro"
# endif
# ifdef FEAT_GUI # ifdef FEAT_GUI
# include "gui.pro" # include "gui.pro"
# if defined(UNIX) || defined(MACOS) # if defined(UNIX) || defined(MACOS)
@@ -194,11 +204,6 @@ extern char_u *vimpty_getenv __ARGS((const char_u *string)); /* from pty.c */
# endif # endif
# ifdef FEAT_GUI_W16 # ifdef FEAT_GUI_W16
# include "gui_w16.pro" # include "gui_w16.pro"
# endif
/* Ugly solution for "BalloonEval" not being defined while it's used in
* the prototypes. */
# ifndef FEAT_BEVAL
# define BalloonEval int
# endif # endif
# ifdef FEAT_GUI_W32 # ifdef FEAT_GUI_W32
# include "gui_w32.pro" # include "gui_w32.pro"
@@ -232,9 +237,6 @@ extern char *vim_SelFile __ARGS((Widget toplevel, char *prompt, char *init_path,
# ifdef FEAT_SUN_WORKSHOP # ifdef FEAT_SUN_WORKSHOP
# include "workshop.pro" # include "workshop.pro"
# endif # endif
# ifdef FEAT_NETBEANS_INTG
# include "netbeans.pro"
# endif
# endif /* FEAT_GUI */ # endif /* FEAT_GUI */
# ifdef FEAT_OLE # ifdef FEAT_OLE

View File

@@ -1,11 +1,13 @@
/* netbeans.c */ /* netbeans.c */
void netbeans_parse_messages __ARGS((void)); void netbeans_parse_messages __ARGS((void));
void messageFromNetbeansW32 __ARGS((void)); void netbeans_read __ARGS((void));
int isNetbeansBuffer __ARGS((buf_T *bufp)); int isNetbeansBuffer __ARGS((buf_T *bufp));
int isNetbeansModified __ARGS((buf_T *bufp)); int isNetbeansModified __ARGS((buf_T *bufp));
void netbeans_end __ARGS((void)); void netbeans_end __ARGS((void));
void ex_nbkey __ARGS((exarg_T *eap)); void ex_nbkey __ARGS((exarg_T *eap));
void netbeans_beval_cb __ARGS((BalloonEval *beval, int state)); void netbeans_beval_cb __ARGS((BalloonEval *beval, int state));
int netbeans_filedesc __ARGS((void));
void netbeans_gui_register __ARGS((void));
void netbeans_startup_done __ARGS((void)); void netbeans_startup_done __ARGS((void));
void netbeans_send_disconnect __ARGS((void)); void netbeans_send_disconnect __ARGS((void));
void netbeans_frame_moved __ARGS((int new_x, int new_y)); void netbeans_frame_moved __ARGS((int new_x, int new_y));