~ubuntu-branches/debian/sid/link-monitor-applet/sid

« back to all changes in this revision

Viewing changes to build/src/lm-tooltips.c

  • Committer: Bazaar Package Importer
  • Author(s): Adriaan Peeters
  • Date: 2008-03-30 22:26:13 UTC
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20080330222613-5aubcuo9mgg2n7st
Tags: upstream-3.0
ImportĀ upstreamĀ versionĀ 3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Generated by GOB (v2.0.15)   (do not edit directly) */
 
2
 
 
3
/* End world hunger, donate to the World Food Programme, http://www.wfp.org */
 
4
 
 
5
#define GOB_VERSION_MAJOR 2
 
6
#define GOB_VERSION_MINOR 0
 
7
#define GOB_VERSION_PATCHLEVEL 15
 
8
 
 
9
#define selfp (self->_priv)
 
10
 
 
11
#include <string.h> /* memset() */
 
12
 
 
13
#include "lm-tooltips.h"
 
14
 
 
15
#include "lm-tooltips-private.h"
 
16
 
 
17
#ifdef G_LIKELY
 
18
#define ___GOB_LIKELY(expr) G_LIKELY(expr)
 
19
#define ___GOB_UNLIKELY(expr) G_UNLIKELY(expr)
 
20
#else /* ! G_LIKELY */
 
21
#define ___GOB_LIKELY(expr) (expr)
 
22
#define ___GOB_UNLIKELY(expr) (expr)
 
23
#endif /* G_LIKELY */
 
24
 
 
25
#line 41 "src/lm-tooltips.gob"
 
26
 
 
27
#include "lm-util.h"
 
28
 
 
29
#define TOOLTIPS_DATA                   "lm-tooltips-data"
 
30
#define TOOLTIPS_INFO                   "lm-tooltips-info"
 
31
#define TOOLTIPS_KEYBOARD_MODE          "gtk-tooltips-keyboard-mode" /* compatible with GtkTooltips */
 
32
 
 
33
#define DELAY 500                       /* Default delay in ms */
 
34
#define STICKY_DELAY 0                  /* Delay before popping up next tip
 
35
                                         * if we're sticky
 
36
                                         */
 
37
#define STICKY_REVERT_DELAY 1000        /* Delay before sticky tooltips revert
 
38
                                         * to normal
 
39
                                         */
 
40
 
 
41
/* The private flags that are used in the private_flags member of GtkWidget.
 
42
 */
 
43
typedef enum
 
44
{
 
45
  PRIVATE_GTK_LEAVE_PENDING     = 1 <<  4
 
46
} GtkPrivateFlags;
 
47
 
 
48
/* Macros for extracting a widgets private_flags from GtkWidget.
 
49
 */
 
50
#define GTK_PRIVATE_FLAGS(wid)            (GTK_WIDGET (wid)->private_flags)
 
51
 
 
52
/* Macros for setting and clearing private widget flags.
 
53
 * we use a preprocessor string concatenation here for a clear
 
54
 * flags/private_flags distinction at the cost of single flag operations.
 
55
 */
 
56
#define GTK_PRIVATE_SET_FLAG(wid,flag)    G_STMT_START{ (GTK_PRIVATE_FLAGS (wid) |= (PRIVATE_ ## flag)); }G_STMT_END
 
57
 
 
58
#line 59 "lm-tooltips.c"
 
59
/* self casting macros */
 
60
#define SELF(x) LM_TOOLTIPS(x)
 
61
#define SELF_CONST(x) LM_TOOLTIPS_CONST(x)
 
62
#define IS_SELF(x) LM_IS_TOOLTIPS(x)
 
63
#define TYPE_SELF LM_TYPE_TOOLTIPS
 
64
#define SELF_CLASS(x) LM_TOOLTIPS_CLASS(x)
 
65
 
 
66
#define SELF_GET_CLASS(x) LM_TOOLTIPS_GET_CLASS(x)
 
67
 
 
68
/* self typedefs */
 
69
typedef LMTooltips Self;
 
70
typedef LMTooltipsClass SelfClass;
 
71
 
 
72
/* here are local prototypes */
 
73
#line 0 "src/lm-tooltips.gob"
 
74
static void lm_tooltips_init (LMTooltips * o);
 
75
#line 76 "lm-tooltips.c"
 
76
#line 0 "src/lm-tooltips.gob"
 
77
static void lm_tooltips_class_init (LMTooltipsClass * c);
 
78
#line 79 "lm-tooltips.c"
 
79
#line 86 "src/lm-tooltips.gob"
 
80
static void lm_tooltips_finalize (LMTooltips * self);
 
81
#line 82 "lm-tooltips.c"
 
82
#line 102 "src/lm-tooltips.gob"
 
83
static void lm_tooltips_destroy_data (TooltipsData * data);
 
84
#line 85 "lm-tooltips.c"
 
85
#line 117 "src/lm-tooltips.gob"
 
86
static void lm_tooltips_display_closed_h (GdkDisplay * display, gboolean is_error, gpointer user_data);
 
87
#line 88 "lm-tooltips.c"
 
88
#line 126 "src/lm-tooltips.gob"
 
89
static void lm_tooltips_disconnect_display_closed (LMTooltips * self);
 
90
#line 91 "lm-tooltips.c"
 
91
#line 134 "src/lm-tooltips.gob"
 
92
static void lm_tooltips_unset_window (LMTooltips * self);
 
93
#line 94 "lm-tooltips.c"
 
94
#line 144 "src/lm-tooltips.gob"
 
95
static void lm_tooltips_update_screen (LMTooltips * self, gboolean new_window);
 
96
#line 97 "lm-tooltips.c"
 
97
#line 171 "src/lm-tooltips.gob"
 
98
static void lm_tooltips_force_window (LMTooltips * self);
 
99
#line 100 "lm-tooltips.c"
 
100
#line 192 "src/lm-tooltips.gob"
 
101
static TooltipsData * lm_tooltips_get_data (GtkWidget * widget);
 
102
#line 103 "lm-tooltips.c"
 
103
#line 198 "src/lm-tooltips.gob"
 
104
static void lm_tooltips_set_tip_widget_real (LMTooltips * self, GtkWidget * widget, GtkWidget * tip_widget, int border_width);
 
105
#line 106 "lm-tooltips.c"
 
106
#line 287 "src/lm-tooltips.gob"
 
107
static gboolean lm_tooltips_paint_window (LMTooltips * self);
 
108
#line 109 "lm-tooltips.c"
 
109
#line 308 "src/lm-tooltips.gob"
 
110
static void lm_tooltips_draw_tips (LMTooltips * self);
 
111
#line 112 "lm-tooltips.c"
 
112
#line 405 "src/lm-tooltips.gob"
 
113
static gboolean lm_tooltips_timeout_cb (gpointer data);
 
114
#line 115 "lm-tooltips.c"
 
115
#line 417 "src/lm-tooltips.gob"
 
116
static void lm_tooltips_set_active_widget (LMTooltips * self, GtkWidget * widget);
 
