diff options
author | Benjamin Otte <otte@redhat.com> | 2010-05-23 21:06:24 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2010-06-28 14:19:18 +0200 |
commit | 7ad08f19aad0868a1ba48bfd3e005b6ea3676622 (patch) | |
tree | 1c15d10364e6c1638766da0bd0426968937f8240 /gtk/gtkmenu.c | |
parent | 9928158d418898252b090481507da6f97f806618 (diff) | |
download | gtk+-7ad08f19aad0868a1ba48bfd3e005b6ea3676622.tar.gz |
Create the navigation region without flipping
Gets rid of some code in preparation to switching to do the computation
completely without GdkRegion.
Diffstat (limited to 'gtk/gtkmenu.c')
-rw-r--r-- | gtk/gtkmenu.c | 57 |
1 files changed, 5 insertions, 52 deletions
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index 2ce078543d..3835e7300a 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -4163,40 +4163,6 @@ draw_stay_up_triangle (GdkWindow *window, } #endif -static GdkRegion * -flip_region (GdkRegion *region, - gboolean flip_x, - gboolean flip_y) -{ - gint n_rectangles; - GdkRectangle *rectangles; - GdkRectangle clipbox; - GdkRegion *new_region; - gint i; - - new_region = gdk_region_new (); - - gdk_region_get_rectangles (region, &rectangles, &n_rectangles); - gdk_region_get_clipbox (region, &clipbox); - - for (i = 0; i < n_rectangles; ++i) - { - GdkRectangle rect = rectangles[i]; - - if (flip_y) - rect.y -= 2 * (rect.y - clipbox.y) + rect.height; - - if (flip_x) - rect.x -= 2 * (rect.x - clipbox.x) + rect.width; - - gdk_region_union_with_rect (new_region, &rect); - } - - g_free (rectangles); - - return new_region; -} - static void gtk_menu_set_submenu_navigation_region (GtkMenu *menu, GtkMenuItem *menu_item, @@ -4228,8 +4194,6 @@ gtk_menu_set_submenu_navigation_region (GtkMenu *menu, if (event->x >= 0 && event->x < width) { gint popdown_delay; - gboolean flip_y = FALSE; - gboolean flip_x = FALSE; gtk_menu_stop_navigating_submenu (menu); @@ -4243,26 +4207,22 @@ gtk_menu_set_submenu_navigation_region (GtkMenu *menu, { /* left */ point[0].x = event->x_root + 1; - point[1].x = 2 * (event->x_root + 1) - submenu_right; - - flip_x = TRUE; + point[1].x = submenu_right; } if (event->y < 0) { /* top */ - point[0].y = event->y_root + 1; - point[1].y = 2 * (event->y_root + 1) - submenu_top + NAVIGATION_REGION_OVERSHOOT; + point[0].y = event->y_root; + point[1].y = submenu_top - NAVIGATION_REGION_OVERSHOOT; - if (point[0].y >= point[1].y - NAVIGATION_REGION_OVERSHOOT) + if (point[0].y <= submenu_top) return; - - flip_y = TRUE; } else { /* bottom */ - point[0].y = event->y_root; + point[0].y = event->y_root + 1; point[1].y = submenu_bottom + NAVIGATION_REGION_OVERSHOOT; if (point[0].y >= submenu_bottom) @@ -4274,13 +4234,6 @@ gtk_menu_set_submenu_navigation_region (GtkMenu *menu, menu->navigation_region = gdk_region_polygon (point, 3, GDK_WINDING_RULE); - if (flip_x || flip_y) - { - GdkRegion *new_region = flip_region (menu->navigation_region, flip_x, flip_y); - gdk_region_destroy (menu->navigation_region); - menu->navigation_region = new_region; - } - g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu)), "gtk-menu-popdown-delay", &popdown_delay, NULL); |