]> Pileus Git - ~andy/gtk/blob - tests/gtkoffscreenbox.c
Deprecate widget flag: GTK_WIDGET_VISIBLE
[~andy/gtk] / tests / gtkoffscreenbox.c
1 /*
2  * gtkoffscreenbox.c
3  */
4
5 #include "config.h"
6
7 #include <math.h>
8 #include <gtk/gtk.h>
9
10 #include "gtkoffscreenbox.h"
11
12 static void        gtk_offscreen_box_realize       (GtkWidget       *widget);
13 static void        gtk_offscreen_box_unrealize     (GtkWidget       *widget);
14 static void        gtk_offscreen_box_size_request  (GtkWidget       *widget,
15                                                     GtkRequisition  *requisition);
16 static void        gtk_offscreen_box_size_allocate (GtkWidget       *widget,
17                                                     GtkAllocation   *allocation);
18 static gboolean    gtk_offscreen_box_damage        (GtkWidget       *widget,
19                                                     GdkEventExpose  *event);
20 static gboolean    gtk_offscreen_box_expose        (GtkWidget       *widget,
21                                                     GdkEventExpose  *offscreen);
22
23 static void        gtk_offscreen_box_add           (GtkContainer    *container,
24                                                     GtkWidget       *child);
25 static void        gtk_offscreen_box_remove        (GtkContainer    *container,
26                                                     GtkWidget       *widget);
27 static void        gtk_offscreen_box_forall        (GtkContainer    *container,
28                                                     gboolean         include_internals,
29                                                     GtkCallback      callback,
30                                                     gpointer         callback_data);
31 static GType       gtk_offscreen_box_child_type    (GtkContainer    *container);
32
33 #define CHILD1_SIZE_SCALE 1.0
34 #define CHILD2_SIZE_SCALE 1.0
35
36 G_DEFINE_TYPE (GtkOffscreenBox, gtk_offscreen_box, GTK_TYPE_CONTAINER);
37
38 static void
39 to_child_2 (GtkOffscreenBox *offscreen_box,
40             double widget_x, double widget_y,
41             double *x_out, double *y_out)
42 {
43   GtkAllocation child_area;
44   double x, y, xr, yr;
45   double cos_angle, sin_angle;
46
47   x = widget_x;
48   y = widget_y;
49
50   if (offscreen_box->child1 && gtk_widget_get_visible (offscreen_box->child1))
51     y -= offscreen_box->child1->allocation.height;
52
53   child_area = offscreen_box->child2->allocation;
54
55   x -= child_area.width / 2;
56   y -= child_area.height / 2;
57
58   cos_angle = cos (-offscreen_box->angle);
59   sin_angle = sin (-offscreen_box->angle);
60
61   xr = x * cos_angle - y * sin_angle;
62   yr = x * sin_angle + y * cos_angle;
63   x = xr;
64   y = yr;
65
66   x += child_area.width / 2;
67   y += child_area.height / 2;
68
69   *x_out = x;
70   *y_out = y;
71 }
72
73 static void
74 to_parent_2 (GtkOffscreenBox *offscreen_box,
75              double offscreen_x, double offscreen_y,
76              double *x_out, double *y_out)
77 {
78   GtkAllocation child_area;
79   double x, y, xr, yr;
80   double cos_angle, sin_angle;
81
82   child_area = offscreen_box->child2->allocation;
83
84   x = offscreen_x;
85   y = offscreen_y;
86
87   x -= child_area.width / 2;
88   y -= child_area.height / 2;
89
90   cos_angle = cos (offscreen_box->angle);
91   sin_angle = sin (offscreen_box->angle);
92
93   xr = x * cos_angle - y * sin_angle;
94   yr = x * sin_angle + y * cos_angle;
95   x = xr;
96   y = yr;
97
98   x += child_area.width / 2;
99   y += child_area.height / 2;
100
101   if (offscreen_box->child1 && gtk_widget_get_visible (offscreen_box->child1))
102     y += offscreen_box->child1->allocation.height;
103
104   *x_out = x;
105   *y_out = y;
106 }
107
108 static void
109 gtk_offscreen_box_class_init (GtkOffscreenBoxClass *klass)
110 {
111   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
112   GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
113
114   widget_class->realize = gtk_offscreen_box_realize;
115   widget_class->unrealize = gtk_offscreen_box_unrealize;
116   widget_class->size_request = gtk_offscreen_box_size_request;
117   widget_class->size_allocate = gtk_offscreen_box_size_allocate;
118   widget_class->expose_event = gtk_offscreen_box_expose;
119
120   g_signal_override_class_closure (g_signal_lookup ("damage-event", GTK_TYPE_WIDGET),
121                                    GTK_TYPE_OFFSCREEN_BOX,
122                                    g_cclosure_new (G_CALLBACK (gtk_offscreen_box_damage),
123                                                    NULL, NULL));
124
125   container_class->add = gtk_offscreen_box_add;
126   container_class->remove = gtk_offscreen_box_remove;
127   container_class->forall = gtk_offscreen_box_forall;
128   container_class->child_type = gtk_offscreen_box_child_type;
129 }
130
131 static void
132 gtk_offscreen_box_init (GtkOffscreenBox *offscreen_box)
133 {
134   GTK_WIDGET_UNSET_FLAGS (offscreen_box, GTK_NO_WINDOW);
135 }
136
137 GtkWidget *
138 gtk_offscreen_box_new (void)
139 {
140   return g_object_new (GTK_TYPE_OFFSCREEN_BOX, NULL);
141 }
142
143 static GdkWindow *
144 pick_offscreen_child (GdkWindow *offscreen_window,
145                       double widget_x, double widget_y,
146                       GtkOffscreenBox *offscreen_box)
147 {
148  GtkAllocation child_area;
149  double x, y;
150
151  /* First check for child 2 */
152  if (offscreen_box->child2 &&
153      gtk_widget_get_visible (offscreen_box->child2))
154     {
155       to_child_2 (offscreen_box,
156                   widget_x, widget_y,
157                   &x, &y);
158
159       child_area = offscreen_box->child2->allocation;
160
161       if (x >= 0 && x < child_area.width &&
162           y >= 0 && y < child_area.height)
163         return offscreen_box->offscreen_window2;
164     }
165
166  if (offscreen_box->child1 && gtk_widget_get_visible (offscreen_box->child1))
167    {
168      x = widget_x;
169      y = widget_y;
170
171      child_area = offscreen_box->child1->allocation;
172
173      if (x >= 0 && x < child_area.width &&
174          y >= 0 && y < child_area.height)
175        return offscreen_box->offscreen_window1;
176    }
177
178   return NULL;
179 }
180
181 static void
182 offscreen_window_to_parent1 (GdkWindow       *offscreen_window,
183                              double           offscreen_x,
184                              double           offscreen_y,
185                              double          *parent_x,
186                              double          *parent_y,
187                              GtkOffscreenBox *offscreen_box)
188 {
189   *parent_x = offscreen_x;
190   *parent_y = offscreen_y;
191 }
192
193 static void
194 offscreen_window_from_parent1 (GdkWindow       *window,
195                                double           parent_x,
196                                double           parent_y,
197                                double          *offscreen_x,
198                                double          *offscreen_y,
199                                GtkOffscreenBox *offscreen_box)
200 {
201   *offscreen_x = parent_x;
202   *offscreen_y = parent_y;
203 }
204
205 static void
206 offscreen_window_to_parent2 (GdkWindow       *offscreen_window,
207                              double           offscreen_x,
208                              double           offscreen_y,
209                              double          *parent_x,
210                              double          *parent_y,
211                              GtkOffscreenBox *offscreen_box)
212 {
213   to_parent_2 (offscreen_box,
214               offscreen_x, offscreen_y,
215               parent_x, parent_y);
216 }
217
218 static void
219 offscreen_window_from_parent2 (GdkWindow       *window,
220                                double           parent_x,
221                                double           parent_y,
222                                double          *offscreen_x,
223                                double          *offscreen_y,
224                                GtkOffscreenBox *offscreen_box)
225 {
226   to_child_2 (offscreen_box,
227               parent_x, parent_y,
228               offscreen_x, offscreen_y);
229 }
230
231 static void
232 gtk_offscreen_box_realize (GtkWidget *widget)
233 {
234   GtkOffscreenBox *offscreen_box = GTK_OFFSCREEN_BOX (widget);
235   GdkWindowAttr attributes;
236   gint attributes_mask;
237   gint border_width;
238   GtkRequisition child_requisition;
239   int start_y = 0;
240
241   GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
242
243   border_width = GTK_CONTAINER (widget)->border_width;
244
245   attributes.x = widget->allocation.x + border_width;
246   attributes.y = widget->allocation.y + border_width;
247   attributes.width = widget->allocation.width - 2 * border_width;
248   attributes.height = widget->allocation.height - 2 * border_width;
249   attributes.window_type = GDK_WINDOW_CHILD;
250   attributes.event_mask = gtk_widget_get_events (widget)
251                         | GDK_EXPOSURE_MASK
252                         | GDK_POINTER_MOTION_MASK
253                         | GDK_BUTTON_PRESS_MASK
254                         | GDK_BUTTON_RELEASE_MASK
255                         | GDK_SCROLL_MASK
256                         | GDK_ENTER_NOTIFY_MASK
257                         | GDK_LEAVE_NOTIFY_MASK;
258
259   attributes.visual = gtk_widget_get_visual (widget);
260   attributes.colormap = gtk_widget_get_colormap (widget);
261   attributes.wclass = GDK_INPUT_OUTPUT;
262
263   attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
264
265   widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
266                                    &attributes, attributes_mask);
267   gdk_window_set_user_data (widget->window, widget);
268
269   g_signal_connect (widget->window, "pick-embedded-child",
270                     G_CALLBACK (pick_offscreen_child), offscreen_box);
271
272   attributes.window_type = GDK_WINDOW_OFFSCREEN;
273
274   /* Child 1 */
275   attributes.x = attributes.y = 0;
276   if (offscreen_box->child1 && gtk_widget_get_visible (offscreen_box->child1))
277     {
278       attributes.width = offscreen_box->child1->allocation.width;
279       attributes.height = offscreen_box->child1->allocation.height;
280       start_y += offscreen_box->child1->allocation.height;
281     }
282   offscreen_box->offscreen_window1 = gdk_window_new (gtk_widget_get_root_window (widget),
283                                                      &attributes, attributes_mask);
284   gdk_window_set_user_data (offscreen_box->offscreen_window1, widget);
285   if (offscreen_box->child1)
286     gtk_widget_set_parent_window (offscreen_box->child1, offscreen_box->offscreen_window1);
287
288   gdk_offscreen_window_set_embedder (offscreen_box->offscreen_window1,
289                                      widget->window);
290   
291   g_signal_connect (offscreen_box->offscreen_window1, "to-embedder",
292                     G_CALLBACK (offscreen_window_to_parent1), offscreen_box);
293   g_signal_connect (offscreen_box->offscreen_window1, "from-embedder",
294                     G_CALLBACK (offscreen_window_from_parent1), offscreen_box);
295
296   /* Child 2 */
297   attributes.y = start_y;
298   child_requisition.width = child_requisition.height = 0;
299   if (offscreen_box->child2 && gtk_widget_get_visible (offscreen_box->child2))
300     {
301       attributes.width = offscreen_box->child2->allocation.width;
302       attributes.height = offscreen_box->child2->allocation.height;
303     }
304   offscreen_box->offscreen_window2 = gdk_window_new (gtk_widget_get_root_window (widget),
305                                                      &attributes, attributes_mask);
306   gdk_window_set_user_data (offscreen_box->offscreen_window2, widget);
307   if (offscreen_box->child2)
308     gtk_widget_set_parent_window (offscreen_box->child2, offscreen_box->offscreen_window2);
309   gdk_offscreen_window_set_embedder (offscreen_box->offscreen_window2,
310                                      widget->window);
311   g_signal_connect (offscreen_box->offscreen_window2, "to-embedder",
312                     G_CALLBACK (offscreen_window_to_parent2), offscreen_box);
313   g_signal_connect (offscreen_box->offscreen_window2, "from-embedder",
314                     G_CALLBACK (offscreen_window_from_parent2), offscreen_box);
315
316   widget->style = gtk_style_attach (widget->style, widget->window);
317
318   gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
319   gtk_style_set_background (widget->style, offscreen_box->offscreen_window1, GTK_STATE_NORMAL);
320   gtk_style_set_background (widget->style, offscreen_box->offscreen_window2, GTK_STATE_NORMAL);
321
322   gdk_window_show (offscreen_box->offscreen_window1);
323   gdk_window_show (offscreen_box->offscreen_window2);
324 }
325
326 static void
327 gtk_offscreen_box_unrealize (GtkWidget *widget)
328 {
329   GtkOffscreenBox *offscreen_box = GTK_OFFSCREEN_BOX (widget);
330
331   gdk_window_set_user_data (offscreen_box->offscreen_window1, NULL);
332   gdk_window_destroy (offscreen_box->offscreen_window1);
333   offscreen_box->offscreen_window1 = NULL;
334
335   gdk_window_set_user_data (offscreen_box->offscreen_window2, NULL);
336   gdk_window_destroy (offscreen_box->offscreen_window2);
337   offscreen_box->offscreen_window2 = NULL;
338
339   GTK_WIDGET_CLASS (gtk_offscreen_box_parent_class)->unrealize (widget);
340 }
341
342 static GType
343 gtk_offscreen_box_child_type (GtkContainer *container)
344 {
345   GtkOffscreenBox *offscreen_box = GTK_OFFSCREEN_BOX (container);
346
347   if (offscreen_box->child1 && offscreen_box->child2)
348     return G_TYPE_NONE;
349
350   return GTK_TYPE_WIDGET;
351 }
352
353 static void
354 gtk_offscreen_box_add (GtkContainer *container,
355                        GtkWidget    *widget)
356 {
357   GtkOffscreenBox *offscreen_box = GTK_OFFSCREEN_BOX (container);
358
359   if (!offscreen_box->child1)
360     gtk_offscreen_box_add1 (offscreen_box, widget);
361   else if (!offscreen_box->child2)
362     gtk_offscreen_box_add2 (offscreen_box, widget);
363   else
364     g_warning ("GtkOffscreenBox cannot have more than 2 children\n");
365 }
366
367 void
368 gtk_offscreen_box_add1 (GtkOffscreenBox *offscreen_box,
369                         GtkWidget       *child)
370 {
371   g_return_if_fail (GTK_IS_OFFSCREEN_BOX (offscreen_box));
372   g_return_if_fail (GTK_IS_WIDGET (child));
373
374   if (offscreen_box->child1 == NULL)
375     {
376       gtk_widget_set_parent_window (child, offscreen_box->offscreen_window1);
377       gtk_widget_set_parent (child, GTK_WIDGET (offscreen_box));
378       offscreen_box->child1 = child;
379     }
380 }
381
382 void
383 gtk_offscreen_box_add2 (GtkOffscreenBox  *offscreen_box,
384                         GtkWidget    *child)
385 {
386   g_return_if_fail (GTK_IS_OFFSCREEN_BOX (offscreen_box));
387   g_return_if_fail (GTK_IS_WIDGET (child));
388
389   if (offscreen_box->child2 == NULL)
390     {
391       gtk_widget_set_parent_window (child, offscreen_box->offscreen_window2);
392       gtk_widget_set_parent (child, GTK_WIDGET (offscreen_box));
393       offscreen_box->child2 = child;
394     }
395 }
396
397 static void
398 gtk_offscreen_box_remove (GtkContainer *container,
399                           GtkWidget    *widget)
400 {
401   GtkOffscreenBox *offscreen_box = GTK_OFFSCREEN_BOX (container);
402   gboolean was_visible;
403
404   was_visible = gtk_widget_get_visible (widget);
405
406   if (offscreen_box->child1 == widget)
407     {
408       gtk_widget_unparent (widget);
409
410       offscreen_box->child1 = NULL;
411
412       if (was_visible && gtk_widget_get_visible (GTK_WIDGET (container)))
413         gtk_widget_queue_resize (GTK_WIDGET (container));
414     }
415   else if (offscreen_box->child2 == widget)
416     {
417       gtk_widget_unparent (widget);
418
419       offscreen_box->child2 = NULL;
420
421       if (was_visible && gtk_widget_get_visible (GTK_WIDGET (container)))
422         gtk_widget_queue_resize (GTK_WIDGET (container));
423     }
424 }
425
426 static void
427 gtk_offscreen_box_forall (GtkContainer *container,
428                           gboolean      include_internals,
429                           GtkCallback   callback,
430                           gpointer      callback_data)
431 {
432   GtkOffscreenBox *offscreen_box = GTK_OFFSCREEN_BOX (container);
433
434   g_return_if_fail (callback != NULL);
435
436   if (offscreen_box->child1)
437     (*callback) (offscreen_box->child1, callback_data);
438   if (offscreen_box->child2)
439     (*callback) (offscreen_box->child2, callback_data);
440 }
441
442 void
443 gtk_offscreen_box_set_angle (GtkOffscreenBox  *offscreen_box,
444                              gdouble           angle)
445 {
446   g_return_if_fail (GTK_IS_OFFSCREEN_BOX (offscreen_box));
447
448   offscreen_box->angle = angle;
449   gtk_widget_queue_draw (GTK_WIDGET (offscreen_box));
450
451   /* TODO: Really needs to resent pointer events if over the rotated window */
452 }
453
454
455 static void
456 gtk_offscreen_box_size_request (GtkWidget      *widget,
457                                 GtkRequisition *requisition)
458 {
459   GtkOffscreenBox *offscreen_box = GTK_OFFSCREEN_BOX (widget);
460   int w, h;
461
462   w = 0;
463   h = 0;
464
465   if (offscreen_box->child1 && gtk_widget_get_visible (offscreen_box->child1))
466     {
467       GtkRequisition child_requisition;
468
469       gtk_widget_size_request (offscreen_box->child1, &child_requisition);
470
471       w = MAX (w, CHILD1_SIZE_SCALE * child_requisition.width);
472       h += CHILD1_SIZE_SCALE * child_requisition.height;
473     }
474
475   if (offscreen_box->child2 && gtk_widget_get_visible (offscreen_box->child2))
476     {
477       GtkRequisition child_requisition;
478
479       gtk_widget_size_request (offscreen_box->child2, &child_requisition);
480
481       w = MAX (w, CHILD2_SIZE_SCALE * child_requisition.width);
482       h += CHILD2_SIZE_SCALE * child_requisition.height;
483     }
484
485   requisition->width = GTK_CONTAINER (widget)->border_width * 2 + w;
486   requisition->height = GTK_CONTAINER (widget)->border_width * 2 + h;
487 }
488
489 static void
490 gtk_offscreen_box_size_allocate (GtkWidget     *widget,
491                                  GtkAllocation *allocation)
492 {
493   GtkOffscreenBox *offscreen_box;
494   gint border_width;
495   gint start_y;
496
497   widget->allocation = *allocation;
498   offscreen_box = GTK_OFFSCREEN_BOX (widget);
499
500   border_width = GTK_CONTAINER (widget)->border_width;
501
502   if (GTK_WIDGET_REALIZED (widget))
503     gdk_window_move_resize (widget->window,
504                             allocation->x + border_width,
505                             allocation->y + border_width,
506                             allocation->width - border_width * 2,
507                             allocation->height - border_width * 2);
508
509   start_y = 0;
510
511   if (offscreen_box->child1 && gtk_widget_get_visible (offscreen_box->child1))
512     {
513       GtkRequisition child_requisition;
514       GtkAllocation child_allocation;
515
516       gtk_widget_get_child_requisition (offscreen_box->child1, &child_requisition);
517       child_allocation.x = child_requisition.width * (CHILD1_SIZE_SCALE - 1.0) / 2;
518       child_allocation.y = start_y + child_requisition.height * (CHILD1_SIZE_SCALE - 1.0) / 2;
519       child_allocation.width = MAX (1, (gint) widget->allocation.width - 2 * border_width);
520       child_allocation.height = child_requisition.height;
521
522       start_y += CHILD1_SIZE_SCALE * child_requisition.height;
523
524       if (GTK_WIDGET_REALIZED (widget))
525         gdk_window_move_resize (offscreen_box->offscreen_window1,
526                                 child_allocation.x,
527                                 child_allocation.y,
528                                 child_allocation.width,
529                                 child_allocation.height);
530
531       child_allocation.x = child_allocation.y = 0;
532       gtk_widget_size_allocate (offscreen_box->child1, &child_allocation);
533     }
534
535   if (offscreen_box->child2 && gtk_widget_get_visible (offscreen_box->child2))
536     {
537       GtkRequisition child_requisition;
538       GtkAllocation child_allocation;
539
540       gtk_widget_get_child_requisition (offscreen_box->child2, &child_requisition);
541       child_allocation.x = child_requisition.width * (CHILD2_SIZE_SCALE - 1.0) / 2;
542       child_allocation.y = start_y + child_requisition.height * (CHILD2_SIZE_SCALE - 1.0) / 2;
543       child_allocation.width = MAX (1, (gint) widget->allocation.width - 2 * border_width);
544       child_allocation.height = child_requisition.height;
545
546       start_y += CHILD2_SIZE_SCALE * child_requisition.height;
547
548       if (GTK_WIDGET_REALIZED (widget))
549         gdk_window_move_resize (offscreen_box->offscreen_window2,
550                                 child_allocation.x,
551                                 child_allocation.y,
552                                 child_allocation.width,
553                                 child_allocation.height);
554
555       child_allocation.x = child_allocation.y = 0;
556       gtk_widget_size_allocate (offscreen_box->child2, &child_allocation);
557     }
558 }
559
560 static gboolean
561 gtk_offscreen_box_damage (GtkWidget      *widget,
562                           GdkEventExpose *event)
563 {
564   gdk_window_invalidate_rect (widget->window, NULL, FALSE);
565
566   return TRUE;
567 }
568
569 static gboolean
570 gtk_offscreen_box_expose (GtkWidget      *widget,
571                           GdkEventExpose *event)
572 {
573   GtkOffscreenBox *offscreen_box = GTK_OFFSCREEN_BOX (widget);
574
575   if (gtk_widget_is_drawable (widget))
576     {
577       if (event->window == widget->window)
578         {
579           GdkPixmap *pixmap;
580           GtkAllocation child_area;
581           cairo_t *cr;
582           int start_y = 0;
583
584           if (offscreen_box->child1 && gtk_widget_get_visible (offscreen_box->child1))
585             {
586               pixmap = gdk_offscreen_window_get_pixmap (offscreen_box->offscreen_window1);
587               child_area = offscreen_box->child1->allocation;
588
589               cr = gdk_cairo_create (widget->window);
590
591               gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0);
592               cairo_paint (cr);
593
594               cairo_destroy (cr);
595
596               start_y += child_area.height;
597             }
598
599           if (offscreen_box->child2 && gtk_widget_get_visible (offscreen_box->child2))
600             {
601               gint w, h;
602
603               pixmap = gdk_offscreen_window_get_pixmap (offscreen_box->offscreen_window2);
604               child_area = offscreen_box->child2->allocation;
605
606               cr = gdk_cairo_create (widget->window);
607
608               /* transform */
609               cairo_translate (cr, 0, start_y);
610               cairo_translate (cr, child_area.width / 2, child_area.height / 2);
611               cairo_rotate (cr, offscreen_box->angle);
612               cairo_translate (cr, -child_area.width / 2, -child_area.height / 2);
613
614               /* clip */
615               gdk_drawable_get_size (pixmap, &w, &h);
616               cairo_rectangle (cr, 0, 0, w, h);
617               cairo_clip (cr);
618
619               /* paint */
620               gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0);
621               cairo_paint (cr);
622
623               cairo_destroy (cr);
624             }
625         }
626       else if (event->window == offscreen_box->offscreen_window1)
627         {
628           gtk_paint_flat_box (widget->style, event->window,
629                               GTK_STATE_NORMAL, GTK_SHADOW_NONE,
630                               &event->area, widget, "blah",
631                               0, 0, -1, -1);
632
633           if (offscreen_box->child1)
634             gtk_container_propagate_expose (GTK_CONTAINER (widget),
635                                             offscreen_box->child1,
636                                             event);
637         }
638       else if (event->window == offscreen_box->offscreen_window2)
639         {
640           gtk_paint_flat_box (widget->style, event->window,
641                               GTK_STATE_NORMAL, GTK_SHADOW_NONE,
642                               &event->area, widget, "blah",
643                               0, 0, -1, -1);
644
645           if (offscreen_box->child2)
646             gtk_container_propagate_expose (GTK_CONTAINER (widget),
647                                             offscreen_box->child2,
648                                             event);
649         }
650     }
651
652   return FALSE;
653 }