117
#line 118 "lm-tooltips.c"
 
118
#line 450 "src/lm-tooltips.gob"
 
119
static void lm_tooltips_show_tip (GtkWidget * widget);
 
120
#line 121 "lm-tooltips.c"
 
121
#line 466 "src/lm-tooltips.gob"
 
122
static void lm_tooltips_hide_tip (GtkWidget * widget);
 
123
#line 124 "lm-tooltips.c"
 
124
#line 479 "src/lm-tooltips.gob"
 
125
static gboolean lm_tooltips_recently_shown (LMTooltips * self);
 
126
#line 127 "lm-tooltips.c"
 
127
#line 491 "src/lm-tooltips.gob"
 
128
static gboolean lm_tooltips_get_keyboard_mode (GtkWidget * widget);
 
129
#line 130 "lm-tooltips.c"
 
130
#line 502 "src/lm-tooltips.gob"
 
131
static void lm_tooltips_start_keyboard_mode (GtkWidget * widget);
 
132
#line 133 "lm-tooltips.c"
 
133
#line 518 "src/lm-tooltips.gob"
 
134
static void lm_tooltips_stop_keyboard_mode (GtkWidget * widget);
 
135
#line 136 "lm-tooltips.c"
 
136
#line 534 "src/lm-tooltips.gob"
 
137
static void lm_tooltips_start_delay (LMTooltips * self, GtkWidget * widget);
 
138
#line 139 "lm-tooltips.c"
 
139
#line 549 "src/lm-tooltips.gob"
 
140
static void lm_tooltips_event_after_h (GtkWidget * widget, GdkEvent * event, gpointer user_data);
 
141
#line 142 "lm-tooltips.c"
 
142
#line 634 "src/lm-tooltips.gob"
 
143
static void lm_tooltips_widget_unmap (GtkWidget * widget, gpointer user_data);
 
144
#line 145 "lm-tooltips.c"
 
145
#line 645 "src/lm-tooltips.gob"
 
146
static void lm_tooltips_widget_remove (GtkWidget * widget, gpointer user_data);
 
147
#line 148 "lm-tooltips.c"
 
148
 
 
149
/* pointer to the class of our parent */
 
150
static GObjectClass *parent_class = NULL;
 
151
 
 
152
/* Short form macros */
 
153
#define self_destroy_data lm_tooltips_destroy_data
 
154
#define self_display_closed_h lm_tooltips_display_closed_h
 
155
#define self_disconnect_display_closed lm_tooltips_disconnect_display_closed
 
156
#define self_unset_window lm_tooltips_unset_window
 
157
#define self_update_screen lm_tooltips_update_screen
 
158
#define self_force_window lm_tooltips_force_window
 
159
#define self_get_data lm_tooltips_get_data
 
160
#define self_set_tip_widget_real lm_tooltips_set_tip_widget_real
 
161
#define self_set_tip lm_tooltips_set_tip
 
162
#define self_set_tip_widget lm_tooltips_set_tip_widget
 
163
#define self_paint_window lm_tooltips_paint_window
 
164
#define self_draw_tips lm_tooltips_draw_tips
 
165
#define self_timeout_cb lm_tooltips_timeout_cb
 
166
#define self_set_active_widget lm_tooltips_set_active_widget
 
167
#define self_show_tip lm_tooltips_show_tip
 
168
#define self_hide_tip lm_tooltips_hide_tip
 
169
#define self_recently_shown lm_tooltips_recently_shown
 
170
#define self_get_keyboard_mode lm_tooltips_get_keyboard_mode
 
171
#define self_start_keyboard_mode lm_tooltips_start_keyboard_mode
 
172
#define self_stop_keyboard_mode lm_tooltips_stop_keyboard_mode
 
173
#define self_start_delay lm_tooltips_start_delay
 
174
#define self_event_after_h lm_tooltips_event_after_h
 
175
#define self_widget_unmap lm_tooltips_widget_unmap
 
176
#define self_widget_remove lm_tooltips_widget_remove
 
177
#define self_toggle_keyboard_mode lm_tooltips_toggle_keyboard_mode
 
178
#define self_new lm_tooltips_new
 
179
GType
 
180
lm_tooltips_get_type (void)
 
181
{
 
182
        static GType type = 0;
 
183
 
 
184
        if ___GOB_UNLIKELY(type == 0) {
 
185
                static const GTypeInfo info = {
 
186
                        sizeof (LMTooltipsClass),
 
187
                        (GBaseInitFunc) NULL,
 
188
                        (GBaseFinalizeFunc) NULL,
 
189
                        (GClassInitFunc) lm_tooltips_class_init,
 
190
                        (GClassFinalizeFunc) NULL,
 
191
                        NULL /* class_data */,
 
192
                        sizeof (LMTooltips),
 
193
                        0 /* n_preallocs */,
 
194
                        (GInstanceInitFunc) lm_tooltips_init,
 
195
                        NULL
 
196
                };
 
197
 
 
198
                type = g_type_register_static (G_TYPE_OBJECT, "LMTooltips", &info, (GTypeFlags)0);
 
199
        }
 
200
 
 
201
        return type;
 
202
}
 
203
 
 
204
/* a macro for creating a new object of our type */
 
205
#define GET_NEW ((LMTooltips *)g_object_new(lm_tooltips_get_type(), NULL))
 
206
 
 
207
/* a function for creating a new object of our type */
 
208
#include <stdarg.h>
 
209
static LMTooltips * GET_NEW_VARG (const char *first, ...) G_GNUC_UNUSED;
 
210
static LMTooltips *
 
211
GET_NEW_VARG (const char *first, ...)
 
212
{
 
213
        LMTooltips *ret;
 
214
        va_list ap;
 
215
        va_start (ap, first);
 
216
        ret = (LMTooltips *)g_object_new_valist (lm_tooltips_get_type (), first, ap);
 
217
        va_end (ap);
 
218
        return ret;
 
219
}
 
220
 
 
221
 
 
222
static void
 
223
___finalize(GObject *obj_self)
 
224
{
 
225
#define __GOB_FUNCTION__ "LM:Tooltips::finalize"
 
226
        LMTooltips *self G_GNUC_UNUSED = LM_TOOLTIPS (obj_self);
 
227
        gpointer priv G_GNUC_UNUSED = self->_priv;
 
228
#line 86 "src/lm-tooltips.gob"
 
229
        lm_tooltips_finalize (self);
 
230
#line 231 "lm-tooltips.c"
 
231
        if(G_OBJECT_CLASS(parent_class)->finalize) \
 
232
                (* G_OBJECT_CLASS(parent_class)->finalize)(obj_self);
 
233
}
 
234
#undef __GOB_FUNCTION__
 
235
 
 
236
static void 
 
237
lm_tooltips_init (LMTooltips * o G_GNUC_UNUSED)
 
238
{
 
239
#define __GOB_FUNCTION__ "LM:Tooltips::init"
 
240
        o->_priv = G_TYPE_INSTANCE_GET_PRIVATE(o,LM_TYPE_TOOLTIPS,LMTooltipsPrivate);
 
241
#line 41 "src/lm-tooltips.gob"
 
242
        o->_priv->border_width = 4;
 
243
#line 244 "lm-tooltips.c"
 
244
}
 
