[Xfce4-commits] <xfce4-panel:xfce-4.8> Libxfce4panel: Avoid problem if panel is not yet realized.
Nick Schermer
noreply at xfce.org
Sat Sep 10 11:04:01 CEST 2011
Updating branch refs/heads/xfce-4.8
to 216efe3f4951fb8c88b07fbcdca78c4540d6a5ed (commit)
from 4c571727ea14eb6fb21219b7a30c030d320025ae (commit)
commit 216efe3f4951fb8c88b07fbcdca78c4540d6a5ed
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.
(cherry picked from commit bd4964379eddb689b32dcc7cb32054714bf306b2)
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 c85e1ab..57586f0 100644
--- a/libxfce4panel/xfce-panel-plugin.c
+++ b/libxfce4panel/xfce-panel-plugin.c
@@ -1989,6 +1989,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);
@@ -2007,13 +2008,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