Commit e9ed210b authored by Matthias Clasen's avatar Matthias Clasen

GtkMenu: take csd shadows into account for placement

When placing menus, we don't want the shadow to influence
our choice.

https://bugzilla.gnome.org/show_bug.cgi?id=731187
parent bde4e863
......@@ -111,6 +111,7 @@
#include "gtkintl.h"
#include "gtktypebuiltins.h"
#include "gtkwidgetprivate.h"
#include "gtkwindowprivate.h"
#include "deprecated/gtktearoffmenuitem.h"
......@@ -4474,6 +4475,7 @@ gtk_menu_position (GtkMenu *menu,
GdkScreen *pointer_screen;
GdkRectangle monitor;
GdkDevice *pointer;
GtkBorder border;
widget = GTK_WIDGET (menu);
......@@ -4485,8 +4487,11 @@ gtk_menu_position (GtkMenu *menu,
* the right place to popup the menu.
*/
gtk_widget_realize (priv->toplevel);
requisition.width = gtk_widget_get_allocated_width (widget);
requisition.height = gtk_widget_get_allocated_height (widget);
_gtk_window_get_shadow_width (GTK_WINDOW (priv->toplevel), &border);
requisition.width = gtk_widget_get_allocated_width (widget)- border.left - border.right;
requisition.height = gtk_widget_get_allocated_height (widget) - border.top - border.bottom;
if (pointer_screen != screen)
{
......@@ -4658,6 +4663,9 @@ gtk_menu_position (GtkMenu *menu,
x = CLAMP (x, monitor.x, MAX (monitor.x, monitor.x + monitor.width - requisition.width));
x -= border.left;
y -= border.top;
if (GTK_MENU_SHELL (menu)->priv->active)
{
priv->have_position = TRUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment