1
0
forked from aniani/vim

patch 7.4.1402

Problem:    GTK 3 is not supported.
Solution:   Add GTK 3 support. (Kazunobu Kuriyama)
This commit is contained in:
Bram Moolenaar
2016-02-23 17:14:37 +01:00
parent 6bd364e084
commit 9892189d2e
20 changed files with 3086 additions and 86 deletions

View File

@@ -109,7 +109,11 @@
#endif
#if defined(FEAT_GUI_GTK) && defined(FEAT_XIM)
# include <gdk/gdkkeysyms.h>
# if GTK_CHECK_VERSION(3,0,0)
# include <gdk/gdkkeysyms-compat.h>
# else
# include <gdk/gdkkeysyms.h>
# endif
# ifdef WIN3264
# include <gdk/gdkwin32.h>
# else
@@ -4941,7 +4945,11 @@ xim_init(void)
#endif
g_return_if_fail(gui.drawarea != NULL);
#if GTK_CHECK_VERSION(3,0,0)
g_return_if_fail(gtk_widget_get_window(gui.drawarea) != NULL);
#else
g_return_if_fail(gui.drawarea->window != NULL);
#endif
xic = gtk_im_multicontext_new();
g_object_ref(xic);
@@ -4955,7 +4963,11 @@ xim_init(void)
g_signal_connect(G_OBJECT(xic), "preedit_end",
G_CALLBACK(&im_preedit_end_cb), NULL);
#if GTK_CHECK_VERSION(3,0,0)
gtk_im_context_set_client_window(xic, gtk_widget_get_window(gui.drawarea));
#else
gtk_im_context_set_client_window(xic, gui.drawarea->window);
#endif
}
void
@@ -5054,12 +5066,21 @@ im_synthesize_keypress(unsigned int keyval, unsigned int state)
# ifdef HAVE_GTK_MULTIHEAD
event = (GdkEventKey *)gdk_event_new(GDK_KEY_PRESS);
# if GTK_CHECK_VERSION(3,0,0)
g_object_ref(gtk_widget_get_window(gui.drawarea));
/* unreffed by gdk_event_free() */
# else
g_object_ref(gui.drawarea->window); /* unreffed by gdk_event_free() */
# endif
# else
event = (GdkEventKey *)g_malloc0((gulong)sizeof(GdkEvent));
event->type = GDK_KEY_PRESS;
# endif
# if GTK_CHECK_VERSION(3,0,0)
event->window = gtk_widget_get_window(gui.drawarea);
# else
event->window = gui.drawarea->window;
# endif
event->send_event = TRUE;
event->time = GDK_CURRENT_TIME;
event->state = state;