Gtk-XEmacs Patches


This page is now of historical interest only. All the patches below have been incorporated into 21.4.16 and the 21.5 mainline. I have also been given write access to the XEmacs CVS repository so future GTK development will be added directly. Please follow xemacs-beta and xemacs-patches for the latest developments.


This page contains a collection of patches that improve the Gtk port of XEmacs and a list of outstanding bugs. It is a supplement to the main Gtk-XEmacs page.

Over the last few years the Gtk port has attracted very little development effort and as a result the version found in the beta releases of 21.5 is not much better than the experimental version released with 21.4. This page is an attempt to improve this situation by bringing together all patches, bug reports and ideas that are scattered sparsely through the mail archives.  In particular it contains all known Gtk specific patches for which the XEmacs Review Board have made no ruling (either for or against) plus descriptions of all outstanding Gtk related bugs.

If you are aware of any patches or bugs that are not in this list please let me know so that I can add them.


The patches listed here are unreviewed ones against the current development version of XEmacs. As a result they could quite possibly to eat your data, crash your machine, kick your dog or make demons fly out of your nose. Please use with appropriate care.


Note: The version and date found in the patch filename specifies which version of 21.5 the patch was made against.

1. Combined Patch

Patch: combined-patches-

This patch is the difference between the current XEmacs CVS head and the version of Gtk-XEmacs that I use regularly. It contains all of the patches below, some of my unreviewed MacOS X and Linux PPC fixes plus any other patches that I think are interesting. Only recommended if you happen to like my taste in XEmacs builds.

2. Background Fix

Patch: gtk-background-fix-

One of the visual problems with the Gtk port is the areas of grey background that appear at various points in an otherwise white frame.  This is particularly noticeable around the load and mail notification icons on the mode line:

Ugly Grey bar around the time and load average

It turns out that this is caused by two problems:

  1. Despite appearances the background colour of a Gtk frame is grey, not white, and this colour will appear wherever the background is not drawn by some face.  This is especially noticeable with XPM files that have regions of transparency (such as in the picture above) because in those cases the transparent areas will be filled with the window background colour. The solution here is to force the background of the frame to be white via the file etc/gtkrc.  This is the equivalent of adding the resource string '*.background: white' in the normal X case.
  2. XPM files can have symbolic colour names, which allows the application to change the color value at run time.  XEmacs provides access to this functionality from lisp via the variable xpm-color-symbols.  Unfortunately Gtk does not support symbolic names at all, only color values. The solution here is to rewrite the XPM data in memory to replace symbolic color entries with the real colors specified in xpm-color-symbols before passing the XPM to Gtk.  This patch also avoids the previous method of writing the XPM data to disk and using at Gtk function to read it back in again, a technique necessitated because of other Gtk XPM API limitations.

3. Menu/Button Mnemonic Support


This patch adds mnemonic support to menus and buttons. It also fixes cases where XEmacs dialog button accelerator escape characters leak through and appear in the button text, such as shown below:

It supports all of the existing X mnemonic functionality including support for menu-accelerator-enabled and making the first character of the text a mnemonic if an XEmacs accelerator escape is not supplied.

Note: The standard X port currently disables mnemonic support for dialog buttons. In a message that I posted here I suggested removing button mnemonic support from all ports because it is not seen by most users. However, once I realised that Gtk menus did not have mnemonic support either I changed my mind because it was easier to add button support, once menu support was in, than it was to remove button support from all ports.

4. Button Widget Crash Fix

Patch: [This patch has been accepted into 21.5]

This patch fixes a crash that occurs whenever a push-button widget is clicked.  The problem can be reproduced by pressing on any button widget (the "Done" button in a customize buffer is a good example).

The problem was that XEmacs was using the wrong Gtk macros when marshalling a lisp object into the return value for a signal callback function. As a result it was writing all over the stack and crashing.

It should be noted that the API that XEmacs is using to marshal in and out of Gtk callback functions is not documented at all so it is not surprising that the wrong macro was used!

Outstanding Bugs

1. Customize 'Done' button crash

(Fixed by the Button Widget Crash Fix patch above)

2. Gutter Broken

The gutter does not work at all. The buffer tabs either do not display or do not function and when the progress bar is displayed it is never cleaned up properly

3. XIM gets disabled

4. Memory Leak

This post and subsequent thread to xemacs-beta records a memory leak from an idle XEmacs running on Solaris. 

This may or may not be a GTK related problem, but it occurs under the GTK build so it will be recorded here.

Other Gtk Pages

1. RedHat Tracking Bug

RedHat has its own tracking bug for the GTK port.

Malcolm Purvis (