245
#undef __GOB_FUNCTION__
 
246
static void 
 
247
lm_tooltips_class_init (LMTooltipsClass * c G_GNUC_UNUSED)
 
248
{
 
249
#define __GOB_FUNCTION__ "LM:Tooltips::class_init"
 
250
        GObjectClass *g_object_class G_GNUC_UNUSED = (GObjectClass*) c;
 
251
 
 
252
        g_type_class_add_private(c,sizeof(LMTooltipsPrivate));
 
253
 
 
254
        parent_class = g_type_class_ref (G_TYPE_OBJECT);
 
255
 
 
256
        g_object_class->finalize = ___finalize;
 
257
}
 
258
#undef __GOB_FUNCTION__
 
259
 
 
260
 
 
261
 
 
262
#line 86 "src/lm-tooltips.gob"
 
263
static void 
 
264
lm_tooltips_finalize (LMTooltips * self)
 
265
{
 
266
#line 267 "lm-tooltips.c"
 
267
#define __GOB_FUNCTION__ "LM:Tooltips::finalize"
 
268
{
 
269
#line 87 "src/lm-tooltips.gob"
 
270
        
 
271
    GSList *l;
 
272
 
 
273
    if (selfp->timeout_id)
 
274
      g_source_remove(selfp->timeout_id);
 
275
 
 
276
    LM_LIST_FOREACH(l, selfp->data_list)
 
277
      {
 
278
        TooltipsData *data = l->data;
 
279
        self_widget_remove(data->widget, data);
 
280
      }
 
281
 
 
282
    self_unset_window(self);
 
283
  }}
 
284
#line 285 "lm-tooltips.c"
 
285
#undef __GOB_FUNCTION__
 
286
 
 
287
#line 102 "src/lm-tooltips.gob"
 
288
static void 
 
289
lm_tooltips_destroy_data (TooltipsData * data)
 
290
{
 
291
#line 292 "lm-tooltips.c"
 
292
#define __GOB_FUNCTION__ "LM:Tooltips::destroy_data"
 
293
{
 
294
#line 104 "src/lm-tooltips.gob"
 
295
        
 
296
    g_object_disconnect(data->widget,
 
297
                        "any-signal", self_event_after_h, data,
 
298
                        "any-signal", self_widget_unmap, data,
 
299
                        "any-signal", self_widget_remove, data,
 
300
                        NULL);
 
301
 
 
302
    g_object_set_data(G_OBJECT(data->widget), TOOLTIPS_DATA, NULL);
 
303
    g_object_unref(data->widget);
 
304
    g_object_unref(data->tip_widget);
 
305
    g_free(data);
 
306
  }}
 
307
#line 308 "lm-tooltips.c"
 
308
#undef __GOB_FUNCTION__
 
309
 
 
310
#line 117 "src/lm-tooltips.gob"
 
311
static void 
 
312
lm_tooltips_display_closed_h (GdkDisplay * display, gboolean is_error, gpointer user_data)
 
313
{
 
314
#line 315 "lm-tooltips.c"
 
315
#define __GOB_FUNCTION__ "LM:Tooltips::display_closed_h"
 
316
{
 
317
#line 121 "src/lm-tooltips.gob"
 
318
        
 
319
    Self *self = SELF(user_data);
 
320
    self_unset_window(self);
 
321
  }}
 
322
#line 323 "lm-tooltips.c"
 
323
#undef __GOB_FUNCTION__
 
324
 
 
325
#line 126 "src/lm-tooltips.gob"
 
326
static void 
 
327
lm_tooltips_disconnect_display_closed (LMTooltips * self)
 
328
{
 
329
#line 330 "lm-tooltips.c"
 
330
#define __GOB_FUNCTION__ "LM:Tooltips::disconnect_display_closed"
 
331
#line 126 "src/lm-tooltips.gob"
 
332
        g_return_if_fail (self != NULL);
 
333
#line 126 "src/lm-tooltips.gob"
 
334
        g_return_if_fail (LM_IS_TOOLTIPS (self));
 
335
#line 336 "lm-tooltips.c"
 
336
{
 
337
#line 128 "src/lm-tooltips.gob"
 
338
        
 
339
    g_signal_handlers_disconnect_by_func(gtk_widget_get_display(selfp->window),
 
340
                                         self_display_closed_h,
 
341
                                         self);
 
342
  }}
 
343
#line 344 "lm-tooltips.c"
 
344
#undef __GOB_FUNCTION__
 
345
 
 
346
#line 134 "src/lm-tooltips.gob"
 
347
static void 
 
348
lm_tooltips_unset_window (LMTooltips * self)
 
349
{
 
350
#line 351 "lm-tooltips.c"
 
351
#define __GOB_FUNCTION__ "LM:Tooltips::unset_window"
 
352
#line 134 "src/lm-tooltips.gob"
 
353
        g_return_if_fail (self != NULL);
 
354
#line 134 "src/lm-tooltips.gob"
 
355
        g_return_if_fail (LM_IS_TOOLTIPS (self));
 
356
#line 357 "lm-tooltips.c"
 
357
{
 
358
#line 136 "src/lm-tooltips.gob"
 
359
        
 
360
    if (selfp->window)
 
361
      {
 
362
        self_disconnect_display_closed(self);
 
363
        gtk_widget_destroy(selfp->window);
 
364
      }
 
365
  }}
 
366
#line 367 "lm-tooltips.c"
 
367
#undef __GOB_FUNCTION__
 
368
 
 
369
#line 144 "src/lm-tooltips.gob"
 
370
static void 
 
371
lm_tooltips_update_screen (LMTooltips * self, gboolean new_window)
 
372
{
 
373
#line 374 "lm-tooltips.c"
 
374
#define __GOB_FUNCTION__ "LM:Tooltips::update_screen"
 
375
#line 144 "src/lm-tooltips.gob"
 
376
        g_return_if_fail (self != NULL);
 
377
#line 144 "src/lm-tooltips.gob"
 
378
        g_return_if_fail (LM_IS_TOOLTIPS (self));
 
379
#line 380 "lm-tooltips.c"
 
380
{
 
381
#line 146 "src/lm-tooltips.gob"
 
382
        
 
383
    gboolean screen_changed = FALSE;
 
384
 
 
385
    if (selfp->active_data && selfp->active_data->widget)
 
386
      {
 
387
        GdkScreen *screen = gtk_widget_get_screen(selfp->active_data->widget);
 
388
 
 
389
        screen_changed = (screen != gtk_widget_get_screen(selfp->window));
 
390
 
 
391
        if (screen_changed)
 
392
          {
 
393
            if (! new_window)
 
394
              self_disconnect_display_closed(self);
 
395
 
 
396
            gtk_window_set_screen(GTK_WINDOW(selfp->window), screen);
 
397
          }
 
398
      }
 
399
 
 
400
    if (screen_changed || new_window)
 
401
      g_signal_connect(gtk_widget_get_display(selfp->window),
 
402
                       "closed",
 
403
                       G_CALLBACK(self_display_closed_h),
 
404
                       self);
 
405
  }}
 
