From f1a9ada5f018437e2bbf72c2845a9290390655f6 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Wed, 17 Jun 2009 14:35:32 -0400 Subject: [PATCH] Improve postioning of status menu Currently we position the user status menu at the upper left of the user status button. Then, because Mutter is inappropriately positioning override-redirect windows it get shoved into the workarea. Once that bug is fixed (bug 582639), we'll have to position the menu ourselves. This patch aligns the user status menu at the left end of and beneath the top panel. http://bugzilla.gnome.org/show_bug.cgi?id=586156 --- src/shell-status-menu.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/shell-status-menu.c b/src/shell-status-menu.c index bfe9b41a2..8293ac212 100644 --- a/src/shell-status-menu.c +++ b/src/shell-status-menu.c @@ -598,12 +598,25 @@ static void position_menu (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data) { ShellStatusMenu *status = SHELL_STATUS_MENU (user_data); + ClutterActor *parent; float src_x, src_y; + float width, height; + int menu_width; - clutter_actor_get_transformed_position (CLUTTER_ACTOR (status), &src_x, &src_y); + gtk_widget_get_size_request (GTK_WIDGET (menu), &menu_width, NULL); - *x = (gint)(0.5 + src_x); - *y = (gint)(0.5 + src_y); + /* Encapsulation breakage: it looks better if the menu is + * aligned with the bottom of the actor's grandparent - the + * panel, rather than with the bottom of the actor. We just + * assume what the hierarchy is and where we are positioned + * in the panel. + */ + parent = clutter_actor_get_parent (CLUTTER_ACTOR (status)); + parent = clutter_actor_get_parent (parent); + clutter_actor_get_transformed_position (parent, &src_x, &src_y); + clutter_actor_get_transformed_size (parent, &width, &height); + *x = (gint)(0.5 + src_x + width - menu_width); + *y = (gint)(0.5 + src_y + height); } void