Skip to content
Snippets Groups Projects
Commit 14482c1e authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

don't crash when fluxbox restarts. see http://bugzilla.gnome.org/show_bug.cgi?id=449858

parent 5b1eb905
No related branches found
No related tags found
No related merge requests found
...@@ -164,6 +164,20 @@ egg_tray_icon_get_property (GObject *object, ...@@ -164,6 +164,20 @@ egg_tray_icon_get_property (GObject *object,
#ifdef GDK_WINDOWING_X11 #ifdef GDK_WINDOWING_X11
static Display *
egg_tray_icon_get_x_display(EggTrayIcon *icon)
{
Display *xdisplay = NULL;
GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (icon));
if (!GDK_IS_DISPLAY (display))
display = gdk_display_get_default ();
xdisplay = GDK_DISPLAY_XDISPLAY (display);
return xdisplay;
}
static void static void
egg_tray_icon_get_orientation_property (EggTrayIcon *icon) egg_tray_icon_get_orientation_property (EggTrayIcon *icon)
{ {
...@@ -180,7 +194,9 @@ egg_tray_icon_get_orientation_property (EggTrayIcon *icon) ...@@ -180,7 +194,9 @@ egg_tray_icon_get_orientation_property (EggTrayIcon *icon)
g_assert (icon->manager_window != None); g_assert (icon->manager_window != None);
xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon))); xdisplay = egg_tray_icon_get_x_display(icon);
if (xdisplay == NULL)
return;
gdk_error_trap_push (); gdk_error_trap_push ();
type = None; type = None;
...@@ -205,11 +221,11 @@ egg_tray_icon_get_orientation_property (EggTrayIcon *icon) ...@@ -205,11 +221,11 @@ egg_tray_icon_get_orientation_property (EggTrayIcon *icon)
GTK_ORIENTATION_VERTICAL; GTK_ORIENTATION_VERTICAL;
if (icon->orientation != orientation) if (icon->orientation != orientation)
{ {
icon->orientation = orientation; icon->orientation = orientation;
g_object_notify (G_OBJECT (icon), "orientation"); g_object_notify (G_OBJECT (icon), "orientation");
} }
} }
if (prop.prop) if (prop.prop)
...@@ -294,7 +310,10 @@ egg_tray_icon_send_manager_message (EggTrayIcon *icon, ...@@ -294,7 +310,10 @@ egg_tray_icon_send_manager_message (EggTrayIcon *icon,
ev.data.l[3] = data2; ev.data.l[3] = data2;
ev.data.l[4] = data3; ev.data.l[4] = data3;
display = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon))); display = egg_tray_icon_get_x_display(icon);
if (display == NULL)
return;
gdk_error_trap_push (); gdk_error_trap_push ();
XSendEvent (display, XSendEvent (display,
...@@ -322,7 +341,10 @@ egg_tray_icon_update_manager_window (EggTrayIcon *icon, ...@@ -322,7 +341,10 @@ egg_tray_icon_update_manager_window (EggTrayIcon *icon,
if (icon->manager_window != None) if (icon->manager_window != None)
return; return;
xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon))); xdisplay = egg_tray_icon_get_x_display(icon);
if (xdisplay == NULL)
return;
XGrabServer (xdisplay); XGrabServer (xdisplay);
...@@ -407,7 +429,6 @@ egg_tray_icon_realize (GtkWidget *widget) ...@@ -407,7 +429,6 @@ egg_tray_icon_realize (GtkWidget *widget)
#ifdef GDK_WINDOWING_X11 #ifdef GDK_WINDOWING_X11
EggTrayIcon *icon = EGG_TRAY_ICON (widget); EggTrayIcon *icon = EGG_TRAY_ICON (widget);
GdkScreen *screen; GdkScreen *screen;
GdkDisplay *display;
Display *xdisplay; Display *xdisplay;
char buffer[256]; char buffer[256];
GdkWindow *root_window; GdkWindow *root_window;
...@@ -417,9 +438,12 @@ egg_tray_icon_realize (GtkWidget *widget) ...@@ -417,9 +438,12 @@ egg_tray_icon_realize (GtkWidget *widget)
make_transparent (widget, NULL); make_transparent (widget, NULL);
xdisplay = egg_tray_icon_get_x_display(icon);
if (xdisplay == NULL)
return;
screen = gtk_widget_get_screen (widget); screen = gtk_widget_get_screen (widget);
display = gdk_screen_get_display (screen);
xdisplay = gdk_x11_display_get_xdisplay (display);
/* Now see if there's a manager window around */ /* Now see if there's a manager window around */
g_snprintf (buffer, sizeof (buffer), g_snprintf (buffer, sizeof (buffer),
...@@ -506,7 +530,10 @@ egg_tray_icon_send_message (EggTrayIcon *icon, ...@@ -506,7 +530,10 @@ egg_tray_icon_send_message (EggTrayIcon *icon,
XClientMessageEvent ev; XClientMessageEvent ev;
Display *xdisplay; Display *xdisplay;
xdisplay = GDK_DISPLAY_XDISPLAY (gtk_widget_get_display (GTK_WIDGET (icon))); xdisplay = egg_tray_icon_get_x_display(icon);
if (xdisplay == NULL)
return 0;
ev.type = ClientMessage; ev.type = ClientMessage;
ev.window = (Window)gtk_plug_get_id (GTK_PLUG (icon)); ev.window = (Window)gtk_plug_get_id (GTK_PLUG (icon));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment