theme.c File Reference

Making Metacity look pretty. More...

Go to the source code of this file.

Data Structures

struct  PosExpr
 Type and value of an expression in a parsed sequence. More...

Defines

#define GDK_COLOR_RGBA(color)
#define GDK_COLOR_RGB(color)
#define ALPHA_TO_UCHAR(d)   ((unsigned char) ((d) * 255))
#define DEBUG_FILL_STRUCT(s)   memset ((s), 0xef, sizeof (*(s)))
#define CLAMP_UCHAR(v)   ((guchar) (CLAMP (((int)v), (int)0, (int)255)))
#define INTENSITY(r, g, b)   ((r) * 0.30 + (g) * 0.59 + (b) * 0.11)
#define CHECK_GEOMETRY_VALUE(vname)   if (!validate_geometry_value (layout->vname, #vname, error)) return FALSE
#define CHECK_GEOMETRY_BORDER(bname)   if (!validate_geometry_border (&layout->bname, #bname, error)) return FALSE
#define IS_VARIABLE_CHAR(c)   (g_ascii_isalpha ((c)) || (c) == '_')
 Whether a variable can validly appear as part of the name of a variable.
#define MAX_EXPRS   32

Enumerations

enum  PosExprType { POS_EXPR_INT, POS_EXPR_DOUBLE, POS_EXPR_OPERATOR }
 The type of a PosExpr: either integer, double, or an operation. More...

Functions

static void gtk_style_shade (GdkColor *a, GdkColor *b, gdouble k)
static void rgb_to_hls (gdouble *r, gdouble *g, gdouble *b)
static void hls_to_rgb (gdouble *h, gdouble *l, gdouble *s)
static GdkPixbuf * colorize_pixbuf (GdkPixbuf *orig, GdkColor *new_color)
static void color_composite (const GdkColor *bg, const GdkColor *fg, double alpha_d, GdkColor *color)
static void init_border (GtkBorder *border)
 Sets all the fields of a border to dummy values.
MetaFrameLayoutmeta_frame_layout_new (void)
 Creates a new, empty MetaFrameLayout.
static gboolean validate_border (const GtkBorder *border, const char **bad)
static gboolean validate_geometry_value (int val, const char *name, GError **error)
 Ensures that the theme supplied a particular dimension.
static gboolean validate_geometry_border (const GtkBorder *border, const char *name, GError **error)
gboolean meta_frame_layout_validate (const MetaFrameLayout *layout, GError **error)
MetaFrameLayoutmeta_frame_layout_copy (const MetaFrameLayout *src)
void meta_frame_layout_ref (MetaFrameLayout *layout)
void meta_frame_layout_unref (MetaFrameLayout *layout)
void meta_frame_layout_get_borders (const MetaFrameLayout *layout, int text_height, MetaFrameFlags flags, int *top_height, int *bottom_height, int *left_width, int *right_width)
static MetaButtonSpacerect_for_function (MetaFrameGeometry *fgeom, MetaFrameFlags flags, MetaButtonFunction function, MetaTheme *theme)
static gboolean strip_button (MetaButtonSpace *func_rects[MAX_BUTTONS_PER_CORNER], GdkRectangle *bg_rects[MAX_BUTTONS_PER_CORNER], int *n_rects, MetaButtonSpace *to_strip)
void meta_frame_layout_calc_geometry (const MetaFrameLayout *layout, int text_height, MetaFrameFlags flags, int client_width, int client_height, const MetaButtonLayout *button_layout, MetaFrameGeometry *fgeom, MetaTheme *theme)
MetaGradientSpecmeta_gradient_spec_new (MetaGradientType type)
static void free_color_spec (gpointer spec, gpointer user_data)
void meta_gradient_spec_free (MetaGradientSpec *spec)
GdkPixbuf * meta_gradient_spec_render (const MetaGradientSpec *spec, GtkWidget *widget, int width, int height)
gboolean meta_gradient_spec_validate (MetaGradientSpec *spec, GError **error)
MetaAlphaGradientSpecmeta_alpha_gradient_spec_new (MetaGradientType type, int n_alphas)
void meta_alpha_gradient_spec_free (MetaAlphaGradientSpec *spec)
MetaColorSpecmeta_color_spec_new (MetaColorSpecType type)
void meta_color_spec_free (MetaColorSpec *spec)
MetaColorSpecmeta_color_spec_new_from_string (const char *str, GError **err)
MetaColorSpecmeta_color_spec_new_gtk (MetaGtkColorComponent component, GtkStateType state)
void meta_color_spec_render (MetaColorSpec *spec, GtkWidget *widget, GdkColor *color)
static const char * op_name (PosOperatorType type)
 Represents an operation as a string.
static PosOperatorType op_from_string (const char *p, int *len)
 Parses a string and returns an operation.
static void free_tokens (PosToken *tokens, int n_tokens)
 Frees an array of tokens.
static gboolean parse_number (const char *p, const char **end_return, PosToken *next, GError **err)
 Tokenises a number in an expression.
static gboolean pos_tokenize (const char *expr, PosToken **tokens_p, int *n_tokens_p, GError **err)
 Tokenises an expression.
static gboolean do_operation (PosExpr *a, PosExpr *b, PosOperatorType op, GError **err)
static gboolean do_operations (PosExpr *exprs, int *n_exprs, int precedence, GError **err)
static gboolean pos_eval_get_variable (PosToken *t, int *result, const MetaPositionExprEnv *env, GError **err)
 There is a predefined set of variables which can appear in an expression.
static gboolean pos_eval_helper (PosToken *tokens, int n_tokens, const MetaPositionExprEnv *env, PosExpr *result, GError **err)
 Evaluates a sequence of tokens within a particular environment context, and returns the current value.
static gboolean pos_eval (MetaDrawSpec *spec, const MetaPositionExprEnv *env, int *val_p, GError **err)
 Evaluates an expression.
