Editres support for GTK+

Editres is a utility that is part of most distributions of the X Window System. In Fedora Core 5, for example, it's available in the xorg-x11-resutils package. Editres communicates with suitably enabled applications using the editres protocol.

Some features of editres are:

Full details of the facilities provided by editres and instructions on using it can be found in the man page.

To make an application understand the editres protocol it needs to have a client event handler installed. An implementation of this event handler for Xt widgets is available in the Xmu library.

Since GTK+ is not based on Xt it isn't possible to use the functions in Xmu to enable editres support in GTK+ applications. I've written a set of functions, based on the code in Xmu, to add editres protocol support to GTK+ applications. Source code is available here: gtk_editres-0.9.0.tgz.

To enable editres protocol support in a GTK+ application you should include the gtk_editres.h include file and register the function gtk_editres_check_messages on each top-level window that you want to communicate with. For example:

   #include <gtk_editres.h>

   ...

   g_signal_connect(GTK_OBJECT(window),
                     "client-event",
                     GTK_SIGNAL_FUNC(gtk_editres_check_messages),
                     NULL);

The screenshot below shows a modified version of gcalctool interacting with editres.

The displayitem widget has been selected in the hierarchy and is being flashed in the application. The labels of the number buttons have been changed to show textual representations of the numbers. The visible property of the backspace button has been changed to FALSE.


Ron Yorston
6th August 2006