summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Wold <[email protected]>2019-07-07 23:09:09 +0000
committerraveit65 <[email protected]>2019-07-09 19:23:11 +0200
commit1fd43b26ae8af38494c0ff91d366493ce037bb32 (patch)
treec0738e8b09dc0fb90f56508fb3d5e527a14bac30
parent9c3d35733b6c76fa0ab478b6ab738c6ebcce062c (diff)
downloadmate-panel-1fd43b26ae8af38494c0ff91d366493ce037bb32.tar.bz2
mate-panel-1fd43b26ae8af38494c0ff91d366493ce037bb32.tar.xz
Keep menu button popup from covering up menu on Wayland
-rw-r--r--mate-panel/panel-menu-button.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/mate-panel/panel-menu-button.c b/mate-panel/panel-menu-button.c
index 001ed50a..03e2a343 100644
--- a/mate-panel/panel-menu-button.c
+++ b/mate-panel/panel-menu-button.c
@@ -456,15 +456,31 @@ panel_menu_button_popup_menu (PanelMenuButton *button,
gtk_window_set_attached_to (GTK_WINDOW (gtk_widget_get_toplevel (button->priv->menu)),
GTK_WIDGET (button));
- /*using these same anchor points lets default "anchor-hints" properly position the menu
- *so that on a vertical panel the menu aligns with the outside edge of a menu button
- *placed at the top or bottom of a left or a right panel
- */
+ GdkGravity widget_anchor = GDK_GRAVITY_NORTH_WEST;
+ GdkGravity menu_anchor = GDK_GRAVITY_NORTH_WEST;
+ switch (panel_toplevel_get_orientation (button->priv->toplevel)) {
+ case PANEL_ORIENTATION_TOP:
+ widget_anchor = GDK_GRAVITY_SOUTH_WEST;
+ g_message ("PANEL_ORIENTATION_TOP");
+ break;
+ case PANEL_ORIENTATION_BOTTOM:
+ menu_anchor = GDK_GRAVITY_SOUTH_WEST;
+ g_message ("PANEL_ORIENTATION_BOTTOM");
+ break;
+ case PANEL_ORIENTATION_LEFT:
+ widget_anchor = GDK_GRAVITY_NORTH_EAST;
+ g_message ("PANEL_ORIENTATION_LEFT");
+ break;
+ case PANEL_ORIENTATION_RIGHT:
+ menu_anchor = GDK_GRAVITY_NORTH_EAST;
+ g_message ("PANEL_ORIENTATION_RIGHT");
+ break;
+ }
gtk_menu_popup_at_widget (GTK_MENU (button->priv->menu),
GTK_WIDGET (button),
- GDK_GRAVITY_NORTH_WEST,
- GDK_GRAVITY_NORTH_WEST,
+ widget_anchor,
+ menu_anchor,
NULL);
}