implement (meta_texture_spec_draw): implement shape spec and blank texture

2002-01-27  Havoc Pennington  <hp@pobox.com>

	* src/theme.c (meta_shape_spec_draw): implement
	(meta_texture_spec_draw): implement shape spec and blank
	texture support
	(meta_frame_style_draw): implement
This commit is contained in:
Havoc Pennington 2002-01-28 05:16:04 +00:00 committed by Havoc Pennington
parent 8ddeb4f953
commit 838d999d86
4 changed files with 967 additions and 95 deletions

View File

@ -1,3 +1,10 @@
2002-01-27 Havoc Pennington <hp@pobox.com>
* src/theme.c (meta_shape_spec_draw): implement
(meta_texture_spec_draw): implement shape spec and blank
texture support
(meta_frame_style_draw): implement
2002-01-27 Havoc Pennington <hp@pobox.com>
* src/display.c (meta_set_syncing): move in here so util.c doesn't

View File

@ -23,8 +23,10 @@
#include "util.h"
#include "theme.h"
#include <gtk/gtk.h>
#include <time.h>
static void run_position_expression_tests (void);
static void run_position_expression_timings (void);
int
main (int argc, char **argv)
@ -32,6 +34,7 @@ main (int argc, char **argv)
bindtextdomain (GETTEXT_PACKAGE, METACITY_LOCALEDIR);
run_position_expression_tests ();
run_position_expression_timings ();
return 0;
}
@ -245,3 +248,46 @@ run_position_expression_tests (void)
++i;
}
}
static void
run_position_expression_timings (void)
{
int i;
int iters;
clock_t start;
clock_t end;
#define ITERATIONS 100000
start = clock ();
iters = 0;
i = 0;
while (iters < ITERATIONS)
{
const PositionExpressionTest *test;
int x, y;
test = &position_expression_tests[i];
meta_parse_position_expression (test->expr,
test->rect.x,
test->rect.y,
test->rect.width,
test->rect.height,
&x, &y, NULL);
++iters;
++i;
if (i == G_N_ELEMENTS (position_expression_tests))
i = 0;
}
end = clock ();
g_print ("%d coordinate expressions parsed in %g seconds (%g seconds average)\n",
ITERATIONS,
((double)end - (double)start) / CLOCKS_PER_SEC,
((double)end - (double)start) / CLOCKS_PER_SEC / (double) ITERATIONS);
}

File diff suppressed because it is too large Load Diff

View File

@ -100,6 +100,11 @@ struct _MetaFrameGeometry
GdkRectangle spacer_rect;
GdkRectangle menu_rect;
GdkRectangle title_rect;
int left_titlebar_edge;
int right_titlebar_edge;
int top_titlebar_edge;
int bottom_titlebar_edge;
};
@ -199,6 +204,7 @@ struct _MetaShapeSpec
GtkStateType state;
GtkShadowType shadow;
GtkArrowType arrow;
gboolean filled;
char *x;
char *y;
char *width;
@ -235,7 +241,9 @@ typedef enum
META_TEXTURE_SOLID,
META_TEXTURE_GRADIENT,
META_TEXTURE_IMAGE,
META_TEXTURE_COMPOSITE
META_TEXTURE_COMPOSITE,
META_TEXTURE_BLANK,
META_TEXTURE_SHAPE_LIST
} MetaTextureType;
struct _MetaTextureSpec
@ -258,14 +266,19 @@ struct _MetaTextureSpec
MetaTextureSpec *foreground;
double alpha;
} composite;
struct {
int dummy;
} blank;
struct {
MetaShapeSpec **shape_specs;
int n_specs;
} shape_list;
} data;
};
typedef enum
{
META_BUTTON_STATE_UNFOCUSED,
META_BUTTON_STATE_FOCUSED,
META_BUTTON_STATE_INSENSITIVE,
META_BUTTON_STATE_NORMAL,
META_BUTTON_STATE_PRESSED,
META_BUTTON_STATE_PRELIGHT,
META_BUTTON_STATE_LAST
@ -454,9 +467,19 @@ typedef enum
} MetaPositionExprError;
gboolean meta_parse_position_expression (const char *expr,
int x, int y, int width, int height,
int *x_return, int *y_return,
int x,
int y,
int width,
int height,
int *x_return,
int *y_return,
GError **err);
gboolean meta_parse_size_expression (const char *expr,
int width,
int height,
int *val_return,
GError **err);
MetaColorSpec* meta_color_spec_new (MetaColorSpecType type);
void meta_color_spec_free (MetaColorSpec *spec);
@ -513,6 +536,17 @@ MetaFrameStyle* meta_frame_style_new (MetaFrameStyle *parent);
void meta_frame_style_ref (MetaFrameStyle *style);
void meta_frame_style_unref (MetaFrameStyle *style);
void meta_frame_style_draw (MetaFrameStyle *style,
GtkWidget *widget,
GdkDrawable *drawable,
const GdkRectangle *clip,
MetaFrameFlags flags,
int client_width,
int client_height,
PangoLayout *title_layout,
int text_height,
MetaButtonState button_states[META_BUTTON_TYPE_LAST]);
MetaFrameStyleSet* meta_frame_style_set_new (MetaFrameStyleSet *parent);
void meta_frame_style_set_ref (MetaFrameStyleSet *style_set);
void meta_frame_style_set_unref (MetaFrameStyleSet *style_set);