406
#line 407 "lm-tooltips.c"
 
407
#undef __GOB_FUNCTION__
 
408
 
 
409
#line 171 "src/lm-tooltips.gob"
 
410
static void 
 
411
lm_tooltips_force_window (LMTooltips * self)
 
412
{
 
413
#line 414 "lm-tooltips.c"
 
414
#define __GOB_FUNCTION__ "LM:Tooltips::force_window"
 
415
#line 171 "src/lm-tooltips.gob"
 
416
        g_return_if_fail (self != NULL);
 
417
#line 171 "src/lm-tooltips.gob"
 
418
        g_return_if_fail (LM_IS_TOOLTIPS (self));
 
419
#line 420 "lm-tooltips.c"
 
420
{
 
421
#line 173 "src/lm-tooltips.gob"
 
422
        
 
423
    if (! selfp->window)
 
424
      {
 
425
        selfp->window = gtk_window_new(GTK_WINDOW_POPUP);
 
426
        self_update_screen(self, TRUE);
 
427
        gtk_widget_set_app_paintable(selfp->window, TRUE);
 
428
        gtk_window_set_resizable(GTK_WINDOW(selfp->window), FALSE);
 
429
        gtk_widget_set_name(selfp->window, "gtk-tooltips");
 
430
        gtk_container_set_border_width(GTK_CONTAINER(selfp->window), selfp->border_width);
 
431
 
 
432
        g_signal_connect_swapped(selfp->window,
 
433
                                 "expose-event",
 
434
                                 G_CALLBACK(self_paint_window),
 
435
                                 self);
 
436
 
 
437
        lm_add_weak_pointer(&selfp->window);
 
438
      }
 
439
  }}
 
440
#line 441 "lm-tooltips.c"
 
441
#undef __GOB_FUNCTION__
 
442
 
 
443
#line 192 "src/lm-tooltips.gob"
 
444
static TooltipsData * 
 
445
lm_tooltips_get_data (GtkWidget * widget)
 
446
{
 
447
#line 448 "lm-tooltips.c"
 
448
#define __GOB_FUNCTION__ "LM:Tooltips::get_data"
 
449
#line 192 "src/lm-tooltips.gob"
 
450
        g_return_val_if_fail (widget != NULL, (TooltipsData * )0);
 
451
#line 192 "src/lm-tooltips.gob"
 
452
        g_return_val_if_fail (GTK_IS_WIDGET (widget), (TooltipsData * )0);
 
453
#line 454 "lm-tooltips.c"
 
454
{
 
455
#line 194 "src/lm-tooltips.gob"
 
456
        
 
457
    return g_object_get_data(G_OBJECT(widget), TOOLTIPS_DATA);
 
458
  }}
 
459
#line 460 "lm-tooltips.c"
 
460
#undef __GOB_FUNCTION__
 
461
 
 
462
#line 198 "src/lm-tooltips.gob"
 
463
static void 
 
464
lm_tooltips_set_tip_widget_real (LMTooltips * self, GtkWidget * widget, GtkWidget * tip_widget, int border_width)
 
465
{
 
466
#line 467 "lm-tooltips.c"
 
467
#define __GOB_FUNCTION__ "LM:Tooltips::set_tip_widget_real"
 
468
#line 198 "src/lm-tooltips.gob"
 
469
        g_return_if_fail (self != NULL);
 
470
#line 198 "src/lm-tooltips.gob"
 
471
        g_return_if_fail (LM_IS_TOOLTIPS (self));
 
472
#line 198 "src/lm-tooltips.gob"
 
473
        g_return_if_fail (widget != NULL);
 
474
#line 198 "src/lm-tooltips.gob"
 
475
        g_return_if_fail (GTK_IS_WIDGET (widget));
 
476
#line 477 "lm-tooltips.c"
 
477
{
 
478
#line 203 "src/lm-tooltips.gob"
 
479
        
 
480
    TooltipsData *data;
 
481
 
 
482
    data = self_get_data(widget);
 
483
 
 
484
    if (! tip_widget)
 
485
      {
 
486
        if (data)
 
487
          self_widget_remove(data->widget, data);
 
488
        return;
 
489
      }
 
490
 
 
491
    if (selfp->active_data
 
492
        && selfp->active_data->widget == widget
 
493
        && GTK_WIDGET_DRAWABLE(selfp->active_data->widget))
 
494
      {
 
495
        if (data->tip_widget)
 
496
          g_object_unref(data->tip_widget);
 
497
 
 
498
        data->tip_widget = tip_widget;
 
499
 
 
500
        if (data->tip_widget)
 
501
          g_object_ref_sink(data->tip_widget);
 
502
 
 
503
        self_draw_tips(self);
 
504
      }
 
505
    else
 
506
      {
 
507
        g_object_ref(widget);
 
508
 
 
509
        if (data)
 
510
          self_widget_remove(data->widget, data);
 
511
 
 
512
        data = g_new0(TooltipsData, 1);
 
513
        data->self = self;
 
514
        data->widget = widget;
 
515
        data->tip_widget = tip_widget;
 
516
 
 
517
        if (data->tip_widget)
 
518
          g_object_ref_sink(data->tip_widget);
 
519
 
 
520
        selfp->data_list = g_slist_append(selfp->data_list, data);
 
521
        g_signal_connect_after(widget, "event-after", G_CALLBACK(self_event_after_h), data);
 
522
 
 
523
        g_object_set_data(G_OBJECT(widget), TOOLTIPS_DATA, data);
 
524
 
 
525
        g_object_connect(widget,
 
526
                         "signal::unmap", self_widget_unmap, data,
 
527
                         "signal::unrealize", self_widget_unmap, data,
 
528
                         "signal::destroy", self_widget_remove, data,
 
529
                         NULL);
 
530
      }
 
531
 
 
532
    selfp->border_width = border_width;
 
533
    if (selfp->window)
 
534
      gtk_container_set_border_width(GTK_CONTAINER(selfp->window), border_width);
 
535
  }}
 
536
#line 537 "lm-tooltips.c"
 
537
#undef __GOB_FUNCTION__
 
538
 
 
539
#line 261 "src/lm-tooltips.gob"
 
540
void 
 
541
lm_tooltips_set_tip (LMTooltips * self, GtkWidget * widget, const char * tip_text)
 
