gadget: simplify code

This commit is contained in:
Cosimo Cecchi
2016-02-24 15:51:40 -08:00
parent 0883ff5eed
commit 3ff66edb6b

View File

@@ -532,12 +532,9 @@ gtk_css_gadget_margin_box_contains_point (GtkCssGadget *gadget,
int x, int x,
int y) int y)
{ {
GtkAllocation margin_allocation; GtkAllocation margin_box;
gtk_css_gadget_get_margin_box (gadget, &margin_box);
gtk_css_gadget_get_margin_allocation (gadget, &margin_allocation, NULL); return allocation_contains_point (&margin_box, x, y);
shift_allocation (gadget, &margin_allocation);
return allocation_contains_point (&margin_allocation, x, y);
} }
/** /**
@@ -558,12 +555,9 @@ gtk_css_gadget_border_box_contains_point (GtkCssGadget *gadget,
int x, int x,
int y) int y)
{ {
GtkAllocation border_allocation; GtkAllocation border_box;
gtk_css_gadget_get_border_box (gadget, &border_box);
gtk_css_gadget_get_border_allocation (gadget, &border_allocation, NULL); return allocation_contains_point (&border_box, x, y);
shift_allocation (gadget, &border_allocation);
return allocation_contains_point (&border_allocation, x, y);
} }
/** /**
@@ -584,12 +578,9 @@ gtk_css_gadget_content_box_contains_point (GtkCssGadget *gadget,
int x, int x,
int y) int y)
{ {
GtkAllocation content_allocation; GtkAllocation content_box;
gtk_css_gadget_get_content_box (gadget, &content_box);
gtk_css_gadget_get_content_allocation (gadget, &content_allocation, NULL); return allocation_contains_point (&content_box, x, y);
shift_allocation (gadget, &content_allocation);
return allocation_contains_point (&content_allocation, x, y);
} }
/** /**
@@ -819,18 +810,17 @@ gtk_css_gadget_draw (GtkCssGadget *gadget,
GtkCssStyle *style; GtkCssStyle *style;
int x, y, width, height; int x, y, width, height;
int contents_x, contents_y, contents_width, contents_height; int contents_x, contents_y, contents_width, contents_height;
GtkAllocation margin_allocation; GtkAllocation margin_box;
if (!gtk_css_gadget_get_visible (gadget)) if (!gtk_css_gadget_get_visible (gadget))
return; return;
gtk_css_gadget_get_margin_allocation (gadget, &margin_allocation, NULL); gtk_css_gadget_get_margin_box (gadget, &margin_box);
shift_allocation (gadget, &margin_allocation);
x = margin_allocation.x; x = margin_box.x;
y = margin_allocation.y; y = margin_box.y;
width = margin_allocation.width; width = margin_box.width;
height = margin_allocation.height; height = margin_box.height;
if (width < 0 || height < 0) if (width < 0 || height < 0)
{ {