summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-01-27 21:08:18 +0100
committerBram Moolenaar <Bram@vim.org>2016-01-27 21:08:18 +0100
commit85be35f33ea848b50e84d57321a45ebfedfad669 (patch)
tree4050b6acf9cc67bb16118cd680ae7a482bf83701
parent4a1314cb9c1847dc32ceeb3eebeae123ef10b16e (diff)
downloadvim-85be35f33ea848b50e84d57321a45ebfedfad669.zip
patch 7.4.1187
Problem: MS-Windows channel code only supports one channel. Doesn't build without netbeans support. Solution: Get the channel index from the socket in the message. Closes #600.
-rw-r--r--src/channel.c19
-rw-r--r--src/gui_w48.c6
-rw-r--r--src/netbeans.c8
-rw-r--r--src/proto/channel.pro1
-rw-r--r--src/proto/netbeans.pro1
-rw-r--r--src/version.c2
6 files changed, 25 insertions, 12 deletions
diff --git a/src/channel.c b/src/channel.c
index d57c24fa4..fc738c522 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -207,7 +207,6 @@ channel_gui_register(int idx)
/*
* Tell Windows we are interested in receiving message when there
* is input on the editor connection socket.
- * TODO: change WM_NETBEANS to something related to the channel index.
*/
if (channel->ch_inputHandler == -1)
channel->ch_inputHandler =
@@ -648,6 +647,24 @@ channel_read(int idx)
#endif
}
+# if defined(FEAT_GUI_W32) || defined(PROTO)
+/*
+ * Lookup the channel index from the socket.
+ * Returns -1 when the socket isn't found.
+ */
+ int
+channel_socket2idx(sock_T fd)
+{
+ int i;
+
+ if (fd >= 0)
+ for (i = 0; i < channel_count; ++i)
+ if (channels[i].ch_fd == fd)
+ return i;
+ return -1;
+}
+# endif
+
/*
* Write "buf" (NUL terminated string) to channel "idx".
* When "fun" is not NULL an error message might be given.
diff --git a/src/gui_w48.c b/src/gui_w48.c
index 6da1c636c..41fec1b8e 100644
--- a/src/gui_w48.c
+++ b/src/gui_w48.c
@@ -1782,8 +1782,10 @@ process_message(void)
#ifdef FEAT_CHANNEL
if (msg.message == WM_NETBEANS)
{
- /* TODO: channel_read(idx) */
- netbeans_read();
+ int channel_idx = channel_socket2idx((sock_T)msg.wParam);
+
+ if (channel_idx >= 0)
+ channel_read(channel_idx);
return;
}
#endif
diff --git a/src/netbeans.c b/src/netbeans.c
index 09d3d9bc0..0db0eaa3e 100644
--- a/src/netbeans.c
+++ b/src/netbeans.c
@@ -427,14 +427,6 @@ netbeans_parse_messages(void)
}
}
-/* TODO: remove */
- void
-netbeans_read()
-{
- if (nb_channel_idx >= 0)
- channel_read(nb_channel_idx);
-}
-
/*
* Handle one NUL terminated command.
*
diff --git a/src/proto/channel.pro b/src/proto/channel.pro
index fa1b9e29b..1cdef5e58 100644
--- a/src/proto/channel.pro
+++ b/src/proto/channel.pro
@@ -9,6 +9,7 @@ char_u *channel_get(int idx);
int channel_collapse(int idx);
void channel_clear(int idx);
void channel_read(int idx);
+int channel_socket2idx(sock_T fd);
void channel_send(int idx, char_u *buf, char *fun);
int channel_poll_setup(int nfd_in, void *fds_in);
int channel_poll_check(int ret_in, void *fds_in);
diff --git a/src/proto/netbeans.pro b/src/proto/netbeans.pro
index b01bf02ed..2df71a11a 100644
--- a/src/proto/netbeans.pro
+++ b/src/proto/netbeans.pro
@@ -1,6 +1,5 @@
/* netbeans.c */
void netbeans_parse_messages(void);
-void netbeans_read(void);
int isNetbeansBuffer(buf_T *bufp);
int isNetbeansModified(buf_T *bufp);
void netbeans_end(void);
diff --git a/src/version.c b/src/version.c
index 487dfd9c4..5a8a39c3c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1187,
+/**/
1186,
/**/
1185,