diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-06-05 23:16:34 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-06-05 23:16:34 +0800 |
commit | 38eba2850bea786a4b99c14a07f638f0e6f94e3f (patch) | |
tree | 082e7632f39415d80a216e0c5133152fee86b5c9 /lib/egg | |
parent | ff00767f95b3e47edee8dbe562e2efb4b0e7d41f (diff) | |
download | gsoc2013-epiphany-38eba2850bea786a4b99c14a07f638f0e6f94e3f.tar.gz gsoc2013-epiphany-38eba2850bea786a4b99c14a07f638f0e6f94e3f.tar.zst gsoc2013-epiphany-38eba2850bea786a4b99c14a07f638f0e6f94e3f.zip |
Update from libegg.
2005-06-05 Christian Persch <chpe@cvs.gnome.org>
* lib/egg/eggtrayicon.c: (egg_tray_icon_manager_filter),
(egg_tray_icon_update_manager_window),
(egg_tray_icon_manager_window_destroyed), (egg_tray_icon_realize):
Update from libegg.
Diffstat (limited to 'lib/egg')
-rw-r--r-- | lib/egg/eggtrayicon.c | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/lib/egg/eggtrayicon.c b/lib/egg/eggtrayicon.c index 6c309306e..0344c702f 100644 --- a/lib/egg/eggtrayicon.c +++ b/lib/egg/eggtrayicon.c @@ -62,7 +62,9 @@ static void egg_tray_icon_get_property (GObject *object, static void egg_tray_icon_realize (GtkWidget *widget); static void egg_tray_icon_unrealize (GtkWidget *widget); -static void egg_tray_icon_update_manager_window (EggTrayIcon *icon); +static void egg_tray_icon_update_manager_window (EggTrayIcon *icon, + gboolean dock_if_realized); +static void egg_tray_icon_manager_window_destroyed (EggTrayIcon *icon); GType egg_tray_icon_get_type (void) @@ -203,7 +205,7 @@ egg_tray_icon_manager_filter (GdkXEvent *xevent, GdkEvent *event, gpointer user_ xev->xclient.message_type == icon->manager_atom && xev->xclient.data.l[1] == icon->selection_atom) { - egg_tray_icon_update_manager_window (icon); + egg_tray_icon_update_manager_window (icon, TRUE); } else if (xev->xany.window == icon->manager_window) { @@ -214,7 +216,7 @@ egg_tray_icon_manager_filter (GdkXEvent *xevent, GdkEvent *event, gpointer user_ } if (xev->xany.type == DestroyNotify) { - egg_tray_icon_update_manager_window (icon); + egg_tray_icon_manager_window_destroyed (icon); } } @@ -286,21 +288,15 @@ egg_tray_icon_send_dock_request (EggTrayIcon *icon) } static void -egg_tray_icon_update_manager_window (EggTrayIcon *icon) +egg_tray_icon_update_manager_window (EggTrayIcon *icon, + gboolean dock_if_realized) { Display *xdisplay; - xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon))); - if (icon->manager_window != None) - { - GdkWindow *gdkwin; + return; - gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (GTK_WIDGET (icon)), - icon->manager_window); - - gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter, icon); - } + xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon))); XGrabServer (xdisplay); @@ -323,14 +319,31 @@ egg_tray_icon_update_manager_window (EggTrayIcon *icon) gdk_window_add_filter (gdkwin, egg_tray_icon_manager_filter, icon); - /* Send a request that we'd like to dock */ - egg_tray_icon_send_dock_request (icon); + if (dock_if_realized && GTK_WIDGET_REALIZED (icon)) + egg_tray_icon_send_dock_request (icon); egg_tray_icon_get_orientation_property (icon); } } static void +egg_tray_icon_manager_window_destroyed (EggTrayIcon *icon) +{ + GdkWindow *gdkwin; + + g_return_if_fail (icon->manager_window != None); + + gdkwin = gdk_window_lookup_for_display (gtk_widget_get_display (GTK_WIDGET (icon)), + icon->manager_window); + + gdk_window_remove_filter (gdkwin, egg_tray_icon_manager_filter, icon); + + icon->manager_window = None; + + egg_tray_icon_update_manager_window (icon, TRUE); +} + +static void egg_tray_icon_realize (GtkWidget *widget) { EggTrayIcon *icon = EGG_TRAY_ICON (widget); @@ -364,7 +377,8 @@ egg_tray_icon_realize (GtkWidget *widget) "_NET_SYSTEM_TRAY_ORIENTATION", False); - egg_tray_icon_update_manager_window (icon); + egg_tray_icon_update_manager_window (icon, FALSE); + egg_tray_icon_send_dock_request (icon); root_window = gdk_screen_get_root_window (screen); |