gboolean meta_parse_position_expression (MetaDrawSpec *spec, const MetaPositionExprEnv *env, int *x_return, int *y_return, GError **err)
gboolean meta_parse_size_expression (MetaDrawSpec *spec, const MetaPositionExprEnv *env, int *val_return, GError **err)
gboolean meta_theme_replace_constants (MetaTheme *theme, PosToken *tokens, int n_tokens, GError **err)
static int parse_x_position_unchecked (MetaDrawSpec *spec, const MetaPositionExprEnv *env)
static int parse_y_position_unchecked (MetaDrawSpec *spec, const MetaPositionExprEnv *env)
static int parse_size_unchecked (MetaDrawSpec *spec, MetaPositionExprEnv *env)
void meta_draw_spec_free (MetaDrawSpec *spec)
MetaDrawSpecmeta_draw_spec_new (MetaTheme *theme, const char *expr, GError **error)
MetaDrawOpmeta_draw_op_new (MetaDrawType type)
void meta_draw_op_free (MetaDrawOp *op)
static GdkGC * get_gc_for_primitive (GtkWidget *widget, GdkDrawable *drawable, MetaColorSpec *color_spec, const GdkRectangle *clip, int line_width)
static GdkPixbuf * apply_alpha (GdkPixbuf *pixbuf, MetaAlphaGradientSpec *spec, gboolean force_copy)
static void render_pixbuf (GdkDrawable *drawable, const GdkRectangle *clip, GdkPixbuf *pixbuf, int x, int y)
static GdkPixbuf * pixbuf_tile (GdkPixbuf *tile, int width, int height)
static GdkPixbuf * replicate_rows (GdkPixbuf *src, int src_x, int src_y, int width, int height)
static GdkPixbuf * replicate_cols (GdkPixbuf *src, int src_x, int src_y, int width, int height)
static GdkPixbuf * scale_and_alpha_pixbuf (GdkPixbuf *src, MetaAlphaGradientSpec *alpha_spec, MetaImageFillType fill_type, int width, int height, gboolean vertical_stripes, gboolean horizontal_stripes)
static GdkPixbuf * draw_op_as_pixbuf (const MetaDrawOp *op, GtkWidget *widget, const MetaDrawInfo *info, int width, int height)
static void fill_env (MetaPositionExprEnv *env, const MetaDrawInfo *info, MetaRectangle logical_region)
static void meta_draw_op_draw_with_env (const MetaDrawOp *op, GtkWidget *widget, GdkDrawable *drawable, const GdkRectangle *clip, const MetaDrawInfo *info, MetaRectangle rect, MetaPositionExprEnv *env)
void meta_draw_op_draw (const MetaDrawOp *op, GtkWidget *widget, GdkDrawable *drawable, const GdkRectangle *clip, const MetaDrawInfo *info, MetaRectangle logical_region)
MetaDrawOpListmeta_draw_op_list_new (int n_preallocs)
void meta_draw_op_list_ref (MetaDrawOpList *op_list)
void meta_draw_op_list_unref (MetaDrawOpList *op_list)
void meta_draw_op_list_draw (const MetaDrawOpList *op_list, GtkWidget *widget, GdkDrawable *drawable, const GdkRectangle *clip, const MetaDrawInfo *info, MetaRectangle rect)
void meta_draw_op_list_append (MetaDrawOpList *op_list, MetaDrawOp *op)
gboolean meta_draw_op_list_validate (MetaDrawOpList *op_list, GError **error)
gboolean meta_draw_op_list_contains (MetaDrawOpList *op_list, MetaDrawOpList *child)
MetaFrameStylemeta_frame_style_new (MetaFrameStyle *parent)
 Constructor for a MetaFrameStyle.
void meta_frame_style_ref (MetaFrameStyle *style)
 Increases the reference count of a frame style.
static void free_button_ops (MetaDrawOpList *op_lists[META_BUTTON_TYPE_LAST][META_BUTTON_STATE_LAST])
void meta_frame_style_unref (MetaFrameStyle *style)
static MetaDrawOpListget_button (MetaFrameStyle *style, MetaButtonType type, MetaButtonState state)
gboolean meta_frame_style_validate (MetaFrameStyle *style, guint current_theme_version, GError **error)
static void button_rect (MetaButtonType type, const MetaFrameGeometry *fgeom, int middle_background_offset, GdkRectangle *rect)
void meta_frame_style_draw (MetaFrameStyle *style, GtkWidget *widget, GdkDrawable *drawable, int x_offset, int y_offset, const GdkRectangle *clip, const MetaFrameGeometry *fgeom, int client_width, int client_height, PangoLayout *title_layout, int text_height, MetaButtonState button_states[META_BUTTON_TYPE_LAST], GdkPixbuf *mini_icon, GdkPixbuf *icon)
MetaFrameStyleSetmeta_frame_style_set_new (MetaFrameStyleSet *parent)
static void free_focus_styles (MetaFrameStyle *focus_styles[META_FRAME_FOCUS_LAST])
void meta_frame_style_set_ref (MetaFrameStyleSet *style_set)
void meta_frame_style_set_unref (MetaFrameStyleSet *style_set)
static MetaFrameStyleget_style (MetaFrameStyleSet *style_set, MetaFrameState state, MetaFrameResize resize, MetaFrameFocus focus)
static gboolean check_state (MetaFrameStyleSet *style_set, MetaFrameState state, GError **error)
gboolean meta_frame_style_set_validate (MetaFrameStyleSet *style_set, GError **error)
MetaThememeta_theme_get_current (void)
void meta_theme_set_current (const char *name, gboolean force_reload)
MetaThememeta_theme_new (void)
void meta_theme_free (MetaTheme *theme)
gboolean meta_theme_validate (MetaTheme *theme, GError **error)
GdkPixbuf * meta_theme_load_image (MetaTheme *theme, const char *filename, guint size_of_theme_icons, GError **error)
static MetaFrameStyletheme_get_style (MetaTheme *theme, MetaFrameType type, MetaFrameFlags flags)
MetaFrameStylemeta_theme_get_frame_style (MetaTheme *theme, MetaFrameType type, MetaFrameFlags flags)
double meta_theme_get_title_scale (MetaTheme *theme, MetaFrameType type, MetaFrameFlags flags)
void meta_theme_draw_frame (MetaTheme *theme, GtkWidget *widget, GdkDrawable *drawable, const GdkRectangle *clip, int x_offset, int y_offset, MetaFrameType type, MetaFrameFlags flags, int client_width, int client_height, PangoLayout *title_layout, int text_height, const MetaButtonLayout *button_layout, MetaButtonState button_states[META_BUTTON_TYPE_LAST], GdkPixbuf *mini_icon, GdkPixbuf *icon)
void meta_theme_get_frame_borders (MetaTheme *theme, MetaFrameType type, int text_height, MetaFrameFlags flags, int *top_height, int *bottom_height, int *left_width, int *right_width)
void meta_theme_calc_geometry (MetaTheme *theme, MetaFrameType type, int text_height, MetaFrameFlags flags, int client_width, int client_height, const MetaButtonLayout *button_layout, MetaFrameGeometry *fgeom)
MetaFrameLayoutmeta_theme_lookup_layout (MetaTheme *theme, const char *name)
void meta_theme_insert_layout (MetaTheme *theme, const char *name, MetaFrameLayout *layout)
MetaDrawOpListmeta_theme_lookup_draw_op_list (MetaTheme *theme, const char *name)
void meta_theme_insert_draw_op_list (MetaTheme *theme, const char *name, MetaDrawOpList *op_list)
MetaFrameStylemeta_theme_lookup_style (MetaTheme *theme, const char *name)
void meta_theme_insert_style (MetaTheme *theme, const char *name, MetaFrameStyle *style)
MetaFrameStyleSetmeta_theme_lookup_style_set (MetaTheme *theme, const char *name)
void meta_theme_insert_style_set (MetaTheme *theme, const char *name, MetaFrameStyleSet *style_set)
static gboolean first_uppercase (const char *str)
gboolean meta_theme_define_int_constant (MetaTheme *theme, const char *name, int value, GError **error)
gboolean meta_theme_lookup_int_constant (MetaTheme *theme, const char *name, int *value)
gboolean meta_theme_define_float_constant (MetaTheme *theme, const char *name, double value, GError **error)
gboolean meta_theme_lookup_float_constant (MetaTheme *theme, const char *name, double *value)
gboolean meta_theme_define_color_constant (MetaTheme *theme, const char *name, const char *value, GError **error)
gboolean meta_theme_lookup_color_constant (MetaTheme *theme, const char *name, char **value)
PangoFontDescription * meta_gtk_widget_get_font_desc (GtkWidget *widget, double scale, const PangoFontDescription *override)
int meta_pango_font_desc_get_text_height (const PangoFontDescription *font_desc, PangoContext *context)
MetaGtkColorComponent meta_color_component_from_string (const char *str)
const char * meta_color_component_to_string (MetaGtkColorComponent component)
MetaButtonState meta_button_state_from_string (const char *str)
const char * meta_button_state_to_string (MetaButtonState state)
MetaButtonType meta_button_type_from_string (const char *str, MetaTheme *theme)
const char * meta_button_type_to_string (MetaButtonType type)
MetaFramePiece meta_frame_piece_from_string (const char *str)
const char * meta_frame_piece_to_string (MetaFramePiece piece)
MetaFrameState meta_frame_state_from_string (const char *str)
const char * meta_frame_state_to_string (MetaFrameState state)
MetaFrameResize meta_frame_resize_from_string (const char *str)
const char * meta_frame_resize_to_string (MetaFrameResize resize)
MetaFrameFocus meta_frame_focus_from_string (const char *str)
const char * meta_frame_focus_to_string (MetaFrameFocus focus)
MetaFrameType meta_frame_type_from_string (const char *str)
const char * meta_frame_type_to_string (MetaFrameType type)
MetaGradientType meta_gradient_type_from_string (const char *str)
const char * meta_gradient_type_to_string (MetaGradientType type)
GtkStateType meta_gtk_state_from_string (const char *str)
const char * meta_gtk_state_to_string (GtkStateType state)
GtkShadowType meta_gtk_shadow_from_string (const char *str)
const char * meta_gtk_shadow_to_string (GtkShadowType shadow)
GtkArrowType meta_gtk_arrow_from_string (const char *str)
const char * meta_gtk_arrow_to_string (GtkArrowType arrow)
MetaImageFillType meta_image_fill_type_from_string (const char *str)
const char * meta_image_fill_type_to_string (MetaImageFillType fill_type)
guint meta_theme_earliest_version_with_button (MetaButtonType type)

Variables

static MetaThememeta_current_theme = NULL
 The current theme.


Detailed Description

Making Metacity look pretty.

The window decorations drawn by Metacity are described by files on disk known internally as "themes" (externally as "window border themes" on http://art.gnome.org/themes/metacity/ or "Metacity themes"). This file contains most of the code necessary to support themes; it does not contain the XML parser, which is in theme-parser.c.

Bug:
This is a big file with lots of different subsystems, which might be better split out into separate files.

Definition in file theme.c.


Define Documentation

#define ALPHA_TO_UCHAR (  )     ((unsigned char) ((d) * 255))

Definition at line 78 of file theme.c.

#define CHECK_GEOMETRY_BORDER ( bname   )     if (!validate_geometry_border (&layout->bname, #bname, error)) return FALSE

#define CHECK_GEOMETRY_VALUE ( vname   )     if (!validate_geometry_value (layout->vname, #vname, error)) return FALSE

#define CLAMP_UCHAR (  )     ((guchar) (CLAMP (((int)v), (int)0, (int)255)))

Definition at line 81 of file theme.c.

Referenced by colorize_pixbuf().

#define DEBUG_FILL_STRUCT (  )     memset ((s), 0xef, sizeof (*(s)))

#define GDK_COLOR_RGB ( color   ) 

Value:

((guint32) ((((color).red / 256) << 16)   |    \
                                     (((color).green / 256) << 8)  |    \
                                     (((color).blue / 256))))

Definition at line 73 of file theme.c.

Referenced by draw_op_as_pixbuf().

#define GDK_COLOR_RGBA ( color   ) 

Value:

((guint32) (0xff                         |     \
                                     (((color).red / 256) << 24)   |    \
                                     (((color).green / 256) << 16) |    \
                                     (((color).blue / 256) << 8)))

Definition at line 67 of file theme.c.

Referenced by draw_op_as_pixbuf().

#define INTENSITY ( r,
g,
 )     ((r) * 0.30 + (g) * 0.59 + (b) * 0.11)

Definition at line 82 of file theme.c.

#define IS_VARIABLE_CHAR (  )     (g_ascii_isalpha ((c)) || (c) == '_')

Whether a variable can validly appear as part of the name of a variable.

Definition at line 1642 of file theme.c.

Referenced by pos_tokenize().

#define MAX_EXPRS   32

Referenced by pos_eval_helper().


Function Documentation

static GdkPixbuf* apply_alpha ( GdkPixbuf *  pixbuf,
MetaAlphaGradientSpec spec,
gboolean  force_copy 
) [static]

static void button_rect ( MetaButtonType  type,
const MetaFrameGeometry fgeom,
int  middle_background_offset,
GdkRectangle *  rect 
) [static]

static gboolean check_state ( MetaFrameStyleSet style_set,
MetaFrameState  state,
GError **  error 
) [static]

static void color_composite ( const GdkColor *  bg,
const GdkColor *  fg,
double  alpha_d,
GdkColor *  color 
) [static]

Definition at line 178 of file theme.c.

Referenced by meta_color_spec_render().

static GdkPixbuf* colorize_pixbuf ( GdkPixbuf *  orig,
GdkColor *  new_color 
) [static]

Definition at line 100 of file theme.c.

References CLAMP_UCHAR, INTENSITY, and NULL.

Referenced by draw_op_as_pixbuf().

static gboolean do_operation ( PosExpr a,
PosExpr b,
PosOperatorType  op,
GError **  err 
) [static]

static gboolean do_operations ( PosExpr exprs,
int *  n_exprs,
int  precedence,
GError **  err 
) [static]

static GdkPixbuf* draw_op_as_pixbuf ( const MetaDrawOp op,
GtkWidget *  widget,
const MetaDrawInfo info,
int  width,
int  height 
) [static]

static void fill_env ( MetaPositionExprEnv env,
const MetaDrawInfo info,
MetaRectangle  logical_region 
) [static]

static gboolean first_uppercase ( const char *  str  )  [static]

static void free_button_ops ( MetaDrawOpList op_lists[META_BUTTON_TYPE_LAST][META_BUTTON_STATE_LAST]  )  [static]

Definition at line 4051 of file theme.c.

References META_BUTTON_TYPE_LAST, and meta_draw_op_list_unref().

Referenced by meta_frame_style_unref().

static void free_color_spec ( gpointer  spec,
gpointer  user_data 
) [static]

Definition at line 957 of file theme.c.

References meta_color_spec_free().

Referenced by meta_gradient_spec_free().

static void free_focus_styles ( MetaFrameStyle focus_styles[META_FRAME_FOCUS_LAST]  )  [static]

Definition at line 4510 of file theme.c.

References meta_frame_style_unref().

Referenced by meta_frame_style_set_unref().

static void free_tokens ( PosToken tokens,
int  n_tokens 
) [static]

Frees an array of tokens.

All the tokens and their associated memory will be freed.

Parameters:
tokens an array of tokens to be freed
n_tokens how many tokens are in the array.

Definition at line 1532 of file theme.c.

References POS_TOKEN_VARIABLE, and PosToken::v.

Referenced by meta_draw_spec_free(), and pos_tokenize().

static MetaDrawOpList* get_button ( MetaFrameStyle style,
MetaButtonType  type,
MetaButtonState  state 
) [static]

static GdkGC* get_gc_for_primitive ( GtkWidget *  widget,
GdkDrawable *  drawable,
MetaColorSpec color_spec,
const GdkRectangle *  clip,
int  line_width 
) [static]

Definition at line 2911 of file theme.c.

References meta_color_spec_render().

Referenced by meta_draw_op_draw_with_env().

static MetaFrameStyle* get_style ( MetaFrameStyleSet style_set,
MetaFrameState  state,
MetaFrameResize  resize,
MetaFrameFocus  focus 
) [static]

static void gtk_style_shade ( GdkColor *  a,
GdkColor *  b,
gdouble  k 
) [static]

Definition at line 5995 of file theme.c.

References hls_to_rgb(), and rgb_to_hls().

Referenced by meta_color_spec_render().

static void hls_to_rgb ( gdouble *  h,
gdouble *  l,
gdouble *  s 
) [static]

Definition at line 6100 of file theme.c.

Referenced by gtk_style_shade().

static void init_border ( GtkBorder *  border  )  [static]

Sets all the fields of a border to dummy values.

Parameters:
border The border whose fields should be reset.

Definition at line 198 of file theme.c.

Referenced by meta_frame_layout_new().

void meta_alpha_gradient_spec_free ( MetaAlphaGradientSpec spec  ) 

MetaAlphaGradientSpec* meta_alpha_gradient_spec_new ( MetaGradientType  type,
int  n_alphas 
)

MetaButtonState meta_button_state_from_string ( const char *  str  ) 

const char* meta_button_state_to_string ( MetaButtonState  state  ) 

MetaButtonType meta_button_type_from_string ( const char *  str,
MetaTheme theme 
)

const char* meta_button_type_to_string ( MetaButtonType  type  ) 

MetaGtkColorComponent meta_color_component_from_string ( const char *  str  ) 

const char* meta_color_component_to_string ( MetaGtkColorComponent  component  ) 

void meta_color_spec_free ( MetaColorSpec spec  ) 

MetaColorSpec* meta_color_spec_new ( MetaColorSpecType  type  ) 

MetaColorSpec* meta_color_spec_new_from_string ( const char *  str,
GError **  err 
)

MetaColorSpec* meta_color_spec_new_gtk ( MetaGtkColorComponent  component,
GtkStateType  state 
)

void meta_color_spec_render ( MetaColorSpec spec,
GtkWidget *  widget,
GdkColor *  color 
)

void meta_draw_op_draw ( const MetaDrawOp op,
GtkWidget *  widget,
GdkDrawable *  drawable,
const GdkRectangle *  clip,
const MetaDrawInfo info,
MetaRectangle  logical_region 
)

Definition at line 3815 of file theme.c.

References fill_env(), and meta_draw_op_draw_with_env().

static void meta_draw_op_draw_with_env ( const MetaDrawOp op,
GtkWidget *  widget,
GdkDrawable *  drawable,
const GdkRectangle *  clip,
const MetaDrawInfo info,
MetaRectangle  rect,
MetaPositionExprEnv env 
) [static]

void meta_draw_op_free ( MetaDrawOp op  ) 

void meta_draw_op_list_append ( MetaDrawOpList op_list,
MetaDrawOp op 
)

gboolean meta_draw_op_list_contains ( MetaDrawOpList op_list,
MetaDrawOpList child 
)

void meta_draw_op_list_draw ( const MetaDrawOpList op_list,
GtkWidget *  widget,
GdkDrawable *  drawable,
const GdkRectangle *  clip,
const MetaDrawInfo info,
MetaRectangle  rect 
)

MetaDrawOpList* meta_draw_op_list_new ( int  n_preallocs  ) 

void meta_draw_op_list_ref ( MetaDrawOpList op_list  ) 

void meta_draw_op_list_unref ( MetaDrawOpList op_list  ) 

gboolean meta_draw_op_list_validate ( MetaDrawOpList op_list,
GError **  error 
)

Definition at line 3961 of file theme.c.

References FALSE, NULL, and TRUE.

Referenced by end_element_handler().

MetaDrawOp* meta_draw_op_new ( MetaDrawType  type  ) 

void meta_draw_spec_free ( MetaDrawSpec spec  ) 

Definition at line 2648 of file theme.c.

References free_tokens(), _MetaDrawSpec::n_tokens, and _MetaDrawSpec::tokens.

Referenced by meta_draw_op_free(), and meta_draw_spec_new().

MetaDrawSpec* meta_draw_spec_new ( MetaTheme theme,
const char *  expr,
GError **  error 
)

MetaFrameFocus meta_frame_focus_from_string ( const char *  str  ) 

Definition at line 5749 of file theme.c.

References META_FRAME_FOCUS_LAST, META_FRAME_FOCUS_NO, and META_FRAME_FOCUS_YES.

Referenced by parse_style_set_element().

const char* meta_frame_focus_to_string ( MetaFrameFocus  focus  ) 

void meta_frame_layout_calc_geometry ( const MetaFrameLayout layout,
int  text_height,
MetaFrameFlags  flags,
int  client_width,
int  client_height,
const MetaButtonLayout button_layout,
MetaFrameGeometry fgeom,
MetaTheme theme 
)

Definition at line 586 of file theme.c.

References _MetaFrameGeometry::above_rect, ADDRESS_OF_BUTTON_RECTS, _MetaFrameGeometry::bottom_height, _MetaFrameLayout::bottom_left_corner_rounded_radius, _MetaFrameGeometry::bottom_left_corner_rounded_radius, _MetaFrameLayout::bottom_right_corner_rounded_radius, _MetaFrameGeometry::bottom_right_corner_rounded_radius, _MetaFrameGeometry::bottom_titlebar_edge, _MetaFrameLayout::button_aspect, _MetaFrameLayout::button_border, _MetaFrameLayout::button_height, _MetaFrameLayout::button_sizing, _MetaFrameLayout::button_width, _MetaButtonSpace::clickable, _MetaFrameGeometry::close_rect, FALSE, _MetaFrameGeometry::height, _MetaFrameLayout::hide_buttons, _MetaButtonLayout::left_buttons, _MetaButtonLayout::left_buttons_has_spacer, _MetaFrameGeometry::left_left_background, _MetaFrameGeometry::left_middle_backgrounds, _MetaFrameGeometry::left_right_background, _MetaFrameLayout::left_titlebar_edge, _MetaFrameGeometry::left_titlebar_edge, _MetaFrameGeometry::left_width, LENGTH_OF_BUTTON_RECTS, MAX_BUTTONS_PER_CORNER, _MetaFrameGeometry::max_rect, _MetaFrameGeometry::menu_rect, meta_bug(), META_BUTTON_FUNCTION_LAST, META_BUTTON_SIZING_ASPECT, META_BUTTON_SIZING_FIXED, META_BUTTON_SIZING_LAST, meta_frame_layout_get_borders(), META_FRAME_MAXIMIZED, META_FRAME_SHADED, _MetaFrameGeometry::min_rect, NULL, rect_for_function(), _MetaButtonLayout::right_buttons, _MetaButtonLayout::right_buttons_has_spacer, _MetaFrameGeometry::right_left_background, _MetaFrameGeometry::right_middle_backgrounds, _MetaFrameGeometry::right_right_background, _MetaFrameLayout::right_titlebar_edge, _MetaFrameGeometry::right_titlebar_edge, _MetaFrameLayout::right_width, _MetaFrameGeometry::right_width, _MetaFrameGeometry::shade_rect, _MetaFrameGeometry::stick_rect, strip_button(), _MetaFrameLayout::title_border, _MetaFrameGeometry::title_rect, _MetaFrameGeometry::top_height, _MetaFrameLayout::top_left_corner_rounded_radius, _MetaFrameGeometry::top_left_corner_rounded_radius, _MetaFrameLayout::top_right_corner_rounded_radius, _MetaFrameGeometry::top_right_corner_rounded_radius, _MetaFrameGeometry::top_titlebar_edge, _MetaButtonSpace::visible, and _MetaFrameGeometry::width.

