diff options
Diffstat (limited to 'src/core/boxes.c')
-rw-r--r-- | src/core/boxes.c | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/src/core/boxes.c b/src/core/boxes.c index 55fd7b3d..8c569aae 100644 --- a/src/core/boxes.c +++ b/src/core/boxes.c @@ -2,14 +2,14 @@ /* Simple box operations */ -/* +/* * Copyright (C) 2005, 2006 Elijah Newren * [meta_rectangle_intersect() is copyright the GTK+ Team according to Havoc, * see gdkrectangle.c. As far as Havoc knows, he probably wrote * meta_rectangle_equal(), and I'm guessing it's (C) Red Hat. So...] * Copyright (C) 1995-2000 GTK+ Team * Copyright (C) 2002 Red Hat, Inc. - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the @@ -19,7 +19,7 @@ * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses/>. */ @@ -36,7 +36,7 @@ meta_rectangle_to_string (const MetaRectangle *rect, * Should be more than enough space. Note that of this space, the * trailing \0 will be overwritten for all but the last rectangle. */ - g_snprintf (output, RECT_LENGTH, "%d,%d +%d,%d", + g_snprintf (output, RECT_LENGTH, "%d,%d +%d,%d", rect->x, rect->y, rect->width, rect->height); return output; @@ -63,7 +63,7 @@ meta_rectangle_region_to_string (GList *region, while (tmp) { MetaRectangle *rect = tmp->data; - g_snprintf (rect_string, RECT_LENGTH, "[%d,%d +%d,%d]", + g_snprintf (rect_string, RECT_LENGTH, "[%d,%d +%d,%d]", rect->x, rect->y, rect->width, rect->height); cur = g_stpcpy (cur, rect_string); tmp = tmp->next; @@ -85,7 +85,7 @@ meta_rectangle_edge_to_string (const MetaEdge *edge, * Plus 2 for parenthesis, 4 for 2 more numbers, 2 more commas, and * 2 more spaces, for a total of 10 more. */ - g_snprintf (output, EDGE_LENGTH, "[%d,%d +%d,%d], %2d, %2d", + g_snprintf (output, EDGE_LENGTH, "[%d,%d +%d,%d], %2d, %2d", edge->rect.x, edge->rect.y, edge->rect.width, edge->rect.height, edge->side_type, edge->edge_type); @@ -117,7 +117,7 @@ meta_rectangle_edge_list_to_string (GList *edge_list, { MetaEdge *edge = tmp->data; MetaRectangle *rect = &edge->rect; - g_snprintf (rect_string, EDGE_LENGTH, "([%d,%d +%d,%d], %2d, %2d)", + g_snprintf (rect_string, EDGE_LENGTH, "([%d,%d +%d,%d], %2d, %2d)", rect->x, rect->y, rect->width, rect->height, edge->side_type, edge->edge_type); cur = g_stpcpy (cur, rect_string); @@ -167,7 +167,7 @@ meta_rectangle_intersect (const MetaRectangle *src1, dest_y = MAX (src1->y, src2->y); dest_w = MIN (src1->x + src1->width, src2->x + src2->width) - dest_x; dest_h = MIN (src1->y + src1->height, src2->y + src2->height) - dest_y; - + if (dest_w > 0 && dest_h > 0) { dest->x = dest_x; @@ -270,7 +270,7 @@ gboolean meta_rectangle_contains_rect (const MetaRectangle *outer_rect, const MetaRectangle *inner_rect) { - return + return inner_rect->x >= outer_rect->x && inner_rect->y >= outer_rect->y && inner_rect->x + inner_rect->width <= outer_rect->x + outer_rect->width && @@ -289,7 +289,7 @@ meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect, * boxes.h has a good comment, but I'm not sure if the below info is also * helpful on top of that (or whether it has superfluous info). */ - + /* These formulas may look overly simplistic at first but you can work * everything out with a left_frame_with, right_frame_width, * border_width, and old and new client area widths (instead of old total @@ -339,7 +339,7 @@ meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect, break; } rect->width = new_width; - + /* Next, the y direction */ switch (gravity) { @@ -578,7 +578,7 @@ meta_rectangle_get_minimal_spanning_set_for_region ( strut_iter = all_struts; for (strut_iter = all_struts; strut_iter; strut_iter = strut_iter->next) { - GList *rect_iter; + GList *rect_iter; MetaRectangle *strut_rect = &((MetaStrut*)strut_iter->data)->rect; tmp_list = ret; @@ -705,7 +705,7 @@ meta_rectangle_expand_to_avoiding_struts (MetaRectangle *rect, */ g_assert ((direction == META_DIRECTION_HORIZONTAL) ^ (direction == META_DIRECTION_VERTICAL )); - + if (direction == META_DIRECTION_HORIZONTAL) { rect->x = expand_to->x; @@ -717,12 +717,12 @@ meta_rectangle_expand_to_avoiding_struts (MetaRectangle *rect, rect->height = expand_to->height; } - + /* Run over all struts */ for (strut_iter = all_struts; strut_iter; strut_iter = strut_iter->next) { MetaStrut *strut = (MetaStrut*) strut_iter->data; - + /* Skip struts that don't overlap */ if (!meta_rectangle_overlap (&strut->rect, rect)) continue; @@ -763,7 +763,7 @@ meta_rectangle_expand_to_avoiding_struts (MetaRectangle *rect, void meta_rectangle_free_list_and_elements (GList *filled_list) { - g_list_foreach (filled_list, + g_list_foreach (filled_list, (void (*)(gpointer,gpointer))&g_free, /* ew, for ugly */ NULL); g_list_free (filled_list); @@ -841,20 +841,20 @@ meta_rectangle_clamp_to_fit_into_region (const GList *spanning_rects, { MetaRectangle *compare_rect = temp->data; int maximal_overlap_amount_for_compare; - + /* If x is fixed and the entire width of rect doesn't fit in compare, * skip this rectangle. */ if ((fixed_directions & FIXED_DIRECTION_X) && - (compare_rect->x > rect->x || + (compare_rect->x > rect->x || compare_rect->x + compare_rect->width < rect->x + rect->width)) continue; - + /* If y is fixed and the entire height of rect doesn't fit in compare, * skip this rectangle. */ if ((fixed_directions & FIXED_DIRECTION_Y) && - (compare_rect->y > rect->y || + (compare_rect->y > rect->y || compare_rect->y + compare_rect->height < rect->y + rect->height)) continue; @@ -914,20 +914,20 @@ meta_rectangle_clip_to_region (const GList *spanning_rects, MetaRectangle *compare_rect = temp->data; MetaRectangle overlap; int maximal_overlap_amount_for_compare; - + /* If x is fixed and the entire width of rect doesn't fit in compare, * skip the rectangle. */ if ((fixed_directions & FIXED_DIRECTION_X) && - (compare_rect->x > rect->x || + (compare_rect->x > rect->x || compare_rect->x + compare_rect->width < rect->x + rect->width)) continue; - + /* If y is fixed and the entire height of rect doesn't fit in compare, * skip the rectangle. */ if ((fixed_directions & FIXED_DIRECTION_Y) && - (compare_rect->y > rect->y || + (compare_rect->y > rect->y || compare_rect->y + compare_rect->height < rect->y + rect->height)) continue; @@ -988,26 +988,26 @@ meta_rectangle_shove_into_region (const GList *spanning_rects, /* First, find best rectangle from spanning_rects to which we will shove * rect into. */ - + for (temp = spanning_rects; temp; temp = temp->next) { MetaRectangle *compare_rect = temp->data; int maximal_overlap_amount_for_compare; int dist_to_compare; - + /* If x is fixed and the entire width of rect doesn't fit in compare, * skip this rectangle. */ if ((fixed_directions & FIXED_DIRECTION_X) && - (compare_rect->x > rect->x || + (compare_rect->x > rect->x || compare_rect->x + compare_rect->width < rect->x + rect->width)) continue; - + /* If y is fixed and the entire height of rect doesn't fit in compare, * skip this rectangle. */ if ((fixed_directions & FIXED_DIRECTION_Y) && - (compare_rect->y > rect->y || + (compare_rect->y > rect->y || compare_rect->y + compare_rect->height < rect->y + rect->height)) continue; @@ -1163,7 +1163,7 @@ meta_rectangle_edge_aligns (const MetaRectangle *rect, const MetaEdge *edge) } static GList* -get_rect_minus_overlap (const GList *rect_in_list, +get_rect_minus_overlap (const GList *rect_in_list, MetaRectangle *overlap) { MetaRectangle *temp; @@ -1208,7 +1208,7 @@ get_rect_minus_overlap (const GList *rect_in_list, } static GList* -replace_rect_with_list (GList *old_element, +replace_rect_with_list (GList *old_element, GList *new_list) { GList *ret; @@ -1420,7 +1420,7 @@ rectangle_and_edge_intersection (const MetaRectangle *rect, overlap->edge_type = -1; overlap->side_type = -1; - /* Figure out what the intersection is */ + /* Figure out what the intersection is */ result->x = MAX (rect->x, rect2->x); result->y = MAX (rect->y, rect2->y); result->width = MIN (BOX_RIGHT (*rect), BOX_RIGHT (*rect2)) - result->x; @@ -1491,7 +1491,7 @@ rectangle_and_edge_intersection (const MetaRectangle *rect, * TOP<->BOTTOM). */ static GList* -add_edges (GList *cur_edges, +add_edges (GList *cur_edges, const MetaRectangle *rect, gboolean rect_is_internal) { @@ -1505,23 +1505,23 @@ add_edges (GList *cur_edges, switch (i) { case 0: - temp_edge->side_type = + temp_edge->side_type = rect_is_internal ? META_SIDE_LEFT : META_SIDE_RIGHT; temp_edge->rect.width = 0; break; case 1: - temp_edge->side_type = + temp_edge->side_type = rect_is_internal ? META_SIDE_RIGHT : META_SIDE_LEFT; temp_edge->rect.x += temp_edge->rect.width; temp_edge->rect.width = 0; break; case 2: - temp_edge->side_type = + temp_edge->side_type = rect_is_internal ? META_SIDE_TOP : META_SIDE_BOTTOM; temp_edge->rect.height = 0; break; case 3: - temp_edge->side_type = + temp_edge->side_type = rect_is_internal ? META_SIDE_BOTTOM : META_SIDE_TOP; temp_edge->rect.y += temp_edge->rect.height; temp_edge->rect.height = 0; @@ -1538,8 +1538,8 @@ add_edges (GList *cur_edges, * edges to cur_list. Return cur_list when finished. */ static GList* -split_edge (GList *cur_list, - const MetaEdge *old_edge, +split_edge (GList *cur_list, + const MetaEdge *old_edge, const MetaEdge *remove) { MetaEdge *temp_edge; @@ -1598,7 +1598,7 @@ split_edge (GList *cur_list, * if and how rect and edge intersect. */ static void -fix_up_edges (MetaRectangle *rect, MetaEdge *edge, +fix_up_edges (MetaRectangle *rect, MetaEdge *edge, GList **strut_edges, GList **edge_splits, gboolean *edge_needs_removal) { @@ -1715,7 +1715,7 @@ meta_rectangle_find_onscreen_edges (const MetaRectangle *basic_rect, { GList *ret; GList *fixed_strut_rects; - GList *edge_iter; + GList *edge_iter; const GList *strut_rect_iter; /* The algorithm is basically as follows: @@ -1755,7 +1755,7 @@ meta_rectangle_find_onscreen_edges (const MetaRectangle *basic_rect, GList *splits_of_cur_edge = NULL; gboolean edge_needs_removal = FALSE; - fix_up_edges (strut_rect, cur_edge, + fix_up_edges (strut_rect, cur_edge, &new_strut_edges, &splits_of_cur_edge, &edge_needs_removal); @@ -1858,7 +1858,7 @@ meta_rectangle_find_nonintersected_xinerama_edges ( for (; all_struts; all_struts = all_struts->next) temp_rects = g_slist_prepend (temp_rects, &((MetaStrut*)all_struts->data)->rect); - ret = meta_rectangle_remove_intersections_with_boxes_from_edges (ret, + ret = meta_rectangle_remove_intersections_with_boxes_from_edges (ret, temp_rects); g_slist_free (temp_rects); |