]> Pileus Git - ~andy/gtk/blob - gtk/gtkplug.c
gtk/Makefile.am gtk/gtkplug.c on request of Owen, reverted my last change
[~andy/gtk] / gtk / gtkplug.c
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free
16  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17  */
18
19 /* By Owen Taylor <otaylor@gtk.org>              98/4/4 */
20
21 /*
22  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
23  * file for a list of people on the GTK+ Team.  See the ChangeLog
24  * files for a list of changes.  These files are distributed with
25  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
26  */
27
28 #include "gtkmain.h"
29 #include "gtkplug.h"
30
31 #include "gdk/gdkkeysyms.h"
32 #include "x11/gdkx.h"
33
34 #include "xembed.h"
35
36 static void            gtk_plug_class_init            (GtkPlugClass     *klass);
37 static void            gtk_plug_init                  (GtkPlug          *plug);
38 static void            gtk_plug_realize               (GtkWidget        *widget);
39 static void            gtk_plug_unrealize             (GtkWidget        *widget);
40 static gboolean        gtk_plug_key_press_event       (GtkWidget        *widget,
41                                                        GdkEventKey      *event);
42 static void            gtk_plug_forward_key_press     (GtkPlug          *plug,
43                                                        GdkEventKey      *event);
44 static void            gtk_plug_set_focus             (GtkWindow        *window,
45                                                        GtkWidget        *focus);
46 static gboolean        gtk_plug_focus                 (GtkContainer     *container,
47                                                        GtkDirectionType  direction);
48 static void            gtk_plug_accel_entries_changed (GtkWindow        *window);
49 static GdkFilterReturn gtk_plug_filter_func           (GdkXEvent        *gdk_xevent,
50                                                        GdkEvent         *event,
51                                                        gpointer          data);
52
53 static void gtk_plug_free_grabbed_keys (GHashTable *key_table);
54 static void handle_modality_off        (GtkPlug    *plug);
55 static void send_xembed_message        (GtkPlug    *plug,
56                                         glong       message,
57                                         glong       detail,
58                                         glong       data1,
59                                         glong       data2,
60                                         guint32     time);
61
62 /* From Tk */
63 #define EMBEDDED_APP_WANTS_FOCUS NotifyNormal+20
64   
65 static GtkWindowClass *parent_class = NULL;
66
67 GtkType
68 gtk_plug_get_type ()
69 {
70   static GtkType plug_type = 0;
71
72   if (!plug_type)
73     {
74       static const GTypeInfo plug_info =
75       {
76         sizeof (GtkPlugClass),
77         NULL,           /* base_init */
78         NULL,           /* base_finalize */
79         (GClassInitFunc) gtk_plug_class_init,
80         NULL,           /* class_finalize */
81         NULL,           /* class_data */
82         sizeof (GtkPlug),
83         16,             /* n_preallocs */
84         (GInstanceInitFunc) gtk_plug_init,
85       };
86
87       plug_type = g_type_register_static (GTK_TYPE_WINDOW, "GtkPlug", &plug_info, 0);
88     }
89
90   return plug_type;
91 }
92
93 static void
94 gtk_plug_class_init (GtkPlugClass *class)
95 {
96   GtkWidgetClass *widget_class = (GtkWidgetClass *)class;
97   GtkContainerClass *container_class = (GtkContainerClass *)class;
98   GtkWindowClass *window_class = (GtkWindowClass *)class;
99
100   parent_class = gtk_type_class (GTK_TYPE_WINDOW);
101
102   widget_class->realize = gtk_plug_realize;
103   widget_class->unrealize = gtk_plug_unrealize;
104   widget_class->key_press_event = gtk_plug_key_press_event;
105
106   container_class->focus = gtk_plug_focus;
107
108   window_class->set_focus = gtk_plug_set_focus;
109 #if 0  
110   window_class->accel_entries_changed = gtk_plug_accel_entries_changed;
111 #endif
112 }
113
114 static void
115 gtk_plug_init (GtkPlug *plug)
116 {
117   GtkWindow *window;
118
119   window = GTK_WINDOW (plug);
120
121   window->type = GTK_WINDOW_TOPLEVEL;
122   window->auto_shrink = TRUE;
123
124 #if 0  
125   gtk_window_set_grab_group (window, window);
126 #endif  
127 }
128
129 void
130 gtk_plug_construct (GtkPlug *plug, GdkNativeWindow socket_id)
131 {
132   if (socket_id)
133     {
134       plug->socket_window = gdk_window_lookup (socket_id);
135       plug->same_app = TRUE;
136
137       if (plug->socket_window == NULL)
138         {
139           plug->socket_window = gdk_window_foreign_new (socket_id);
140           plug->same_app = FALSE;
141         }
142     }
143 }
144
145 GtkWidget*
146 gtk_plug_new (GdkNativeWindow socket_id)
147 {
148   GtkPlug *plug;
149
150   plug = GTK_PLUG (gtk_type_new (GTK_TYPE_PLUG));
151   gtk_plug_construct (plug, socket_id);
152   return GTK_WIDGET (plug);
153 }
154
155 static void
156 gtk_plug_unrealize (GtkWidget *widget)
157 {
158   GtkPlug *plug;
159
160   g_return_if_fail (widget != NULL);
161   g_return_if_fail (GTK_IS_PLUG (widget));
162
163   plug = GTK_PLUG (widget);
164
165   if (plug->socket_window != NULL)
166     {
167       gdk_window_set_user_data (plug->socket_window, NULL);
168       gdk_window_unref (plug->socket_window);
169       plug->socket_window = NULL;
170     }
171
172 #if 0  
173   if (plug->modality_window)
174     handle_modality_off (plug);
175 #endif  
176   
177   if (GTK_WIDGET_CLASS (parent_class)->unrealize)
178     (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
179 }
180
181 static void
182 gtk_plug_realize (GtkWidget *widget)
183 {
184   GtkWindow *window;
185   GtkPlug *plug;
186   GdkWindowAttr attributes;
187   gint attributes_mask;
188
189   g_return_if_fail (widget != NULL);
190   g_return_if_fail (GTK_IS_PLUG (widget));
191
192   GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
193   window = GTK_WINDOW (widget);
194   plug = GTK_PLUG (widget);
195
196   attributes.window_type = GDK_WINDOW_CHILD;    /* XXX GDK_WINDOW_PLUG ? */
197   attributes.title = window->title;
198   attributes.wmclass_name = window->wmclass_name;
199   attributes.wmclass_class = window->wmclass_class;
200   attributes.width = widget->allocation.width;
201   attributes.height = widget->allocation.height;
202   attributes.wclass = GDK_INPUT_OUTPUT;
203
204   /* this isn't right - we should match our parent's visual/colormap.
205    * though that will require handling "foreign" colormaps */
206   attributes.visual = gtk_widget_get_visual (widget);
207   attributes.colormap = gtk_widget_get_colormap (widget);
208   attributes.event_mask = gtk_widget_get_events (widget);
209   attributes.event_mask |= (GDK_EXPOSURE_MASK |
210                             GDK_KEY_PRESS_MASK |
211                             GDK_ENTER_NOTIFY_MASK |
212                             GDK_LEAVE_NOTIFY_MASK |
213                             GDK_FOCUS_CHANGE_MASK |
214                             GDK_STRUCTURE_MASK);
215
216   attributes_mask = GDK_WA_VISUAL | GDK_WA_COLORMAP;
217   attributes_mask |= (window->title ? GDK_WA_TITLE : 0);
218   attributes_mask |= (window->wmclass_name ? GDK_WA_WMCLASS : 0);
219
220   gdk_error_trap_push ();
221   widget->window = gdk_window_new (plug->socket_window, 
222                                    &attributes, attributes_mask);
223   gdk_flush ();
224   if (gdk_error_trap_pop ()) /* Uh-oh */
225     {
226       gdk_error_trap_push ();
227       gdk_window_destroy (widget->window);
228       gdk_flush ();
229       gdk_error_trap_pop ();
230       widget->window = gdk_window_new (NULL, &attributes, attributes_mask);
231     }
232   
233   GDK_WINDOW_TYPE (widget->window) = GDK_WINDOW_TOPLEVEL;
234   gdk_window_set_user_data (widget->window, window);
235
236   widget->style = gtk_style_attach (widget->style, widget->window);
237   gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
238
239   gdk_window_add_filter (widget->window, gtk_plug_filter_func, widget);
240 }
241
242 static gboolean
243 gtk_plug_key_press_event (GtkWidget   *widget,
244                           GdkEventKey *event)
245 {
246   if (!GTK_WINDOW (widget)->has_focus)
247     {
248       gtk_plug_forward_key_press (GTK_PLUG (widget), event);
249       return TRUE;
250     }
251   else
252     return GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event);
253 }
254
255 static void
256 gtk_plug_forward_key_press (GtkPlug *plug, GdkEventKey *event)
257 {
258   XEvent xevent;
259   
260   xevent.xkey.type = KeyPress;
261   xevent.xkey.display = GDK_WINDOW_XDISPLAY (GTK_WIDGET(plug)->window);
262   xevent.xkey.window = GDK_WINDOW_XWINDOW (plug->socket_window);
263   xevent.xkey.root = GDK_ROOT_WINDOW (); /* FIXME */
264   xevent.xkey.time = event->time;
265   /* FIXME, the following might cause big problems for
266    * non-GTK apps */
267   xevent.xkey.x = 0;
268   xevent.xkey.y = 0;
269   xevent.xkey.x_root = 0;
270   xevent.xkey.y_root = 0;
271   xevent.xkey.state = event->state;
272   xevent.xkey.keycode =  XKeysymToKeycode(GDK_DISPLAY(), 
273                                           event->keyval);
274   xevent.xkey.same_screen = TRUE; /* FIXME ? */
275
276   gdk_error_trap_push ();
277   XSendEvent (gdk_display,
278               GDK_WINDOW_XWINDOW (plug->socket_window),
279               False, NoEventMask, &xevent);
280   gdk_flush ();
281   gdk_error_trap_pop ();
282 }
283
284 static void
285 gtk_plug_set_focus (GtkWindow *window,
286                     GtkWidget *focus)
287 {
288   GtkPlug *plug = GTK_PLUG (window);
289
290   GTK_WINDOW_CLASS (parent_class)->set_focus (window, focus);
291   
292   /* Ask for focus from embedder
293    */
294
295   if (focus && !window->has_focus)
296     {
297 #if 0      
298       XEvent xevent;
299
300       xevent.xfocus.type = FocusIn;
301       xevent.xfocus.display = GDK_WINDOW_XDISPLAY (GTK_WIDGET(plug)->window);
302       xevent.xfocus.window = GDK_WINDOW_XWINDOW (plug->socket_window);
303       xevent.xfocus.mode = EMBEDDED_APP_WANTS_FOCUS;
304       xevent.xfocus.detail = FALSE; /* Don't force */
305
306       gdk_error_trap_push ();
307       XSendEvent (gdk_display,
308                   GDK_WINDOW_XWINDOW (plug->socket_window),
309                   False, NoEventMask, &xevent);
310       gdk_flush ();
311       gdk_error_trap_pop ();
312 #endif
313
314       send_xembed_message (plug, XEMBED_REQUEST_FOCUS, 0, 0, 0,
315                            gtk_get_current_event_time ());
316     }
317 }
318
319 #if 0
320
321 typedef struct
322 {
323   guint                  accelerator_key;
324   GdkModifierType        accelerator_mods;
325 } GrabbedKey;
326
327 static guint
328 grabbed_key_hash (gconstpointer a)
329 {
330   const GrabbedKey *key = a;
331   guint h;
332   
333   h = key->accelerator_key << 16;
334   h ^= key->accelerator_key >> 16;
335   h ^= key->accelerator_mods;
336
337   return h;
338 }
339
340 static gboolean
341 grabbed_key_equal (gconstpointer a, gconstpointer b)
342 {
343   const GrabbedKey *keya = a;
344   const GrabbedKey *keyb = b;
345
346   return (keya->accelerator_key == keyb->accelerator_key &&
347           keya->accelerator_mods == keyb->accelerator_mods);
348 }
349
350 static void
351 add_grabbed_keys (gpointer key, gpointer val, gpointer data)
352 {
353   GrabbedKey *grabbed_key = key;
354   GtkPlug *plug = data;
355
356   if (!plug->grabbed_keys ||
357       !g_hash_table_lookup (plug->grabbed_keys, grabbed_key))
358     {
359       send_xembed_message (plug, XEMBED_GRAB_KEY, 0, 
360                            grabbed_key->accelerator_key, grabbed_key->accelerator_mods,
361                            gtk_get_current_event_time ());
362     }
363 }
364
365 static void
366 remove_grabbed_keys (gpointer key, gpointer val, gpointer data)
367 {
368   GrabbedKey *grabbed_key = key;
369   GtkPlug *plug = data;
370
371   if (!plug->grabbed_keys ||
372       !g_hash_table_lookup (plug->grabbed_keys, grabbed_key))
373     {
374       send_xembed_message (plug, XEMBED_UNGRAB_KEY, 0, 
375                            grabbed_key->accelerator_key, grabbed_key->accelerator_mods,
376                            gtk_get_current_event_time ());
377     }
378 }
379
380 static void
381 gtk_plug_free_grabbed_keys (GHashTable *key_table)
382 {
383   g_hash_table_foreach (key_table, (GHFunc)g_free, NULL);
384   g_hash_table_destroy (key_table);
385 }
386
387 static void
388 gtk_plug_accel_entries_changed (GtkWindow *window)
389 {
390   GHashTable *new_grabbed_keys, *old_grabbed_keys;
391   GSList *accel_groups, *tmp_list;
392   GtkPlug *plug = GTK_PLUG (window);
393
394   new_grabbed_keys = g_hash_table_new (grabbed_key_hash, grabbed_key_equal);
395
396   accel_groups = gtk_accel_groups_from_object (GTK_OBJECT (window));
397   
398   tmp_list = accel_groups;
399
400   while (tmp_list)
401     {
402       GtkAccelGroup *accel_group = tmp_list->data;
403       gint i, n_entries;
404       GtkAccelEntry *entries;
405
406       gtk_accel_group_get_entries (accel_group, &entries, &n_entries);
407
408       for (i = 0; i < n_entries; i++)
409         {
410           GdkKeymapKey *keys;
411           gint n_keys;
412           
413           if (gdk_keymap_get_entries_for_keyval (NULL, entries[i].accelerator_key, &keys, &n_keys))
414             {
415               GrabbedKey *key = g_new (GrabbedKey, 1);
416               
417               key->accelerator_key = keys[0].keycode;
418               key->accelerator_mods = entries[i].accelerator_mods;
419               
420               g_hash_table_insert (new_grabbed_keys, key, key);
421
422               g_free (keys);
423             }
424         }
425       
426       tmp_list = tmp_list->next;
427     }
428
429   g_hash_table_foreach (new_grabbed_keys, add_grabbed_keys, plug);
430
431   old_grabbed_keys = plug->grabbed_keys;
432   plug->grabbed_keys = new_grabbed_keys;
433
434   if (old_grabbed_keys)
435     {
436       g_hash_table_foreach (old_grabbed_keys, remove_grabbed_keys, plug);
437       gtk_plug_free_grabbed_keys (old_grabbed_keys);
438     }
439
440 }
441 #endif
442
443 static gboolean
444 gtk_plug_focus (GtkContainer     *container,
445                 GtkDirectionType  direction)
446 {
447   GtkBin *bin = GTK_BIN (container);
448   GtkPlug *plug = GTK_PLUG (container);
449   GtkWindow *window = GTK_WINDOW (container);
450   GtkWidget *old_focus_child = container->focus_child;
451   GtkWidget *parent;
452   
453   /* We override GtkWindow's behavior, since we don't want wrapping here.
454    */
455   if (old_focus_child)
456     {
457       if (GTK_IS_CONTAINER (old_focus_child) &&
458           GTK_WIDGET_DRAWABLE (old_focus_child) &&
459           GTK_WIDGET_IS_SENSITIVE (old_focus_child) &&
460           gtk_container_focus (GTK_CONTAINER (old_focus_child), direction))
461         return TRUE;
462
463       if (window->focus_widget)
464         {
465           /* Wrapped off the end, clear the focus setting for the toplevel */
466           parent = window->focus_widget->parent;
467           while (parent)
468             {
469               gtk_container_set_focus_child (GTK_CONTAINER (parent), NULL);
470               parent = GTK_WIDGET (parent)->parent;
471             }
472           
473           gtk_window_set_focus (GTK_WINDOW (container), NULL);
474
475           if (!GTK_CONTAINER (window)->focus_child)
476             {
477               gint message = -1;
478
479               switch (direction)
480                 {
481                 case GTK_DIR_UP:
482                 case GTK_DIR_LEFT:
483                 case GTK_DIR_TAB_BACKWARD:
484                   message = XEMBED_FOCUS_PREV;
485                   break;
486                 case GTK_DIR_DOWN:
487                 case GTK_DIR_RIGHT:
488                 case GTK_DIR_TAB_FORWARD:
489                   message = XEMBED_FOCUS_NEXT;
490                   break;
491                 }
492               
493               send_xembed_message (plug, message, 0, 0, 0,
494                                    gtk_get_current_event_time ());
495               
496 #if 0         
497               gtk_window_set_focus (GTK_WINDOW (widget), NULL);
498
499               gdk_error_trap_push ();
500               XSetInputFocus (GDK_DISPLAY (),
501                               GDK_WINDOW_XWINDOW (plug->socket_window),
502                               RevertToParent, event->time);
503               gdk_flush ();
504               gdk_error_trap_pop ();
505
506               gtk_plug_forward_key_press (plug, event);
507 #endif        
508             }
509         }
510
511       return FALSE;
512     }
513   else
514     {
515       /* Try to focus the first widget in the window */
516       if (GTK_WIDGET_DRAWABLE (bin->child) &&
517           GTK_WIDGET_IS_SENSITIVE (bin->child))
518         {
519           if (GTK_IS_CONTAINER (bin->child))
520             {
521               if (gtk_container_focus (GTK_CONTAINER (bin->child), direction))
522                 return TRUE;
523             }
524           else if (GTK_WIDGET_CAN_FOCUS (bin->child))
525             {
526               gtk_widget_grab_focus (bin->child);
527               return TRUE;
528             }
529         }
530     }
531
532   return FALSE;
533 }
534
535 static void
536 send_xembed_message (GtkPlug *plug,
537                      glong      message,
538                      glong      detail,
539                      glong      data1,
540                      glong      data2,
541                      guint32    time)
542 {
543   if (plug->socket_window)
544     {
545       XEvent xevent;
546
547       xevent.xclient.window = GDK_WINDOW_XWINDOW (plug->socket_window);
548       xevent.xclient.type = ClientMessage;
549       xevent.xclient.message_type = gdk_atom_intern ("_XEMBED", FALSE);
550       xevent.xclient.format = 32;
551       xevent.xclient.data.l[0] = time;
552       xevent.xclient.data.l[1] = message;
553       xevent.xclient.data.l[2] = detail;
554       xevent.xclient.data.l[3] = data1;
555       xevent.xclient.data.l[4] = data2;
556
557       gdk_error_trap_push ();
558       XSendEvent (gdk_display,
559                   GDK_WINDOW_XWINDOW (plug->socket_window),
560                   False, NoEventMask, &xevent);
561       gdk_flush ();
562       gdk_error_trap_pop ();
563     }
564 }
565
566 static void
567 focus_first_last (GtkPlug          *plug,
568                   GtkDirectionType  direction)
569 {
570   GtkWindow *window = GTK_WINDOW (plug);
571   GtkWidget *parent;
572   
573   if (window->focus_widget)
574     {
575       parent = window->focus_widget->parent;
576       while (parent)
577         {
578           gtk_container_set_focus_child (GTK_CONTAINER (parent), NULL);
579           parent = GTK_WIDGET (parent)->parent;
580         }
581       
582       gtk_window_set_focus (GTK_WINDOW (plug), NULL);
583     }
584
585   gtk_container_focus (GTK_CONTAINER (plug), direction);
586 }
587
588 static void
589 handle_modality_on (GtkPlug *plug)
590 {
591 #if 0
592   if (!plug->modality_window)
593     {
594       plug->modality_window = gtk_window_new (GTK_WINDOW_POPUP);
595       gtk_window_set_grab_group (GTK_WINDOW (plug->modality_window), GTK_WINDOW (plug));
596       gtk_grab_add (plug->modality_window);
597     }
598 #endif  
599 }
600
601 static void
602 handle_modality_off (GtkPlug *plug)
603 {
604 #if 0  
605   if (plug->modality_window)
606     {
607       gtk_grab_remove (plug->modality_window);
608       gtk_widget_destroy (plug->modality_window);
609       plug->modality_window = NULL;
610     }
611 #endif  
612 }
613
614 static void
615 handle_xembed_message (GtkPlug   *plug,
616                        glong      message,
617                        glong      detail,
618                        glong      data1,
619                        glong      data2,
620                        guint32    time)
621 {
622   GTK_NOTE (PLUGSOCKET,
623             g_message ("Message of type %ld received", message));
624   
625   switch (message)
626     {
627     case XEMBED_EMBEDDED_NOTIFY:
628       break;
629     case XEMBED_WINDOW_ACTIVATE:
630       GTK_NOTE(PLUGSOCKET,
631                g_message ("GtkPlug: ACTIVATE received"));
632       break;
633     case XEMBED_WINDOW_DEACTIVATE:
634       GTK_NOTE(PLUGSOCKET,
635                g_message ("GtkPlug: DEACTIVATE received"));
636       break;
637       
638     case XEMBED_MODALITY_ON:
639       handle_modality_on (plug);
640       break;
641     case XEMBED_MODALITY_OFF:
642       handle_modality_off (plug);
643       break;
644
645     case XEMBED_FOCUS_IN:
646       switch (detail)
647         {
648         case XEMBED_FOCUS_FIRST:
649           focus_first_last (plug, GTK_DIR_TAB_FORWARD);
650           break;
651         case XEMBED_FOCUS_LAST:
652           focus_first_last (plug, GTK_DIR_TAB_BACKWARD);
653           break;
654         case XEMBED_FOCUS_CURRENT:
655           /* fall through */;
656         }
657       
658     case XEMBED_FOCUS_OUT:
659       {
660         GdkEvent event;
661
662         event.focus_change.type = GDK_FOCUS_CHANGE;
663         event.focus_change.window = GTK_WIDGET (plug)->window;
664         event.focus_change.send_event = TRUE;
665         event.focus_change.in = (message == XEMBED_FOCUS_IN);
666
667         gtk_widget_event (GTK_WIDGET (plug), &event);
668
669         break;
670       }
671       
672     case XEMBED_REQUEST_FOCUS:
673     case XEMBED_FOCUS_NEXT:
674     case XEMBED_FOCUS_PREV:
675     case XEMBED_GRAB_KEY:
676     case XEMBED_UNGRAB_KEY:
677       g_warning ("GtkPlug: Invalid _XEMBED message of type %ld received", message);
678       break;
679       
680     default:
681       GTK_NOTE(PLUGSOCKET,
682                g_message ("GtkPlug: Ignoring unknown _XEMBED message of type %ld", message));
683       break;
684     }
685 }
686
687 static GdkFilterReturn
688 gtk_plug_filter_func (GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data)
689 {
690   GtkPlug *plug = GTK_PLUG (data);
691   XEvent *xevent = (XEvent *)gdk_xevent;
692
693   GdkFilterReturn return_val;
694   
695   return_val = GDK_FILTER_CONTINUE;
696
697   switch (xevent->type)
698     {
699     case ClientMessage:
700       if (xevent->xclient.message_type == gdk_atom_intern ("_XEMBED", FALSE))
701         {
702           handle_xembed_message (plug,
703                                  xevent->xclient.data.l[1],
704                                  xevent->xclient.data.l[2],
705                                  xevent->xclient.data.l[3],
706                                  xevent->xclient.data.l[4],
707                                  xevent->xclient.data.l[0]);
708                                  
709
710           return GDK_FILTER_REMOVE;
711         }
712       break;
713     }
714
715   return GDK_FILTER_CONTINUE;
716 }