Referenced by meta_theme_calc_geometry(), and meta_theme_draw_frame().

MetaFrameLayout* meta_frame_layout_copy ( const MetaFrameLayout src  ) 

Definition at line 367 of file theme.c.

References _MetaFrameLayout::refcount.

Referenced by parse_toplevel_element().

void meta_frame_layout_get_borders ( const MetaFrameLayout layout,
int  text_height,
MetaFrameFlags  flags,
int *  top_height,
int *  bottom_height,
int *  left_width,
int *  right_width 
)

MetaFrameLayout* meta_frame_layout_new ( void   ) 

void meta_frame_layout_ref ( MetaFrameLayout layout  ) 

Definition at line 381 of file theme.c.

References NULL, and _MetaFrameLayout::refcount.

Referenced by meta_theme_insert_layout(), and parse_toplevel_element().

void meta_frame_layout_unref ( MetaFrameLayout layout  ) 

gboolean meta_frame_layout_validate ( const MetaFrameLayout layout,
GError **  error 
)

MetaFramePiece meta_frame_piece_from_string ( const char *  str  ) 

const char* meta_frame_piece_to_string ( MetaFramePiece  piece  ) 

MetaFrameResize meta_frame_resize_from_string ( const char *  str  ) 

const char* meta_frame_resize_to_string ( MetaFrameResize  resize  ) 

MetaFrameState meta_frame_state_from_string ( const char *  str  ) 

const char* meta_frame_state_to_string ( MetaFrameState  state  ) 

void meta_frame_style_draw ( MetaFrameStyle style,
GtkWidget *  widget,
GdkDrawable *  drawable,
int  x_offset,
int  y_offset,
const GdkRectangle *  clip,
const MetaFrameGeometry fgeom,
int  client_width,
int  client_height,
PangoLayout *  title_layout,
int  text_height,
MetaButtonState  button_states[META_BUTTON_TYPE_LAST],
GdkPixbuf *  mini_icon,
GdkPixbuf *  icon 
)

MetaFrameStyle* meta_frame_style_new ( MetaFrameStyle parent  ) 

Constructor for a MetaFrameStyle.

Parameters:
parent The parent style. Data not filled in here will be looked for in the parent style, and in its parent style, and so on.
Returns:
The newly-constructed style.

Definition at line 4018 of file theme.c.

References meta_frame_style_ref(), _MetaFrameStyle::parent, _MetaFrameStyle::refcount, and _MetaFrameStyle::window_background_alpha.

Referenced by parse_toplevel_element().

void meta_frame_style_ref ( MetaFrameStyle style  ) 

Increases the reference count of a frame style.

If the style is NULL, this is a no-op.

Parameters:
style The style.

Definition at line 4043 of file theme.c.

References NULL, and _MetaFrameStyle::refcount.

Referenced by meta_frame_style_new(), meta_theme_insert_style(), and parse_style_set_element().

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  ) 

gboolean meta_frame_style_set_validate ( MetaFrameStyleSet style_set,
GError **  error 
)

void meta_frame_style_unref ( MetaFrameStyle style  ) 

gboolean meta_frame_style_validate ( MetaFrameStyle style,
guint  current_theme_version,
GError **  error 
)

MetaFrameType meta_frame_type_from_string ( const char *  str  ) 

const char* meta_frame_type_to_string ( MetaFrameType  type  ) 

void meta_gradient_spec_free ( MetaGradientSpec spec  ) 

Definition at line 963 of file theme.c.

References _MetaGradientSpec::color_specs, DEBUG_FILL_STRUCT, free_color_spec(), and NULL.

Referenced by meta_draw_op_free().

MetaGradientSpec* meta_gradient_spec_new ( MetaGradientType  type  ) 

Definition at line 944 of file theme.c.

References _MetaGradientSpec::color_specs, NULL, and _MetaGradientSpec::type.

Referenced by parse_draw_op_element().

GdkPixbuf* meta_gradient_spec_render ( const MetaGradientSpec spec,
GtkWidget *  widget,
int  width,
int  height 
)

gboolean meta_gradient_spec_validate ( MetaGradientSpec spec,
GError **  error 
)

MetaGradientType meta_gradient_type_from_string ( const char *  str  ) 

const char* meta_gradient_type_to_string ( MetaGradientType  type  ) 

GtkArrowType meta_gtk_arrow_from_string ( const char *  str  ) 

Definition at line 5932 of file theme.c.

Referenced by parse_draw_op_element().

const char* meta_gtk_arrow_to_string ( GtkArrowType  arrow  ) 

Definition at line 5949 of file theme.c.

GtkShadowType meta_gtk_shadow_from_string ( const char *  str  ) 

Definition at line 5895 of file theme.c.

Referenced by parse_draw_op_element().

const char* meta_gtk_shadow_to_string ( GtkShadowType  shadow  ) 

Definition at line 5912 of file theme.c.

GtkStateType meta_gtk_state_from_string ( const char *  str  ) 

Definition at line 5858 of file theme.c.

Referenced by meta_color_spec_new_from_string(), and parse_draw_op_element().

const char* meta_gtk_state_to_string ( GtkStateType  state  ) 

Definition at line 5875 of file theme.c.

PangoFontDescription* meta_gtk_widget_get_font_desc ( GtkWidget *  widget,
double  scale,
const PangoFontDescription *  override 
)

Definition at line 5404 of file theme.c.

References NULL, and TRUE.

Referenced by ensure_info(), and meta_frames_ensure_layout().

MetaImageFillType meta_image_fill_type_from_string ( const char *  str  ) 

Definition at line 5969 of file theme.c.

References META_IMAGE_FILL_SCALE, and META_IMAGE_FILL_TILE.

