Index: xfce-panel-plugin-iface.c =================================================================== --- xfce-panel-plugin-iface.c (revision 26119) +++ xfce-panel-plugin-iface.c (working copy) @@ -1330,22 +1330,24 @@ /** * xfce_panel_plugin_position_widget: - * @plugin : an #XfcePanelPlugin + * @panel_plugin : an #XfcePanelPlugin * @menu_widget : a #GtkWidget that will be used as popup menu * @attach_widget : a #GtkWidget relative to which the menu should be positioned * @x : return location for the x coordinate * @y : return location for the y coordinate * - * The menu widget is positioned relative to the plugin. This function is - * intended for custom menu widgets. + * The menu widget is positioned relative to @attach_widget. + * If @attach_widget is NULL, the menu widget is instead positioned + * relative to @panel_plugin. * - * For a regular #GtkMenu you should use xfce_panel_plugin_position_menu() + * This function is intended for custom menu widgets. + * For a regular #GtkMenu you should use xfce_panel_plugin_position_menu() * instead (as callback argument to gtk_menu_popup()). * * See also: xfce_panel_plugin_position_menu(). **/ void -xfce_panel_plugin_position_widget (XfcePanelPlugin *plugin, +xfce_panel_plugin_position_widget (XfcePanelPlugin *panel_plugin, GtkWidget *menu_widget, GtkWidget *attach_widget, gint *x, @@ -1356,17 +1358,20 @@ GdkRectangle geom; gint mon; - g_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin)); + g_return_if_fail (XFCE_IS_PANEL_PLUGIN (panel_plugin)); g_return_if_fail (GTK_IS_WIDGET (menu_widget)); - g_return_if_fail (GTK_IS_WIDGET (attach_widget)); + g_return_if_fail (attach_widget == NULL || GTK_IS_WIDGET (attach_widget)); + if (attach_widget == NULL) + attach_widget = GTK_WIDGET (panel_plugin); + if (!GTK_WIDGET_REALIZED (menu_widget)) gtk_widget_realize (menu_widget); gtk_widget_size_request (menu_widget, &req); gdk_window_get_origin (attach_widget->window, x, y); - switch (xfce_panel_plugin_arrow_type (plugin)) + switch (xfce_panel_plugin_arrow_type (panel_plugin)) { case GTK_ARROW_UP: *y -= req.height; @@ -1418,7 +1423,7 @@ * Function to be used as #GtkMenuPositionFunc in a call to gtk_menu_popup(). * As data argument it needs an #XfcePanelPlugin. * - * The menu is normally positioned relative to @attach_widget. If you want the + * The menu is normally positioned relative to @panel_plugin. If you want the * menu to be positioned relative to another widget, you can use * gtk_menu_attach_to_widget() to explicitly set a 'parent' widget. *