]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/gtk+/gtk+-2.6.10/help.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / gtk+ / gtk+-2.6.10 / help.patch
1 diff -NaurBb gtk+-2.6.10.old/gtk/Makefile.am gtk+-2.6.10/gtk/Makefile.am
2 --- gtk+-2.6.10.old/gtk/Makefile.am     2005-08-18 16:10:56.000000000 +0200
3 +++ gtk+-2.6.10/gtk/Makefile.am 2005-12-29 01:23:52.000000000 +0100
4 @@ -520,6 +520,7 @@
5         gtkwidget.c             \
6         gtkwindow-decorate.c    \
7         gtkwindow.c             \
8 +       gpe-what.c              \
9         xembed.h
10  
11  if OS_UNIX
12 diff -NaurBb gtk+-2.6.10.old/gtk/gpe-what.c gtk+-2.6.10/gtk/gpe-what.c
13 --- gtk+-2.6.10.old/gtk/gpe-what.c      1970-01-01 01:00:00.000000000 +0100
14 +++ gtk+-2.6.10/gtk/gpe-what.c  2005-12-29 00:59:26.000000000 +0100
15 @@ -0,0 +1,130 @@
16 +/*
17 + * Copyright (C) 2002, 2003 Philip Blundell <philb@gnu.org>
18 + *
19 + * This library is free software; you can redistribute it and/or
20 + * modify it under the terms of the GNU Lesser General Public
21 + * License as published by the Free Software Foundation; either
22 + * version 2 of the License, or (at your option) any later version.
23 + *
24 + * This library is distributed in the hope that it will be useful,
25 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
27 + * Lesser General Public License for more details.
28 + *
29 + * You should have received a copy of the GNU Lesser General Public
30 + * License along with this library; if not, write to the
31 + * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
32 + * Boston, MA 02111-1307, USA.
33 + */
34 +
35 +#include <stdio.h>
36 +#include <string.h>
37 +#include <stdlib.h>
38 +
39 +#include <X11/Xlib.h>
40 +#include <X11/Xatom.h>
41 +
42 +#ifdef GDK_WINDOWING_X11
43 +#error X11 required
44 +#endif
45 +
46 +#include "gtkwidget.h"
47 +#include "gtktooltips.h"
48 +#include "x11/gdkx.h"
49 +#include "config.h"
50 +
51 +#include <libintl.h>
52 +
53 +#define _(x) dgettext(GETTEXT_PACKAGE, x)
54 +
55 +static GdkAtom help_atom;
56 +static gboolean gpe_what_initialised;
57 +
58 +static GSList *widgets;
59 +
60 +static void
61 +send_text (Display *dpy, Window w, char *text)
62 +{
63 +  Atom help_xatom = gdk_x11_atom_to_xatom (help_atom);
64 +
65 +  gdk_error_trap_push ();
66 +
67 +  XChangeProperty (dpy, w, help_xatom, XA_STRING, 8, PropModeReplace, text, strlen (text));
68 +
69 +  XFlush (dpy);
70 +
71 +  gdk_error_trap_pop ();
72 +}
73 +
74 +static GdkFilterReturn 
75 +filter_func (GdkXEvent *xev, GdkEvent *ev, gpointer p)
76 +{
77 +  XClientMessageEvent *xc = (XClientMessageEvent *)xev;
78 +  GSList *list;
79 +  Window sender = xc->data.l[0];
80 +
81 +  for (list = widgets; list; list = list->next)
82 +    {
83 +      GtkWidget *widget = GTK_WIDGET (list->data);
84 +      int x = xc->data.l[1], y = xc->data.l[2];
85 +      int ax, ay;
86 +      
87 +      if (!GTK_WIDGET_DRAWABLE (widget)) continue;
88 +      
89 +      if (GTK_WIDGET_NO_WINDOW (widget))
90 +       {
91 +         ax = widget->allocation.x;
92 +         ay = widget->allocation.y;
93 +       }
94 +      else
95 +       {
96 +         ax = 0;
97 +         ay = 0;
98 +       }
99 +
100 +      if (widget->window == ev->any.window
101 +         && x >= ax && x < ax + widget->allocation.width
102 +         && y >= ay && y < ay + widget->allocation.height)
103 +       {
104 +         GtkTooltipsData *data = gtk_tooltips_data_get (widget);
105 +         if (data)
106 +           {
107 +             send_text (GDK_WINDOW_XDISPLAY (widget->window), sender, 
108 +                        data->tip_private ? data->tip_private : data->tip_text);
109 +             return GDK_FILTER_CONTINUE;
110 +           }
111 +       }
112 +    }
113 +
114 +  send_text (GDK_WINDOW_XDISPLAY (ev->any.window), sender, _("No help available."));
115 +
116 +  return GDK_FILTER_CONTINUE;
117 +}
118 +
119 +void
120 +gpe_what_mark_widget (GtkWidget *widget)
121 +{
122 +  if (!gpe_what_initialised)
123 +    {
124 +      help_atom = gdk_atom_intern ("_GPE_INTERACTIVE_HELP", FALSE);
125 +
126 +      gdk_add_client_message_filter (help_atom, filter_func, NULL);
127 +
128 +      gpe_what_initialised = TRUE;
129 +    }
130 +  
131 +  if (widget->window)
132 +    {
133 +      widgets = g_slist_prepend (widgets, widget);
134 +      
135 +      gdk_property_change (widget->window,
136 +                          help_atom,
137 +                          help_atom,
138 +                          8,
139 +                          GDK_PROP_MODE_REPLACE,
140 +                          NULL,
141 +                          0);
142 +    }
143 +  else
144 +    abort ();
145 +}
146 diff -NaurBb gtk+-2.6.10.old/gtk/gtkwidget.c gtk+-2.6.10/gtk/gtkwidget.c
147 --- gtk+-2.6.10.old/gtk/gtkwidget.c     2005-08-18 16:10:59.000000000 +0200
148 +++ gtk+-2.6.10/gtk/gtkwidget.c 2005-12-29 00:59:26.000000000 +0100
149 @@ -2285,6 +2285,9 @@
150        
151        g_signal_emit (widget, widget_signals[REALIZE], 0);
152        
153 +      extern void gpe_what_mark_widget (GtkWidget *widget);
154 +      gpe_what_mark_widget (widget);
155 +      
156        if (GTK_WIDGET_HAS_SHAPE_MASK (widget))
157         {
158           shape_info = g_object_get_qdata (G_OBJECT (widget), quark_shape_info);