sponsor Vim development Vim logo Vim Book Ad

gtkvim.tgz : GTK+ widget interface to gvim

 script karma  Rating 14/7, Downloaded by 1758  Comments, bugs, improvements  Vim wiki

created by
Neil Bird
 
script type
utility
 
description
C source to 'GtkVim' widget, which embeds a gvim into your application as if it were a normal widget (actually runs a gvim as another process, displaying in your widget via a GtkSocket).

The current version is for GTK2, and unfortunately requires a pached vim.  This is pending, should make it into vim 7.0 in some fashion, and may even make it into 6.4.  I'll update this note as and when a decision is made.

Next step I guess is to extend GtkVim to be a full Bonobo (?) widget to allow more flexible use in applications which support that (like evolution, I think).

==== Old GTK1 notes ====

Versions 1.x require a GTK+ gvim 6.0 and probably GTK+ 1.2.8 or later.

If you have focusing problems, you may also require the following patch to your GTK libraries (inc. the latest [at time of writing] 1.2.10) for automatic focusing (e.g., upon <Tab>) to work correctly.  Point-and-click activation will still work OK without this patch.

Currently still /not/ working is the ability to set the GtkVim widget's focus at startup (gtk_widget_grab_focus() or gtk_window_set_focus()).

--- gtk/gtkwindow.c.focus Fri Mar  9 18:39:16 2001
+++ gtk/gtkwindow.c Thu Jul  5 10:34:00 2001
@@ -985,7 +985,13 @@
       break;
     case EnterNotify:
     case LeaveNotify:
-      if (xev->xcrossing.detail != NotifyInferior &&
+      /* We only track the actual destination of keyboard events for real
+       * toplevels, not for embedded toplevels such as GtkPlug. The reason for
+       * this is that GtkPlug redirects events so the widget may effectively not
+       * have the focus even if it actually has the focus.
+       */
+      if (gdk_window_get_parent (GTK_WIDGET (window)->window) == GDK_ROOT_PARENT () &&
+   xev->xcrossing.detail != NotifyInferior &&
  xev->xcrossing.focus && !window->window_has_focus)
{
  window->window_has_pointer_focus = (xev->xany.type == EnterNotify) ? TRUE : FALSE;
 
install details
Unpack the tgz file ('tar zxf gtkvim.tgz') somewhere and 'make' in the new directory it creates.  Sorry, no configure or anything, but it's pretty minimalist so shouldn't cause any problems.

Link the gtkvim.o with your app.  See included example cadged from the GTK+ release ('rangewidgets').
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
gtkvim.tgz 2.0 2006-03-17 6.0 Neil Bird Updated to build against GTK2 by default.
gtkvim.tgz 1.7 2002-02-08 6.0 Neil Bird Fixed coredump due to incorrectly initialised string (Evan Martin).

gtkvim.tgz 1.6 2001-12-03 6.0 Neil Bird Initial upload
ip used for rating: 18.118.166.98

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github