diff -NaurBb gtk+-2.6.10.old/gtk/Makefile.am gtk+-2.6.10/gtk/Makefile.am --- gtk+-2.6.10.old/gtk/Makefile.am 2005-08-18 16:10:56.000000000 +0200 +++ gtk+-2.6.10/gtk/Makefile.am 2005-12-29 01:23:52.000000000 +0100 @@ -520,6 +520,7 @@ gtkwidget.c \ gtkwindow-decorate.c \ gtkwindow.c \ + gpe-what.c \ xembed.h if OS_UNIX diff -NaurBb gtk+-2.6.10.old/gtk/gpe-what.c gtk+-2.6.10/gtk/gpe-what.c --- gtk+-2.6.10.old/gtk/gpe-what.c 1970-01-01 01:00:00.000000000 +0100 +++ gtk+-2.6.10/gtk/gpe-what.c 2005-12-29 00:59:26.000000000 +0100 @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2002, 2003 Philip Blundell + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include +#include +#include + +#include +#include + +#ifdef GDK_WINDOWING_X11 +#error X11 required +#endif + +#include "gtkwidget.h" +#include "gtktooltips.h" +#include "x11/gdkx.h" +#include "config.h" + +#include + +#define _(x) dgettext(GETTEXT_PACKAGE, x) + +static GdkAtom help_atom; +static gboolean gpe_what_initialised; + +static GSList *widgets; + +static void +send_text (Display *dpy, Window w, char *text) +{ + Atom help_xatom = gdk_x11_atom_to_xatom (help_atom); + + gdk_error_trap_push (); + + XChangeProperty (dpy, w, help_xatom, XA_STRING, 8, PropModeReplace, text, strlen (text)); + + XFlush (dpy); + + gdk_error_trap_pop (); +} + +static GdkFilterReturn +filter_func (GdkXEvent *xev, GdkEvent *ev, gpointer p) +{ + XClientMessageEvent *xc = (XClientMessageEvent *)xev; + GSList *list; + Window sender = xc->data.l[0]; + + for (list = widgets; list; list = list->next) + { + GtkWidget *widget = GTK_WIDGET (list->data); + int x = xc->data.l[1], y = xc->data.l[2]; + int ax, ay; + + if (!GTK_WIDGET_DRAWABLE (widget)) continue; + + if (GTK_WIDGET_NO_WINDOW (widget)) + { + ax = widget->allocation.x; + ay = widget->allocation.y; + } + else + { + ax = 0; + ay = 0; + } + + if (widget->window == ev->any.window + && x >= ax && x < ax + widget->allocation.width + && y >= ay && y < ay + widget->allocation.height) + { + GtkTooltipsData *data = gtk_tooltips_data_get (widget); + if (data) + { + send_text (GDK_WINDOW_XDISPLAY (widget->window), sender, + data->tip_private ? data->tip_private : data->tip_text); + return GDK_FILTER_CONTINUE; + } + } + } + + send_text (GDK_WINDOW_XDISPLAY (ev->any.window), sender, _("No help available.")); + + return GDK_FILTER_CONTINUE; +} + +void +gpe_what_mark_widget (GtkWidget *widget) +{ + if (!gpe_what_initialised) + { + help_atom = gdk_atom_intern ("_GPE_INTERACTIVE_HELP", FALSE); + + gdk_add_client_message_filter (help_atom, filter_func, NULL); + + gpe_what_initialised = TRUE; + } + + if (widget->window) + { + widgets = g_slist_prepend (widgets, widget); + + gdk_property_change (widget->window, + help_atom, + help_atom, + 8, + GDK_PROP_MODE_REPLACE, + NULL, + 0); + } + else + abort (); +} diff -NaurBb gtk+-2.6.10.old/gtk/gtkwidget.c gtk+-2.6.10/gtk/gtkwidget.c --- gtk+-2.6.10.old/gtk/gtkwidget.c 2005-08-18 16:10:59.000000000 +0200 +++ gtk+-2.6.10/gtk/gtkwidget.c 2005-12-29 00:59:26.000000000 +0100 @@ -2285,6 +2285,9 @@ g_signal_emit (widget, widget_signals[REALIZE], 0); + extern void gpe_what_mark_widget (GtkWidget *widget); + gpe_what_mark_widget (widget); + if (GTK_WIDGET_HAS_SHAPE_MASK (widget)) { shape_info = g_object_get_qdata (G_OBJECT (widget), quark_shape_info);