Mercurial > vim
diff src/channel.c @ 8218:3456e2ebebd4 v7.4.1402
commit https://github.com/vim/vim/commit/9892189d2e7ab94b750f99e6da4cbfc3c8014517
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 23 17:14:37 2016 +0100
patch 7.4.1402
Problem: GTK 3 is not supported.
Solution: Add GTK 3 support. (Kazunobu Kuriyama)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 23 Feb 2016 17:15:05 +0100 |
parents | b717dae2f26d |
children | 4f0677020a43 |
line wrap: on
line diff
--- a/src/channel.c +++ b/src/channel.c @@ -361,6 +361,17 @@ messageFromNetbeans(XtPointer clientData #endif #ifdef FEAT_GUI_GTK +# if GTK_CHECK_VERSION(3,0,0) + static gboolean +messageFromNetbeans(GIOChannel *unused1 UNUSED, + GIOCondition unused2 UNUSED, + gpointer clientData) +{ + channel_read_fd(GPOINTER_TO_INT(clientData)); + return TRUE; /* Return FALSE instead in case the event source is to + * be removed after this function returns. */ +} +# else static void messageFromNetbeans(gpointer clientData, gint unused1 UNUSED, @@ -368,6 +379,7 @@ messageFromNetbeans(gpointer clientData, { channel_read_fd((int)(long)clientData); } +# endif #endif static void @@ -388,12 +400,27 @@ channel_gui_register_one(channel_T *chan /* Tell gdk we are interested in being called when there * is input on the editor connection socket. */ if (channel->ch_part[part].ch_inputHandler == 0) +# if GTK_CHECK_VERSION(3,0,0) + { + GIOChannel *chnnl = g_io_channel_unix_new( + (gint)channel->ch_part[part].ch_fd); + + channel->ch_part[part].ch_inputHandler = g_io_add_watch( + chnnl, + G_IO_IN|G_IO_HUP|G_IO_ERR|G_IO_PRI, + messageFromNetbeans, + GINT_TO_POINTER(channel->ch_part[part].ch_fd)); + + g_io_channel_unref(chnnl); + } +# else channel->ch_part[part].ch_inputHandler = gdk_input_add( (gint)channel->ch_part[part].ch_fd, (GdkInputCondition) ((int)GDK_INPUT_READ + (int)GDK_INPUT_EXCEPTION), messageFromNetbeans, (gpointer)(long)channel->ch_part[part].ch_fd); +# endif # else # ifdef FEAT_GUI_W32 /* Tell Windows we are interested in receiving message when there @@ -457,7 +484,11 @@ channel_gui_unregister(channel_T *channe # ifdef FEAT_GUI_GTK if (channel->ch_part[part].ch_inputHandler != 0) { +# if GTK_CHECK_VERSION(3,0,0) + g_source_remove(channel->ch_part[part].ch_inputHandler); +# else gdk_input_remove(channel->ch_part[part].ch_inputHandler); +# endif channel->ch_part[part].ch_inputHandler = 0; } # else @@ -606,7 +637,7 @@ channel_open( fd_set wfds; #if defined(__APPLE__) && __APPLE__ == 1 # define PASS_RFDS - fd_set rfds; + fd_set rfds; FD_ZERO(&rfds); FD_SET(sd, &rfds);