mirror of
https://github.com/brl/mutter.git
synced 2025-08-06 08:34:41 +00:00
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:

committed by
Havoc Pennington

parent
8ddeb4f953
commit
838d999d86
@@ -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>
|
2002-01-27 Havoc Pennington <hp@pobox.com>
|
||||||
|
|
||||||
* src/display.c (meta_set_syncing): move in here so util.c doesn't
|
* src/display.c (meta_set_syncing): move in here so util.c doesn't
|
||||||
|
@@ -23,8 +23,10 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "theme.h"
|
#include "theme.h"
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
static void run_position_expression_tests (void);
|
static void run_position_expression_tests (void);
|
||||||
|
static void run_position_expression_timings (void);
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
@@ -32,6 +34,7 @@ main (int argc, char **argv)
|
|||||||
bindtextdomain (GETTEXT_PACKAGE, METACITY_LOCALEDIR);
|
bindtextdomain (GETTEXT_PACKAGE, METACITY_LOCALEDIR);
|
||||||
|
|
||||||
run_position_expression_tests ();
|
run_position_expression_tests ();
|
||||||
|
run_position_expression_timings ();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -245,3 +248,46 @@ run_position_expression_tests (void)
|
|||||||
++i;
|
++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);
|
||||||
|
|
||||||
|
}
|
||||||
|
895
src/theme.c
895
src/theme.c
File diff suppressed because it is too large
Load Diff
46
src/theme.h
46
src/theme.h
@@ -100,6 +100,11 @@ struct _MetaFrameGeometry
|
|||||||
GdkRectangle spacer_rect;
|
GdkRectangle spacer_rect;
|
||||||
GdkRectangle menu_rect;
|
GdkRectangle menu_rect;
|
||||||
GdkRectangle title_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;
|
GtkStateType state;
|
||||||
GtkShadowType shadow;
|
GtkShadowType shadow;
|
||||||
GtkArrowType arrow;
|
GtkArrowType arrow;
|
||||||
|
gboolean filled;
|
||||||
char *x;
|
char *x;
|
||||||
char *y;
|
char *y;
|
||||||
char *width;
|
char *width;
|
||||||
@@ -235,7 +241,9 @@ typedef enum
|
|||||||
META_TEXTURE_SOLID,
|
META_TEXTURE_SOLID,
|
||||||
META_TEXTURE_GRADIENT,
|
META_TEXTURE_GRADIENT,
|
||||||
META_TEXTURE_IMAGE,
|
META_TEXTURE_IMAGE,
|
||||||
META_TEXTURE_COMPOSITE
|
META_TEXTURE_COMPOSITE,
|
||||||
|
META_TEXTURE_BLANK,
|
||||||
|
META_TEXTURE_SHAPE_LIST
|
||||||
} MetaTextureType;
|
} MetaTextureType;
|
||||||
|
|
||||||
struct _MetaTextureSpec
|
struct _MetaTextureSpec
|
||||||
@@ -258,14 +266,19 @@ struct _MetaTextureSpec
|
|||||||
MetaTextureSpec *foreground;
|
MetaTextureSpec *foreground;
|
||||||
double alpha;
|
double alpha;
|
||||||
} composite;
|
} composite;
|
||||||
|
struct {
|
||||||
|
int dummy;
|
||||||
|
} blank;
|
||||||
|
struct {
|
||||||
|
MetaShapeSpec **shape_specs;
|
||||||
|
int n_specs;
|
||||||
|
} shape_list;
|
||||||
} data;
|
} data;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
META_BUTTON_STATE_UNFOCUSED,
|
META_BUTTON_STATE_NORMAL,
|
||||||
META_BUTTON_STATE_FOCUSED,
|
|
||||||
META_BUTTON_STATE_INSENSITIVE,
|
|
||||||
META_BUTTON_STATE_PRESSED,
|
META_BUTTON_STATE_PRESSED,
|
||||||
META_BUTTON_STATE_PRELIGHT,
|
META_BUTTON_STATE_PRELIGHT,
|
||||||
META_BUTTON_STATE_LAST
|
META_BUTTON_STATE_LAST
|
||||||
@@ -454,9 +467,19 @@ typedef enum
|
|||||||
} MetaPositionExprError;
|
} MetaPositionExprError;
|
||||||
|
|
||||||
gboolean meta_parse_position_expression (const char *expr,
|
gboolean meta_parse_position_expression (const char *expr,
|
||||||
int x, int y, int width, int height,
|
int x,
|
||||||
int *x_return, int *y_return,
|
int y,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int *x_return,
|
||||||
|
int *y_return,
|
||||||
GError **err);
|
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);
|
MetaColorSpec* meta_color_spec_new (MetaColorSpecType type);
|
||||||
void meta_color_spec_free (MetaColorSpec *spec);
|
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_ref (MetaFrameStyle *style);
|
||||||
void meta_frame_style_unref (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);
|
MetaFrameStyleSet* meta_frame_style_set_new (MetaFrameStyleSet *parent);
|
||||||
void meta_frame_style_set_ref (MetaFrameStyleSet *style_set);
|
void meta_frame_style_set_ref (MetaFrameStyleSet *style_set);
|
||||||
void meta_frame_style_set_unref (MetaFrameStyleSet *style_set);
|
void meta_frame_style_set_unref (MetaFrameStyleSet *style_set);
|
||||||
|
Reference in New Issue
Block a user