mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
Add boxes.{c,h} to libmetacity_private
2006-04-18 Björn Lindqvist <bjourne@gmail.com> * makefile.am: Add boxes.{c,h} to libmetacity_private * src/theme-parser.c (check_expression): * src/theme-viewer.c (run_position_expression_tests): Use meta_rect (). * src/theme.c: Replace while loops iterating over sequences with for loops. * src/theme.c, src/theme.h (struct _MetaPositionExprEnv, meta_draw_op_draw, meta_draw_op_list_draw, meta_theme_draw_menu_icon): Use MetaRectangles in function prototypes instead of x, y, with, height ints where applicable.
This commit is contained in:
parent
fe47d4436d
commit
ae85a33614
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
|||||||
|
2006-04-18 Björn Lindqvist <bjourne@gmail.com>
|
||||||
|
|
||||||
|
* makefile.am: Add boxes.{c,h} to libmetacity_private
|
||||||
|
* src/theme-parser.c (check_expression):
|
||||||
|
* src/theme-viewer.c (run_position_expression_tests):
|
||||||
|
Use meta_rect ().
|
||||||
|
|
||||||
|
* src/theme.c: Replace while loops iterating over sequences with
|
||||||
|
for loops.
|
||||||
|
|
||||||
|
* src/theme.c, src/theme.h (struct _MetaPositionExprEnv,
|
||||||
|
meta_draw_op_draw, meta_draw_op_list_draw,
|
||||||
|
meta_theme_draw_menu_icon): Use MetaRectangles in function
|
||||||
|
prototypes instead of x, y, with, height ints where applicable.
|
||||||
|
|
||||||
2006-04-18 Kjartan Maraas <kmaraas@gnome.org>
|
2006-04-18 Kjartan Maraas <kmaraas@gnome.org>
|
||||||
|
|
||||||
* configure.in: Remove obsolete entry for no_NO
|
* configure.in: Remove obsolete entry for no_NO
|
||||||
|
@ -102,6 +102,8 @@ metacity_SOURCES= \
|
|||||||
# metacity proper will be compiled with different names.
|
# metacity proper will be compiled with different names.
|
||||||
libmetacity_private_la_CFLAGS =
|
libmetacity_private_la_CFLAGS =
|
||||||
libmetacity_private_la_SOURCES= \
|
libmetacity_private_la_SOURCES= \
|
||||||
|
boxes.c \
|
||||||
|
boxes.h \
|
||||||
gradient.c \
|
gradient.c \
|
||||||
gradient.h \
|
gradient.h \
|
||||||
preview-widget.c \
|
preview-widget.c \
|
||||||
|
@ -1562,10 +1562,7 @@ check_expression (const char *expr,
|
|||||||
* are at least 1.
|
* are at least 1.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
env.x = 0;
|
env.rect = meta_rect (0, 0, 0, 0);
|
||||||
env.y = 0;
|
|
||||||
env.width = 0;
|
|
||||||
env.height = 0;
|
|
||||||
if (has_object)
|
if (has_object)
|
||||||
{
|
{
|
||||||
env.object_width = 0;
|
env.object_width = 0;
|
||||||
|
@ -1192,10 +1192,8 @@ run_position_expression_tests (void)
|
|||||||
|
|
||||||
err = NULL;
|
err = NULL;
|
||||||
|
|
||||||
env.x = test->rect.x;
|
env.rect = meta_rect (test->rect.x, test->rect.y,
|
||||||
env.y = test->rect.y;
|
test->rect.width, test->rect.height);
|
||||||
env.width = test->rect.width;
|
|
||||||
env.height = test->rect.height;
|
|
||||||
env.object_width = -1;
|
env.object_width = -1;
|
||||||
env.object_height = -1;
|
env.object_height = -1;
|
||||||
env.left_width = 0;
|
env.left_width = 0;
|
||||||
|
321
src/theme.c
321
src/theme.c
@ -535,8 +535,7 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
|
|||||||
|
|
||||||
n_left = 0;
|
n_left = 0;
|
||||||
n_right = 0;
|
n_right = 0;
|
||||||
i = 0;
|
for (i = 0; i < MAX_BUTTONS_PER_CORNER; i++)
|
||||||
while (i < MAX_BUTTONS_PER_CORNER)
|
|
||||||
{
|
{
|
||||||
/* NULL all unused */
|
/* NULL all unused */
|
||||||
left_func_rects[i] = NULL;
|
left_func_rects[i] = NULL;
|
||||||
@ -558,43 +557,33 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
|
|||||||
if (right_func_rects[n_right] != NULL)
|
if (right_func_rects[n_right] != NULL)
|
||||||
++n_right;
|
++n_right;
|
||||||
}
|
}
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
for (i = 0; i < MAX_BUTTONS_PER_CORNER; i++)
|
||||||
while (i < MAX_BUTTONS_PER_CORNER)
|
|
||||||
{
|
{
|
||||||
left_bg_rects[i] = NULL;
|
left_bg_rects[i] = NULL;
|
||||||
right_bg_rects[i] = NULL;
|
right_bg_rects[i] = NULL;
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
for (i = 0; i < n_left; i++)
|
||||||
while (i < n_left)
|
|
||||||
{
|
{
|
||||||
if (i == 0) /* prefer left background if only one button */
|
if (i == 0) /* prefer left background if only one button */
|
||||||
left_bg_rects[i] = &fgeom->left_left_background;
|
left_bg_rects[i] = &fgeom->left_left_background;
|
||||||
else if (i == (n_left - 1))
|
else if (i == (n_left - 1))
|
||||||
left_bg_rects[i] = &fgeom->left_right_background;
|
left_bg_rects[i] = &fgeom->left_right_background;
|
||||||
else
|
else
|
||||||
left_bg_rects[i] = &fgeom->left_middle_backgrounds[i-1];
|
left_bg_rects[i] = &fgeom->left_middle_backgrounds[i - 1];
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
for (i = 0; i < n_right; i++)
|
||||||
while (i < n_right)
|
|
||||||
{
|
{
|
||||||
if (i == (n_right - 1)) /* prefer right background if only one button */
|
/* prefer right background if only one button */
|
||||||
|
if (i == (n_right - 1))
|
||||||
right_bg_rects[i] = &fgeom->right_right_background;
|
right_bg_rects[i] = &fgeom->right_right_background;
|
||||||
else if (i == 0)
|
else if (i == 0)
|
||||||
right_bg_rects[i] = &fgeom->right_left_background;
|
right_bg_rects[i] = &fgeom->right_left_background;
|
||||||
else
|
else
|
||||||
right_bg_rects[i] = &fgeom->right_middle_backgrounds[i-1];
|
right_bg_rects[i] = &fgeom->right_middle_backgrounds[i - 1];
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Be sure buttons fit */
|
/* Be sure buttons fit */
|
||||||
@ -607,27 +596,13 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
|
|||||||
|
|
||||||
space_used_by_buttons = 0;
|
space_used_by_buttons = 0;
|
||||||
|
|
||||||
i = 0;
|
space_used_by_buttons += button_width * n_left;
|
||||||
while (i < n_left)
|
space_used_by_buttons += layout->button_border.left * n_left;
|
||||||
{
|
space_used_by_buttons += layout->button_border.right * n_left;
|
||||||
space_used_by_buttons += button_width;
|
|
||||||
|
|
||||||
if (i != n_left)
|
space_used_by_buttons += button_width * n_right;
|
||||||
space_used_by_buttons += layout->button_border.left + layout->button_border.right;
|
space_used_by_buttons += layout->button_border.left * n_right;
|
||||||
|
space_used_by_buttons += layout->button_border.right * n_right;
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
while (i < n_right)
|
|
||||||
{
|
|
||||||
space_used_by_buttons += button_width;
|
|
||||||
|
|
||||||
if (i != n_right)
|
|
||||||
space_used_by_buttons += layout->button_border.left + layout->button_border.right;
|
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (space_used_by_buttons <= space_available)
|
if (space_used_by_buttons <= space_available)
|
||||||
break; /* Everything fits, bail out */
|
break; /* Everything fits, bail out */
|
||||||
@ -703,9 +678,7 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
|
|||||||
* the left-side buttons
|
* the left-side buttons
|
||||||
*/
|
*/
|
||||||
x = layout->left_titlebar_edge;
|
x = layout->left_titlebar_edge;
|
||||||
|
for (i = 0; i < n_left; i++)
|
||||||
i = 0;
|
|
||||||
while (i < n_left)
|
|
||||||
{
|
{
|
||||||
GdkRectangle *rect;
|
GdkRectangle *rect;
|
||||||
|
|
||||||
@ -719,8 +692,6 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
|
|||||||
x = rect->x + rect->width + layout->button_border.right;
|
x = rect->x + rect->width + layout->button_border.right;
|
||||||
|
|
||||||
*(left_bg_rects[i]) = *rect;
|
*(left_bg_rects[i]) = *rect;
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We always fill as much vertical space as possible with title rect,
|
/* We always fill as much vertical space as possible with title rect,
|
||||||
@ -1383,13 +1354,10 @@ free_tokens (PosToken *tokens,
|
|||||||
* it was initialized
|
* it was initialized
|
||||||
*/
|
*/
|
||||||
|
|
||||||
i = 0;
|
for (i = 0; i < n_tokens; i++)
|
||||||
while (i < n_tokens)
|
|
||||||
{
|
|
||||||
if (tokens[i].type == POS_TOKEN_VARIABLE)
|
if (tokens[i].type == POS_TOKEN_VARIABLE)
|
||||||
g_free (tokens[i].d.v.name);
|
g_free (tokens[i].d.v.name);
|
||||||
++i;
|
|
||||||
}
|
|
||||||
g_free (tokens);
|
g_free (tokens);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1602,8 +1570,7 @@ debug_print_tokens (PosToken *tokens,
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
i = 0;
|
for (i = 0; i < n_tokens; i++)
|
||||||
while (i < n_tokens)
|
|
||||||
{
|
{
|
||||||
PosToken *t = &tokens[i];
|
PosToken *t = &tokens[i];
|
||||||
|
|
||||||
@ -1630,8 +1597,6 @@ debug_print_tokens (PosToken *tokens,
|
|||||||
g_print ("\"%s\"", op_name (t->d.o.op));
|
g_print ("\"%s\"", op_name (t->d.o.op));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_print ("\n");
|
g_print ("\n");
|
||||||
@ -1663,8 +1628,7 @@ debug_print_exprs (PosExpr *exprs,
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
i = 0;
|
for (i = 0; i < n_exprs; i++)
|
||||||
while (i < n_exprs)
|
|
||||||
{
|
{
|
||||||
switch (exprs[i].type)
|
switch (exprs[i].type)
|
||||||
{
|
{
|
||||||
@ -1678,8 +1642,6 @@ debug_print_exprs (PosExpr *exprs,
|
|||||||
g_print (" %s", op_name (exprs[i].d.operator));
|
g_print (" %s", op_name (exprs[i].d.operator));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
g_print ("\n");
|
g_print ("\n");
|
||||||
}
|
}
|
||||||
@ -1966,8 +1928,7 @@ pos_eval_helper (PosToken *tokens,
|
|||||||
first_paren = 0;
|
first_paren = 0;
|
||||||
paren_level = 0;
|
paren_level = 0;
|
||||||
n_exprs = 0;
|
n_exprs = 0;
|
||||||
i = 0;
|
for (i = 0; i < n_tokens; i++)
|
||||||
while (i < n_tokens)
|
|
||||||
{
|
{
|
||||||
PosToken *t = &tokens[i];
|
PosToken *t = &tokens[i];
|
||||||
|
|
||||||
@ -2015,9 +1976,9 @@ pos_eval_helper (PosToken *tokens,
|
|||||||
* for optimization purposes
|
* for optimization purposes
|
||||||
*/
|
*/
|
||||||
if (strcmp (t->d.v.name, "width") == 0)
|
if (strcmp (t->d.v.name, "width") == 0)
|
||||||
exprs[n_exprs].d.int_val = env->width;
|
exprs[n_exprs].d.int_val = env->rect.width;
|
||||||
else if (strcmp (t->d.v.name, "height") == 0)
|
else if (strcmp (t->d.v.name, "height") == 0)
|
||||||
exprs[n_exprs].d.int_val = env->height;
|
exprs[n_exprs].d.int_val = env->rect.height;
|
||||||
else if (env->object_width >= 0 &&
|
else if (env->object_width >= 0 &&
|
||||||
strcmp (t->d.v.name, "object_width") == 0)
|
strcmp (t->d.v.name, "object_width") == 0)
|
||||||
exprs[n_exprs].d.int_val = env->object_width;
|
exprs[n_exprs].d.int_val = env->object_width;
|
||||||
@ -2115,8 +2076,6 @@ pos_eval_helper (PosToken *tokens,
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paren_level > 0)
|
if (paren_level > 0)
|
||||||
@ -2228,9 +2187,9 @@ meta_parse_position_expression (const char *expr,
|
|||||||
if (pos_eval (tokens, n_tokens, env, &val, err))
|
if (pos_eval (tokens, n_tokens, env, &val, err))
|
||||||
{
|
{
|
||||||
if (x_return)
|
if (x_return)
|
||||||
*x_return = env->x + val;
|
*x_return = env->rect.x + val;
|
||||||
if (y_return)
|
if (y_return)
|
||||||
*y_return = env->y + val;
|
*y_return = env->rect.y + val;
|
||||||
free_tokens (tokens, n_tokens);
|
free_tokens (tokens, n_tokens);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -2311,8 +2270,7 @@ meta_theme_replace_constants (MetaTheme *theme,
|
|||||||
|
|
||||||
str = g_string_new (NULL);
|
str = g_string_new (NULL);
|
||||||
|
|
||||||
i = 0;
|
for (i = 0; i < n_tokens; i++)
|
||||||
while (i < n_tokens)
|
|
||||||
{
|
{
|
||||||
PosToken *t = &tokens[i];
|
PosToken *t = &tokens[i];
|
||||||
|
|
||||||
@ -2356,8 +2314,6 @@ meta_theme_replace_constants (MetaTheme *theme,
|
|||||||
g_string_append (str, op_name (t->d.o.op));
|
g_string_append (str, op_name (t->d.o.op));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free_tokens (tokens, n_tokens);
|
free_tokens (tokens, n_tokens);
|
||||||
@ -2430,7 +2386,6 @@ parse_size_unchecked (const char *expr,
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MetaDrawOp*
|
MetaDrawOp*
|
||||||
meta_draw_op_new (MetaDrawType type)
|
meta_draw_op_new (MetaDrawType type)
|
||||||
{
|
{
|
||||||
@ -3163,17 +3118,11 @@ draw_op_as_pixbuf (const MetaDrawOp *op,
|
|||||||
static void
|
static void
|
||||||
fill_env (MetaPositionExprEnv *env,
|
fill_env (MetaPositionExprEnv *env,
|
||||||
const MetaDrawInfo *info,
|
const MetaDrawInfo *info,
|
||||||
int x,
|
MetaRectangle logical_region)
|
||||||
int y,
|
|
||||||
int width,
|
|
||||||
int height)
|
|
||||||
{
|
{
|
||||||
/* FIXME this stuff could be raised into draw_op_list_draw() probably
|
/* FIXME this stuff could be raised into draw_op_list_draw() probably
|
||||||
*/
|
*/
|
||||||
env->x = x;
|
env->rect = logical_region;
|
||||||
env->y = y;
|
|
||||||
env->width = width;
|
|
||||||
env->height = height;
|
|
||||||
env->object_width = -1;
|
env->object_width = -1;
|
||||||
env->object_height = -1;
|
env->object_height = -1;
|
||||||
if (info->fgeom)
|
if (info->fgeom)
|
||||||
@ -3207,10 +3156,7 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
|
|||||||
GdkDrawable *drawable,
|
GdkDrawable *drawable,
|
||||||
const GdkRectangle *clip,
|
const GdkRectangle *clip,
|
||||||
const MetaDrawInfo *info,
|
const MetaDrawInfo *info,
|
||||||
int x,
|
MetaRectangle rect,
|
||||||
int y,
|
|
||||||
int width,
|
|
||||||
int height,
|
|
||||||
MetaPositionExprEnv *env)
|
MetaPositionExprEnv *env)
|
||||||
{
|
{
|
||||||
GdkGC *gc;
|
GdkGC *gc;
|
||||||
@ -3494,25 +3440,25 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
|
|||||||
|
|
||||||
case META_DRAW_OP_LIST:
|
case META_DRAW_OP_LIST:
|
||||||
{
|
{
|
||||||
int rx, ry, rwidth, rheight;
|
MetaRectangle d_rect;
|
||||||
|
|
||||||
rx = parse_x_position_unchecked (op->data.op_list.x, env);
|
d_rect.x = parse_x_position_unchecked (op->data.op_list.x, env);
|
||||||
ry = parse_y_position_unchecked (op->data.op_list.y, env);
|
d_rect.y = parse_y_position_unchecked (op->data.op_list.y, env);
|
||||||
rwidth = parse_size_unchecked (op->data.op_list.width, env);
|
d_rect.width = parse_size_unchecked (op->data.op_list.width, env);
|
||||||
rheight = parse_size_unchecked (op->data.op_list.height, env);
|
d_rect.height = parse_size_unchecked (op->data.op_list.height, env);
|
||||||
|
|
||||||
meta_draw_op_list_draw (op->data.op_list.op_list,
|
meta_draw_op_list_draw (op->data.op_list.op_list,
|
||||||
widget, drawable, clip, info,
|
widget, drawable, clip, info,
|
||||||
rx, ry, rwidth, rheight);
|
d_rect);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case META_DRAW_TILE:
|
case META_DRAW_TILE:
|
||||||
{
|
{
|
||||||
int rx, ry, rwidth, rheight;
|
int rx, ry, rwidth, rheight;
|
||||||
int tile_xoffset, tile_yoffset, tile_width, tile_height;
|
int tile_xoffset, tile_yoffset;
|
||||||
GdkRectangle new_clip;
|
GdkRectangle new_clip;
|
||||||
int tile_x, tile_y;
|
MetaRectangle tile;
|
||||||
|
|
||||||
rx = parse_x_position_unchecked (op->data.tile.x, env);
|
rx = parse_x_position_unchecked (op->data.tile.x, env);
|
||||||
ry = parse_y_position_unchecked (op->data.tile.y, env);
|
ry = parse_y_position_unchecked (op->data.tile.y, env);
|
||||||
@ -3530,27 +3476,27 @@ meta_draw_op_draw_with_env (const MetaDrawOp *op,
|
|||||||
tile_xoffset = parse_x_position_unchecked (op->data.tile.tile_xoffset, env);
|
tile_xoffset = parse_x_position_unchecked (op->data.tile.tile_xoffset, env);
|
||||||
tile_yoffset = parse_y_position_unchecked (op->data.tile.tile_yoffset, env);
|
tile_yoffset = parse_y_position_unchecked (op->data.tile.tile_yoffset, env);
|
||||||
/* tile offset should not include x/y */
|
/* tile offset should not include x/y */
|
||||||
tile_xoffset -= x;
|
tile_xoffset -= rect.x;
|
||||||
tile_yoffset -= y;
|
tile_yoffset -= rect.y;
|
||||||
|
|
||||||
tile_width = parse_size_unchecked (op->data.tile.tile_width, env);
|
tile.width = parse_size_unchecked (op->data.tile.tile_width, env);
|
||||||
tile_height = parse_size_unchecked (op->data.tile.tile_height, env);
|
tile.height = parse_size_unchecked (op->data.tile.tile_height, env);
|
||||||
|
|
||||||
tile_x = rx - tile_xoffset;
|
tile.x = rx - tile_xoffset;
|
||||||
|
|
||||||
while (tile_x < (rx + rwidth))
|
while (tile.x < (rx + rwidth))
|
||||||
{
|
{
|
||||||
tile_y = ry - tile_yoffset;
|
tile.y = ry - tile_yoffset;
|
||||||
while (tile_y < (ry + rheight))
|
while (tile.y < (ry + rheight))
|
||||||
{
|
{
|
||||||
meta_draw_op_list_draw (op->data.tile.op_list,
|
meta_draw_op_list_draw (op->data.tile.op_list,
|
||||||
widget, drawable, &new_clip, info,
|
widget, drawable, &new_clip, info,
|
||||||
tile_x, tile_y, tile_width, tile_height);
|
tile);
|
||||||
|
|
||||||
tile_y += tile_height;
|
tile.y += tile.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
tile_x += tile_width;
|
tile.x += tile.width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3564,18 +3510,16 @@ meta_draw_op_draw (const MetaDrawOp *op,
|
|||||||
GdkDrawable *drawable,
|
GdkDrawable *drawable,
|
||||||
const GdkRectangle *clip,
|
const GdkRectangle *clip,
|
||||||
const MetaDrawInfo *info,
|
const MetaDrawInfo *info,
|
||||||
int x,
|
MetaRectangle logical_region)
|
||||||
int y,
|
|
||||||
int width,
|
|
||||||
int height)
|
|
||||||
{
|
{
|
||||||
MetaPositionExprEnv env;
|
MetaPositionExprEnv env;
|
||||||
|
|
||||||
fill_env (&env, info, x, y, width, height);
|
fill_env (&env, info, logical_region);
|
||||||
|
|
||||||
meta_draw_op_draw_with_env (op, widget, drawable, clip,
|
meta_draw_op_draw_with_env (op, widget, drawable, clip,
|
||||||
info, x, y, width, height,
|
info, logical_region,
|
||||||
&env);
|
&env);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaDrawOpList*
|
MetaDrawOpList*
|
||||||
@ -3615,12 +3559,8 @@ meta_draw_op_list_unref (MetaDrawOpList *op_list)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
i = 0;
|
for (i = 0; i < op_list->n_ops; i++)
|
||||||
while (i < op_list->n_ops)
|
|
||||||
{
|
|
||||||
meta_draw_op_free (op_list->ops[i]);
|
meta_draw_op_free (op_list->ops[i]);
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free (op_list->ops);
|
g_free (op_list->ops);
|
||||||
|
|
||||||
@ -3635,10 +3575,7 @@ meta_draw_op_list_draw (const MetaDrawOpList *op_list,
|
|||||||
GdkDrawable *drawable,
|
GdkDrawable *drawable,
|
||||||
const GdkRectangle *clip,
|
const GdkRectangle *clip,
|
||||||
const MetaDrawInfo *info,
|
const MetaDrawInfo *info,
|
||||||
int x,
|
MetaRectangle rect)
|
||||||
int y,
|
|
||||||
int width,
|
|
||||||
int height)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
GdkRectangle active_clip;
|
GdkRectangle active_clip;
|
||||||
@ -3648,7 +3585,7 @@ meta_draw_op_list_draw (const MetaDrawOpList *op_list,
|
|||||||
if (op_list->n_ops == 0)
|
if (op_list->n_ops == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fill_env (&env, info, x, y, width, height);
|
fill_env (&env, info, rect);
|
||||||
|
|
||||||
/* FIXME this can be optimized, potentially a lot, by
|
/* FIXME this can be optimized, potentially a lot, by
|
||||||
* compressing multiple ops when possible. For example,
|
* compressing multiple ops when possible. For example,
|
||||||
@ -3662,19 +3599,20 @@ meta_draw_op_list_draw (const MetaDrawOpList *op_list,
|
|||||||
* adjacent items when possible.
|
* adjacent items when possible.
|
||||||
*/
|
*/
|
||||||
if (clip)
|
if (clip)
|
||||||
|
{
|
||||||
orig_clip = *clip;
|
orig_clip = *clip;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
orig_clip.x = x;
|
orig_clip.x = rect.x;
|
||||||
orig_clip.y = y;
|
orig_clip.y = rect.y;
|
||||||
orig_clip.width = width;
|
orig_clip.width = rect.width;
|
||||||
orig_clip.height = height;
|
orig_clip.height = rect.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
active_clip = orig_clip;
|
active_clip = orig_clip;
|
||||||
|
|
||||||
i = 0;
|
for (i = 0; i < op_list->n_ops; i++)
|
||||||
while (i < op_list->n_ops)
|
|
||||||
{
|
{
|
||||||
MetaDrawOp *op = op_list->ops[i];
|
MetaDrawOp *op = op_list->ops[i];
|
||||||
|
|
||||||
@ -3692,11 +3630,9 @@ meta_draw_op_list_draw (const MetaDrawOpList *op_list,
|
|||||||
{
|
{
|
||||||
meta_draw_op_draw_with_env (op,
|
meta_draw_op_draw_with_env (op,
|
||||||
widget, drawable, &active_clip, info,
|
widget, drawable, &active_clip, info,
|
||||||
x, y, width, height,
|
rect,
|
||||||
&env);
|
&env);
|
||||||
}
|
}
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3737,8 +3673,7 @@ meta_draw_op_list_contains (MetaDrawOpList *op_list,
|
|||||||
|
|
||||||
/* mmm, huge tree recursion */
|
/* mmm, huge tree recursion */
|
||||||
|
|
||||||
i = 0;
|
for (i = 0; i < op_list->n_ops; i++)
|
||||||
while (i < op_list->n_ops)
|
|
||||||
{
|
{
|
||||||
if (op_list->ops[i]->type == META_DRAW_OP_LIST)
|
if (op_list->ops[i]->type == META_DRAW_OP_LIST)
|
||||||
{
|
{
|
||||||
@ -3758,8 +3693,6 @@ meta_draw_op_list_contains (MetaDrawOpList *op_list,
|
|||||||
child))
|
child))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -3794,20 +3727,10 @@ free_button_ops (MetaDrawOpList *op_lists[META_BUTTON_TYPE_LAST][META_BUTTON_STA
|
|||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
i = 0;
|
for (i = 0; i < META_BUTTON_TYPE_LAST; i++)
|
||||||
while (i < META_BUTTON_TYPE_LAST)
|
for (j = 0; j < META_BUTTON_STATE_LAST; j++)
|
||||||
{
|
|
||||||
j = 0;
|
|
||||||
while (j < META_BUTTON_STATE_LAST)
|
|
||||||
{
|
|
||||||
if (op_lists[i][j])
|
if (op_lists[i][j])
|
||||||
meta_draw_op_list_unref (op_lists[i][j]);
|
meta_draw_op_list_unref (op_lists[i][j]);
|
||||||
|
|
||||||
++j;
|
|
||||||
}
|
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -3824,15 +3747,10 @@ meta_frame_style_unref (MetaFrameStyle *style)
|
|||||||
|
|
||||||
free_button_ops (style->buttons);
|
free_button_ops (style->buttons);
|
||||||
|
|
||||||
i = 0;
|
for (i = 0; i < META_FRAME_PIECE_LAST; i++)
|
||||||
while (i < META_FRAME_PIECE_LAST)
|
|
||||||
{
|
|
||||||
if (style->pieces[i])
|
if (style->pieces[i])
|
||||||
meta_draw_op_list_unref (style->pieces[i]);
|
meta_draw_op_list_unref (style->pieces[i]);
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (style->layout)
|
if (style->layout)
|
||||||
meta_frame_layout_unref (style->layout);
|
meta_frame_layout_unref (style->layout);
|
||||||
|
|
||||||
@ -3894,14 +3812,12 @@ meta_frame_style_validate (MetaFrameStyle *style,
|
|||||||
g_return_val_if_fail (style != NULL, FALSE);
|
g_return_val_if_fail (style != NULL, FALSE);
|
||||||
g_return_val_if_fail (style->layout != NULL, FALSE);
|
g_return_val_if_fail (style->layout != NULL, FALSE);
|
||||||
|
|
||||||
i = 0;
|
for (i = 0; i < META_BUTTON_TYPE_LAST; i++)
|
||||||
while (i < META_BUTTON_TYPE_LAST)
|
|
||||||
{
|
{
|
||||||
/* for now the "positional" buttons are optional */
|
/* for now the "positional" buttons are optional */
|
||||||
if (i >= META_BUTTON_TYPE_CLOSE)
|
if (i >= META_BUTTON_TYPE_CLOSE)
|
||||||
{
|
{
|
||||||
j = 0;
|
for (j = 0; j < META_BUTTON_STATE_LAST; j++)
|
||||||
while (j < META_BUTTON_STATE_LAST)
|
|
||||||
{
|
{
|
||||||
if (get_button (style, i, j) == NULL)
|
if (get_button (style, i, j) == NULL)
|
||||||
{
|
{
|
||||||
@ -3912,12 +3828,8 @@ meta_frame_style_validate (MetaFrameStyle *style,
|
|||||||
meta_button_state_to_string (j));
|
meta_button_state_to_string (j));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
++j;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -4150,12 +4062,16 @@ meta_frame_style_draw (MetaFrameStyle *style,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (op_list)
|
if (op_list)
|
||||||
|
{
|
||||||
|
MetaRectangle m_rect;
|
||||||
|
m_rect = meta_rect (rect.x, rect.y, rect.width, rect.height);
|
||||||
meta_draw_op_list_draw (op_list,
|
meta_draw_op_list_draw (op_list,
|
||||||
widget,
|
widget,
|
||||||
drawable,
|
drawable,
|
||||||
&combined_clip,
|
&combined_clip,
|
||||||
&draw_info,
|
&draw_info,
|
||||||
rect.x, rect.y, rect.width, rect.height);
|
m_rect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4187,12 +4103,17 @@ meta_frame_style_draw (MetaFrameStyle *style,
|
|||||||
op_list = get_button (style, j, button_states[j]);
|
op_list = get_button (style, j, button_states[j]);
|
||||||
|
|
||||||
if (op_list)
|
if (op_list)
|
||||||
|
{
|
||||||
|
MetaRectangle m_rect;
|
||||||
|
m_rect = meta_rect (rect.x, rect.y,
|
||||||
|
rect.width, rect.height);
|
||||||
meta_draw_op_list_draw (op_list,
|
meta_draw_op_list_draw (op_list,
|
||||||
widget,
|
widget,
|
||||||
drawable,
|
drawable,
|
||||||
&combined_clip,
|
&combined_clip,
|
||||||
&draw_info,
|
&draw_info,
|
||||||
rect.x, rect.y, rect.width, rect.height);
|
m_rect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MIDDLE_BACKGROUND type may get drawn more than once */
|
/* MIDDLE_BACKGROUND type may get drawn more than once */
|
||||||
@ -4235,14 +4156,9 @@ free_focus_styles (MetaFrameStyle *focus_styles[META_FRAME_FOCUS_LAST])
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
i = 0;
|
for (i = 0; i < META_FRAME_FOCUS_LAST; i++)
|
||||||
while (i < META_FRAME_FOCUS_LAST)
|
|
||||||
{
|
|
||||||
if (focus_styles[i])
|
if (focus_styles[i])
|
||||||
meta_frame_style_unref (focus_styles[i]);
|
meta_frame_style_unref (focus_styles[i]);
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -4265,14 +4181,9 @@ meta_frame_style_set_unref (MetaFrameStyleSet *style_set)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
i = 0;
|
for (i = 0; i < META_FRAME_RESIZE_LAST; i++)
|
||||||
while (i < META_FRAME_RESIZE_LAST)
|
|
||||||
{
|
|
||||||
free_focus_styles (style_set->normal_styles[i]);
|
free_focus_styles (style_set->normal_styles[i]);
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
free_focus_styles (style_set->maximized_styles);
|
free_focus_styles (style_set->maximized_styles);
|
||||||
free_focus_styles (style_set->shaded_styles);
|
free_focus_styles (style_set->shaded_styles);
|
||||||
free_focus_styles (style_set->maximized_and_shaded_styles);
|
free_focus_styles (style_set->maximized_and_shaded_styles);
|
||||||
@ -4349,8 +4260,7 @@ check_state (MetaFrameStyleSet *style_set,
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
i = 0;
|
for (i = 0; i < META_FRAME_FOCUS_LAST; i++)
|
||||||
while (i < META_FRAME_FOCUS_LAST)
|
|
||||||
{
|
{
|
||||||
if (get_style (style_set, state,
|
if (get_style (style_set, state,
|
||||||
META_FRAME_RESIZE_NONE, i) == NULL)
|
META_FRAME_RESIZE_NONE, i) == NULL)
|
||||||
@ -4363,8 +4273,6 @@ check_state (MetaFrameStyleSet *style_set,
|
|||||||
meta_frame_focus_to_string (i));
|
meta_frame_focus_to_string (i));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -4378,14 +4286,9 @@ meta_frame_style_set_validate (MetaFrameStyleSet *style_set,
|
|||||||
|
|
||||||
g_return_val_if_fail (style_set != NULL, FALSE);
|
g_return_val_if_fail (style_set != NULL, FALSE);
|
||||||
|
|
||||||
i = 0;
|
for (i = 0; i < META_FRAME_RESIZE_LAST; i++)
|
||||||
while (i < META_FRAME_RESIZE_LAST)
|
for (j = 0; j < META_FRAME_FOCUS_LAST; j++)
|
||||||
{
|
if (get_style (style_set, META_FRAME_STATE_NORMAL, i, j) == NULL)
|
||||||
j = 0;
|
|
||||||
while (j < META_FRAME_FOCUS_LAST)
|
|
||||||
{
|
|
||||||
if (get_style (style_set, META_FRAME_STATE_NORMAL,
|
|
||||||
i, j) == NULL)
|
|
||||||
{
|
{
|
||||||
g_set_error (error, META_THEME_ERROR,
|
g_set_error (error, META_THEME_ERROR,
|
||||||
META_THEME_ERROR_FAILED,
|
META_THEME_ERROR_FAILED,
|
||||||
@ -4396,11 +4299,6 @@ meta_frame_style_set_validate (MetaFrameStyleSet *style_set,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
++j;
|
|
||||||
}
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!check_state (style_set, META_FRAME_STATE_SHADED, error))
|
if (!check_state (style_set, META_FRAME_STATE_SHADED, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -4501,20 +4399,10 @@ free_menu_ops (MetaDrawOpList *op_lists[META_MENU_ICON_TYPE_LAST][N_GTK_STATES])
|
|||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
i = 0;
|
for (i = 0; i < META_MENU_ICON_TYPE_LAST; i++)
|
||||||
while (i < META_MENU_ICON_TYPE_LAST)
|
for (j = 0; j < N_GTK_STATES; j++)
|
||||||
{
|
|
||||||
j = 0;
|
|
||||||
while (j < N_GTK_STATES)
|
|
||||||
{
|
|
||||||
if (op_lists[i][j])
|
if (op_lists[i][j])
|
||||||
meta_draw_op_list_unref (op_lists[i][j]);
|
meta_draw_op_list_unref (op_lists[i][j]);
|
||||||
|
|
||||||
++j;
|
|
||||||
}
|
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -4548,13 +4436,9 @@ meta_theme_free (MetaTheme *theme)
|
|||||||
if (theme->style_sets_by_name)
|
if (theme->style_sets_by_name)
|
||||||
g_hash_table_destroy (theme->style_sets_by_name);
|
g_hash_table_destroy (theme->style_sets_by_name);
|
||||||
|
|
||||||
i = 0;
|
for (i = 0; i < META_FRAME_TYPE_LAST; i++)
|
||||||
while (i < META_FRAME_TYPE_LAST)
|
|
||||||
{
|
|
||||||
if (theme->style_sets_by_type[i])
|
if (theme->style_sets_by_type[i])
|
||||||
meta_frame_style_set_unref (theme->style_sets_by_type[i]);
|
meta_frame_style_set_unref (theme->style_sets_by_type[i]);
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
free_menu_ops (theme->menu_icons);
|
free_menu_ops (theme->menu_icons);
|
||||||
|
|
||||||
@ -4626,9 +4510,7 @@ meta_theme_validate (MetaTheme *theme,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
for (i = 0; i < (int)META_FRAME_TYPE_LAST; i++)
|
||||||
while (i < (int) META_FRAME_TYPE_LAST)
|
|
||||||
{
|
|
||||||
if (theme->style_sets_by_type[i] == NULL)
|
if (theme->style_sets_by_type[i] == NULL)
|
||||||
{
|
{
|
||||||
g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
|
g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
|
||||||
@ -4640,16 +4522,8 @@ meta_theme_validate (MetaTheme *theme,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
++i;
|
for (i = 0; i < META_MENU_ICON_TYPE_LAST; i++)
|
||||||
}
|
for (j = 0; j < N_GTK_STATES; j++)
|
||||||
|
|
||||||
i = 0;
|
|
||||||
while (i < META_MENU_ICON_TYPE_LAST)
|
|
||||||
{
|
|
||||||
j = 0;
|
|
||||||
while (j < N_GTK_STATES)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (get_menu_icon (theme, i, j) == NULL)
|
if (get_menu_icon (theme, i, j) == NULL)
|
||||||
{
|
{
|
||||||
g_set_error (error, META_THEME_ERROR,
|
g_set_error (error, META_THEME_ERROR,
|
||||||
@ -4660,12 +4534,6 @@ meta_theme_validate (MetaTheme *theme,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
++j;
|
|
||||||
}
|
|
||||||
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4865,10 +4733,7 @@ meta_theme_draw_menu_icon (MetaTheme *theme,
|
|||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
GdkDrawable *drawable,
|
GdkDrawable *drawable,
|
||||||
const GdkRectangle *clip,
|
const GdkRectangle *clip,
|
||||||
int x_offset,
|
MetaRectangle offset_rect,
|
||||||
int y_offset,
|
|
||||||
int width,
|
|
||||||
int height,
|
|
||||||
MetaMenuIconType type)
|
MetaMenuIconType type)
|
||||||
{
|
{
|
||||||
MetaDrawInfo info;
|
MetaDrawInfo info;
|
||||||
@ -4891,7 +4756,7 @@ meta_theme_draw_menu_icon (MetaTheme *theme,
|
|||||||
drawable,
|
drawable,
|
||||||
clip,
|
clip,
|
||||||
&info,
|
&info,
|
||||||
x_offset, y_offset, width, height);
|
offset_rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
22
src/theme.h
22
src/theme.h
@ -22,6 +22,7 @@
|
|||||||
#ifndef META_THEME_H
|
#ifndef META_THEME_H
|
||||||
#define META_THEME_H
|
#define META_THEME_H
|
||||||
|
|
||||||
|
#include "boxes.h"
|
||||||
#include "gradient.h"
|
#include "gradient.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include <gtk/gtkrc.h>
|
#include <gtk/gtkrc.h>
|
||||||
@ -565,10 +566,7 @@ struct _MetaTheme
|
|||||||
|
|
||||||
struct _MetaPositionExprEnv
|
struct _MetaPositionExprEnv
|
||||||
{
|
{
|
||||||
int x;
|
MetaRectangle rect;
|
||||||
int y;
|
|
||||||
int width;
|
|
||||||
int height;
|
|
||||||
/* size of an object being drawn, if it has a natural size */
|
/* size of an object being drawn, if it has a natural size */
|
||||||
int object_width;
|
int object_width;
|
||||||
int object_height;
|
int object_height;
|
||||||
@ -638,11 +636,7 @@ void meta_draw_op_draw (const MetaDrawOp *op,
|
|||||||
const GdkRectangle *clip,
|
const GdkRectangle *clip,
|
||||||
const MetaDrawInfo *info,
|
const MetaDrawInfo *info,
|
||||||
/* logical region being drawn */
|
/* logical region being drawn */
|
||||||
int x,
|
MetaRectangle logical_region);
|
||||||
int y,
|
|
||||||
int width,
|
|
||||||
int height);
|
|
||||||
|
|
||||||
|
|
||||||
MetaDrawOpList* meta_draw_op_list_new (int n_preallocs);
|
MetaDrawOpList* meta_draw_op_list_new (int n_preallocs);
|
||||||
void meta_draw_op_list_ref (MetaDrawOpList *op_list);
|
void meta_draw_op_list_ref (MetaDrawOpList *op_list);
|
||||||
@ -652,10 +646,7 @@ void meta_draw_op_list_draw (const MetaDrawOpList *op_list,
|
|||||||
GdkDrawable *drawable,
|
GdkDrawable *drawable,
|
||||||
const GdkRectangle *clip,
|
const GdkRectangle *clip,
|
||||||
const MetaDrawInfo *info,
|
const MetaDrawInfo *info,
|
||||||
int x,
|
MetaRectangle rect);
|
||||||
int y,
|
|
||||||
int width,
|
|
||||||
int height);
|
|
||||||
void meta_draw_op_list_append (MetaDrawOpList *op_list,
|
void meta_draw_op_list_append (MetaDrawOpList *op_list,
|
||||||
MetaDrawOp *op);
|
MetaDrawOp *op);
|
||||||
gboolean meta_draw_op_list_validate (MetaDrawOpList *op_list,
|
gboolean meta_draw_op_list_validate (MetaDrawOpList *op_list,
|
||||||
@ -748,10 +739,7 @@ void meta_theme_draw_menu_icon (MetaTheme *theme,
|
|||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
GdkDrawable *drawable,
|
GdkDrawable *drawable,
|
||||||
const GdkRectangle *clip,
|
const GdkRectangle *clip,
|
||||||
int x_offset,
|
MetaRectangle offset_rect,
|
||||||
int y_offset,
|
|
||||||
int width,
|
|
||||||
int height,
|
|
||||||
MetaMenuIconType type);
|
MetaMenuIconType type);
|
||||||
|
|
||||||
void meta_theme_get_frame_borders (MetaTheme *theme,
|
void meta_theme_get_frame_borders (MetaTheme *theme,
|
||||||
|
Loading…
Reference in New Issue
Block a user