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
This commit is contained in:
Owen W. Taylor 2009-06-17 14:35:32 -04:00
parent 5f0d67263b
commit f1a9ada5f0

View File

@ -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