]> granicus.if.org Git - vim/commitdiff
patch 7.4.1187 v7.4.1187
authorBram Moolenaar <Bram@vim.org>
Wed, 27 Jan 2016 20:08:18 +0000 (21:08 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 27 Jan 2016 20:08:18 +0000 (21:08 +0100)
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.

src/channel.c
src/gui_w48.c
src/netbeans.c
src/proto/channel.pro
src/proto/netbeans.pro
src/version.c

index d57c24fa49af2ec9a75dae0a74237f503b82925a..fc738c522df10ba9fdc189ebd7cb70add13cc074 100644 (file)
@@ -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.
index 6da1c636cb012eed6e3e8f7b55aa214bc215c5b9..41fec1b8ecfed9a82c1b932ddcf666600ef6033b 100644 (file)
@@ -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
index 09d3d9bc0cf7c4b8c298f644c51ca14eea0cf6ba..0db0eaa3e3c1d01edb80fcfb4b1da12d6d71774d 100644 (file)
@@ -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.
  *
index fa1b9e29b0a47766a85ad3e727602af2e7be871c..1cdef5e58ffbab4cc4dfa951275ef75c1b52ef6b 100644 (file)
@@ -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);
index b01bf02ed19cc1edb69c2c42801eae0b0a6b917c..2df71a11afa7928db6f571735284b213d4f0594f 100644 (file)
@@ -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);
index 487dfd9c495d572a6aad89ffa3297c8faaf28caf..5a8a39c3c604e60bfa0ba18bcc0e61ee1c9d3ee1 100644 (file)
@@ -746,6 +746,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1187,
 /**/
     1186,
 /**/