[gtk+/gtk-2-22] Create the navigation region without flipping
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-22] Create the navigation region without flipping
- Date: Sun, 23 May 2010 20:54:18 +0000 (UTC)
commit 239cfddc97fe3e42d9a0552b8d3c59b7bd0678b5
Author: Benjamin Otte <otte redhat com>
Date: Sun May 23 21:06:24 2010 +0200
Create the navigation region without flipping
Gets rid of some code in preparation to switching to do the computation
completely without GdkRegion.
gtk/gtkmenu.c | 57 +++++----------------------------------------------------
1 files changed, 5 insertions(+), 52 deletions(-)
---
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index b5b9820..e263851 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -4042,40 +4042,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,
@@ -4106,8 +4072,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);
@@ -4121,26 +4085,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)
@@ -4152,13 +4112,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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]