1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* eggtrayicon.c
3  * Copyright (C) 2002 Anders Carlsson <andersca@gnu.org>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20 
21 /*
22 
23 Permission to use this file under wxWindows license given by
24 copyright holder:
25 --------
26 From andersca@gnu.org Tue Dec  9 13:01:56 2003
27 Return-path: <andersca@gnu.org>
28 Envelope-to: vasek@localhost
29 Delivery-date: Tue, 09 Dec 2003 13:04:35 +0100
30 Received: from localhost
31 	([127.0.0.1] helo=amavis ident=amavis)
32 	by armitage with esmtp (Exim 3.35 #1)
33 	id 1ATgbS-0001Gs-00
34 	for vasek@localhost; Tue, 09 Dec 2003 13:04:35 +0100
35 Received: from armitage ([127.0.0.1])
36 	by amavis (armitage [127.0.0.1]) (amavisd-new, port 10024) with ESMTP
37 	id 04227-09 for <vasek@localhost>;
38 	Tue, 9 Dec 2003 13:04:11 +0100 (CET)
39 Received: from localhost ([127.0.0.1] ident=fetchmail)
40 	by armitage with esmtp (Exim 3.35 #1)
41 	id 1ATgb5-0001GY-00
42 	for vasek@localhost; Tue, 09 Dec 2003 13:04:11 +0100
43 Delivered-To: alias-email-slavikvaclav@seznam.cz
44 Received: from pop3.seznam.cz [212.80.76.45]
45 	by localhost with POP3 (fetchmail-5.9.11)
46 	for vasek@localhost (single-drop); Tue, 09 Dec 2003 13:04:11 +0100 (CET)
47 Received: (qmail 9861 invoked from network); 9 Dec 2003 12:02:17 -0000
48 Received: from unknown (HELO maxipes.logix.cz) (81.0.234.97)
49   by buster.go.seznam.cz with SMTP; 9 Dec 2003 12:02:17 -0000
50 Received: by maxipes.logix.cz (Postfix, from userid 604)
51 	id 37E6D29A51; Tue,  9 Dec 2003 13:02:16 +0100 (CET)
52 X-Original-To: vaclav.slavik@matfyz.cz
53 Received: from mail.csbnet.se (glutus.csbnet.se [193.11.248.2])
54 	by maxipes.logix.cz (Postfix) with ESMTP id 90D6A29A51
55 	for <vaclav.slavik@matfyz.cz>; Tue,  9 Dec 2003 13:02:15 +0100 (CET)
56 Received: by mail.csbnet.se (Postfix, from userid 8)
57 	id 7AA7F10A6D7; Tue,  9 Dec 2003 13:02:14 +0100 (CET)
58 Received: from carbon.csbnet.se (carbon.csbnet.se [193.11.248.180])
59 	by mail.csbnet.se (Postfix) with ESMTP id A190F10A71D
60 	for <vaclav.slavik@matfyz.cz>; Tue,  9 Dec 2003 13:01:56 +0100 (CET)
61 Subject: Re: eggtrayicon.{c,h} licensing
62 From: Anders Carlsson <andersca@gnu.org>
63 To: Vaclav Slavik <vaclav.slavik@matfyz.cz>
64 In-Reply-To: <200312091142.54542.vaclav.slavik@matfyz.cz>
65 References: <200312091142.54542.vaclav.slavik@matfyz.cz>
66 Content-Type: text/plain
67 Message-Id: <1070971316.30989.0.camel@carbon.csbnet.se>
68 Mime-Version: 1.0
69 X-Mailer: Ximian Evolution 1.5
70 Date: Tue, 09 Dec 2003 13:01:56 +0100
71 Content-Transfer-Encoding: 7bit
72 X-Scanned-By: CLAM (openantivirus DB) antivirus scanner at mail.csbnet.se
73 X-Virus-Scanned: by amavisd-new-20030616-p5 (Debian) at armitage
74 X-Spam-Status: No, hits=-4.9 tagged_above=-999.0 required=6.3 tests=BAYES_00
75 X-Spam-Level:
76 Status: R
77 X-Status: N
78 X-KMail-EncryptionState:
79 X-KMail-SignatureState:
80 
81 On tis, 2003-12-09 at 11:42 +0100, Vaclav Slavik wrote:
82 > Hi,
83 >
84 > I'm working on the wxWindows cross-platform GUI toolkit
85 > (http://www.wxwindows.org) which uses GTK+ and it would save me a lot
86 > of time if I could use your eggtrayicon code to implement tray icons
87 > on X11. Unfortunately I can't use it right now because it is not part
88 > of any library we could depend on (as we do depend on GTK+) and would
89 > have to be included in our sources and it is under the LGPL license.
90 > The problem is that wxWindows' license is more permissive (see
91 > http://www.opensource.org/licenses/wxwindows.php for details) and so
92 > I can't take your code and put it under wxWindows License. And I
93 > can't put code that can't be used under the terms of wxWindows
94 > License into wxWindows either. Do you think it would be possible to
95 > get permission to include eggtrayicon under wxWindows license?
96 >
97 > Thanks,
98 > Vaclav
99 >
100 
101 Sure, that's fine by me.
102 
103 Anders
104 --------
105 */
106 
107 #include "wx/platform.h"
108 
109 #include <gtk/gtkversion.h>
110 #if GTK_CHECK_VERSION(2, 1, 0)
111 
112 #include <string.h>
113 #include "eggtrayicon.h"
114 
115 #include <gdkconfig.h>
116 #if defined (GDK_WINDOWING_X11)
117 #include <gdk/gdkx.h>
118 #include <X11/Xatom.h>
119 #elif defined (GDK_WINDOWING_WIN32)
120 #include <gdk/gdkwin32.h>
121 #endif
122 
123 #define SYSTEM_TRAY_REQUEST_DOCK    0
124 #define SYSTEM_TRAY_BEGIN_MESSAGE   1
125 #define SYSTEM_TRAY_CANCEL_MESSAGE  2
126 
127 #define SYSTEM_TRAY_ORIENTATION_HORZ 0
128 #define SYSTEM_TRAY_ORIENTATION_VERT 1
129 
130 enum {
131   PROP_0,
132   PROP_ORIENTATION
133 };
134 
135 static GtkPlugClass *parent_class = NULL;
136 
137 static void egg_tray_icon_init (EggTrayIcon *icon);
138 static void egg_tray_icon_class_init (EggTrayIconClass *klass);
139 
140 static void egg_tray_icon_get_property (GObject    *object,
141 					guint       prop_id,
142 					GValue     *value,
143 					GParamSpec *pspec);
144 
145 static void egg_tray_icon_realize   (GtkWidget *widget);
146 static void egg_tray_icon_unrealize (GtkWidget *widget);
147 
148 static void egg_tray_icon_add (GtkContainer *container,
149 			       GtkWidget    *widget);
150 
151 #ifdef GDK_WINDOWING_X11
152 static void egg_tray_icon_update_manager_window    (EggTrayIcon *icon,
153 						    gboolean     dock_if_realized);
154 static void egg_tray_icon_manager_window_destroyed (EggTrayIcon *icon);
155 #endif
156 
157 GType
egg_tray_icon_get_type(void)158 egg_tray_icon_get_type (void)
159 {
160   static GType our_type = 0;
161 
162   if (our_type == 0)
163     {
164       static const GTypeInfo our_info =
165       {
166 	sizeof (EggTrayIconClass),
167 	(GBaseInitFunc) NULL,
168 	(GBaseFinalizeFunc) NULL,
169 	(GClassInitFunc) egg_tray_icon_class_init,
170 	NULL, /* class_finalize */
171 	NULL, /* class_data */
172 	sizeof (EggTrayIcon),
173 	0,    /* n_preallocs */
174 	(GInstanceInitFunc) egg_tray_icon_init
175       };
176 
177       our_type = g_type_register_static (GTK_TYPE_PLUG, "EggTrayIcon", &our_info, 0);
178     }
179 
180   return our_type;
181 }
182 
183 static void
egg_tray_icon_init(EggTrayIcon * icon)184 egg_tray_icon_init (EggTrayIcon *icon)
185 {
186   icon->stamp = 1;
187   icon->orientation = GTK_ORIENTATION_HORIZONTAL;
188 
189   gtk_widget_add_events (GTK_WIDGET (icon), GDK_PROPERTY_CHANGE_MASK);
190 }
191 
192 static void
egg_tray_icon_class_init(EggTrayIconClass * klass)193 egg_tray_icon_class_init (EggTrayIconClass *klass)
194 {
195   GObjectClass *gobject_class = (GObjectClass *)klass;
196   GtkWidgetClass *widget_class = (GtkWidgetClass *)klass;
197   GtkContainerClass *container_class = (GtkContainerClass *)klass;
198 
199   parent_class = g_type_class_peek_parent (klass);
200 
201   gobject_class->get_property = egg_tray_icon_get_property;
202 
203   widget_class->realize   = egg_tray_icon_realize;
204   widget_class->unrealize = egg_tray_icon_unrealize;
205 
206   container_class->add = egg_tray_icon_add;
207 
208   g_object_class_install_property (gobject_class,
209 				   PROP_ORIENTATION,
210 				   g_param_spec_enum ("orientation",
211 						      "Orientation",
212 						      "The orientation of the tray.",
213 						      GTK_TYPE_ORIENTATION,
214 						      GTK_ORIENTATION_HORIZONTAL,
215 						      G_PARAM_READABLE));
216 }
217 
218 static void
egg_tray_icon_get_property(GObject * object,guint prop_id,GValue * value,GParamSpec * pspec)219 egg_tray_icon_get_property (GObject    *object,
220 			    guint       prop_id,
221 			    GValue     *value,
222 			    GParamSpec *pspec)
223 {
224   EggTrayIcon *icon = EGG_TRAY_ICON (object);
225 
226   switch (prop_id)
227     {
228     case PROP_ORIENTATION:
229       g_value_set_enum (value, icon->orientation);
230       break;
231     default:
232       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
233       break;
234     }
235 }
236 
237 #ifdef GDK_WINDOWING_X11
238 
239 static void
egg_tray_icon_get_orientation_property(EggTrayIcon * icon)240 egg_tray_icon_get_orientation_property (EggTrayIcon *icon)
241 {
242   Display *xdisplay;
243   Atom type;
244   int format;
245   union {
246 	gulong *prop;
247 	guchar *prop_ch;
248   } prop = { NULL };
249   gulong nitems;
250   gulong bytes_after;
251   int error, result;
252 
253   g_assert (icon->manager_window != None);
254 
255   xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
256 
257   gdk_error_trap_push ();
258   type = None;
259   result = XGetWindowProperty (xdisplay,
260 			       icon->manager_window,
261 			       icon->orientation_atom,
262 			       0, G_MAXLONG, FALSE,
263 			       XA_CARDINAL,
264 			       &type, &format, &nitems,
265 			       &bytes_after, &(prop.prop_ch));
266   error = gdk_error_trap_pop ();
267 
268   if (error || result != Success)
269     return;
270 
271   if (type == XA_CARDINAL)
272     {
273       GtkOrientation orientation;
274 
275       orientation = (prop.prop [0] == SYSTEM_TRAY_ORIENTATION_HORZ) ?
276 					GTK_ORIENTATION_HORIZONTAL :
277 					GTK_ORIENTATION_VERTICAL;
278 
279       if (icon->orientation != orientation)
280 	{
281 	  icon->orientation = orientation;
282 
283 	  g_object_notify (G_OBJECT (icon), "orientation");
284 	}
285     }
286 
287   if (prop.prop)
288     XFree (prop.prop);
289 }
290 
291 static GdkFilterReturn
egg_tray_icon_manager_filter(GdkXEvent * xevent,GdkEvent * event,gpointer user_data)292 egg_tray_icon_manager_filter (GdkXEvent *xevent, GdkEvent *event, gpointer user_data)
293 {
294   EggTrayIcon *icon = user_data;
295   XEvent *xev = (XEvent *)xevent;
296 
297   if (xev->xany.type == ClientMessage &&
298       xev->xclient.message_type == icon->manager_atom &&
299       xev->xclient.data.l[1] == icon->selection_atom)
300     {
301       egg_tray_icon_update_manager_window (icon, TRUE);
302     }
303   else if (xev->xany.window == icon->manager_window)
304     {
305       if (xev->xany.type == PropertyNotify &&
306 	  xev->xproperty.atom == icon->orientation_atom)
307 	{
308 	  egg_tray_icon_get_orientation_property (icon);
309 	}
310       if (xev->xany.type == DestroyNotify)
311 	{
312 	  egg_tray_icon_manager_window_destroyed (icon);
313 	}
314     }
315   return GDK_FILTER_CONTINUE;
316 }
317 
318 #endif
319 
320 static void
egg_tray_icon_unrealize(GtkWidget * widget)321 egg_tray_icon_unrealize (GtkWidget *widget)
322 {
323 #ifdef GDK_WINDOWING_X11
324   EggTrayIcon *icon = EGG_TRAY_ICON (widget);
325   GdkWindow *root_window;
326 
327   if (icon->manager_window != None)
328     {
329       GdkWindow *gdkwin;
330 
331       gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (widget),
332                                               icon->manager_window);
333 
334       gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter, icon);
335     }
336 
337   root_window = gdk_screen_get_root_window (gtk_widget_get_screen (widget));
338 
339   gdk_window_remove_filter (root_window, egg_tray_icon_manager_filter, icon);
340 
341   if (GTK_WIDGET_CLASS (parent_class)->unrealize)
342     (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
343 #endif
344 }
345 
346 #ifdef GDK_WINDOWING_X11
347 
348 static void
egg_tray_icon_send_manager_message(EggTrayIcon * icon,long message,Window window,long data1,long data2,long data3)349 egg_tray_icon_send_manager_message (EggTrayIcon *icon,
350 				    long         message,
351 				    Window       window,
352 				    long         data1,
353 				    long         data2,
354 				    long         data3)
355 {
356   XClientMessageEvent ev;
357   Display *display;
358 
359   ev.type = ClientMessage;
360   ev.window = window;
361   ev.message_type = icon->system_tray_opcode_atom;
362   ev.format = 32;
363   ev.data.l[0] = gdk_x11_get_server_time (GTK_WIDGET (icon)->window);
364   ev.data.l[1] = message;
365   ev.data.l[2] = data1;
366   ev.data.l[3] = data2;
367   ev.data.l[4] = data3;
368 
369   display = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
370 
371   gdk_error_trap_push ();
372   XSendEvent (display,
373 	      icon->manager_window, False, NoEventMask, (XEvent *)&ev);
374   XSync (display, False);
375   gdk_error_trap_pop ();
376 }
377 
378 static void
egg_tray_icon_send_dock_request(EggTrayIcon * icon)379 egg_tray_icon_send_dock_request (EggTrayIcon *icon)
380 {
381   egg_tray_icon_send_manager_message (icon,
382 				      SYSTEM_TRAY_REQUEST_DOCK,
383 				      icon->manager_window,
384 				      gtk_plug_get_id (GTK_PLUG (icon)),
385 				      0, 0);
386 }
387 
388 static void
egg_tray_icon_update_manager_window(EggTrayIcon * icon,gboolean dock_if_realized)389 egg_tray_icon_update_manager_window (EggTrayIcon *icon,
390 				     gboolean     dock_if_realized)
391 {
392   Display *xdisplay;
393 
394   if (icon->manager_window != None)
395     return;
396 
397   xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
398 
399   XGrabServer (xdisplay);
400 
401   icon->manager_window = XGetSelectionOwner (xdisplay,
402 					     icon->selection_atom);
403 
404   if (icon->manager_window != None)
405     XSelectInput (xdisplay,
406 		  icon->manager_window, StructureNotifyMask|PropertyChangeMask);
407 
408   XUngrabServer (xdisplay);
409   XFlush (xdisplay);
410 
411   if (icon->manager_window != None)
412     {
413       GdkWindow *gdkwin;
414 
415       gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (GTK_WIDGET (icon)),
416 					      icon->manager_window);
417 
418       gdk_window_add_filter (gdkwin, egg_tray_icon_manager_filter, icon);
419 
420       if (dock_if_realized && GTK_WIDGET_REALIZED (icon))
421 	egg_tray_icon_send_dock_request (icon);
422 
423       egg_tray_icon_get_orientation_property (icon);
424     }
425 }
426 
427 static void
egg_tray_icon_manager_window_destroyed(EggTrayIcon * icon)428 egg_tray_icon_manager_window_destroyed (EggTrayIcon *icon)
429 {
430   GdkWindow *gdkwin;
431 
432   g_return_if_fail (icon->manager_window != None);
433 
434   gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (GTK_WIDGET (icon)),
435 					  icon->manager_window);
436 
437   gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter, icon);
438 
439   icon->manager_window = None;
440 
441   egg_tray_icon_update_manager_window (icon, TRUE);
442 }
443 
444 #endif
445 
446 static gboolean
transparent_expose_event(GtkWidget * widget,GdkEventExpose * event,gpointer user_data)447 transparent_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
448 {
449   gdk_window_clear_area (widget->window, event->area.x, event->area.y,
450 			 event->area.width, event->area.height);
451   return FALSE;
452 }
453 
454 static void
make_transparent_again(GtkWidget * widget,GtkStyle * previous_style,gpointer user_data)455 make_transparent_again (GtkWidget *widget, GtkStyle *previous_style,
456 			gpointer user_data)
457 {
458   gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
459 }
460 
461 static void
make_transparent(GtkWidget * widget,gpointer user_data)462 make_transparent (GtkWidget *widget, gpointer user_data)
463 {
464   if (GTK_WIDGET_NO_WINDOW (widget) || GTK_WIDGET_APP_PAINTABLE (widget))
465     return;
466 
467   gtk_widget_set_app_paintable (widget, TRUE);
468   gtk_widget_set_double_buffered (widget, FALSE);
469   gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
470   g_signal_connect (widget, "expose_event",
471 		    G_CALLBACK (transparent_expose_event), NULL);
472   g_signal_connect_after (widget, "style_set",
473 			  G_CALLBACK (make_transparent_again), NULL);
474 }
475 
476 static void
egg_tray_icon_realize(GtkWidget * widget)477 egg_tray_icon_realize (GtkWidget *widget)
478 {
479 #ifdef GDK_WINDOWING_X11
480   EggTrayIcon *icon = EGG_TRAY_ICON (widget);
481   GdkScreen *screen;
482   GdkDisplay *display;
483   Display *xdisplay;
484   char buffer[256];
485   GdkWindow *root_window;
486 
487   if (GTK_WIDGET_CLASS (parent_class)->realize)
488     GTK_WIDGET_CLASS (parent_class)->realize (widget);
489 
490   make_transparent (widget, NULL);
491 
492   screen = gtk_widget_get_screen (widget);
493   display = gdk_screen_get_display (screen);
494   xdisplay = gdk_x11_display_get_xdisplay (display);
495 
496   /* Now see if there's a manager window around */
497   g_snprintf (buffer, sizeof (buffer),
498 	      "_NET_SYSTEM_TRAY_S%d",
499 	      gdk_screen_get_number (screen));
500 
501   icon->selection_atom = XInternAtom (xdisplay, buffer, False);
502 
503   icon->manager_atom = XInternAtom (xdisplay, "MANAGER", False);
504 
505   icon->system_tray_opcode_atom = XInternAtom (xdisplay,
506 						   "_NET_SYSTEM_TRAY_OPCODE",
507 						   False);
508 
509   icon->orientation_atom = XInternAtom (xdisplay,
510 					"_NET_SYSTEM_TRAY_ORIENTATION",
511 					False);
512 
513   egg_tray_icon_update_manager_window (icon, FALSE);
514   egg_tray_icon_send_dock_request (icon);
515 
516   root_window = gdk_screen_get_root_window (screen);
517 
518   /* Add a root window filter so that we get changes on MANAGER */
519   gdk_window_add_filter (root_window,
520 			 egg_tray_icon_manager_filter, icon);
521 #endif
522 }
523 
524 static void
egg_tray_icon_add(GtkContainer * container,GtkWidget * widget)525 egg_tray_icon_add (GtkContainer *container, GtkWidget *widget)
526 {
527   g_signal_connect (widget, "realize",
528 		    G_CALLBACK (make_transparent), NULL);
529   GTK_CONTAINER_CLASS (parent_class)->add (container, widget);
530 }
531 
532 EggTrayIcon *
egg_tray_icon_new_for_screen(GdkScreen * screen,const char * name)533 egg_tray_icon_new_for_screen (GdkScreen *screen, const char *name)
534 {
535   g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
536 
537   return g_object_new (EGG_TYPE_TRAY_ICON, "screen", screen, "title", name, NULL);
538 }
539 
540 EggTrayIcon*
egg_tray_icon_new(const gchar * name)541 egg_tray_icon_new (const gchar *name)
542 {
543   return g_object_new (EGG_TYPE_TRAY_ICON, "title", name, NULL);
544 }
545 
546 guint
egg_tray_icon_send_message(EggTrayIcon * icon,gint timeout,const gchar * message,gint len)547 egg_tray_icon_send_message (EggTrayIcon *icon,
548 			    gint         timeout,
549 			    const gchar *message,
550 			    gint         len)
551 {
552   guint stamp;
553 
554   g_return_val_if_fail (EGG_IS_TRAY_ICON (icon), 0);
555   g_return_val_if_fail (timeout >= 0, 0);
556   g_return_val_if_fail (message != NULL, 0);
557 
558 #ifdef GDK_WINDOWING_X11
559   if (icon->manager_window == None)
560     return 0;
561 #endif
562 
563   if (len < 0)
564     len = strlen (message);
565 
566   stamp = icon->stamp++;
567 
568 #ifdef GDK_WINDOWING_X11
569   /* Get ready to send the message */
570   egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_BEGIN_MESSAGE,
571 				      icon->manager_window,
572 				      timeout, len, stamp);
573 
574   /* Now to send the actual message */
575   gdk_error_trap_push ();
576   while (len > 0)
577     {
578       XClientMessageEvent ev;
579       Display *xdisplay;
580 
581       xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon)));
582 
583       ev.type = ClientMessage;
584       ev.window = icon->manager_window;
585       ev.format = 8;
586       ev.message_type = XInternAtom (xdisplay,
587 				     "_NET_SYSTEM_TRAY_MESSAGE_DATA", False);
588       if (len > 20)
589 	{
590 	  memcpy (&ev.data, message, 20);
591 	  len -= 20;
592 	  message += 20;
593 	}
594       else
595 	{
596 	  memcpy (&ev.data, message, len);
597 	  len = 0;
598 	}
599 
600       XSendEvent (xdisplay,
601 		  icon->manager_window, False, StructureNotifyMask, (XEvent *)&ev);
602       XSync (xdisplay, False);
603     }
604   gdk_error_trap_pop ();
605 #endif
606 
607   return stamp;
608 }
609 
610 void
egg_tray_icon_cancel_message(EggTrayIcon * icon,guint id)611 egg_tray_icon_cancel_message (EggTrayIcon *icon,
612 			      guint        id)
613 {
614   g_return_if_fail (EGG_IS_TRAY_ICON (icon));
615   g_return_if_fail (id > 0);
616 #ifdef GDK_WINDOWING_X11
617   egg_tray_icon_send_manager_message (icon, SYSTEM_TRAY_CANCEL_MESSAGE,
618 				      (Window)gtk_plug_get_id (GTK_PLUG (icon)),
619 				      id, 0, 0);
620 #endif
621 }
622 
623 GtkOrientation
egg_tray_icon_get_orientation(EggTrayIcon * icon)624 egg_tray_icon_get_orientation (EggTrayIcon *icon)
625 {
626   g_return_val_if_fail (EGG_IS_TRAY_ICON (icon), GTK_ORIENTATION_HORIZONTAL);
627 
628   return icon->orientation;
629 }
630 
631 
632 
633 #endif /* GTK_CHECK_VERSION(2, 1, 0) */
634