[Xfce4-commits] <xfce4-panel:master> Libxfce4panel: Avoid problem if panel is not yet realized.

Nick Schermer noreply at xfce.org
Fri Sep 9 20:06:02 CEST 2011


Updating branch refs/heads/master
         to bd4964379eddb689b32dcc7cb32054714bf306b2 (commit)
       from 5485525958b3006df3bb974974250cfd860d5b98 (commit)

commit bd4964379eddb689b32dcc7cb32054714bf306b2
Author: Nick Schermer <nick at xfce.org>
Date:   Fri Sep 9 19:40:25 2011 +0200

    Libxfce4panel: Avoid problem if panel is not yet realized.

 libxfce4panel/xfce-panel-plugin.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/libxfce4panel/xfce-panel-plugin.c b/libxfce4panel/xfce-panel-plugin.c
index 5b7abf9..0251992 100644
--- a/libxfce4panel/xfce-panel-plugin.c
+++ b/libxfce4panel/xfce-panel-plugin.c
@@ -2077,6 +2077,7 @@ xfce_panel_plugin_arrow_type (XfcePanelPlugin *plugin)
   gint                monitor_num;
   GdkRectangle        monitor;
   gint                x, y;
+  GdkWindow          *window;
 
   g_return_val_if_fail (XFCE_IS_PANEL_PLUGIN (plugin), GTK_ARROW_NONE);
   g_return_val_if_fail (XFCE_PANEL_PLUGIN_CONSTRUCTED (plugin), GTK_ARROW_NONE);
@@ -2095,13 +2096,17 @@ xfce_panel_plugin_arrow_type (XfcePanelPlugin *plugin)
     return GTK_ARROW_LEFT;
   else /* floating */
     {
+      window = gtk_widget_get_window (GTK_WIDGET (plugin));
+      if (G_UNLIKELY (window == NULL))
+        return GTK_ARROW_NONE;
+
       /* get the monitor geometry */
       screen = gtk_widget_get_screen (GTK_WIDGET (plugin));
-      monitor_num = gdk_screen_get_monitor_at_window (screen, GTK_WIDGET (plugin)->window);
+      monitor_num = gdk_screen_get_monitor_at_window (screen, window);
       gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
 
       /* get the plugin root origin */
-      gdk_window_get_root_origin (GTK_WIDGET (plugin)->window, &x, &y);
+      gdk_window_get_root_origin (window, &x, &y);
 
       /* detect arrow type */
       if (screen_position == XFCE_SCREEN_POSITION_FLOATING_H)


More information about the Xfce4-commits mailing list