Referenced by parse_draw_op_element().

const char* meta_image_fill_type_to_string ( MetaImageFillType  fill_type  ) 

Definition at line 5980 of file theme.c.

References META_IMAGE_FILL_SCALE, and META_IMAGE_FILL_TILE.

int meta_pango_font_desc_get_text_height ( const PangoFontDescription *  font_desc,
PangoContext *  context 
)

gboolean meta_parse_position_expression ( MetaDrawSpec spec,
const MetaPositionExprEnv env,
int *  x_return,
int *  y_return,
GError **  err 
)

gboolean meta_parse_size_expression ( MetaDrawSpec spec,
const MetaPositionExprEnv env,
int *  val_return,
GError **  err 
)

Definition at line 2512 of file theme.c.

References _MetaDrawSpec::constant, FALSE, NULL, pos_eval(), TRUE, and _MetaDrawSpec::value.

Referenced by parse_size_unchecked().

void meta_theme_calc_geometry ( MetaTheme theme,
MetaFrameType  type,
int  text_height,
MetaFrameFlags  flags,
int  client_width,
int  client_height,
const MetaButtonLayout button_layout,
MetaFrameGeometry fgeom 
)

gboolean meta_theme_define_color_constant ( MetaTheme theme,
const char *  name,
const char *  value,
GError **  error 
)

gboolean meta_theme_define_float_constant ( MetaTheme theme,
const char *  name,
double  value,
GError **  error 
)

gboolean meta_theme_define_int_constant ( MetaTheme theme,
const char *  name,
int  value,
GError **  error 
)

void meta_theme_draw_frame ( MetaTheme theme,
GtkWidget *  widget,
GdkDrawable *  drawable,
const GdkRectangle *  clip,
int  x_offset,
int  y_offset,
MetaFrameType  type,
MetaFrameFlags  flags,
int  client_width,
int  client_height,
PangoLayout *  title_layout,
int  text_height,
const MetaButtonLayout button_layout,
MetaButtonState  button_states[META_BUTTON_TYPE_LAST],
GdkPixbuf *  mini_icon,
GdkPixbuf *  icon 
)

guint meta_theme_earliest_version_with_button ( MetaButtonType  type  ) 

void meta_theme_free ( MetaTheme theme  ) 

MetaTheme* meta_theme_get_current ( void   ) 

void meta_theme_get_frame_borders ( MetaTheme theme,
MetaFrameType  type,
int  text_height,
MetaFrameFlags  flags,
int *  top_height,
int *  bottom_height,
int *  left_width,
int *  right_width 
)

MetaFrameStyle* meta_theme_get_frame_style ( MetaTheme theme,
MetaFrameType  type,
MetaFrameFlags  flags 
)

double meta_theme_get_title_scale ( MetaTheme theme,
MetaFrameType  type,
MetaFrameFlags  flags 
)

void meta_theme_insert_draw_op_list ( MetaTheme theme,
const char *  name,
MetaDrawOpList op_list 
)

Definition at line 5170 of file theme.c.

References _MetaTheme::draw_op_lists_by_name, and meta_draw_op_list_ref().

Referenced by parse_toplevel_element().

void meta_theme_insert_layout ( MetaTheme theme,
const char *  name,
MetaFrameLayout layout 
)

Definition at line 5154 of file theme.c.

References _MetaTheme::layouts_by_name, and meta_frame_layout_ref().

Referenced by parse_toplevel_element().

void meta_theme_insert_style ( MetaTheme theme,
const char *  name,
MetaFrameStyle style 
)

Definition at line 5186 of file theme.c.

References meta_frame_style_ref(), and _MetaTheme::styles_by_name.

Referenced by parse_toplevel_element().

void meta_theme_insert_style_set ( MetaTheme theme,
const char *  name,
MetaFrameStyleSet style_set 
)

Definition at line 5202 of file theme.c.

References meta_frame_style_set_ref(), and _MetaTheme::style_sets_by_name.

Referenced by parse_toplevel_element().

GdkPixbuf* meta_theme_load_image ( MetaTheme theme,
const char *  filename,
guint  size_of_theme_icons,
GError **  error 
)

gboolean meta_theme_lookup_color_constant ( MetaTheme theme,
const char *  name,
char **  value 
)

Definition at line 5378 of file theme.c.

References _MetaTheme::color_constants, FALSE, NULL, and TRUE.

Referenced by parse_color().

MetaDrawOpList* meta_theme_lookup_draw_op_list ( MetaTheme theme,
const char *  name 
)

gboolean meta_theme_lookup_float_constant ( MetaTheme theme,
const char *  name,
double *  value 
)

Definition at line 5317 of file theme.c.

References FALSE, _MetaTheme::float_constants, NULL, and TRUE.

Referenced by meta_theme_replace_constants().

gboolean meta_theme_lookup_int_constant ( MetaTheme theme,
const char *  name,
int *  value 
)

Definition at line 5253 of file theme.c.

References FALSE, _MetaTheme::integer_constants, NULL, and TRUE.

Referenced by meta_theme_replace_constants(), and parse_positive_integer().

MetaFrameLayout* meta_theme_lookup_layout ( MetaTheme theme,
const char *  name 
)

Definition at line 5147 of file theme.c.

References _MetaTheme::layouts_by_name.

Referenced by parse_toplevel_element().

MetaFrameStyle* meta_theme_lookup_style ( MetaTheme theme,
const char *  name 
)

Definition at line 5179 of file theme.c.

References _MetaTheme::styles_by_name.

Referenced by parse_style_set_element(), and parse_toplevel_element().

MetaFrameStyleSet* meta_theme_lookup_style_set ( MetaTheme theme,
const char *  name 
)

Definition at line 5195 of file theme.c.

References _MetaTheme::style_sets_by_name.

Referenced by parse_toplevel_element().

MetaTheme* meta_theme_new ( void   ) 

gboolean meta_theme_replace_constants ( MetaTheme theme,
PosToken tokens,
int  n_tokens,
GError **  err 
)

void meta_theme_set_current ( const char *  name,
gboolean  force_reload 
)

gboolean meta_theme_validate ( MetaTheme theme,
GError **  error 
)

static PosOperatorType op_from_string ( const char *  p,
int *  len 
) [static]

Parses a string and returns an operation.

Parameters:
p a pointer into a string representing an operation; part of an expression somewhere, so not null-terminated
len set to the length of the string found. Set to 0 if none is.
Returns:
the operation found. If none was, returns POS_OP_NONE.

Definition at line 1477 of file theme.c.

References POS_OP_ADD, POS_OP_DIVIDE, POS_OP_MAX, POS_OP_MIN, POS_OP_MOD, POS_OP_MULTIPLY, POS_OP_NONE, and POS_OP_SUBTRACT.

Referenced by pos_tokenize().

static const char* op_name ( PosOperatorType  type  )  [static]

Represents an operation as a string.

Parameters:
type an operation, such as addition
Returns:
a string, such as "+"

Definition at line 1443 of file theme.c.

References POS_OP_ADD, POS_OP_DIVIDE, POS_OP_MAX, POS_OP_MIN, POS_OP_MOD, POS_OP_MULTIPLY, POS_OP_NONE, and POS_OP_SUBTRACT.

Referenced by do_operations().

static int parse_size_unchecked ( MetaDrawSpec spec,
MetaPositionExprEnv env 
) [static]

Definition at line 2628 of file theme.c.

References _, meta_parse_size_expression(), meta_warning(), and NULL.

Referenced by meta_draw_op_draw_with_env(), and meta_draw_op_list_draw().

static int parse_x_position_unchecked ( MetaDrawSpec spec,
const MetaPositionExprEnv env 
) [static]

Definition at line 2588 of file theme.c.

References _, meta_parse_position_expression(), meta_warning(), and NULL.

Referenced by meta_draw_op_draw_with_env(), and meta_draw_op_list_draw().

static int parse_y_position_unchecked ( MetaDrawSpec spec,
const MetaPositionExprEnv env 
) [static]

Definition at line 2608 of file theme.c.

References _, meta_parse_position_expression(), meta_warning(), and NULL.

Referenced by meta_draw_op_draw_with_env(), and meta_draw_op_list_draw().

static GdkPixbuf* pixbuf_tile ( GdkPixbuf *  tile,
int  width,
int  height 
) [static]

Definition at line 3025 of file theme.c.

Referenced by scale_and_alpha_pixbuf().

static MetaButtonSpace* rect_for_function ( MetaFrameGeometry fgeom,
MetaFrameFlags  flags,
MetaButtonFunction  function,
MetaTheme theme 
) [static]

static void render_pixbuf ( GdkDrawable *  drawable,
const GdkRectangle *  clip,
GdkPixbuf *  pixbuf,
int  x,
int  y 
) [static]

Definition at line 2977 of file theme.c.

References NULL.

Referenced by meta_draw_op_draw_with_env().

static GdkPixbuf* replicate_cols ( GdkPixbuf *  src,
int  src_x,
int  src_y,
int  width,
int  height 
) [static]

Definition at line 3095 of file theme.c.

Referenced by scale_and_alpha_pixbuf().

static GdkPixbuf* replicate_rows ( GdkPixbuf *  src,
int  src_x,
int  src_y,
int  width,
int  height 
) [static]

Definition at line 3068 of file theme.c.

Referenced by scale_and_alpha_pixbuf().

static void rgb_to_hls ( gdouble *  r,
gdouble *  g,
gdouble *  b 
) [static]

Definition at line 6029 of file theme.c.

Referenced by gtk_style_shade().

static GdkPixbuf* scale_and_alpha_pixbuf ( GdkPixbuf *  src,
MetaAlphaGradientSpec alpha_spec,
MetaImageFillType  fill_type,
int  width,
int  height,
gboolean  vertical_stripes,
gboolean  horizontal_stripes 
) [static]

static gboolean strip_button ( MetaButtonSpace func_rects[MAX_BUTTONS_PER_CORNER],
GdkRectangle *  bg_rects[MAX_BUTTONS_PER_CORNER],
int *  n_rects,
MetaButtonSpace to_strip 
) [static]

Definition at line 550 of file theme.c.

References FALSE, NULL, and TRUE.

Referenced by meta_frame_layout_calc_geometry().

static MetaFrameStyle* theme_get_style ( MetaTheme theme,
MetaFrameType  type,
MetaFrameFlags  flags 
) [static]

static gboolean validate_border ( const GtkBorder *  border,
const char **  bad 
) [static]

Definition at line 250 of file theme.c.

References _, and NULL.

Referenced by validate_geometry_border().

static gboolean validate_geometry_border ( const GtkBorder *  border,
const char *  name,
GError **  error 
) [static]

Definition at line 298 of file theme.c.

References _, FALSE, META_THEME_ERROR, META_THEME_ERROR_FRAME_GEOMETRY, TRUE, and validate_border().

static gboolean validate_geometry_value ( int  val,
const char *  name,
GError **  error 
) [static]

Ensures that the theme supplied a particular dimension.

When a MetaFrameLayout is created, all its integer fields are set to -1 by meta_frame_layout_new(). After an instance of this type should have been initialised, this function checks that a given field is not still at -1. It is never called directly, but rather via the CHECK_GEOMETRY_VALUE and CHECK_GEOMETRY_BORDER macros.

Parameters:
val The value to check
name The name to use in the error message
[out] error Set to an error if val was not initialised

Definition at line 281 of file theme.c.

References _, FALSE, META_THEME_ERROR, META_THEME_ERROR_FRAME_GEOMETRY, and TRUE.


Variable Documentation

MetaTheme* meta_current_theme = NULL [static]

The current theme.

(Themes are singleton.)

Definition at line 97 of file theme.c.


Generated on Sat Aug 23 22:04:23 2008 for metacity by  doxygen 1.5.5