[gtk+] menu: Respect borders properly for scroll arrows



commit f4e44e9e6e92c9fddc92970f7b1d36c308508096
Author: Benjamin Otte <otte redhat com>
Date:   Sat Oct 11 02:40:48 2014 +0200

    menu: Respect borders properly for scroll arrows

 gtk/gtkmenu.c |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 270fbec..1dab98c 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -2991,44 +2991,46 @@ get_arrows_visible_area (GtkMenu      *menu,
   border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
   border->x = border_width + menu_padding.left;
   border->y = border_width + menu_padding.top;
-  border->width = gdk_window_get_width (gtk_widget_get_window (widget));
-  border->height = gdk_window_get_height (gtk_widget_get_window (widget));
+  border->width = gdk_window_get_width (gtk_widget_get_window (widget))
+                  - 2 * border_width - menu_padding.left - menu_padding.right;
+  border->height = gdk_window_get_height (gtk_widget_get_window (widget))
+                   - 2 * border_width - menu_padding.top - menu_padding.bottom;
 
   switch (arrow_placement)
     {
     case GTK_ARROWS_BOTH:
       upper->x = border->x;
       upper->y = border->y;
-      upper->width = border->width - 2 * border->x;
+      upper->width = border->width;
       upper->height = scroll_arrow_height;
 
       lower->x = border->x;
       lower->y = border->height - border->y - scroll_arrow_height;
-      lower->width = border->width - 2 * border->x;
+      lower->width = border->width;
       lower->height = scroll_arrow_height;
       break;
 
     case GTK_ARROWS_START:
       upper->x = border->x;
       upper->y = border->y;
-      upper->width = (border->width - 2 * border->x) / 2;
+      upper->width = border->width / 2;
       upper->height = scroll_arrow_height;
 
       lower->x = border->x + upper->width;
       lower->y = border->y;
-      lower->width = (border->width - 2 * border->x) / 2;
+      lower->width = border->width - upper->width;
       lower->height = scroll_arrow_height;
       break;
 
     case GTK_ARROWS_END:
       upper->x = border->x;
-      upper->y = border->height - border->y - scroll_arrow_height;
-      upper->width = (border->width - 2 * border->x) / 2;
+      upper->y = border->height - scroll_arrow_height;
+      upper->width = border->width / 2;
       upper->height = scroll_arrow_height;
 
       lower->x = border->x + upper->width;
-      lower->y = border->height - border->y - scroll_arrow_height;
-      lower->width = (border->width - 2 * border->x) / 2;
+      lower->y = border->height - scroll_arrow_height;
+      lower->width = border->width - upper->width;
       lower->height = scroll_arrow_height;
       break;
 
@@ -3038,7 +3040,7 @@ get_arrows_visible_area (GtkMenu      *menu,
        lower->x = lower->y = lower->width = lower->height = 0;
     }
 
-  *arrow_space = scroll_arrow_height - menu_padding.top - menu_padding.bottom;
+  *arrow_space = scroll_arrow_height;
 }
 
 static gboolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]