542
{
 
543
#line 544 "lm-tooltips.c"
 
544
#define __GOB_FUNCTION__ "LM:Tooltips::set_tip"
 
545
#line 261 "src/lm-tooltips.gob"
 
546
        g_return_if_fail (self != NULL);
 
547
#line 261 "src/lm-tooltips.gob"
 
548
        g_return_if_fail (LM_IS_TOOLTIPS (self));
 
549
#line 261 "src/lm-tooltips.gob"
 
550
        g_return_if_fail (widget != NULL);
 
551
#line 261 "src/lm-tooltips.gob"
 
552
        g_return_if_fail (GTK_IS_WIDGET (widget));
 
553
#line 554 "lm-tooltips.c"
 
554
{
 
555
#line 265 "src/lm-tooltips.gob"
 
556
        
 
557
    GtkWidget *label = NULL;
 
558
 
 
559
    if (tip_text)
 
560
      {
 
561
        label = gtk_label_new(tip_text);
 
562
        gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
 
563
        gtk_misc_set_alignment(GTK_MISC(label), 0.5, 0.5);
 
564
        gtk_widget_show(label);
 
565
      }
 
566
 
 
567
    self_set_tip_widget_real(self, widget, label, 4);
 
568
  }}
 
569
#line 570 "lm-tooltips.c"
 
570
#undef __GOB_FUNCTION__
 
571
 
 
572
#line 279 "src/lm-tooltips.gob"
 
573
void 
 
574
lm_tooltips_set_tip_widget (LMTooltips * self, GtkWidget * widget, GtkWidget * tip_widget)
 
575
{
 
576
#line 577 "lm-tooltips.c"
 
577
#define __GOB_FUNCTION__ "LM:Tooltips::set_tip_widget"
 
578
#line 279 "src/lm-tooltips.gob"
 
579
        g_return_if_fail (self != NULL);
 
580
#line 279 "src/lm-tooltips.gob"
 
581
        g_return_if_fail (LM_IS_TOOLTIPS (self));
 
582
#line 279 "src/lm-tooltips.gob"
 
583
        g_return_if_fail (widget != NULL);
 
584
#line 279 "src/lm-tooltips.gob"
 
585
        g_return_if_fail (GTK_IS_WIDGET (widget));
 
586
#line 587 "lm-tooltips.c"
 
587
{
 
588
#line 283 "src/lm-tooltips.gob"
 
589
        
 
590
    self_set_tip_widget_real(self, widget, tip_widget, 12);
 
591
  }}
 
592
#line 593 "lm-tooltips.c"
 
593
#undef __GOB_FUNCTION__
 
594
 
 
595
#line 287 "src/lm-tooltips.gob"
 
596
static gboolean 
 
597
lm_tooltips_paint_window (LMTooltips * self)
 
598
{
 
599
#line 600 "lm-tooltips.c"
 
600
#define __GOB_FUNCTION__ "LM:Tooltips::paint_window"
 
601
#line 287 "src/lm-tooltips.gob"
 
602
        g_return_val_if_fail (self != NULL, (gboolean )0);
 
603
#line 287 "src/lm-tooltips.gob"
 
604
        g_return_val_if_fail (LM_IS_TOOLTIPS (self), (gboolean )0);
 
605
#line 606 "lm-tooltips.c"
 
606
{
 
607
#line 289 "src/lm-tooltips.gob"
 
608
        
 
609
    GtkRequisition req;
 
610
 
 
611
    gtk_widget_size_request(selfp->window, &req);
 
612
    gtk_paint_flat_box(selfp->window->style,
 
613
                       selfp->window->window,
 
614
                       GTK_STATE_NORMAL,
 
615
                       GTK_SHADOW_OUT,
 
616
                       NULL,
 
617
                       selfp->window,
 
618
                       "tooltip",
 
619
                       0,
 
620
                       0,
 
621
                       req.width,
 
622
                       req.height);
 
623
 
 
624
    return FALSE;
 
625
  }}
 
626
#line 627 "lm-tooltips.c"
 
627
#undef __GOB_FUNCTION__
 
628
 
 
629
#line 308 "src/lm-tooltips.gob"
 
630
static void 
 
631
lm_tooltips_draw_tips (LMTooltips * self)
 
632
{
 
633
#line 634 "lm-tooltips.c"
 
634
#define __GOB_FUNCTION__ "LM:Tooltips::draw_tips"
 
635
#line 308 "src/lm-tooltips.gob"
 
636
        g_return_if_fail (self != NULL);
 
637
#line 308 "src/lm-tooltips.gob"
 
638
        g_return_if_fail (LM_IS_TOOLTIPS (self));
 
639
#line 640 "lm-tooltips.c"
 
640
{
 
641
#line 310 "src/lm-tooltips.gob"
 
642
        
 
643
    GtkRequisition requisition;
 
644
    GtkWidget *widget;
 
645
    gint x, y, w, h;
 
646
    TooltipsData *data;
 
647
    GtkWidget *child;
 
648
    gboolean keyboard_mode;
 
649
    GdkScreen *screen;
 
650
    GdkScreen *pointer_screen;
 
651
    gint monitor_num, px, py;
 
652
    GdkRectangle monitor;
 
653
    int screen_width;
 
654
 
 
655
    if (! selfp->window)
 
656
      self_force_window(self);
 
657
    else if (GTK_WIDGET_VISIBLE(selfp->window))
 
658
      g_get_current_time(&selfp->last_popdown);
 
659
 
 
660
    gtk_widget_ensure_style(selfp->window);
 
661
 
 
662
    widget = selfp->active_data->widget;
 
663
    g_object_set_data(G_OBJECT(selfp->window), TOOLTIPS_INFO, self);
 
664
 
 
665
    keyboard_mode = self_get_keyboard_mode(widget);
 
666
 
 
667
    self_update_screen(self, FALSE);
 
668
 
 
669
    screen = gtk_widget_get_screen(widget);
 
670
 
 
671
    data = selfp->active_data;
 
672
 
 
673
    child = GTK_BIN(selfp->window)->child;
 
674
    if (child)
 
675
      gtk_container_remove(GTK_CONTAINER(selfp->window), child);
 
676
 
 
677
    if (data->tip_widget)
 
678
      {
 
679
        gtk_container_add(GTK_CONTAINER(selfp->window), data->tip_widget);
 
680
        gtk_widget_show(data->tip_widget);
 
681
      }
 
682
 
 
683
    gtk_widget_size_request(selfp->window, &requisition);
 
684
    w = requisition.width;
 
685
    h = requisition.height;
 
686
 
 
687
    gdk_window_get_origin(widget->window, &x, &y);
 
688
    if (GTK_WIDGET_NO_WINDOW(widget))
 
689
      {
 
690
        x += widget->allocation.x;
 
691
        y += widget->allocation.y;
 
692
      }
 
693
 
 
694
    x += widget->allocation.width / 2;
 
695
 
 
696
    if (! keyboard_mode)
 
697
      gdk_window_get_pointer(gdk_screen_get_root_window(screen), &x, NULL, NULL);
 
698
 
 
699
    x -= (w / 2 + 4);
 
700
 
 
701
    gdk_display_get_pointer(gdk_screen_get_display(screen), &pointer_screen, &px, &py, NULL);
 
702
    if (pointer_screen != screen)
 
703
      {
 
704
        px = x;
 
705
        py = y;
 
706
      }
 
707
    monitor_num = gdk_screen_get_monitor_at_point(screen, px, py);
 
708
    gdk_screen_get_monitor_geometry(screen, monitor_num, &monitor);
 
709
 
 
710
    if ((x + w) > monitor.x + monitor.width)
 
711
      x -= (x + w) - (monitor.x + monitor.width);
 
712
    else if (x < monitor.x)
 
713
      x = monitor.x;
 
714
 
 
715
    if ((y + h + widget->allocation.height + 4) > monitor.y + monitor.height
 
716
        && (y - 4) > monitor.y)
 
717
      y = y - h - 4;
 
718
    else
 
719
      y = y + widget->allocation.height + 4;
 
720
 
 
721
    /*
 
722
     * The following block is not part of GTK+ and has been added to
 
723
     * make sure that the tooltip will not go beyond the screen edges
 
724
     * (horizontally).
 
725
     */
 
726
    screen_width = gdk_screen_get_width(screen);
 
727
    if (x < 0 || x + w > screen_width)
 
728
      {
 
729
        x = 0;
 
730
        gtk_widget_set_size_request(selfp->window, MIN(w, screen_width), -1);
 
731
      }
 
732
 
 
733
    gtk_window_move(GTK_WINDOW(selfp->window), x, y);
 
734
    gtk_widget_show(selfp->window);
 
735
  }}
 
736
#line 737 "lm-tooltips.c"
 
737
#undef __GOB_FUNCTION__
 
738
 
 
739
#line 405 "src/lm-tooltips.gob"
 
740
static gboolean 
 
741
lm_tooltips_timeout_cb (gpointer data)
 
742
{
 
743
#line 744 "lm-tooltips.c"
 
744
#define __GOB_FUNCTION__ "LM:Tooltips::timeout_cb"
 
745
{
 
746
#line 407 "src/lm-tooltips.gob"
 
747
        
 
748
    Self *self = SELF(data);
 
749
 
 
750
    if (selfp->active_data != NULL && GTK_WIDGET_DRAWABLE(selfp->active_data->widget))
 
751
      self_draw_tips(self);
 
752
 
 
753
    selfp->timeout_id = 0;
 
754
    return FALSE;               /* remove timeout */
 
755
  }}
 
756
#line 757 "lm-tooltips.c"
 
757
#undef __GOB_FUNCTION__
 
758
 
 
759
#line 417 "src/lm-tooltips.gob"
 
760
static void 
 
761
lm_tooltips_set_active_widget (LMTooltips * self, GtkWidget * widget)
 
762
{
 
763
#line 764 "lm-tooltips.c"
 
764
#define __GOB_FUNCTION__ "LM:Tooltips::set_active_widget"
 
765
#line 417 "src/lm-tooltips.gob"
 
766
        g_return_if_fail (self != NULL);
 
767
#line 417 "src/lm-tooltips.gob"
 
768
        g_return_if_fail (LM_IS_TOOLTIPS (self));
 
769
#line 770 "lm-tooltips.c"
 
770
{
 
771
#line 419 "src/lm-tooltips.gob"
 
772
        
 
773
    if (selfp->window)
 
774
      {
 
775
        if (GTK_WIDGET_VISIBLE(selfp->window))
 
776
          g_get_current_time(&selfp->last_popdown);
 
777
        gtk_widget_hide(selfp->window);
 
778
      }
 
779
 
 
780
    lm_source_clear(&selfp->timeout_id);
 
781
 
 
782
    selfp->active_data = NULL;
 
783
 
 
784
    if (widget)
 
785
      {
 
786
        GSList *l;
 
787
 
 
788
        LM_LIST_FOREACH(l, selfp->data_list)
 
789
          {
 
790
            TooltipsData *data = l->data;
 
791
 
 
792
            if (data->widget == widget && GTK_WIDGET_DRAWABLE(widget))
 
793
              {
 
794
                selfp->active_data = data;
 
795
                break;
 
796
              }
 
797
          }
 
798
      }
 
799
    else
 
800
      selfp->use_sticky_delay = FALSE;
 
801
  }}
 
802
#line 803 "lm-tooltips.c"
 
803
#undef __GOB_FUNCTION__
 
804
 
 
805
#line 450 "src/lm-tooltips.gob"
 
806
static void 
 
807
lm_tooltips_show_tip (GtkWidget * widget)
 
808
{
 
809
#line 810 "lm-tooltips.c"
 
810
#define __GOB_FUNCTION__ "LM:Tooltips::show_tip"
 
811
#line 450 "src/lm-tooltips.gob"
 
812
        g_return_if_fail (widget != NULL);
 
813
#line 450 "src/lm-tooltips.gob"
 
814
        g_return_if_fail (GTK_IS_WIDGET (widget));
 
815
#line 816 "lm-tooltips.c"
 
816
{
 
817
#line 452 "src/lm-tooltips.gob"
 
818
        
 
819
    TooltipsData *data;
 
820
 
 
821
    data = self_get_data(widget);
 
822
 
 
823
    if (data &&
 
824
        (! data->self->_priv->active_data ||
 
825
         data->self->_priv->active_data->widget != widget))
 
826
      {
 
827
        self_set_active_widget(data->self, widget);
 
828
        self_draw_tips(data->self);
 
829
      }
 
830
  }}
 
831
#line 832 "lm-tooltips.c"
 
832
#undef __GOB_FUNCTION__
 
833
 
 
834
#line 466 "src/lm-tooltips.gob"
 
835
static void 
 
836
lm_tooltips_hide_tip (GtkWidget * widget)
 
837
{
 
838
#line 839 "lm-tooltips.c"
 
839
#define __GOB_FUNCTION__ "LM:Tooltips::hide_tip"
 
840
#line 466 "src/lm-tooltips.gob"
 
841
        g_return_if_fail (widget != NULL);
 
842
#line 466 "src/lm-tooltips.gob"
 
843
        g_return_if_fail (GTK_IS_WIDGET (widget));
 
844
#line 845 "lm-tooltips.c"
 
845
{
 
846
#line 468 "src/lm-tooltips.gob"
 
847
        
 
848
    TooltipsData *data;
 
849
 
 
850
    data = self_get_data(widget);
 
851
 
 
852
    if (data &&
 
853
        (data->self->_priv->active_data &&
 
854
         data->self->_priv->active_data->widget == widget))
 
855
      self_set_active_widget(data->self, NULL);
 
856
  }}
 
857
#line 858 "lm-tooltips.c"
 
858
#undef __GOB_FUNCTION__
 
859
 
 
860
#line 479 "src/lm-tooltips.gob"
 
861
static gboolean 
 
862
lm_tooltips_recently_shown (LMTooltips * self)
 
863
{
 
864
#line 865 "lm-tooltips.c"
 
865
#define __GOB_FUNCTION__ "LM:Tooltips::recently_shown"
 
866
#line 479 "src/lm-tooltips.gob"
 
867
        g_return_val_if_fail (self != NULL, (gboolean )0);
 
868
#line 479 "src/lm-tooltips.gob"
 
869
        g_return_val_if_fail (LM_IS_TOOLTIPS (self), (gboolean )0);
 
870
#line 871 "lm-tooltips.c"
 
871
{
 
872
#line 481 "src/lm-tooltips.gob"
 
873
        
 
874
    GTimeVal now;
 
875
    glong msec;
 
876
 
 
877
    g_get_current_time (&now);
 
878
    msec = (now.tv_sec - selfp->last_popdown.tv_sec) * 1000 +
 
879
      (now.tv_usec - selfp->last_popdown.tv_usec) / 1000;
 
880
    return (msec < STICKY_REVERT_DELAY);
 
881
  }}
 
882
#line 883 "lm-tooltips.c"
 
883
#undef __GOB_FUNCTION__
 
884
 
 
885
#line 491 "src/lm-tooltips.gob"
 
886
static gboolean 
 
887
lm_tooltips_get_keyboard_mode (GtkWidget * widget)
 
888
{
 
889
#line 890 "lm-tooltips.c"
 
890
#define __GOB_FUNCTION__ "LM:Tooltips::get_keyboard_mode"
 
891
#line 491 "src/lm-tooltips.gob"
 
892
        g_return_val_if_fail (widget != NULL, (gboolean )0);
 
893
#line 491 "src/lm-tooltips.gob"
 
894
        g_return_val_if_fail (GTK_IS_WIDGET (widget), (gboolean )0);
 
895
#line 896 "lm-tooltips.c"
 
896
{
 
897
#line 493 "src/lm-tooltips.gob"
 
898
        
 
899
    GtkWidget *toplevel = gtk_widget_get_toplevel(widget);
 
900
 
 
901
    if (GTK_IS_WINDOW(toplevel))
 
902
      return GPOINTER_TO_INT(g_object_get_data(G_OBJECT(toplevel), TOOLTIPS_KEYBOARD_MODE));
 
903
    else
 
904
      return FALSE;
 
905
  }}
 
906
#line 907 "lm-tooltips.c"
 
907
#undef __GOB_FUNCTION__
 
908
 
 
909
#line 502 "src/lm-tooltips.gob"
 
910
static void 
 
911
lm_tooltips_start_keyboard_mode (GtkWidget * widget)
 
912
{
 
913
#line 914 "lm-tooltips.c"
 
914
#define __GOB_FUNCTION__ "LM:Tooltips::start_keyboard_mode"
 
915
#line 502 "src/lm-tooltips.gob"
 
916
        g_return_if_fail (widget != NULL);
 
917
#line 502 "src/lm-tooltips.gob"
 
918
        g_return_if_fail (GTK_IS_WIDGET (widget));
 
919
#line 920 "lm-tooltips.c"
 
920
{
 
921
#line 504 "src/lm-tooltips.gob"
 
922
        
 
923
    GtkWidget *toplevel = gtk_widget_get_toplevel(widget);
 
924
 
 
925
    if (GTK_IS_WINDOW(toplevel))
 
926
      {
 
927
        GtkWidget *focus = GTK_WINDOW(toplevel)->focus_widget;
 
928
 
 
929
        g_object_set_data(G_OBJECT(toplevel), TOOLTIPS_KEYBOARD_MODE, GINT_TO_POINTER(TRUE));
 
930
 
 
931
        if (focus)
 
932
          self_show_tip(focus);
 
933
      }
 
934
  }}
 
935
#line 936 "lm-tooltips.c"
 
936
#undef __GOB_FUNCTION__
 
937
 
 
938
#line 518 "src/lm-tooltips.gob"
 
939
static void 
 
940
lm_tooltips_stop_keyboard_mode (GtkWidget * widget)
 
941
{
 
942
#line 943 "lm-tooltips.c"
 
943
#define __GOB_FUNCTION__ "LM:Tooltips::stop_keyboard_mode"
 
944
#line 518 "src/lm-tooltips.gob"
 
945
        g_return_if_fail (widget != NULL);
 
946
#line 518 "src/lm-tooltips.gob"
 
947
        g_return_if_fail (GTK_IS_WIDGET (widget));
 
948
#line 949 "lm-tooltips.c"
 
949
{
 
950
#line 520 "src/lm-tooltips.gob"
 
951
        
 
952
    GtkWidget *toplevel = gtk_widget_get_toplevel(widget);
 
953
 
 
954
    if (GTK_IS_WINDOW(toplevel))
 
955
      {
 
956
        GtkWidget *focus = GTK_WINDOW(toplevel)->focus_widget;
 
957
 
 
958
        if (focus)
 
959
          self_hide_tip(focus);
 
960
 
 
961
        g_object_set_data(G_OBJECT(toplevel), TOOLTIPS_KEYBOARD_MODE, GINT_TO_POINTER(FALSE));
 
962
      }
 
963
  }}
 
964
#line 965 "lm-tooltips.c"
 
965
#undef __GOB_FUNCTION__
 
966
 
 
967
#line 534 "src/lm-tooltips.gob"
 
968
static void 
 
969
lm_tooltips_start_delay (LMTooltips * self, GtkWidget * widget)
 
970
{
 
971
#line 972 "lm-tooltips.c"
 
972
#define __GOB_FUNCTION__ "LM:Tooltips::start_delay"
 
973
#line 534 "src/lm-tooltips.gob"
 
974
        g_return_if_fail (self != NULL);
 
975
#line 534 "src/lm-tooltips.gob"
 
976
        g_return_if_fail (LM_IS_TOOLTIPS (self));
 
977
#line 978 "lm-tooltips.c"
 
978
{
 
979
#line 536 "src/lm-tooltips.gob"
 
980
        
 
981
    TooltipsData *old_data;
 
982
 
 
983
    old_data = selfp->active_data;
 
984
    if (! old_data || old_data->widget != widget)
 
985
      {
 
986
        self_set_active_widget(self, widget);
 
987
        selfp->timeout_id = gdk_threads_add_timeout((selfp->use_sticky_delay && self_recently_shown(self)) ? STICKY_DELAY : DELAY,
 
988
                                                    self_timeout_cb,
 
989
                                                    self);
 
990
      }
 
991
  }}
 
992
#line 993 "lm-tooltips.c"
 
993
#undef __GOB_FUNCTION__
 
994
 
 
995
#line 549 "src/lm-tooltips.gob"
 
996
static void 
 
997
lm_tooltips_event_after_h (GtkWidget * widget, GdkEvent * event, gpointer user_data)
 
