[Xfce4-commits] <xfce4-panel:xfce-4.8> Fix menu positioning for moved external plugins (bug #7529).
Nick Schermer
noreply at xfce.org
Sat Jun 18 12:18:06 CEST 2011
Updating branch refs/heads/xfce-4.8
to 1c22fd97ba9f72e7efb7963c6351fe0226b033c6 (commit)
from 2f0852c8791ab3bd386fbd6f000428de6ceabf20 (commit)
commit 1c22fd97ba9f72e7efb7963c6351fe0226b033c6
Author: Nick Schermer <nick at xfce.org>
Date: Sat May 28 17:45:56 2011 +0200
Fix menu positioning for moved external plugins (bug #7529).
For some reason the window position cache in gdk is not updated
so work around this.
(cherry picked from commit 176a68b8f347f84e4dc8fdf7f8e81d1e8e6034b0)
libxfce4panel/xfce-panel-plugin.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/libxfce4panel/xfce-panel-plugin.c b/libxfce4panel/xfce-panel-plugin.c
index 360ed7d..c85e1ab 100644
--- a/libxfce4panel/xfce-panel-plugin.c
+++ b/libxfce4panel/xfce-panel-plugin.c
@@ -2055,6 +2055,8 @@ xfce_panel_plugin_position_widget (XfcePanelPlugin *plugin,
GdkRectangle monitor;
gint monitor_num;
GTimeVal now_t, end_t;
+ GtkWidget *toplevel, *plug;
+ gint px, py;
g_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin));
g_return_if_fail (GTK_IS_WIDGET (menu_widget));
@@ -2077,7 +2079,19 @@ xfce_panel_plugin_position_widget (XfcePanelPlugin *plugin,
gtk_widget_size_request (menu_widget, &requisition);
/* get the root position of the attach widget */
- gdk_window_get_position (GDK_WINDOW (attach_widget->window), x, y);
+ toplevel = gtk_widget_get_toplevel (attach_widget);
+ gtk_window_get_position (GTK_WINDOW (toplevel), x, y);
+
+ /* correct position for external plugins */
+ plug = gtk_widget_get_ancestor (attach_widget, GTK_TYPE_PLUG);
+ if (plug != NULL)
+ {
+ gdk_window_get_geometry (gtk_plug_get_socket_window (GTK_PLUG (plug)),
+ &px, &py, NULL, NULL, NULL);
+
+ *x += px;
+ *y += py;
+ }
/* if the panel is hidden (auto hide is enabled) and we requested a
* panel lock, wait for gtk to position the panel before we actually
More information about the Xfce4-commits
mailing list