998
{
 
999
#line 1000 "lm-tooltips.c"
 
1000
#define __GOB_FUNCTION__ "LM:Tooltips::event_after_h"
 
1001
{
 
1002
#line 551 "src/lm-tooltips.gob"
 
1003
        
 
1004
    Self *self;
 
1005
    TooltipsData *old_data;
 
1006
    GtkWidget *event_widget;
 
1007
    gboolean keyboard_mode = self_get_keyboard_mode(widget);
 
1008
 
 
1009
    if ((event->type == GDK_LEAVE_NOTIFY || event->type == GDK_ENTER_NOTIFY) &&
 
1010
        event->crossing.detail == GDK_NOTIFY_INFERIOR)
 
1011
      return;
 
1012
 
 
1013
    old_data = self_get_data(widget);
 
1014
    self = old_data->self;
 
1015
 
 
1016
    if (keyboard_mode)
 
1017
      {
 
1018
        switch (event->type)
 
1019
          {
 
1020
          case GDK_FOCUS_CHANGE:
 
1021
            if (event->focus_change.in)
 
1022
              self_show_tip(widget);
 
1023
            else
 
1024
              self_hide_tip(widget);
 
1025
            break;
 
1026
 
 
1027
          default:
 
1028
            break;
 
1029
          }
 
1030
      }
 
1031
    else
 
1032
      {
 
1033
        if (event->type != GDK_KEY_PRESS && event->type != GDK_KEY_RELEASE)
 
1034
          {
 
1035
            event_widget = gtk_get_event_widget(event);
 
1036
            if (event_widget != widget)
 
1037
              return;
 
1038
          }
 
1039
 
 
1040
        switch (event->type)
 
1041
          {
 
1042
          case GDK_EXPOSE:
 
1043
            /* do nothing */
 
1044
            break;
 
1045
 
 
1046
          case GDK_ENTER_NOTIFY:
 
1047
            if (! (GTK_IS_MENU_ITEM(widget) && GTK_MENU_ITEM(widget)->submenu))
 
1048
              self_start_delay(self, widget);
 
1049
            break;
 
1050
 
 
1051
          case GDK_LEAVE_NOTIFY:
 
1052
            self_set_active_widget(self, NULL);
 
1053
            selfp->use_sticky_delay = selfp->window && GTK_WIDGET_VISIBLE(selfp->window);
 
1054
            break;
 
1055
 
 
1056
          case GDK_MOTION_NOTIFY:
 
1057
            /* Handle menu items specially ... pend popup for each motion
 
1058
             * on other widgets, we ignore motion.
 
1059
             */
 
1060
            if (GTK_IS_MENU_ITEM(widget) && ! GTK_MENU_ITEM(widget)->submenu)
 
1061
              {
 
1062
                /* Completely evil hack to make sure we get the LEAVE_NOTIFY
 
1063
                 */
 
1064
                GTK_PRIVATE_SET_FLAG(widget, GTK_LEAVE_PENDING);
 
1065
                self_set_active_widget(self, NULL);
 
1066
                self_start_delay(self, widget);
 
1067
                break;
 
1068
              }
 
1069
            break;              /* ignore */
 
1070
 
 
1071
          case GDK_BUTTON_PRESS:
 
1072
          case GDK_BUTTON_RELEASE:
 
1073
          case GDK_KEY_PRESS:
 
1074
          case GDK_KEY_RELEASE:
 
1075
          case GDK_PROXIMITY_IN:
 
1076
          case GDK_SCROLL:
 
1077
            self_set_active_widget(self, NULL);
 
1078
            break;
 
1079
 
 
1080
          default:
 
1081
            break;
 
1082
          }
 
1083
      }
 
1084
  }}
 
1085
#line 1086 "lm-tooltips.c"
 
1086
#undef __GOB_FUNCTION__
 
1087
 
 
1088
#line 634 "src/lm-tooltips.gob"
 
1089
static void 
 
1090
lm_tooltips_widget_unmap (GtkWidget * widget, gpointer user_data)
 
1091
{
 
1092
#line 1093 "lm-tooltips.c"
 
1093
#define __GOB_FUNCTION__ "LM:Tooltips::widget_unmap"
 
1094
#line 634 "src/lm-tooltips.gob"
 
1095
        g_return_if_fail (widget != NULL);
 
1096
#line 634 "src/lm-tooltips.gob"
 
1097
        g_return_if_fail (GTK_IS_WIDGET (widget));
 
1098
#line 1099 "lm-tooltips.c"
 
1099
{
 
1100
#line 636 "src/lm-tooltips.gob"
 
1101
        
 
1102
    TooltipsData *data = user_data;
 
1103
    Self *self = data->self;
 
1104
 
 
1105
    if (selfp->active_data &&
 
1106
        (selfp->active_data->widget == widget))
 
1107
      self_set_active_widget(self, NULL);
 
1108
  }}
 
1109
#line 1110 "lm-tooltips.c"
 
1110
#undef __GOB_FUNCTION__
 
1111
 
 
1112
#line 645 "src/lm-tooltips.gob"
 
1113
static void 
 
1114
lm_tooltips_widget_remove (GtkWidget * widget, gpointer user_data)
 
1115
{
 
1116
#line 1117 "lm-tooltips.c"
 
1117
#define __GOB_FUNCTION__ "LM:Tooltips::widget_remove"
 
1118
#line 645 "src/lm-tooltips.gob"
 
1119
        g_return_if_fail (widget != NULL);
 
1120
#line 645 "src/lm-tooltips.gob"
 
1121
        g_return_if_fail (GTK_IS_WIDGET (widget));
 
1122
#line 1123 "lm-tooltips.c"
 
1123
{
 
1124
#line 647 "src/lm-tooltips.gob"
 
1125
        
 
1126
    TooltipsData *data = user_data;
 
1127
    Self *self = data->self;
 
1128
 
 
1129
    self_widget_unmap(widget, user_data);
 
1130
    selfp->data_list = g_slist_remove(selfp->data_list, data);
 
1131
    self_destroy_data(data);
 
1132
  }}
 
1133
#line 1134 "lm-tooltips.c"
 
1134
#undef __GOB_FUNCTION__
 
1135
 
 
1136
#line 656 "src/lm-tooltips.gob"
 
1137
void 
 
1138
lm_tooltips_toggle_keyboard_mode (GtkWidget * widget)
 
1139
{
 
1140
#line 1141 "lm-tooltips.c"
 
1141
#define __GOB_FUNCTION__ "LM:Tooltips::toggle_keyboard_mode"
 
1142
#line 656 "src/lm-tooltips.gob"
 
1143
        g_return_if_fail (widget != NULL);
 
1144
#line 656 "src/lm-tooltips.gob"
 
1145
        g_return_if_fail (GTK_IS_WIDGET (widget));
 
1146
#line 1147 "lm-tooltips.c"
 
1147
{
 
1148
#line 658 "src/lm-tooltips.gob"
 
1149
        
 
1150
    if (self_get_keyboard_mode(widget))
 
1151
      self_stop_keyboard_mode(widget);
 
1152
    else
 
1153
      self_start_keyboard_mode(widget);
 
1154
  }}
 
1155
#line 1156 "lm-tooltips.c"
 
1156
#undef __GOB_FUNCTION__
 
1157
 
 
1158
#line 665 "src/lm-tooltips.gob"
 
1159
LMTooltips * 
 
1160
lm_tooltips_new (void)
 
1161
{
 
1162
#line 1163 "lm-tooltips.c"
 
1163
#define __GOB_FUNCTION__ "LM:Tooltips::new"
 
1164
{
 
1165
#line 667 "src/lm-tooltips.gob"
 
1166
        
 
1167
    return GET_NEW;
 
1168
  }}
 
1169
#line 1170 "lm-tooltips.c"
 
1170
#undef __GOB_FUNCTION__