2006-10-01 22:30:10 +00:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
/*
|
2001-05-31 16:18:40 +00:00
|
|
|
* Copyright (C) 2001 Havoc Pennington
|
2002-02-07 03:07:56 +00:00
|
|
|
*
|
2001-05-31 16:18:40 +00:00
|
|
|
* 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
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* 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.
|
2002-02-07 03:07:56 +00:00
|
|
|
*
|
2001-05-31 16:18:40 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2014-01-12 01:42:06 +00:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2001-05-31 16:18:40 +00:00
|
|
|
*/
|
|
|
|
|
2013-03-15 17:21:14 +00:00
|
|
|
/*
|
2011-11-02 15:34:45 +00:00
|
|
|
* SECTION:theme
|
2013-03-11 15:52:36 +00:00
|
|
|
* @title: MetaTheme
|
|
|
|
* @short_description: Metacity Theme Rendering
|
2008-01-17 03:49:24 +00:00
|
|
|
*
|
|
|
|
* 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.
|
2013-03-11 15:52:36 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2011-11-02 15:34:45 +00:00
|
|
|
* FIXME: This is a big file with lots of different subsystems, which might
|
|
|
|
* be better split out into separate files.
|
2008-01-17 03:49:24 +00:00
|
|
|
*/
|
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
#include <config.h>
|
2010-10-18 18:34:14 +00:00
|
|
|
#include "theme-private.h"
|
2012-12-16 22:54:33 +00:00
|
|
|
#include "frames.h" /* for META_TYPE_FRAMES */
|
2013-09-11 08:18:53 +00:00
|
|
|
#include "util-private.h"
|
2011-03-06 00:29:12 +00:00
|
|
|
#include <meta/gradient.h>
|
2011-07-12 04:55:50 +00:00
|
|
|
#include <meta/prefs.h>
|
2008-11-12 03:43:51 +00:00
|
|
|
#include <gtk/gtk.h>
|
2002-01-06 04:51:53 +00:00
|
|
|
#include <string.h>
|
2002-01-28 02:09:12 +00:00
|
|
|
#include <stdlib.h>
|
2002-06-06 04:00:22 +00:00
|
|
|
#include <math.h>
|
2001-05-31 16:18:40 +00:00
|
|
|
|
2002-02-07 04:22:57 +00:00
|
|
|
#define GDK_COLOR_RGBA(color) \
|
|
|
|
((guint32) (0xff | \
|
2011-05-17 18:50:40 +00:00
|
|
|
((int)((color).red * 255) << 24) | \
|
|
|
|
((int)((color).green * 255) << 16) | \
|
|
|
|
((int)((color).blue * 255) << 8)))
|
2002-01-27 07:32:46 +00:00
|
|
|
|
2002-02-07 04:22:57 +00:00
|
|
|
#define GDK_COLOR_RGB(color) \
|
2011-05-17 18:50:40 +00:00
|
|
|
((guint32) (((int)((color).red * 255) << 16) | \
|
|
|
|
((int)((color).green * 255) << 8) | \
|
|
|
|
((int)((color).blue * 255))))
|
2002-01-27 07:32:46 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
#define ALPHA_TO_UCHAR(d) ((unsigned char) ((d) * 255))
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
#define DEBUG_FILL_STRUCT(s) memset ((s), 0xef, sizeof (*(s)))
|
2002-02-07 04:22:57 +00:00
|
|
|
#define CLAMP_UCHAR(v) ((guchar) (CLAMP (((int)v), (int)0, (int)255)))
|
2002-02-07 05:13:26 +00:00
|
|
|
#define INTENSITY(r, g, b) ((r) * 0.30 + (g) * 0.59 + (b) * 0.11)
|
|
|
|
|
2011-05-17 18:50:40 +00:00
|
|
|
static void gtk_style_shade (GdkRGBA *a,
|
|
|
|
GdkRGBA *b,
|
2002-06-06 04:00:22 +00:00
|
|
|
gdouble k);
|
|
|
|
static void rgb_to_hls (gdouble *r,
|
|
|
|
gdouble *g,
|
|
|
|
gdouble *b);
|
|
|
|
static void hls_to_rgb (gdouble *h,
|
|
|
|
gdouble *l,
|
|
|
|
gdouble *s);
|
2002-02-07 05:13:26 +00:00
|
|
|
|
2011-11-02 15:34:45 +00:00
|
|
|
/*
|
2008-01-17 03:49:24 +00:00
|
|
|
* The current theme. (Themes are singleton.)
|
|
|
|
*/
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
static MetaTheme *meta_current_theme = NULL;
|
|
|
|
|
2002-02-07 03:43:13 +00:00
|
|
|
static GdkPixbuf *
|
2002-02-07 04:22:57 +00:00
|
|
|
colorize_pixbuf (GdkPixbuf *orig,
|
2011-05-17 18:50:40 +00:00
|
|
|
GdkRGBA *new_color)
|
2002-02-07 03:43:13 +00:00
|
|
|
{
|
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
double intensity;
|
|
|
|
int x, y;
|
2002-02-07 04:22:57 +00:00
|
|
|
const guchar *src;
|
|
|
|
guchar *dest;
|
|
|
|
int orig_rowstride;
|
|
|
|
int dest_rowstride;
|
|
|
|
int width, height;
|
|
|
|
gboolean has_alpha;
|
|
|
|
const guchar *src_pixels;
|
|
|
|
guchar *dest_pixels;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:43:13 +00:00
|
|
|
pixbuf = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (orig), gdk_pixbuf_get_has_alpha (orig),
|
|
|
|
gdk_pixbuf_get_bits_per_sample (orig),
|
|
|
|
gdk_pixbuf_get_width (orig), gdk_pixbuf_get_height (orig));
|
2002-02-07 04:22:57 +00:00
|
|
|
|
2002-02-07 05:01:56 +00:00
|
|
|
if (pixbuf == NULL)
|
|
|
|
return NULL;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 04:22:57 +00:00
|
|
|
orig_rowstride = gdk_pixbuf_get_rowstride (orig);
|
|
|
|
dest_rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
|
|
|
width = gdk_pixbuf_get_width (pixbuf);
|
|
|
|
height = gdk_pixbuf_get_height (pixbuf);
|
|
|
|
has_alpha = gdk_pixbuf_get_has_alpha (orig);
|
|
|
|
src_pixels = gdk_pixbuf_get_pixels (orig);
|
|
|
|
dest_pixels = gdk_pixbuf_get_pixels (pixbuf);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 04:22:57 +00:00
|
|
|
for (y = 0; y < height; y++)
|
2002-02-07 03:43:13 +00:00
|
|
|
{
|
2002-02-07 04:22:57 +00:00
|
|
|
src = src_pixels + y * orig_rowstride;
|
|
|
|
dest = dest_pixels + y * dest_rowstride;
|
2002-02-07 03:43:13 +00:00
|
|
|
|
2002-02-07 04:22:57 +00:00
|
|
|
for (x = 0; x < width; x++)
|
|
|
|
{
|
2002-02-07 05:13:26 +00:00
|
|
|
double dr, dg, db;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 04:22:57 +00:00
|
|
|
intensity = INTENSITY (src[0], src[1], src[2]) / 255.0;
|
2002-02-07 05:13:26 +00:00
|
|
|
|
2002-02-07 06:24:10 +00:00
|
|
|
if (intensity <= 0.5)
|
|
|
|
{
|
|
|
|
/* Go from black at intensity = 0.0 to new_color at intensity = 0.5 */
|
2011-05-17 18:50:40 +00:00
|
|
|
dr = new_color->red * intensity * 2.0;
|
|
|
|
dg = new_color->green * intensity * 2.0;
|
|
|
|
db = new_color->blue * intensity * 2.0;
|
2002-02-07 06:24:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Go from new_color at intensity = 0.5 to white at intensity = 1.0 */
|
2011-05-17 18:50:40 +00:00
|
|
|
dr = new_color->red + (1.0 - new_color->red) * (intensity - 0.5) * 2.0;
|
|
|
|
dg = new_color->green + (1.0 - new_color->green) * (intensity - 0.5) * 2.0;
|
|
|
|
db = new_color->blue + (1.0 - new_color->blue) * (intensity - 0.5) * 2.0;
|
2002-02-07 06:24:10 +00:00
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 05:13:26 +00:00
|
|
|
dest[0] = CLAMP_UCHAR (255 * dr);
|
|
|
|
dest[1] = CLAMP_UCHAR (255 * dg);
|
|
|
|
dest[2] = CLAMP_UCHAR (255 * db);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 04:22:57 +00:00
|
|
|
if (has_alpha)
|
|
|
|
{
|
|
|
|
dest[3] = src[3];
|
|
|
|
src += 4;
|
|
|
|
dest += 4;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
src += 3;
|
|
|
|
dest += 3;
|
|
|
|
}
|
|
|
|
}
|
2002-02-07 03:43:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return pixbuf;
|
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-27 07:32:46 +00:00
|
|
|
static void
|
2011-05-17 18:50:40 +00:00
|
|
|
color_composite (const GdkRGBA *bg,
|
|
|
|
const GdkRGBA *fg,
|
|
|
|
double alpha,
|
|
|
|
GdkRGBA *color)
|
2002-01-27 07:32:46 +00:00
|
|
|
{
|
|
|
|
*color = *bg;
|
2011-05-17 18:50:40 +00:00
|
|
|
color->red = color->red + (fg->red - color->red) * alpha;
|
|
|
|
color->green = color->green + (fg->green - color->green) * alpha;
|
|
|
|
color->blue = color->blue + (fg->blue - color->blue) * alpha;
|
2002-01-27 07:32:46 +00:00
|
|
|
}
|
|
|
|
|
2008-01-17 03:49:24 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* init_border:
|
|
|
|
* @border: The border whose fields should be reset.
|
2008-01-17 03:49:24 +00:00
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* Sets all the fields of a border to dummy values.
|
2008-01-17 03:49:24 +00:00
|
|
|
*/
|
2002-02-07 03:07:56 +00:00
|
|
|
static void
|
|
|
|
init_border (GtkBorder *border)
|
|
|
|
{
|
|
|
|
border->top = -1;
|
|
|
|
border->bottom = -1;
|
|
|
|
border->left = -1;
|
|
|
|
border->right = -1;
|
|
|
|
}
|
|
|
|
|
2008-01-17 03:49:24 +00:00
|
|
|
/**
|
2010-09-01 19:39:53 +00:00
|
|
|
* meta_frame_layout_new: (skip)
|
|
|
|
*
|
2008-01-17 03:49:24 +00:00
|
|
|
* Creates a new, empty MetaFrameLayout. The fields will be set to dummy
|
|
|
|
* values.
|
|
|
|
*
|
2010-09-01 19:39:53 +00:00
|
|
|
* Returns: The newly created MetaFrameLayout.
|
2008-01-17 03:49:24 +00:00
|
|
|
*/
|
2002-01-19 03:50:03 +00:00
|
|
|
MetaFrameLayout*
|
|
|
|
meta_frame_layout_new (void)
|
|
|
|
{
|
|
|
|
MetaFrameLayout *layout;
|
|
|
|
|
|
|
|
layout = g_new0 (MetaFrameLayout, 1);
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
layout->refcount = 1;
|
|
|
|
|
|
|
|
/* Fill with -1 values to detect invalid themes */
|
|
|
|
layout->left_width = -1;
|
|
|
|
layout->right_width = -1;
|
|
|
|
layout->bottom_height = -1;
|
|
|
|
|
|
|
|
init_border (&layout->title_border);
|
|
|
|
|
|
|
|
layout->title_vertical_pad = -1;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
layout->right_titlebar_edge = -1;
|
|
|
|
layout->left_titlebar_edge = -1;
|
|
|
|
|
2002-06-04 02:13:00 +00:00
|
|
|
layout->button_sizing = META_BUTTON_SIZING_LAST;
|
|
|
|
layout->button_aspect = 1.0;
|
2002-02-07 03:07:56 +00:00
|
|
|
layout->button_width = -1;
|
|
|
|
layout->button_height = -1;
|
|
|
|
|
2002-02-09 06:54:44 +00:00
|
|
|
layout->has_title = TRUE;
|
2002-02-11 16:28:17 +00:00
|
|
|
layout->title_scale = 1.0;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
init_border (&layout->button_border);
|
|
|
|
|
|
|
|
return layout;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
validate_border (const GtkBorder *border,
|
|
|
|
const char **bad)
|
|
|
|
{
|
|
|
|
*bad = NULL;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
if (border->top < 0)
|
|
|
|
*bad = _("top");
|
|
|
|
else if (border->bottom < 0)
|
|
|
|
*bad = _("bottom");
|
|
|
|
else if (border->left < 0)
|
|
|
|
*bad = _("left");
|
|
|
|
else if (border->right < 0)
|
|
|
|
*bad = _("right");
|
|
|
|
|
|
|
|
return *bad == NULL;
|
|
|
|
}
|
|
|
|
|
2008-01-17 03:49:24 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* validate_geometry_value:
|
|
|
|
* @val: The value to check
|
|
|
|
* @name: The name to use in the error message
|
|
|
|
* @error: (out): Set to an error if val was not initialised
|
|
|
|
*
|
2008-01-17 03:49:24 +00:00
|
|
|
* Ensures that the theme supplied a particular dimension. When a
|
2011-11-02 15:34:45 +00:00
|
|
|
* #MetaFrameLayout is created, all its integer fields are set to -1
|
2008-01-17 03:49:24 +00:00
|
|
|
* 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
|
2011-11-02 15:34:45 +00:00
|
|
|
* rather via the %CHECK_GEOMETRY_VALUE and %CHECK_GEOMETRY_BORDER
|
2008-01-17 03:49:24 +00:00
|
|
|
* macros.
|
|
|
|
*/
|
2002-02-07 03:07:56 +00:00
|
|
|
static gboolean
|
|
|
|
validate_geometry_value (int val,
|
|
|
|
const char *name,
|
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
if (val < 0)
|
|
|
|
{
|
|
|
|
g_set_error (error, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FRAME_GEOMETRY,
|
|
|
|
_("frame geometry does not specify \"%s\" dimension"),
|
|
|
|
name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
validate_geometry_border (const GtkBorder *border,
|
|
|
|
const char *name,
|
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
const char *bad;
|
|
|
|
|
|
|
|
if (!validate_border (border, &bad))
|
|
|
|
{
|
|
|
|
g_set_error (error, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FRAME_GEOMETRY,
|
|
|
|
_("frame geometry does not specify dimension \"%s\" for border \"%s\""),
|
|
|
|
bad, name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
meta_frame_layout_validate (const MetaFrameLayout *layout,
|
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (layout != NULL, FALSE);
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
|
|
|
CHECK_GEOMETRY_VALUE (left_width);
|
|
|
|
CHECK_GEOMETRY_VALUE (right_width);
|
|
|
|
CHECK_GEOMETRY_VALUE (bottom_height);
|
|
|
|
|
|
|
|
CHECK_GEOMETRY_BORDER (title_border);
|
|
|
|
|
|
|
|
CHECK_GEOMETRY_VALUE (title_vertical_pad);
|
|
|
|
|
|
|
|
CHECK_GEOMETRY_VALUE (right_titlebar_edge);
|
|
|
|
CHECK_GEOMETRY_VALUE (left_titlebar_edge);
|
|
|
|
|
2002-06-04 02:13:00 +00:00
|
|
|
switch (layout->button_sizing)
|
|
|
|
{
|
|
|
|
case META_BUTTON_SIZING_ASPECT:
|
|
|
|
if (layout->button_aspect < (0.1) ||
|
|
|
|
layout->button_aspect > (15.0))
|
|
|
|
{
|
|
|
|
g_set_error (error, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FRAME_GEOMETRY,
|
|
|
|
_("Button aspect ratio %g is not reasonable"),
|
|
|
|
layout->button_aspect);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case META_BUTTON_SIZING_FIXED:
|
|
|
|
CHECK_GEOMETRY_VALUE (button_width);
|
|
|
|
CHECK_GEOMETRY_VALUE (button_height);
|
|
|
|
break;
|
|
|
|
case META_BUTTON_SIZING_LAST:
|
|
|
|
g_set_error (error, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FRAME_GEOMETRY,
|
|
|
|
_("Frame geometry does not specify size of buttons"));
|
|
|
|
return FALSE;
|
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
|
|
|
|
CHECK_GEOMETRY_BORDER (button_border);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
MetaFrameLayout*
|
|
|
|
meta_frame_layout_copy (const MetaFrameLayout *src)
|
|
|
|
{
|
|
|
|
MetaFrameLayout *layout;
|
|
|
|
|
|
|
|
layout = g_new0 (MetaFrameLayout, 1);
|
|
|
|
|
|
|
|
*layout = *src;
|
|
|
|
|
|
|
|
layout->refcount = 1;
|
|
|
|
|
2002-01-19 03:50:03 +00:00
|
|
|
return layout;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-02-07 03:07:56 +00:00
|
|
|
meta_frame_layout_ref (MetaFrameLayout *layout)
|
2002-01-19 03:50:03 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (layout != NULL);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
|
|
|
layout->refcount += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_frame_layout_unref (MetaFrameLayout *layout)
|
|
|
|
{
|
|
|
|
g_return_if_fail (layout != NULL);
|
|
|
|
g_return_if_fail (layout->refcount > 0);
|
|
|
|
|
|
|
|
layout->refcount -= 1;
|
|
|
|
|
|
|
|
if (layout->refcount == 0)
|
|
|
|
{
|
|
|
|
DEBUG_FILL_STRUCT (layout);
|
|
|
|
g_free (layout);
|
|
|
|
}
|
2002-01-19 03:50:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_frame_layout_get_borders (const MetaFrameLayout *layout,
|
|
|
|
int text_height,
|
|
|
|
MetaFrameFlags flags,
|
2011-09-14 23:06:02 +00:00
|
|
|
MetaFrameType type,
|
2011-07-12 04:37:41 +00:00
|
|
|
MetaFrameBorders *borders)
|
2002-01-19 03:50:03 +00:00
|
|
|
{
|
2011-07-12 04:55:50 +00:00
|
|
|
int buttons_height, title_height, draggable_borders;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2011-09-22 18:52:10 +00:00
|
|
|
meta_frame_borders_clear (borders);
|
|
|
|
|
|
|
|
/* For a full-screen window, we don't have any borders, visible or not. */
|
|
|
|
if (flags & META_FRAME_FULLSCREEN)
|
|
|
|
return;
|
|
|
|
|
2010-09-17 09:19:46 +00:00
|
|
|
g_return_if_fail (layout != NULL);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-09 06:54:44 +00:00
|
|
|
if (!layout->has_title)
|
|
|
|
text_height = 0;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-01-19 03:50:03 +00:00
|
|
|
buttons_height = layout->button_height +
|
|
|
|
layout->button_border.top + layout->button_border.bottom;
|
|
|
|
title_height = text_height +
|
2002-02-07 03:07:56 +00:00
|
|
|
layout->title_vertical_pad +
|
2002-01-19 03:50:03 +00:00
|
|
|
layout->title_border.top + layout->title_border.bottom;
|
|
|
|
|
2011-09-22 18:52:10 +00:00
|
|
|
borders->visible.top = MAX (buttons_height, title_height);
|
|
|
|
borders->visible.left = layout->left_width;
|
|
|
|
borders->visible.right = layout->right_width;
|
2011-09-17 00:21:53 +00:00
|
|
|
borders->visible.bottom = layout->bottom_height;
|
2002-06-08 06:07:21 +00:00
|
|
|
|
2011-07-12 04:55:50 +00:00
|
|
|
draggable_borders = meta_prefs_get_draggable_border_width ();
|
|
|
|
|
2011-09-22 18:52:10 +00:00
|
|
|
if (flags & META_FRAME_ALLOWS_HORIZONTAL_RESIZE)
|
|
|
|
{
|
|
|
|
borders->invisible.left = MAX (0, draggable_borders - borders->visible.left);
|
|
|
|
borders->invisible.right = MAX (0, draggable_borders - borders->visible.right);
|
|
|
|
}
|
2011-07-12 04:55:50 +00:00
|
|
|
|
2011-09-22 18:52:10 +00:00
|
|
|
if (flags & META_FRAME_ALLOWS_VERTICAL_RESIZE)
|
|
|
|
{
|
|
|
|
borders->invisible.bottom = MAX (0, draggable_borders - borders->visible.bottom);
|
2011-09-14 23:06:02 +00:00
|
|
|
|
2011-09-22 18:52:10 +00:00
|
|
|
/* borders.visible.top is the height of the *title bar*. We can't do the same
|
|
|
|
* algorithm here, titlebars are expectedly much bigger. Just subtract a couple
|
|
|
|
* pixels to get a proper feel. */
|
|
|
|
if (type != META_FRAME_TYPE_ATTACHED)
|
|
|
|
borders->invisible.top = MAX (0, draggable_borders - 2);
|
|
|
|
}
|
2011-09-17 00:21:53 +00:00
|
|
|
|
2011-07-12 04:55:50 +00:00
|
|
|
borders->total.left = borders->invisible.left + borders->visible.left;
|
|
|
|
borders->total.right = borders->invisible.right + borders->visible.right;
|
|
|
|
borders->total.bottom = borders->invisible.bottom + borders->visible.bottom;
|
|
|
|
borders->total.top = borders->invisible.top + borders->visible.top;
|
2002-01-19 03:50:03 +00:00
|
|
|
}
|
|
|
|
|
2010-12-02 00:16:10 +00:00
|
|
|
static MetaButtonType
|
|
|
|
map_button_function_to_type (MetaButtonFunction function)
|
|
|
|
{
|
|
|
|
switch (function)
|
|
|
|
{
|
|
|
|
case META_BUTTON_FUNCTION_SHADE:
|
|
|
|
return META_BUTTON_TYPE_SHADE;
|
|
|
|
case META_BUTTON_FUNCTION_ABOVE:
|
|
|
|
return META_BUTTON_TYPE_ABOVE;
|
|
|
|
case META_BUTTON_FUNCTION_STICK:
|
|
|
|
return META_BUTTON_TYPE_STICK;
|
|
|
|
case META_BUTTON_FUNCTION_UNSHADE:
|
|
|
|
return META_BUTTON_TYPE_UNSHADE;
|
|
|
|
case META_BUTTON_FUNCTION_UNABOVE:
|
|
|
|
return META_BUTTON_TYPE_UNABOVE;
|
|
|
|
case META_BUTTON_FUNCTION_UNSTICK:
|
|
|
|
return META_BUTTON_TYPE_UNSTICK;
|
|
|
|
case META_BUTTON_FUNCTION_MENU:
|
|
|
|
return META_BUTTON_TYPE_MENU;
|
|
|
|
case META_BUTTON_FUNCTION_MINIMIZE:
|
|
|
|
return META_BUTTON_TYPE_MINIMIZE;
|
|
|
|
case META_BUTTON_FUNCTION_MAXIMIZE:
|
|
|
|
return META_BUTTON_TYPE_MAXIMIZE;
|
|
|
|
case META_BUTTON_FUNCTION_CLOSE:
|
|
|
|
return META_BUTTON_TYPE_CLOSE;
|
|
|
|
case META_BUTTON_FUNCTION_LAST:
|
|
|
|
return META_BUTTON_TYPE_LAST;
|
|
|
|
}
|
|
|
|
|
|
|
|
return META_BUTTON_TYPE_LAST;
|
|
|
|
}
|
|
|
|
|
2006-08-07 18:01:21 +00:00
|
|
|
static MetaButtonSpace*
|
2002-10-04 02:28:57 +00:00
|
|
|
rect_for_function (MetaFrameGeometry *fgeom,
|
|
|
|
MetaFrameFlags flags,
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
MetaButtonFunction function,
|
|
|
|
MetaTheme *theme)
|
2002-10-04 02:28:57 +00:00
|
|
|
{
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
|
|
|
|
/* Firstly, check version-specific things. */
|
2014-05-02 13:34:02 +00:00
|
|
|
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
if (META_THEME_ALLOWS(theme, META_THEME_SHADE_STICK_ABOVE_BUTTONS))
|
|
|
|
{
|
|
|
|
switch (function)
|
|
|
|
{
|
|
|
|
case META_BUTTON_FUNCTION_SHADE:
|
|
|
|
if ((flags & META_FRAME_ALLOWS_SHADE) && !(flags & META_FRAME_SHADED))
|
|
|
|
return &fgeom->shade_rect;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
case META_BUTTON_FUNCTION_ABOVE:
|
|
|
|
if (!(flags & META_FRAME_ABOVE))
|
|
|
|
return &fgeom->above_rect;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
case META_BUTTON_FUNCTION_STICK:
|
|
|
|
if (!(flags & META_FRAME_STUCK))
|
|
|
|
return &fgeom->stick_rect;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
case META_BUTTON_FUNCTION_UNSHADE:
|
|
|
|
if ((flags & META_FRAME_ALLOWS_SHADE) && (flags & META_FRAME_SHADED))
|
|
|
|
return &fgeom->unshade_rect;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
case META_BUTTON_FUNCTION_UNABOVE:
|
|
|
|
if (flags & META_FRAME_ABOVE)
|
|
|
|
return &fgeom->unabove_rect;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
case META_BUTTON_FUNCTION_UNSTICK:
|
|
|
|
if (flags & META_FRAME_STUCK)
|
|
|
|
return &fgeom->unstick_rect;
|
|
|
|
default:
|
|
|
|
/* just go on to the next switch block */;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* now consider the buttons which exist in all versions */
|
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
switch (function)
|
|
|
|
{
|
|
|
|
case META_BUTTON_FUNCTION_MENU:
|
|
|
|
if (flags & META_FRAME_ALLOWS_MENU)
|
|
|
|
return &fgeom->menu_rect;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
case META_BUTTON_FUNCTION_MINIMIZE:
|
|
|
|
if (flags & META_FRAME_ALLOWS_MINIMIZE)
|
|
|
|
return &fgeom->min_rect;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
case META_BUTTON_FUNCTION_MAXIMIZE:
|
|
|
|
if (flags & META_FRAME_ALLOWS_MAXIMIZE)
|
|
|
|
return &fgeom->max_rect;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
case META_BUTTON_FUNCTION_CLOSE:
|
|
|
|
if (flags & META_FRAME_ALLOWS_DELETE)
|
|
|
|
return &fgeom->close_rect;
|
|
|
|
else
|
|
|
|
return NULL;
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
case META_BUTTON_FUNCTION_STICK:
|
|
|
|
case META_BUTTON_FUNCTION_SHADE:
|
|
|
|
case META_BUTTON_FUNCTION_ABOVE:
|
|
|
|
case META_BUTTON_FUNCTION_UNSTICK:
|
|
|
|
case META_BUTTON_FUNCTION_UNSHADE:
|
|
|
|
case META_BUTTON_FUNCTION_UNABOVE:
|
|
|
|
/* we are being asked for a >v1 button which hasn't been handled yet,
|
|
|
|
* so obviously we're not in a theme which supports that version.
|
|
|
|
* therefore, we don't show the button. return NULL and all will
|
|
|
|
* be well.
|
|
|
|
*/
|
|
|
|
return NULL;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
case META_BUTTON_FUNCTION_LAST:
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2006-08-07 18:01:21 +00:00
|
|
|
strip_button (MetaButtonSpace *func_rects[MAX_BUTTONS_PER_CORNER],
|
|
|
|
GdkRectangle *bg_rects[MAX_BUTTONS_PER_CORNER],
|
|
|
|
int *n_rects,
|
|
|
|
MetaButtonSpace *to_strip)
|
2002-10-04 02:28:57 +00:00
|
|
|
{
|
|
|
|
int i;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
i = 0;
|
|
|
|
while (i < *n_rects)
|
|
|
|
{
|
|
|
|
if (func_rects[i] == to_strip)
|
|
|
|
{
|
|
|
|
*n_rects -= 1;
|
|
|
|
|
|
|
|
/* shift the other rects back in the array */
|
|
|
|
while (i < *n_rects)
|
|
|
|
{
|
|
|
|
func_rects[i] = func_rects[i+1];
|
|
|
|
bg_rects[i] = bg_rects[i+1];
|
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
func_rects[i] = NULL;
|
|
|
|
bg_rects[i] = NULL;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE; /* did not strip anything */
|
|
|
|
}
|
|
|
|
|
2012-04-26 23:26:09 +00:00
|
|
|
static void
|
2002-10-04 02:28:57 +00:00
|
|
|
meta_frame_layout_calc_geometry (const MetaFrameLayout *layout,
|
|
|
|
int text_height,
|
|
|
|
MetaFrameFlags flags,
|
|
|
|
int client_width,
|
|
|
|
int client_height,
|
|
|
|
const MetaButtonLayout *button_layout,
|
2011-09-14 23:06:02 +00:00
|
|
|
MetaFrameType type,
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
MetaFrameGeometry *fgeom,
|
|
|
|
MetaTheme *theme)
|
2002-01-19 03:50:03 +00:00
|
|
|
{
|
2008-02-29 20:41:07 +00:00
|
|
|
int i, n_left, n_right, n_left_spacers, n_right_spacers;
|
2002-01-19 03:50:03 +00:00
|
|
|
int x;
|
|
|
|
int button_y;
|
|
|
|
int title_right_edge;
|
|
|
|
int width, height;
|
2002-06-04 02:13:00 +00:00
|
|
|
int button_width, button_height;
|
2002-08-28 02:48:59 +00:00
|
|
|
int min_size_for_rounding;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
/* the left/right rects in order; the max # of rects
|
|
|
|
* is the number of button functions
|
|
|
|
*/
|
2006-08-07 18:01:21 +00:00
|
|
|
MetaButtonSpace *left_func_rects[MAX_BUTTONS_PER_CORNER];
|
|
|
|
MetaButtonSpace *right_func_rects[MAX_BUTTONS_PER_CORNER];
|
2002-10-04 02:28:57 +00:00
|
|
|
GdkRectangle *left_bg_rects[MAX_BUTTONS_PER_CORNER];
|
2008-02-29 20:41:07 +00:00
|
|
|
gboolean left_buttons_has_spacer[MAX_BUTTONS_PER_CORNER];
|
2002-10-04 02:28:57 +00:00
|
|
|
GdkRectangle *right_bg_rects[MAX_BUTTONS_PER_CORNER];
|
2008-02-29 20:41:07 +00:00
|
|
|
gboolean right_buttons_has_spacer[MAX_BUTTONS_PER_CORNER];
|
2011-07-12 04:37:41 +00:00
|
|
|
|
|
|
|
MetaFrameBorders borders;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
meta_frame_layout_get_borders (layout, text_height,
|
2011-09-14 23:06:02 +00:00
|
|
|
flags, type,
|
2011-07-12 04:37:41 +00:00
|
|
|
&borders);
|
|
|
|
|
2011-07-12 05:16:48 +00:00
|
|
|
fgeom->borders = borders;
|
2011-07-12 04:37:41 +00:00
|
|
|
|
2011-07-12 05:16:48 +00:00
|
|
|
width = client_width + borders.total.left + borders.total.right;
|
2002-06-13 17:26:39 +00:00
|
|
|
|
2014-05-21 16:21:05 +00:00
|
|
|
height = borders.total.top + borders.total.bottom;
|
|
|
|
if (!(flags & META_FRAME_SHADED))
|
|
|
|
height += client_height;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-19 03:50:03 +00:00
|
|
|
fgeom->width = width;
|
|
|
|
fgeom->height = height;
|
|
|
|
|
2002-01-28 05:16:04 +00:00
|
|
|
fgeom->top_titlebar_edge = layout->title_border.top;
|
|
|
|
fgeom->bottom_titlebar_edge = layout->title_border.bottom;
|
2002-02-07 03:07:56 +00:00
|
|
|
fgeom->left_titlebar_edge = layout->left_titlebar_edge;
|
|
|
|
fgeom->right_titlebar_edge = layout->right_titlebar_edge;
|
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
/* gcc warnings */
|
|
|
|
button_width = -1;
|
|
|
|
button_height = -1;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-04 02:13:00 +00:00
|
|
|
switch (layout->button_sizing)
|
|
|
|
{
|
|
|
|
case META_BUTTON_SIZING_ASPECT:
|
2011-07-12 05:16:48 +00:00
|
|
|
button_height = borders.visible.top - layout->button_border.top - layout->button_border.bottom;
|
2002-06-04 02:13:00 +00:00
|
|
|
button_width = button_height / layout->button_aspect;
|
|
|
|
break;
|
|
|
|
case META_BUTTON_SIZING_FIXED:
|
|
|
|
button_width = layout->button_width;
|
|
|
|
button_height = layout->button_height;
|
|
|
|
break;
|
|
|
|
case META_BUTTON_SIZING_LAST:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
2002-01-19 03:50:03 +00:00
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
/* FIXME all this code sort of pretends that duplicate buttons
|
|
|
|
* with the same function are allowed, but that breaks the
|
|
|
|
* code in frames.c, so isn't really allowed right now.
|
|
|
|
* Would need left_close_rect, right_close_rect, etc.
|
|
|
|
*/
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
/* Init all button rects to 0, lame hack */
|
|
|
|
memset (ADDRESS_OF_BUTTON_RECTS (fgeom), '\0',
|
|
|
|
LENGTH_OF_BUTTON_RECTS);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
n_left = 0;
|
|
|
|
n_right = 0;
|
2008-02-29 20:41:07 +00:00
|
|
|
n_left_spacers = 0;
|
|
|
|
n_right_spacers = 0;
|
2002-01-19 03:50:03 +00:00
|
|
|
|
2007-07-22 06:39:29 +00:00
|
|
|
if (!layout->hide_buttons)
|
|
|
|
{
|
2002-10-04 02:28:57 +00:00
|
|
|
/* Try to fill in rects */
|
2007-07-22 06:39:29 +00:00
|
|
|
for (i = 0; i < MAX_BUTTONS_PER_CORNER && button_layout->left_buttons[i] != META_BUTTON_FUNCTION_LAST; i++)
|
2002-10-04 02:28:57 +00:00
|
|
|
{
|
|
|
|
left_func_rects[n_left] = rect_for_function (fgeom, flags,
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
button_layout->left_buttons[i],
|
|
|
|
theme);
|
2002-10-04 02:28:57 +00:00
|
|
|
if (left_func_rects[n_left] != NULL)
|
2008-02-29 20:41:07 +00:00
|
|
|
{
|
|
|
|
left_buttons_has_spacer[n_left] = button_layout->left_buttons_has_spacer[i];
|
|
|
|
if (button_layout->left_buttons_has_spacer[i])
|
|
|
|
++n_left_spacers;
|
|
|
|
|
|
|
|
++n_left;
|
|
|
|
}
|
2002-10-04 02:28:57 +00:00
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2007-07-22 06:39:29 +00:00
|
|
|
for (i = 0; i < MAX_BUTTONS_PER_CORNER && button_layout->right_buttons[i] != META_BUTTON_FUNCTION_LAST; i++)
|
2002-10-04 02:28:57 +00:00
|
|
|
{
|
|
|
|
right_func_rects[n_right] = rect_for_function (fgeom, flags,
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
button_layout->right_buttons[i],
|
|
|
|
theme);
|
2002-10-04 02:28:57 +00:00
|
|
|
if (right_func_rects[n_right] != NULL)
|
2008-02-29 20:41:07 +00:00
|
|
|
{
|
|
|
|
right_buttons_has_spacer[n_right] = button_layout->right_buttons_has_spacer[i];
|
|
|
|
if (button_layout->right_buttons_has_spacer[i])
|
|
|
|
++n_right_spacers;
|
|
|
|
|
|
|
|
++n_right;
|
|
|
|
}
|
2002-10-04 02:28:57 +00:00
|
|
|
}
|
2002-01-19 03:50:03 +00:00
|
|
|
}
|
|
|
|
|
2006-04-18 17:18:53 +00:00
|
|
|
for (i = 0; i < MAX_BUTTONS_PER_CORNER; i++)
|
2002-01-19 03:50:03 +00:00
|
|
|
{
|
2002-10-04 02:28:57 +00:00
|
|
|
left_bg_rects[i] = NULL;
|
|
|
|
right_bg_rects[i] = NULL;
|
2002-01-19 03:50:03 +00:00
|
|
|
}
|
2006-04-18 17:18:53 +00:00
|
|
|
|
|
|
|
for (i = 0; i < n_left; i++)
|
2002-01-19 03:50:03 +00:00
|
|
|
{
|
2010-12-03 00:14:13 +00:00
|
|
|
if (n_left == 1)
|
|
|
|
left_bg_rects[i] = &fgeom->left_single_background;
|
|
|
|
else if (i == 0)
|
2002-10-24 20:47:19 +00:00
|
|
|
left_bg_rects[i] = &fgeom->left_left_background;
|
2002-11-03 19:55:38 +00:00
|
|
|
else if (i == (n_left - 1))
|
|
|
|
left_bg_rects[i] = &fgeom->left_right_background;
|
2002-10-04 02:28:57 +00:00
|
|
|
else
|
2006-04-18 17:18:53 +00:00
|
|
|
left_bg_rects[i] = &fgeom->left_middle_backgrounds[i - 1];
|
2002-01-19 03:50:03 +00:00
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2006-04-18 17:18:53 +00:00
|
|
|
for (i = 0; i < n_right; i++)
|
2002-01-19 03:50:03 +00:00
|
|
|
{
|
2010-12-03 00:14:13 +00:00
|
|
|
if (n_right == 1)
|
|
|
|
right_bg_rects[i] = &fgeom->right_single_background;
|
|
|
|
else if (i == (n_right - 1))
|
2002-10-04 02:28:57 +00:00
|
|
|
right_bg_rects[i] = &fgeom->right_right_background;
|
2002-11-03 19:55:38 +00:00
|
|
|
else if (i == 0)
|
|
|
|
right_bg_rects[i] = &fgeom->right_left_background;
|
2002-10-04 02:28:57 +00:00
|
|
|
else
|
2006-04-18 17:18:53 +00:00
|
|
|
right_bg_rects[i] = &fgeom->right_middle_backgrounds[i - 1];
|
2002-01-19 03:50:03 +00:00
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
/* Be sure buttons fit */
|
|
|
|
while (n_left > 0 || n_right > 0)
|
2002-01-19 03:50:03 +00:00
|
|
|
{
|
2002-10-04 02:28:57 +00:00
|
|
|
int space_used_by_buttons;
|
|
|
|
int space_available;
|
2002-01-19 03:50:03 +00:00
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
space_available = fgeom->width - layout->left_titlebar_edge - layout->right_titlebar_edge;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
space_used_by_buttons = 0;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2006-04-18 17:18:53 +00:00
|
|
|
space_used_by_buttons += button_width * n_left;
|
2008-02-29 20:41:07 +00:00
|
|
|
space_used_by_buttons += (button_width * 0.75) * n_left_spacers;
|
2006-04-18 17:18:53 +00:00
|
|
|
space_used_by_buttons += layout->button_border.left * n_left;
|
|
|
|
space_used_by_buttons += layout->button_border.right * n_left;
|
2002-01-19 03:50:03 +00:00
|
|
|
|
2006-04-18 17:18:53 +00:00
|
|
|
space_used_by_buttons += button_width * n_right;
|
2008-02-29 20:41:07 +00:00
|
|
|
space_used_by_buttons += (button_width * 0.75) * n_right_spacers;
|
2006-04-18 17:18:53 +00:00
|
|
|
space_used_by_buttons += layout->button_border.left * n_right;
|
|
|
|
space_used_by_buttons += layout->button_border.right * n_right;
|
2002-01-19 03:50:03 +00:00
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
if (space_used_by_buttons <= space_available)
|
|
|
|
break; /* Everything fits, bail out */
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2008-02-29 20:41:07 +00:00
|
|
|
/* First try to remove separators */
|
|
|
|
if (n_left_spacers > 0)
|
|
|
|
{
|
|
|
|
left_buttons_has_spacer[--n_left_spacers] = FALSE;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if (n_right_spacers > 0)
|
|
|
|
{
|
|
|
|
right_buttons_has_spacer[--n_right_spacers] = FALSE;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
/* Otherwise we need to shave out a button. Shave
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
* above, stick, shade, min, max, close, then menu (menu is most useful);
|
2002-10-04 02:28:57 +00:00
|
|
|
* prefer the default button locations.
|
|
|
|
*/
|
|
|
|
if (strip_button (left_func_rects, left_bg_rects,
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
&n_left, &fgeom->above_rect))
|
|
|
|
continue;
|
|
|
|
else if (strip_button (right_func_rects, right_bg_rects,
|
|
|
|
&n_right, &fgeom->above_rect))
|
|
|
|
continue;
|
|
|
|
else if (strip_button (left_func_rects, left_bg_rects,
|
|
|
|
&n_left, &fgeom->stick_rect))
|
|
|
|
continue;
|
|
|
|
else if (strip_button (right_func_rects, right_bg_rects,
|
|
|
|
&n_right, &fgeom->stick_rect))
|
|
|
|
continue;
|
|
|
|
else if (strip_button (left_func_rects, left_bg_rects,
|
|
|
|
&n_left, &fgeom->shade_rect))
|
|
|
|
continue;
|
|
|
|
else if (strip_button (right_func_rects, right_bg_rects,
|
|
|
|
&n_right, &fgeom->shade_rect))
|
|
|
|
continue;
|
|
|
|
else if (strip_button (left_func_rects, left_bg_rects,
|
2002-10-04 02:28:57 +00:00
|
|
|
&n_left, &fgeom->min_rect))
|
|
|
|
continue;
|
|
|
|
else if (strip_button (right_func_rects, right_bg_rects,
|
|
|
|
&n_right, &fgeom->min_rect))
|
|
|
|
continue;
|
|
|
|
else if (strip_button (left_func_rects, left_bg_rects,
|
|
|
|
&n_left, &fgeom->max_rect))
|
|
|
|
continue;
|
|
|
|
else if (strip_button (right_func_rects, right_bg_rects,
|
|
|
|
&n_right, &fgeom->max_rect))
|
|
|
|
continue;
|
|
|
|
else if (strip_button (left_func_rects, left_bg_rects,
|
|
|
|
&n_left, &fgeom->close_rect))
|
|
|
|
continue;
|
|
|
|
else if (strip_button (right_func_rects, right_bg_rects,
|
|
|
|
&n_right, &fgeom->close_rect))
|
|
|
|
continue;
|
|
|
|
else if (strip_button (right_func_rects, right_bg_rects,
|
|
|
|
&n_right, &fgeom->menu_rect))
|
|
|
|
continue;
|
|
|
|
else if (strip_button (left_func_rects, left_bg_rects,
|
|
|
|
&n_left, &fgeom->menu_rect))
|
|
|
|
continue;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_bug ("Could not find a button to strip. n_left = %d n_right = %d\n",
|
|
|
|
n_left, n_right);
|
|
|
|
}
|
2002-01-19 03:50:03 +00:00
|
|
|
}
|
2010-12-02 00:16:10 +00:00
|
|
|
|
|
|
|
/* Save the button layout */
|
|
|
|
fgeom->button_layout = *button_layout;
|
|
|
|
fgeom->n_left_buttons = n_left;
|
|
|
|
fgeom->n_right_buttons = n_right;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
/* center buttons vertically */
|
2011-07-12 05:16:48 +00:00
|
|
|
button_y = (borders.visible.top -
|
|
|
|
(button_height + layout->button_border.top + layout->button_border.bottom)) / 2 + layout->button_border.top + borders.invisible.top;
|
2002-01-19 03:50:03 +00:00
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
/* right edge of farthest-right button */
|
2011-07-12 05:16:48 +00:00
|
|
|
x = width - layout->right_titlebar_edge - borders.invisible.right;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
i = n_right - 1;
|
|
|
|
while (i >= 0)
|
2002-01-19 03:50:03 +00:00
|
|
|
{
|
2006-08-07 18:01:21 +00:00
|
|
|
MetaButtonSpace *rect;
|
2002-10-04 02:28:57 +00:00
|
|
|
|
|
|
|
if (x < 0) /* if we go negative, leave the buttons we don't get to as 0-width */
|
|
|
|
break;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
rect = right_func_rects[i];
|
2006-08-07 18:01:21 +00:00
|
|
|
rect->visible.x = x - layout->button_border.right - button_width;
|
2008-02-29 20:41:07 +00:00
|
|
|
if (right_buttons_has_spacer[i])
|
|
|
|
rect->visible.x -= (button_width * 0.75);
|
|
|
|
|
2006-08-07 18:01:21 +00:00
|
|
|
rect->visible.y = button_y;
|
|
|
|
rect->visible.width = button_width;
|
|
|
|
rect->visible.height = button_height;
|
2002-10-04 02:28:57 +00:00
|
|
|
|
2010-12-08 01:16:35 +00:00
|
|
|
if (flags & META_FRAME_MAXIMIZED ||
|
|
|
|
flags & META_FRAME_TILED_LEFT ||
|
|
|
|
flags & META_FRAME_TILED_RIGHT)
|
2006-08-07 18:01:21 +00:00
|
|
|
{
|
|
|
|
rect->clickable.x = rect->visible.x;
|
|
|
|
rect->clickable.y = 0;
|
|
|
|
rect->clickable.width = rect->visible.width;
|
|
|
|
rect->clickable.height = button_height + button_y;
|
|
|
|
|
|
|
|
if (i == n_right - 1)
|
|
|
|
rect->clickable.width += layout->right_titlebar_edge + layout->right_width + layout->button_border.right;
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
g_memmove (&(rect->clickable), &(rect->visible), sizeof(rect->clickable));
|
|
|
|
|
|
|
|
*(right_bg_rects[i]) = rect->visible;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2006-08-07 18:01:21 +00:00
|
|
|
x = rect->visible.x - layout->button_border.left;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
--i;
|
2002-01-19 03:50:03 +00:00
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
/* save right edge of titlebar for later use */
|
|
|
|
title_right_edge = x - layout->title_border.right;
|
|
|
|
|
|
|
|
/* Now x changes to be position from the left and we go through
|
|
|
|
* the left-side buttons
|
|
|
|
*/
|
2011-07-12 05:16:48 +00:00
|
|
|
x = layout->left_titlebar_edge + borders.invisible.left;
|
2006-04-18 17:18:53 +00:00
|
|
|
for (i = 0; i < n_left; i++)
|
2002-01-19 03:50:03 +00:00
|
|
|
{
|
2006-08-07 18:01:21 +00:00
|
|
|
MetaButtonSpace *rect;
|
2006-04-18 17:18:53 +00:00
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
rect = left_func_rects[i];
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2006-08-07 18:01:21 +00:00
|
|
|
rect->visible.x = x + layout->button_border.left;
|
|
|
|
rect->visible.y = button_y;
|
|
|
|
rect->visible.width = button_width;
|
|
|
|
rect->visible.height = button_height;
|
|
|
|
|
|
|
|
if (flags & META_FRAME_MAXIMIZED)
|
|
|
|
{
|
|
|
|
if (i==0)
|
|
|
|
{
|
|
|
|
rect->clickable.x = 0;
|
|
|
|
rect->clickable.width = button_width + x;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rect->clickable.x = rect->visible.x;
|
|
|
|
rect->clickable.width = button_width;
|
|
|
|
}
|
|
|
|
|
|
|
|
rect->clickable.y = 0;
|
|
|
|
rect->clickable.height = button_height + button_y;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
g_memmove (&(rect->clickable), &(rect->visible), sizeof(rect->clickable));
|
2006-04-18 17:18:53 +00:00
|
|
|
|
|
|
|
|
2006-08-07 18:01:21 +00:00
|
|
|
x = rect->visible.x + rect->visible.width + layout->button_border.right;
|
2008-02-29 20:41:07 +00:00
|
|
|
if (left_buttons_has_spacer[i])
|
|
|
|
x += (button_width * 0.75);
|
2002-10-23 19:46:44 +00:00
|
|
|
|
2006-08-07 18:01:21 +00:00
|
|
|
*(left_bg_rects[i]) = rect->visible;
|
2002-01-19 03:50:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* We always fill as much vertical space as possible with title rect,
|
2002-02-07 03:07:56 +00:00
|
|
|
* rather than centering it like the buttons
|
2002-01-19 03:50:03 +00:00
|
|
|
*/
|
|
|
|
fgeom->title_rect.x = x + layout->title_border.left;
|
2011-07-12 05:16:48 +00:00
|
|
|
fgeom->title_rect.y = layout->title_border.top + borders.invisible.top;
|
2002-01-19 03:50:03 +00:00
|
|
|
fgeom->title_rect.width = title_right_edge - fgeom->title_rect.x;
|
2011-07-12 05:16:48 +00:00
|
|
|
fgeom->title_rect.height = borders.visible.top - layout->title_border.top - layout->title_border.bottom;
|
2002-01-19 03:50:03 +00:00
|
|
|
|
|
|
|
/* Nuke title if it won't fit */
|
|
|
|
if (fgeom->title_rect.width < 0 ||
|
|
|
|
fgeom->title_rect.height < 0)
|
|
|
|
{
|
|
|
|
fgeom->title_rect.width = 0;
|
|
|
|
fgeom->title_rect.height = 0;
|
|
|
|
}
|
2002-05-31 00:02:54 +00:00
|
|
|
|
2002-08-28 02:48:59 +00:00
|
|
|
if (flags & META_FRAME_SHADED)
|
|
|
|
min_size_for_rounding = 0;
|
|
|
|
else
|
2005-07-14 21:00:26 +00:00
|
|
|
min_size_for_rounding = 5;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
fgeom->top_left_corner_rounded_radius = 0;
|
|
|
|
fgeom->top_right_corner_rounded_radius = 0;
|
|
|
|
fgeom->bottom_left_corner_rounded_radius = 0;
|
|
|
|
fgeom->bottom_right_corner_rounded_radius = 0;
|
2002-08-24 21:28:02 +00:00
|
|
|
|
2011-07-12 05:16:48 +00:00
|
|
|
if (borders.visible.top + borders.visible.left >= min_size_for_rounding)
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
fgeom->top_left_corner_rounded_radius = layout->top_left_corner_rounded_radius;
|
2011-07-12 05:16:48 +00:00
|
|
|
if (borders.visible.top + borders.visible.right >= min_size_for_rounding)
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
fgeom->top_right_corner_rounded_radius = layout->top_right_corner_rounded_radius;
|
2002-01-08 07:23:35 +00:00
|
|
|
|
2011-07-12 05:16:48 +00:00
|
|
|
if (borders.visible.bottom + borders.visible.left >= min_size_for_rounding)
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
fgeom->bottom_left_corner_rounded_radius = layout->bottom_left_corner_rounded_radius;
|
2011-07-12 05:16:48 +00:00
|
|
|
if (borders.visible.bottom + borders.visible.right >= min_size_for_rounding)
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
fgeom->bottom_right_corner_rounded_radius = layout->bottom_right_corner_rounded_radius;
|
2002-08-24 21:28:02 +00:00
|
|
|
}
|
2002-02-02 05:09:19 +00:00
|
|
|
|
2010-09-01 19:39:53 +00:00
|
|
|
/**
|
|
|
|
* meta_gradient_spec_new: (skip)
|
|
|
|
*
|
|
|
|
*/
|
2002-02-02 05:09:19 +00:00
|
|
|
MetaGradientSpec*
|
|
|
|
meta_gradient_spec_new (MetaGradientType type)
|
|
|
|
{
|
|
|
|
MetaGradientSpec *spec;
|
|
|
|
|
|
|
|
spec = g_new (MetaGradientSpec, 1);
|
|
|
|
|
|
|
|
spec->type = type;
|
|
|
|
spec->color_specs = NULL;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
return spec;
|
|
|
|
}
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
static void
|
|
|
|
free_color_spec (gpointer spec, gpointer user_data)
|
|
|
|
{
|
|
|
|
meta_color_spec_free (spec);
|
|
|
|
}
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
void
|
|
|
|
meta_gradient_spec_free (MetaGradientSpec *spec)
|
|
|
|
{
|
|
|
|
g_return_if_fail (spec != NULL);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
|
|
|
g_slist_foreach (spec->color_specs, free_color_spec, NULL);
|
2002-02-02 05:09:19 +00:00
|
|
|
g_slist_free (spec->color_specs);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
DEBUG_FILL_STRUCT (spec);
|
2002-02-02 05:09:19 +00:00
|
|
|
g_free (spec);
|
|
|
|
}
|
|
|
|
|
|
|
|
GdkPixbuf*
|
|
|
|
meta_gradient_spec_render (const MetaGradientSpec *spec,
|
2011-03-18 15:42:41 +00:00
|
|
|
GtkStyleContext *style,
|
2002-02-02 05:09:19 +00:00
|
|
|
int width,
|
|
|
|
int height)
|
|
|
|
{
|
|
|
|
int n_colors;
|
2011-05-12 14:47:45 +00:00
|
|
|
GdkRGBA *colors;
|
2002-02-02 05:09:19 +00:00
|
|
|
GSList *tmp;
|
|
|
|
int i;
|
|
|
|
GdkPixbuf *pixbuf;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
n_colors = g_slist_length (spec->color_specs);
|
|
|
|
|
|
|
|
if (n_colors == 0)
|
|
|
|
return NULL;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2011-05-12 14:47:45 +00:00
|
|
|
colors = g_new (GdkRGBA, n_colors);
|
2002-02-02 05:09:19 +00:00
|
|
|
|
|
|
|
i = 0;
|
|
|
|
tmp = spec->color_specs;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
2011-05-17 18:50:40 +00:00
|
|
|
meta_color_spec_render (tmp->data, style, &colors[i]);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
tmp = tmp->next;
|
|
|
|
++i;
|
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
pixbuf = meta_gradient_create_multi (width, height,
|
|
|
|
colors, n_colors,
|
|
|
|
spec->type);
|
|
|
|
|
|
|
|
g_free (colors);
|
|
|
|
|
|
|
|
return pixbuf;
|
|
|
|
}
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
gboolean
|
|
|
|
meta_gradient_spec_validate (MetaGradientSpec *spec,
|
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (spec != NULL, FALSE);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
if (g_slist_length (spec->color_specs) < 2)
|
|
|
|
{
|
|
|
|
g_set_error (error, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
|
|
|
_("Gradients should have at least two colors"));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-09-01 19:39:53 +00:00
|
|
|
/**
|
|
|
|
* meta_alpha_gradient_spec_new: (skip)
|
|
|
|
*
|
|
|
|
*/
|
2002-05-31 21:18:11 +00:00
|
|
|
MetaAlphaGradientSpec*
|
|
|
|
meta_alpha_gradient_spec_new (MetaGradientType type,
|
|
|
|
int n_alphas)
|
|
|
|
{
|
|
|
|
MetaAlphaGradientSpec *spec;
|
|
|
|
|
|
|
|
g_return_val_if_fail (n_alphas > 0, NULL);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-05-31 21:18:11 +00:00
|
|
|
spec = g_new0 (MetaAlphaGradientSpec, 1);
|
|
|
|
|
|
|
|
spec->type = type;
|
|
|
|
spec->alphas = g_new0 (unsigned char, n_alphas);
|
|
|
|
spec->n_alphas = n_alphas;
|
|
|
|
|
|
|
|
return spec;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_alpha_gradient_spec_free (MetaAlphaGradientSpec *spec)
|
|
|
|
{
|
|
|
|
g_return_if_fail (spec != NULL);
|
|
|
|
|
|
|
|
g_free (spec->alphas);
|
|
|
|
g_free (spec);
|
|
|
|
}
|
|
|
|
|
2010-09-01 19:39:53 +00:00
|
|
|
/**
|
|
|
|
* meta_color_spec_new: (skip)
|
|
|
|
*
|
|
|
|
*/
|
2002-02-02 05:09:19 +00:00
|
|
|
MetaColorSpec*
|
|
|
|
meta_color_spec_new (MetaColorSpecType type)
|
|
|
|
{
|
|
|
|
MetaColorSpec *spec;
|
|
|
|
MetaColorSpec dummy;
|
|
|
|
int size;
|
|
|
|
|
|
|
|
size = G_STRUCT_OFFSET (MetaColorSpec, data);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case META_COLOR_SPEC_BASIC:
|
|
|
|
size += sizeof (dummy.data.basic);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_COLOR_SPEC_GTK:
|
|
|
|
size += sizeof (dummy.data.gtk);
|
|
|
|
break;
|
|
|
|
|
2011-05-04 14:13:55 +00:00
|
|
|
case META_COLOR_SPEC_GTK_CUSTOM:
|
|
|
|
size += sizeof (dummy.data.gtkcustom);
|
|
|
|
break;
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_COLOR_SPEC_BLEND:
|
|
|
|
size += sizeof (dummy.data.blend);
|
|
|
|
break;
|
2002-06-06 04:00:22 +00:00
|
|
|
|
|
|
|
case META_COLOR_SPEC_SHADE:
|
|
|
|
size += sizeof (dummy.data.shade);
|
|
|
|
break;
|
2002-02-02 05:09:19 +00:00
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
spec = g_malloc0 (size);
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
spec->type = type;
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
return spec;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_color_spec_free (MetaColorSpec *spec)
|
|
|
|
{
|
|
|
|
g_return_if_fail (spec != NULL);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
switch (spec->type)
|
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
case META_COLOR_SPEC_BASIC:
|
|
|
|
DEBUG_FILL_STRUCT (&spec->data.basic);
|
2002-02-02 05:09:19 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case META_COLOR_SPEC_GTK:
|
2002-02-07 03:07:56 +00:00
|
|
|
DEBUG_FILL_STRUCT (&spec->data.gtk);
|
2002-02-02 05:09:19 +00:00
|
|
|
break;
|
|
|
|
|
2011-05-04 14:13:55 +00:00
|
|
|
case META_COLOR_SPEC_GTK_CUSTOM:
|
|
|
|
if (spec->data.gtkcustom.color_name)
|
|
|
|
g_free (spec->data.gtkcustom.color_name);
|
|
|
|
if (spec->data.gtkcustom.fallback)
|
|
|
|
meta_color_spec_free (spec->data.gtkcustom.fallback);
|
|
|
|
DEBUG_FILL_STRUCT (&spec->data.gtkcustom);
|
|
|
|
break;
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_COLOR_SPEC_BLEND:
|
|
|
|
if (spec->data.blend.foreground)
|
2002-02-07 03:07:56 +00:00
|
|
|
meta_color_spec_free (spec->data.blend.foreground);
|
2002-02-02 05:09:19 +00:00
|
|
|
if (spec->data.blend.background)
|
|
|
|
meta_color_spec_free (spec->data.blend.background);
|
2002-02-07 03:07:56 +00:00
|
|
|
DEBUG_FILL_STRUCT (&spec->data.blend);
|
2002-02-02 05:09:19 +00:00
|
|
|
break;
|
2002-06-06 04:00:22 +00:00
|
|
|
|
|
|
|
case META_COLOR_SPEC_SHADE:
|
|
|
|
if (spec->data.shade.base)
|
|
|
|
meta_color_spec_free (spec->data.shade.base);
|
|
|
|
DEBUG_FILL_STRUCT (&spec->data.shade);
|
|
|
|
break;
|
2002-02-02 05:09:19 +00:00
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
g_free (spec);
|
|
|
|
}
|
|
|
|
|
2010-09-01 19:39:53 +00:00
|
|
|
/**
|
|
|
|
* meta_color_spec_new_from_string: (skip)
|
|
|
|
*
|
|
|
|
*/
|
2002-02-02 05:09:19 +00:00
|
|
|
MetaColorSpec*
|
|
|
|
meta_color_spec_new_from_string (const char *str,
|
|
|
|
GError **err)
|
|
|
|
{
|
|
|
|
MetaColorSpec *spec;
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
spec = NULL;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2011-05-04 14:13:55 +00:00
|
|
|
if (str[0] == 'g' && str[1] == 't' && str[2] == 'k' && str[3] == ':' &&
|
|
|
|
str[4] == 'c' && str[5] == 'u' && str[6] == 's' && str[7] == 't' &&
|
|
|
|
str[8] == 'o' && str[9] == 'm')
|
|
|
|
{
|
|
|
|
const char *color_name_start, *fallback_str_start, *end;
|
2011-08-07 16:55:30 +00:00
|
|
|
char *color_name;
|
2011-05-04 14:13:55 +00:00
|
|
|
MetaColorSpec *fallback = NULL;
|
2011-08-07 16:55:30 +00:00
|
|
|
static gboolean debug, debug_set = FALSE;
|
|
|
|
|
|
|
|
if (!debug_set)
|
|
|
|
{
|
|
|
|
debug = g_getenv ("MUTTER_DISABLE_FALLBACK_COLOR") != NULL;
|
|
|
|
debug_set = TRUE;
|
|
|
|
}
|
2011-05-04 14:13:55 +00:00
|
|
|
|
|
|
|
if (str[10] != '(')
|
|
|
|
{
|
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
|
|
|
_("GTK custom color specification must have color name and fallback in parentheses, e.g. gtk:custom(foo,bar); could not parse \"%s\""),
|
|
|
|
str);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
color_name_start = str + 11;
|
|
|
|
|
|
|
|
fallback_str_start = color_name_start;
|
|
|
|
while (*fallback_str_start && *fallback_str_start != ',')
|
|
|
|
{
|
|
|
|
if (!(g_ascii_isalnum (*fallback_str_start)
|
|
|
|
|| *fallback_str_start == '-'
|
|
|
|
|| *fallback_str_start == '_'))
|
|
|
|
{
|
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
|
|
|
_("Invalid character '%c' in color_name parameter of gtk:custom, only A-Za-z0-9-_ are valid"),
|
|
|
|
*fallback_str_start);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
fallback_str_start++;
|
|
|
|
}
|
|
|
|
fallback_str_start++;
|
|
|
|
|
|
|
|
end = strrchr (str, ')');
|
|
|
|
|
|
|
|
if (color_name_start == NULL || fallback_str_start == NULL || end == NULL)
|
|
|
|
{
|
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
|
|
|
_("Gtk:custom format is \"gtk:custom(color_name,fallback)\", \"%s\" does not fit the format"),
|
|
|
|
str);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-08-07 16:55:30 +00:00
|
|
|
if (!debug)
|
|
|
|
{
|
|
|
|
char *fallback_str;
|
|
|
|
fallback_str = g_strndup (fallback_str_start,
|
|
|
|
end - fallback_str_start);
|
|
|
|
fallback = meta_color_spec_new_from_string (fallback_str, err);
|
|
|
|
g_free (fallback_str);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fallback = meta_color_spec_new_from_string ("pink", err);
|
|
|
|
}
|
2011-05-04 14:13:55 +00:00
|
|
|
|
|
|
|
if (fallback == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
color_name = g_strndup (color_name_start,
|
|
|
|
fallback_str_start - color_name_start - 1);
|
|
|
|
|
|
|
|
spec = meta_color_spec_new (META_COLOR_SPEC_GTK_CUSTOM);
|
|
|
|
spec->data.gtkcustom.color_name = color_name;
|
|
|
|
spec->data.gtkcustom.fallback = fallback;
|
|
|
|
}
|
|
|
|
else if (str[0] == 'g' && str[1] == 't' && str[2] == 'k' && str[3] == ':')
|
2002-02-07 03:07:56 +00:00
|
|
|
{
|
|
|
|
/* GTK color */
|
|
|
|
const char *bracket;
|
|
|
|
const char *end_bracket;
|
|
|
|
char *tmp;
|
2011-05-18 21:32:44 +00:00
|
|
|
GtkStateFlags state;
|
2002-02-07 03:07:56 +00:00
|
|
|
MetaGtkColorComponent component;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
bracket = str;
|
|
|
|
while (*bracket && *bracket != '[')
|
|
|
|
++bracket;
|
|
|
|
|
|
|
|
if (*bracket == '\0')
|
|
|
|
{
|
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
|
|
|
_("GTK color specification must have the state in brackets, e.g. gtk:fg[NORMAL] where NORMAL is the state; could not parse \"%s\""),
|
|
|
|
str);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
end_bracket = bracket;
|
|
|
|
++end_bracket;
|
|
|
|
while (*end_bracket && *end_bracket != ']')
|
|
|
|
++end_bracket;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
if (*end_bracket == '\0')
|
|
|
|
{
|
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
|
|
|
_("GTK color specification must have a close bracket after the state, e.g. gtk:fg[NORMAL] where NORMAL is the state; could not parse \"%s\""),
|
|
|
|
str);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp = g_strndup (bracket + 1, end_bracket - bracket - 1);
|
|
|
|
state = meta_gtk_state_from_string (tmp);
|
|
|
|
if (((int) state) == -1)
|
|
|
|
{
|
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
|
|
|
_("Did not understand state \"%s\" in color specification"),
|
|
|
|
tmp);
|
|
|
|
g_free (tmp);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
g_free (tmp);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
tmp = g_strndup (str + 4, bracket - str - 4);
|
|
|
|
component = meta_color_component_from_string (tmp);
|
|
|
|
if (component == META_GTK_COLOR_LAST)
|
|
|
|
{
|
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
|
|
|
_("Did not understand color component \"%s\" in color specification"),
|
|
|
|
tmp);
|
|
|
|
g_free (tmp);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
g_free (tmp);
|
|
|
|
|
|
|
|
spec = meta_color_spec_new (META_COLOR_SPEC_GTK);
|
|
|
|
spec->data.gtk.state = state;
|
|
|
|
spec->data.gtk.component = component;
|
|
|
|
g_assert (spec->data.gtk.component < META_GTK_COLOR_LAST);
|
|
|
|
}
|
|
|
|
else if (str[0] == 'b' && str[1] == 'l' && str[2] == 'e' && str[3] == 'n' &&
|
|
|
|
str[4] == 'd' && str[5] == '/')
|
|
|
|
{
|
|
|
|
/* blend */
|
|
|
|
char **split;
|
|
|
|
double alpha;
|
|
|
|
char *end;
|
|
|
|
MetaColorSpec *fg;
|
|
|
|
MetaColorSpec *bg;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
split = g_strsplit (str, "/", 4);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
if (split[0] == NULL || split[1] == NULL ||
|
|
|
|
split[2] == NULL || split[3] == NULL)
|
|
|
|
{
|
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
|
|
|
_("Blend format is \"blend/bg_color/fg_color/alpha\", \"%s\" does not fit the format"),
|
|
|
|
str);
|
|
|
|
g_strfreev (split);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
alpha = g_ascii_strtod (split[3], &end);
|
|
|
|
if (end == split[3])
|
|
|
|
{
|
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
|
|
|
_("Could not parse alpha value \"%s\" in blended color"),
|
|
|
|
split[3]);
|
|
|
|
g_strfreev (split);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (alpha < (0.0 - 1e6) || alpha > (1.0 + 1e6))
|
|
|
|
{
|
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
|
|
|
_("Alpha value \"%s\" in blended color is not between 0.0 and 1.0"),
|
|
|
|
split[3]);
|
|
|
|
g_strfreev (split);
|
|
|
|
return NULL;
|
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
fg = NULL;
|
|
|
|
bg = NULL;
|
|
|
|
|
|
|
|
bg = meta_color_spec_new_from_string (split[1], err);
|
|
|
|
if (bg == NULL)
|
|
|
|
{
|
|
|
|
g_strfreev (split);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
fg = meta_color_spec_new_from_string (split[2], err);
|
|
|
|
if (fg == NULL)
|
|
|
|
{
|
|
|
|
meta_color_spec_free (bg);
|
|
|
|
g_strfreev (split);
|
|
|
|
return NULL;
|
|
|
|
}
|
2002-02-02 05:09:19 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
g_strfreev (split);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
spec = meta_color_spec_new (META_COLOR_SPEC_BLEND);
|
|
|
|
spec->data.blend.alpha = alpha;
|
|
|
|
spec->data.blend.background = bg;
|
|
|
|
spec->data.blend.foreground = fg;
|
|
|
|
}
|
2002-06-06 04:00:22 +00:00
|
|
|
else if (str[0] == 's' && str[1] == 'h' && str[2] == 'a' && str[3] == 'd' &&
|
|
|
|
str[4] == 'e' && str[5] == '/')
|
|
|
|
{
|
|
|
|
/* shade */
|
|
|
|
char **split;
|
|
|
|
double factor;
|
|
|
|
char *end;
|
|
|
|
MetaColorSpec *base;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
split = g_strsplit (str, "/", 3);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
if (split[0] == NULL || split[1] == NULL ||
|
|
|
|
split[2] == NULL)
|
|
|
|
{
|
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
|
|
|
_("Shade format is \"shade/base_color/factor\", \"%s\" does not fit the format"),
|
|
|
|
str);
|
|
|
|
g_strfreev (split);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
factor = g_ascii_strtod (split[2], &end);
|
|
|
|
if (end == split[2])
|
|
|
|
{
|
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
|
|
|
_("Could not parse shade factor \"%s\" in shaded color"),
|
|
|
|
split[2]);
|
|
|
|
g_strfreev (split);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (factor < (0.0 - 1e6))
|
|
|
|
{
|
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
|
|
|
_("Shade factor \"%s\" in shaded color is negative"),
|
|
|
|
split[2]);
|
|
|
|
g_strfreev (split);
|
|
|
|
return NULL;
|
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
base = NULL;
|
|
|
|
|
|
|
|
base = meta_color_spec_new_from_string (split[1], err);
|
|
|
|
if (base == NULL)
|
|
|
|
{
|
|
|
|
g_strfreev (split);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_strfreev (split);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
spec = meta_color_spec_new (META_COLOR_SPEC_SHADE);
|
|
|
|
spec->data.shade.factor = factor;
|
|
|
|
spec->data.shade.base = base;
|
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
spec = meta_color_spec_new (META_COLOR_SPEC_BASIC);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2011-05-17 18:50:40 +00:00
|
|
|
if (!gdk_rgba_parse (&spec->data.basic.color, str))
|
2002-02-07 03:07:56 +00:00
|
|
|
{
|
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
|
|
|
_("Could not parse color \"%s\""),
|
|
|
|
str);
|
|
|
|
meta_color_spec_free (spec);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_assert (spec);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
return spec;
|
|
|
|
}
|
|
|
|
|
2010-09-01 19:39:53 +00:00
|
|
|
/**
|
|
|
|
* meta_color_spec_new_gtk: (skip)
|
|
|
|
*
|
|
|
|
*/
|
2002-02-02 05:09:19 +00:00
|
|
|
MetaColorSpec*
|
|
|
|
meta_color_spec_new_gtk (MetaGtkColorComponent component,
|
2011-05-18 21:32:44 +00:00
|
|
|
GtkStateFlags state)
|
2002-02-02 05:09:19 +00:00
|
|
|
{
|
|
|
|
MetaColorSpec *spec;
|
|
|
|
|
|
|
|
spec = meta_color_spec_new (META_COLOR_SPEC_GTK);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
spec->data.gtk.component = component;
|
|
|
|
spec->data.gtk.state = state;
|
|
|
|
|
|
|
|
return spec;
|
|
|
|
}
|
|
|
|
|
2011-03-24 15:45:08 +00:00
|
|
|
/* Based on set_color() in gtkstyle.c */
|
|
|
|
#define LIGHTNESS_MULT 1.3
|
|
|
|
#define DARKNESS_MULT 0.7
|
2011-05-18 19:22:03 +00:00
|
|
|
void
|
|
|
|
meta_gtk_style_get_light_color (GtkStyleContext *style,
|
|
|
|
GtkStateFlags state,
|
|
|
|
GdkRGBA *color)
|
|
|
|
{
|
|
|
|
gtk_style_context_get_background_color (style, state, color);
|
|
|
|
gtk_style_shade (color, color, LIGHTNESS_MULT);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_gtk_style_get_dark_color (GtkStyleContext *style,
|
|
|
|
GtkStateFlags state,
|
|
|
|
GdkRGBA *color)
|
|
|
|
{
|
|
|
|
gtk_style_context_get_background_color (style, state, color);
|
|
|
|
gtk_style_shade (color, color, DARKNESS_MULT);
|
|
|
|
}
|
|
|
|
|
2011-03-24 15:45:08 +00:00
|
|
|
static void
|
2011-05-17 18:50:40 +00:00
|
|
|
meta_set_color_from_style (GdkRGBA *color,
|
2011-03-24 15:45:08 +00:00
|
|
|
GtkStyleContext *context,
|
2011-05-18 21:32:44 +00:00
|
|
|
GtkStateFlags state,
|
2011-03-24 15:45:08 +00:00
|
|
|
MetaGtkColorComponent component)
|
|
|
|
{
|
2011-05-18 19:22:03 +00:00
|
|
|
GdkRGBA other;
|
2011-03-24 15:45:08 +00:00
|
|
|
|
|
|
|
switch (component)
|
|
|
|
{
|
|
|
|
case META_GTK_COLOR_BG:
|
|
|
|
case META_GTK_COLOR_BASE:
|
2011-05-18 21:32:44 +00:00
|
|
|
gtk_style_context_get_background_color (context, state, color);
|
2011-03-24 15:45:08 +00:00
|
|
|
break;
|
|
|
|
case META_GTK_COLOR_FG:
|
|
|
|
case META_GTK_COLOR_TEXT:
|
2011-05-18 21:32:44 +00:00
|
|
|
gtk_style_context_get_color (context, state, color);
|
2011-05-18 19:22:03 +00:00
|
|
|
break;
|
2011-03-24 15:45:08 +00:00
|
|
|
case META_GTK_COLOR_TEXT_AA:
|
2011-05-18 21:32:44 +00:00
|
|
|
gtk_style_context_get_color (context, state, color);
|
2011-05-18 19:22:03 +00:00
|
|
|
meta_set_color_from_style (&other, context, state, META_GTK_COLOR_BASE);
|
|
|
|
|
|
|
|
color->red = (color->red + other.red) / 2;
|
|
|
|
color->green = (color->green + other.green) / 2;
|
|
|
|
color->blue = (color->blue + other.blue) / 2;
|
|
|
|
break;
|
|
|
|
case META_GTK_COLOR_MID:
|
2011-05-18 21:32:44 +00:00
|
|
|
meta_gtk_style_get_light_color (context, state, color);
|
|
|
|
meta_gtk_style_get_dark_color (context, state, &other);
|
2011-05-18 19:22:03 +00:00
|
|
|
|
|
|
|
color->red = (color->red + other.red) / 2;
|
|
|
|
color->green = (color->green + other.green) / 2;
|
|
|
|
color->blue = (color->blue + other.blue) / 2;
|
|
|
|
break;
|
|
|
|
case META_GTK_COLOR_LIGHT:
|
2011-05-18 21:32:44 +00:00
|
|
|
meta_gtk_style_get_light_color (context, state, color);
|
2011-05-18 19:22:03 +00:00
|
|
|
break;
|
|
|
|
case META_GTK_COLOR_DARK:
|
2011-05-18 21:32:44 +00:00
|
|
|
meta_gtk_style_get_dark_color (context, state, color);
|
2011-03-24 15:45:08 +00:00
|
|
|
break;
|
|
|
|
case META_GTK_COLOR_LAST:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-04 14:13:55 +00:00
|
|
|
static void
|
|
|
|
meta_set_custom_color_from_style (GdkRGBA *color,
|
|
|
|
GtkStyleContext *context,
|
|
|
|
char *color_name,
|
|
|
|
MetaColorSpec *fallback)
|
|
|
|
{
|
|
|
|
if (!gtk_style_context_lookup_color (context, color_name, color))
|
|
|
|
meta_color_spec_render (fallback, context, color);
|
|
|
|
}
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
void
|
2011-03-18 15:42:41 +00:00
|
|
|
meta_color_spec_render (MetaColorSpec *spec,
|
|
|
|
GtkStyleContext *context,
|
2011-05-17 18:50:40 +00:00
|
|
|
GdkRGBA *color)
|
2002-02-02 05:09:19 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (spec != NULL);
|
2011-03-18 15:42:41 +00:00
|
|
|
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
switch (spec->type)
|
|
|
|
{
|
|
|
|
case META_COLOR_SPEC_BASIC:
|
|
|
|
*color = spec->data.basic.color;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_COLOR_SPEC_GTK:
|
2011-03-24 15:45:08 +00:00
|
|
|
meta_set_color_from_style (color,
|
|
|
|
context,
|
|
|
|
spec->data.gtk.state,
|
|
|
|
spec->data.gtk.component);
|
2002-02-02 05:09:19 +00:00
|
|
|
break;
|
|
|
|
|
2011-05-04 14:13:55 +00:00
|
|
|
case META_COLOR_SPEC_GTK_CUSTOM:
|
|
|
|
meta_set_custom_color_from_style (color,
|
|
|
|
context,
|
|
|
|
spec->data.gtkcustom.color_name,
|
|
|
|
spec->data.gtkcustom.fallback);
|
|
|
|
break;
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_COLOR_SPEC_BLEND:
|
|
|
|
{
|
2011-05-17 18:50:40 +00:00
|
|
|
GdkRGBA bg, fg;
|
2002-02-02 05:09:19 +00:00
|
|
|
|
2011-03-18 15:42:41 +00:00
|
|
|
meta_color_spec_render (spec->data.blend.background, context, &bg);
|
|
|
|
meta_color_spec_render (spec->data.blend.foreground, context, &fg);
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
2014-05-02 13:34:02 +00:00
|
|
|
color_composite (&bg, &fg, spec->data.blend.alpha,
|
2008-05-13 12:53:36 +00:00
|
|
|
&spec->data.blend.color);
|
2002-02-02 05:09:19 +00:00
|
|
|
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
*color = spec->data.blend.color;
|
2002-02-02 05:09:19 +00:00
|
|
|
}
|
|
|
|
break;
|
2002-06-06 04:00:22 +00:00
|
|
|
|
|
|
|
case META_COLOR_SPEC_SHADE:
|
|
|
|
{
|
2011-03-18 15:42:41 +00:00
|
|
|
meta_color_spec_render (spec->data.shade.base, context,
|
2008-05-13 12:53:36 +00:00
|
|
|
&spec->data.shade.color);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
|
|
|
gtk_style_shade (&spec->data.shade.color,
|
2008-05-13 12:53:36 +00:00
|
|
|
&spec->data.shade.color, spec->data.shade.factor);
|
2002-06-06 04:00:22 +00:00
|
|
|
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
*color = spec->data.shade.color;
|
2002-06-06 04:00:22 +00:00
|
|
|
}
|
|
|
|
break;
|
2002-02-02 05:09:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-17 03:49:24 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* op_name:
|
|
|
|
* @type: an operation, such as addition
|
|
|
|
*
|
2008-01-17 03:49:24 +00:00
|
|
|
* Represents an operation as a string.
|
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* Returns: a string, such as "+"
|
2008-01-17 03:49:24 +00:00
|
|
|
*/
|
2002-02-07 03:07:56 +00:00
|
|
|
static const char*
|
|
|
|
op_name (PosOperatorType type)
|
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case POS_OP_ADD:
|
|
|
|
return "+";
|
|
|
|
case POS_OP_SUBTRACT:
|
|
|
|
return "-";
|
|
|
|
case POS_OP_MULTIPLY:
|
|
|
|
return "*";
|
|
|
|
case POS_OP_DIVIDE:
|
|
|
|
return "/";
|
|
|
|
case POS_OP_MOD:
|
|
|
|
return "%";
|
|
|
|
case POS_OP_MAX:
|
|
|
|
return "`max`";
|
|
|
|
case POS_OP_MIN:
|
|
|
|
return "`min`";
|
|
|
|
case POS_OP_NONE:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return "<unknown>";
|
|
|
|
}
|
|
|
|
|
2008-01-17 03:49:24 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* op_from_string:
|
|
|
|
* @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.
|
|
|
|
*
|
2008-01-17 03:49:24 +00:00
|
|
|
* Parses a string and returns an operation.
|
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* Returns: the operation found. If none was, returns %POS_OP_NONE.
|
2008-01-17 03:49:24 +00:00
|
|
|
*/
|
2002-02-07 03:07:56 +00:00
|
|
|
static PosOperatorType
|
|
|
|
op_from_string (const char *p,
|
|
|
|
int *len)
|
|
|
|
{
|
|
|
|
*len = 0;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
switch (*p)
|
|
|
|
{
|
|
|
|
case '+':
|
|
|
|
*len = 1;
|
|
|
|
return POS_OP_ADD;
|
|
|
|
case '-':
|
|
|
|
*len = 1;
|
|
|
|
return POS_OP_SUBTRACT;
|
|
|
|
case '*':
|
|
|
|
*len = 1;
|
|
|
|
return POS_OP_MULTIPLY;
|
|
|
|
case '/':
|
|
|
|
*len = 1;
|
|
|
|
return POS_OP_DIVIDE;
|
|
|
|
case '%':
|
|
|
|
*len = 1;
|
|
|
|
return POS_OP_MOD;
|
|
|
|
|
|
|
|
case '`':
|
|
|
|
if (p[0] == '`' &&
|
|
|
|
p[1] == 'm' &&
|
|
|
|
p[2] == 'a' &&
|
|
|
|
p[3] == 'x' &&
|
|
|
|
p[4] == '`')
|
|
|
|
{
|
|
|
|
*len = 5;
|
|
|
|
return POS_OP_MAX;
|
|
|
|
}
|
|
|
|
else if (p[0] == '`' &&
|
|
|
|
p[1] == 'm' &&
|
|
|
|
p[2] == 'i' &&
|
|
|
|
p[3] == 'n' &&
|
|
|
|
p[4] == '`')
|
|
|
|
{
|
|
|
|
*len = 5;
|
|
|
|
return POS_OP_MIN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return POS_OP_NONE;
|
|
|
|
}
|
|
|
|
|
2008-01-17 03:49:24 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* free_tokens:
|
|
|
|
* @tokens: an array of tokens to be freed
|
|
|
|
* @n_tokens: how many tokens are in the array.
|
|
|
|
*
|
2008-01-17 03:49:24 +00:00
|
|
|
* Frees an array of tokens. All the tokens and their associated memory
|
|
|
|
* will be freed.
|
|
|
|
*/
|
2002-01-28 02:09:12 +00:00
|
|
|
static void
|
|
|
|
free_tokens (PosToken *tokens,
|
|
|
|
int n_tokens)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* n_tokens can be 0 since tokens may have been allocated more than
|
|
|
|
* it was initialized
|
|
|
|
*/
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2006-04-18 17:18:53 +00:00
|
|
|
for (i = 0; i < n_tokens; i++)
|
|
|
|
if (tokens[i].type == POS_TOKEN_VARIABLE)
|
|
|
|
g_free (tokens[i].d.v.name);
|
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
g_free (tokens);
|
|
|
|
}
|
|
|
|
|
2008-01-17 03:49:24 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* parse_number:
|
|
|
|
* @p: a pointer into a string representing an operation; part of an
|
2008-01-17 03:49:24 +00:00
|
|
|
* expression somewhere, so not null-terminated
|
2011-11-02 15:34:45 +00:00
|
|
|
* @end_return: set to a pointer to the end of the number found; but
|
2008-01-17 03:49:24 +00:00
|
|
|
* not updated if no number was found at all
|
2011-11-02 15:34:45 +00:00
|
|
|
* @next: set to either an integer or a float token
|
|
|
|
* @err: (out): set to the problem if there was a problem
|
|
|
|
*
|
|
|
|
* Tokenises a number in an expression.
|
|
|
|
*
|
|
|
|
* FIXME: The "while (*start)..." part: what's wrong with strchr-ish things?
|
|
|
|
* FIXME: The name is wrong: it doesn't parse anything.
|
2008-01-17 03:49:24 +00:00
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* Returns: %TRUE if a valid number was found, FALSE otherwise (and "err" will
|
|
|
|
* have been set)
|
2008-01-17 03:49:24 +00:00
|
|
|
*/
|
2002-01-28 02:09:12 +00:00
|
|
|
static gboolean
|
|
|
|
parse_number (const char *p,
|
|
|
|
const char **end_return,
|
|
|
|
PosToken *next,
|
|
|
|
GError **err)
|
|
|
|
{
|
|
|
|
const char *start = p;
|
|
|
|
char *end;
|
|
|
|
gboolean is_float;
|
|
|
|
char *num_str;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
while (*p && (*p == '.' || g_ascii_isdigit (*p)))
|
|
|
|
++p;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
if (p == start)
|
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
char buf[7] = { '\0' };
|
|
|
|
buf[g_unichar_to_utf8 (g_utf8_get_char (p), buf)] = '\0';
|
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_BAD_CHARACTER,
|
|
|
|
_("Coordinate expression contains character '%s' which is not allowed"),
|
|
|
|
buf);
|
2002-01-28 02:09:12 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
*end_return = p;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
/* we need this to exclude floats like "1e6" */
|
|
|
|
num_str = g_strndup (start, p - start);
|
|
|
|
start = num_str;
|
|
|
|
is_float = FALSE;
|
|
|
|
while (*start)
|
|
|
|
{
|
|
|
|
if (*start == '.')
|
|
|
|
is_float = TRUE;
|
|
|
|
++start;
|
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
if (is_float)
|
|
|
|
{
|
|
|
|
next->type = POS_TOKEN_DOUBLE;
|
|
|
|
next->d.d.val = g_ascii_strtod (num_str, &end);
|
|
|
|
|
|
|
|
if (end == num_str)
|
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
2002-01-28 02:09:12 +00:00
|
|
|
_("Coordinate expression contains floating point number '%s' which could not be parsed"),
|
|
|
|
num_str);
|
|
|
|
g_free (num_str);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
next->type = POS_TOKEN_INT;
|
|
|
|
next->d.i.val = strtol (num_str, &end, 10);
|
|
|
|
if (end == num_str)
|
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
2002-01-28 02:09:12 +00:00
|
|
|
_("Coordinate expression contains integer '%s' which could not be parsed"),
|
|
|
|
num_str);
|
|
|
|
g_free (num_str);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (num_str);
|
|
|
|
|
|
|
|
g_assert (next->type == POS_TOKEN_INT || next->type == POS_TOKEN_DOUBLE);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-11-02 15:34:45 +00:00
|
|
|
/*
|
2008-01-17 03:49:24 +00:00
|
|
|
* Whether a variable can validly appear as part of the name of a variable.
|
|
|
|
*/
|
2002-02-07 03:07:56 +00:00
|
|
|
#define IS_VARIABLE_CHAR(c) (g_ascii_isalpha ((c)) || (c) == '_')
|
|
|
|
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
#if 0
|
|
|
|
static void
|
|
|
|
debug_print_tokens (PosToken *tokens,
|
|
|
|
int n_tokens)
|
|
|
|
{
|
|
|
|
int i;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
for (i = 0; i < n_tokens; i++)
|
|
|
|
{
|
|
|
|
PosToken *t = &tokens[i];
|
|
|
|
|
|
|
|
g_print (" ");
|
|
|
|
|
|
|
|
switch (t->type)
|
|
|
|
{
|
|
|
|
case POS_TOKEN_INT:
|
|
|
|
g_print ("\"%d\"", t->d.i.val);
|
|
|
|
break;
|
|
|
|
case POS_TOKEN_DOUBLE:
|
|
|
|
g_print ("\"%g\"", t->d.d.val);
|
|
|
|
break;
|
|
|
|
case POS_TOKEN_OPEN_PAREN:
|
|
|
|
g_print ("\"(\"");
|
|
|
|
break;
|
|
|
|
case POS_TOKEN_CLOSE_PAREN:
|
|
|
|
g_print ("\")\"");
|
|
|
|
break;
|
|
|
|
case POS_TOKEN_VARIABLE:
|
|
|
|
g_print ("\"%s\"", t->d.v.name);
|
|
|
|
break;
|
|
|
|
case POS_TOKEN_OPERATOR:
|
|
|
|
g_print ("\"%s\"", op_name (t->d.o.op));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_print ("\n");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-01-17 03:49:24 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* pos_tokenize:
|
|
|
|
* @expr: The expression
|
2013-05-03 21:31:12 +00:00
|
|
|
* @tokens_p: (out): The resulting tokens
|
2011-11-02 15:34:45 +00:00
|
|
|
* @n_tokens_p: (out): The number of resulting tokens
|
|
|
|
* @err: (out): set to the problem if there was a problem
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2008-01-17 03:49:24 +00:00
|
|
|
* Tokenises an expression.
|
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* Returns: %TRUE if the expression was successfully tokenised; %FALSE otherwise.
|
2008-01-17 03:49:24 +00:00
|
|
|
*/
|
2002-01-28 02:09:12 +00:00
|
|
|
static gboolean
|
|
|
|
pos_tokenize (const char *expr,
|
|
|
|
PosToken **tokens_p,
|
|
|
|
int *n_tokens_p,
|
|
|
|
GError **err)
|
|
|
|
{
|
|
|
|
PosToken *tokens;
|
|
|
|
int n_tokens;
|
|
|
|
int allocated;
|
|
|
|
const char *p;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
*tokens_p = NULL;
|
|
|
|
*n_tokens_p = 0;
|
|
|
|
|
|
|
|
allocated = 3;
|
|
|
|
n_tokens = 0;
|
|
|
|
tokens = g_new (PosToken, allocated);
|
|
|
|
|
|
|
|
p = expr;
|
|
|
|
while (*p)
|
|
|
|
{
|
|
|
|
PosToken *next;
|
2002-02-07 03:07:56 +00:00
|
|
|
int len;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
if (n_tokens == allocated)
|
|
|
|
{
|
|
|
|
allocated *= 2;
|
|
|
|
tokens = g_renew (PosToken, tokens, allocated);
|
|
|
|
}
|
|
|
|
|
|
|
|
next = &tokens[n_tokens];
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
switch (*p)
|
|
|
|
{
|
|
|
|
case '*':
|
|
|
|
case '/':
|
|
|
|
case '+':
|
|
|
|
case '-': /* negative numbers aren't allowed so this is easy */
|
2002-02-02 05:09:19 +00:00
|
|
|
case '%':
|
2002-02-07 03:07:56 +00:00
|
|
|
case '`':
|
2002-01-28 02:09:12 +00:00
|
|
|
next->type = POS_TOKEN_OPERATOR;
|
2002-02-07 03:07:56 +00:00
|
|
|
next->d.o.op = op_from_string (p, &len);
|
|
|
|
if (next->d.o.op != POS_OP_NONE)
|
|
|
|
{
|
|
|
|
++n_tokens;
|
|
|
|
p = p + (len - 1); /* -1 since we ++p later */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
|
|
|
_("Coordinate expression contained unknown operator at the start of this text: \"%s\""),
|
|
|
|
p);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
goto error;
|
|
|
|
}
|
2002-01-28 02:09:12 +00:00
|
|
|
break;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
case '(':
|
|
|
|
next->type = POS_TOKEN_OPEN_PAREN;
|
|
|
|
++n_tokens;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ')':
|
|
|
|
next->type = POS_TOKEN_CLOSE_PAREN;
|
|
|
|
++n_tokens;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ' ':
|
|
|
|
case '\t':
|
2014-05-02 13:34:02 +00:00
|
|
|
case '\n':
|
2002-01-28 02:09:12 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2002-02-07 03:07:56 +00:00
|
|
|
if (IS_VARIABLE_CHAR (*p))
|
2002-01-28 02:09:12 +00:00
|
|
|
{
|
|
|
|
/* Assume variable */
|
|
|
|
const char *start = p;
|
2002-02-07 03:07:56 +00:00
|
|
|
while (*p && IS_VARIABLE_CHAR (*p))
|
2002-01-28 02:09:12 +00:00
|
|
|
++p;
|
|
|
|
g_assert (p != start);
|
|
|
|
next->type = POS_TOKEN_VARIABLE;
|
|
|
|
next->d.v.name = g_strndup (start, p - start);
|
|
|
|
++n_tokens;
|
|
|
|
--p; /* since we ++p again at the end of while loop */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Assume number */
|
|
|
|
const char *end;
|
|
|
|
|
|
|
|
if (!parse_number (p, &end, next, err))
|
|
|
|
goto error;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
++n_tokens;
|
|
|
|
p = end - 1; /* -1 since we ++p again at the end of while loop */
|
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
++p;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (n_tokens == 0)
|
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
2002-01-28 02:09:12 +00:00
|
|
|
_("Coordinate expression was empty or not understood"));
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
*tokens_p = tokens;
|
|
|
|
*n_tokens_p = n_tokens;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
error:
|
|
|
|
g_assert (err == NULL || *err != NULL);
|
|
|
|
|
|
|
|
free_tokens (tokens, n_tokens);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-01-22 04:00:35 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* PosExprType:
|
|
|
|
*
|
2008-01-22 04:00:35 +00:00
|
|
|
* The type of a PosExpr: either integer, double, or an operation.
|
|
|
|
*/
|
2002-01-28 02:09:12 +00:00
|
|
|
typedef enum
|
2002-02-07 03:07:56 +00:00
|
|
|
{
|
2002-01-28 02:09:12 +00:00
|
|
|
POS_EXPR_INT,
|
|
|
|
POS_EXPR_DOUBLE,
|
|
|
|
POS_EXPR_OPERATOR
|
|
|
|
} PosExprType;
|
|
|
|
|
2008-01-17 03:49:24 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* PosExpr:
|
|
|
|
*
|
2008-01-22 04:00:35 +00:00
|
|
|
* Type and value of an expression in a parsed sequence. We don't
|
2011-11-02 15:34:45 +00:00
|
|
|
* keep expressions in a tree; if this is of type %POS_EXPR_OPERATOR,
|
2008-01-22 04:00:35 +00:00
|
|
|
* the arguments of the operator will be in the array positions
|
|
|
|
* immediately preceding and following this operator; they cannot
|
|
|
|
* themselves be operators.
|
2008-01-17 03:49:24 +00:00
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* FIXME: operator is #gchar; it should really be of #PosOperatorType.
|
2008-01-17 03:49:24 +00:00
|
|
|
*/
|
2002-01-28 02:09:12 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
PosExprType type;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
double double_val;
|
|
|
|
int int_val;
|
|
|
|
char operator;
|
|
|
|
} d;
|
|
|
|
} PosExpr;
|
|
|
|
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 23:18:22 +00:00
|
|
|
#if 0
|
2002-01-28 02:09:12 +00:00
|
|
|
static void
|
|
|
|
debug_print_exprs (PosExpr *exprs,
|
|
|
|
int n_exprs)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2006-04-18 17:18:53 +00:00
|
|
|
for (i = 0; i < n_exprs; i++)
|
2002-01-28 02:09:12 +00:00
|
|
|
{
|
|
|
|
switch (exprs[i].type)
|
|
|
|
{
|
|
|
|
case POS_EXPR_INT:
|
|
|
|
g_print (" %d", exprs[i].d.int_val);
|
|
|
|
break;
|
|
|
|
case POS_EXPR_DOUBLE:
|
|
|
|
g_print (" %g", exprs[i].d.double_val);
|
|
|
|
break;
|
|
|
|
case POS_EXPR_OPERATOR:
|
2002-02-07 03:07:56 +00:00
|
|
|
g_print (" %s", op_name (exprs[i].d.operator));
|
2002-01-28 02:09:12 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_print ("\n");
|
|
|
|
}
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 23:18:22 +00:00
|
|
|
#endif
|
2002-01-28 02:09:12 +00:00
|
|
|
|
|
|
|
static gboolean
|
|
|
|
do_operation (PosExpr *a,
|
|
|
|
PosExpr *b,
|
2002-02-07 03:07:56 +00:00
|
|
|
PosOperatorType op,
|
2002-01-28 02:09:12 +00:00
|
|
|
GError **err)
|
|
|
|
{
|
|
|
|
/* Promote types to double if required */
|
|
|
|
if (a->type == POS_EXPR_DOUBLE ||
|
|
|
|
b->type == POS_EXPR_DOUBLE)
|
|
|
|
{
|
|
|
|
if (a->type != POS_EXPR_DOUBLE)
|
|
|
|
{
|
|
|
|
a->type = POS_EXPR_DOUBLE;
|
|
|
|
a->d.double_val = a->d.int_val;
|
|
|
|
}
|
|
|
|
if (b->type != POS_EXPR_DOUBLE)
|
|
|
|
{
|
|
|
|
b->type = POS_EXPR_DOUBLE;
|
|
|
|
b->d.double_val = b->d.int_val;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_assert (a->type == b->type);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
if (a->type == POS_EXPR_INT)
|
|
|
|
{
|
|
|
|
switch (op)
|
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
case POS_OP_MULTIPLY:
|
2002-01-28 02:09:12 +00:00
|
|
|
a->d.int_val = a->d.int_val * b->d.int_val;
|
|
|
|
break;
|
2002-02-07 03:07:56 +00:00
|
|
|
case POS_OP_DIVIDE:
|
2002-01-28 02:09:12 +00:00
|
|
|
if (b->d.int_val == 0)
|
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_DIVIDE_BY_ZERO,
|
2002-01-28 02:09:12 +00:00
|
|
|
_("Coordinate expression results in division by zero"));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
a->d.int_val = a->d.int_val / b->d.int_val;
|
|
|
|
break;
|
2002-02-07 03:07:56 +00:00
|
|
|
case POS_OP_MOD:
|
2002-01-28 02:09:12 +00:00
|
|
|
if (b->d.int_val == 0)
|
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_DIVIDE_BY_ZERO,
|
2002-01-28 02:09:12 +00:00
|
|
|
_("Coordinate expression results in division by zero"));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
a->d.int_val = a->d.int_val % b->d.int_val;
|
|
|
|
break;
|
2002-02-07 03:07:56 +00:00
|
|
|
case POS_OP_ADD:
|
2002-01-28 02:09:12 +00:00
|
|
|
a->d.int_val = a->d.int_val + b->d.int_val;
|
|
|
|
break;
|
2002-02-07 03:07:56 +00:00
|
|
|
case POS_OP_SUBTRACT:
|
2002-01-28 02:09:12 +00:00
|
|
|
a->d.int_val = a->d.int_val - b->d.int_val;
|
|
|
|
break;
|
2002-02-07 03:07:56 +00:00
|
|
|
case POS_OP_MAX:
|
|
|
|
a->d.int_val = MAX (a->d.int_val, b->d.int_val);
|
|
|
|
break;
|
|
|
|
case POS_OP_MIN:
|
|
|
|
a->d.int_val = MIN (a->d.int_val, b->d.int_val);
|
|
|
|
break;
|
|
|
|
case POS_OP_NONE:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
2002-01-28 02:09:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (a->type == POS_EXPR_DOUBLE)
|
|
|
|
{
|
|
|
|
switch (op)
|
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
case POS_OP_MULTIPLY:
|
2002-01-28 02:09:12 +00:00
|
|
|
a->d.double_val = a->d.double_val * b->d.double_val;
|
|
|
|
break;
|
2002-02-07 03:07:56 +00:00
|
|
|
case POS_OP_DIVIDE:
|
2002-01-28 02:09:12 +00:00
|
|
|
if (b->d.double_val == 0.0)
|
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_DIVIDE_BY_ZERO,
|
2002-01-28 02:09:12 +00:00
|
|
|
_("Coordinate expression results in division by zero"));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
a->d.double_val = a->d.double_val / b->d.double_val;
|
|
|
|
break;
|
2002-02-07 03:07:56 +00:00
|
|
|
case POS_OP_MOD:
|
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_MOD_ON_FLOAT,
|
2002-01-28 02:09:12 +00:00
|
|
|
_("Coordinate expression tries to use mod operator on a floating-point number"));
|
|
|
|
return FALSE;
|
2002-02-07 03:07:56 +00:00
|
|
|
case POS_OP_ADD:
|
2002-01-28 02:09:12 +00:00
|
|
|
a->d.double_val = a->d.double_val + b->d.double_val;
|
|
|
|
break;
|
2002-02-07 03:07:56 +00:00
|
|
|
case POS_OP_SUBTRACT:
|
2002-01-28 02:09:12 +00:00
|
|
|
a->d.double_val = a->d.double_val - b->d.double_val;
|
|
|
|
break;
|
2002-02-07 03:07:56 +00:00
|
|
|
case POS_OP_MAX:
|
|
|
|
a->d.double_val = MAX (a->d.double_val, b->d.double_val);
|
|
|
|
break;
|
|
|
|
case POS_OP_MIN:
|
|
|
|
a->d.double_val = MIN (a->d.double_val, b->d.double_val);
|
|
|
|
break;
|
|
|
|
case POS_OP_NONE:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
2002-01-28 02:09:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
do_operations (PosExpr *exprs,
|
|
|
|
int *n_exprs,
|
|
|
|
int precedence,
|
|
|
|
GError **err)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
g_print ("Doing prec %d ops on %d exprs\n", precedence, *n_exprs);
|
|
|
|
debug_print_exprs (exprs, *n_exprs);
|
|
|
|
#endif
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
i = 1;
|
|
|
|
while (i < *n_exprs)
|
|
|
|
{
|
|
|
|
gboolean compress;
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
/* exprs[i-1] first operand
|
2002-01-28 02:09:12 +00:00
|
|
|
* exprs[i] operator
|
|
|
|
* exprs[i+1] second operand
|
|
|
|
*
|
|
|
|
* we replace first operand with result of mul/div/mod,
|
|
|
|
* or skip over operator and second operand if we have
|
|
|
|
* an add/subtract
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (exprs[i-1].type == POS_EXPR_OPERATOR)
|
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
|
|
|
_("Coordinate expression has an operator \"%s\" where an operand was expected"),
|
|
|
|
op_name (exprs[i-1].d.operator));
|
2002-01-28 02:09:12 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
if (exprs[i].type != POS_EXPR_OPERATOR)
|
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
2002-01-28 02:09:12 +00:00
|
|
|
_("Coordinate expression had an operand where an operator was expected"));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == (*n_exprs - 1))
|
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
2002-01-28 02:09:12 +00:00
|
|
|
_("Coordinate expression ended with an operator instead of an operand"));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_assert ((i+1) < *n_exprs);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
if (exprs[i+1].type == POS_EXPR_OPERATOR)
|
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
2002-01-28 02:09:12 +00:00
|
|
|
_("Coordinate expression has operator \"%c\" following operator \"%c\" with no operand in between"),
|
|
|
|
exprs[i+1].d.operator,
|
|
|
|
exprs[i].d.operator);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
compress = FALSE;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
|
|
|
switch (precedence)
|
2002-01-28 02:09:12 +00:00
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
case 2:
|
2002-01-28 02:09:12 +00:00
|
|
|
switch (exprs[i].d.operator)
|
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
case POS_OP_DIVIDE:
|
|
|
|
case POS_OP_MOD:
|
|
|
|
case POS_OP_MULTIPLY:
|
2002-01-28 02:09:12 +00:00
|
|
|
compress = TRUE;
|
|
|
|
if (!do_operation (&exprs[i-1], &exprs[i+1],
|
|
|
|
exprs[i].d.operator,
|
|
|
|
err))
|
|
|
|
return FALSE;
|
|
|
|
break;
|
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
switch (exprs[i].d.operator)
|
|
|
|
{
|
|
|
|
case POS_OP_ADD:
|
|
|
|
case POS_OP_SUBTRACT:
|
|
|
|
compress = TRUE;
|
|
|
|
if (!do_operation (&exprs[i-1], &exprs[i+1],
|
|
|
|
exprs[i].d.operator,
|
|
|
|
err))
|
|
|
|
return FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
/* I have no rationale at all for making these low-precedence */
|
|
|
|
case 0:
|
2002-01-28 02:09:12 +00:00
|
|
|
switch (exprs[i].d.operator)
|
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
case POS_OP_MAX:
|
|
|
|
case POS_OP_MIN:
|
2002-01-28 02:09:12 +00:00
|
|
|
compress = TRUE;
|
|
|
|
if (!do_operation (&exprs[i-1], &exprs[i+1],
|
|
|
|
exprs[i].d.operator,
|
|
|
|
err))
|
|
|
|
return FALSE;
|
|
|
|
break;
|
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
break;
|
2002-01-28 02:09:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (compress)
|
|
|
|
{
|
|
|
|
/* exprs[i-1] first operand (now result)
|
|
|
|
* exprs[i] operator
|
|
|
|
* exprs[i+1] second operand
|
|
|
|
* exprs[i+2] new operator
|
|
|
|
*
|
|
|
|
* we move new operator just after first operand
|
|
|
|
*/
|
|
|
|
if ((i+2) < *n_exprs)
|
|
|
|
{
|
|
|
|
g_memmove (&exprs[i], &exprs[i+2],
|
|
|
|
sizeof (PosExpr) * (*n_exprs - i - 2));
|
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
*n_exprs -= 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Skip operator and next operand */
|
|
|
|
i += 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2008-01-17 03:49:24 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* pos_eval_get_variable:
|
|
|
|
* @t: The token representing a variable
|
|
|
|
* @result: (out): The value of that variable; not set if the token did
|
|
|
|
* not represent a known variable
|
|
|
|
* @env: The environment within which t should be evaluated
|
|
|
|
* @err: (out): set to the problem if there was a problem
|
|
|
|
*
|
2008-01-17 03:49:24 +00:00
|
|
|
* There is a predefined set of variables which can appear in an expression.
|
|
|
|
* Here we take a token representing a variable, and return the current value
|
|
|
|
* of that variable in a particular environment.
|
|
|
|
* (The value is always an integer.)
|
|
|
|
*
|
|
|
|
* There are supposedly some circumstances in which this function can be
|
2011-11-02 15:34:45 +00:00
|
|
|
* called from outside Metacity, in which case env->theme will be %NULL, and
|
2008-01-17 03:49:24 +00:00
|
|
|
* therefore we can't use it to find out quark values, so we do the comparison
|
2011-11-02 15:34:45 +00:00
|
|
|
* using strcmp(), which is slower.
|
2008-01-17 03:49:24 +00:00
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* FIXME: shouldn't @t be const?
|
|
|
|
* FIXME: we should perhaps consider some sort of lookup arrangement into an
|
|
|
|
* array; also, the duplication of code is unlovely; perhaps using glib
|
|
|
|
* string hashes instead of quarks would fix both problems?
|
2008-01-17 03:49:24 +00:00
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* Returns: %TRUE if we found the variable asked for, %FALSE if we didn't
|
2008-01-17 03:49:24 +00:00
|
|
|
*/
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
static gboolean
|
|
|
|
pos_eval_get_variable (PosToken *t,
|
|
|
|
int *result,
|
|
|
|
const MetaPositionExprEnv *env,
|
|
|
|
GError **err)
|
|
|
|
{
|
|
|
|
if (env->theme)
|
|
|
|
{
|
|
|
|
if (t->d.v.name_quark == env->theme->quark_width)
|
|
|
|
*result = env->rect.width;
|
|
|
|
else if (t->d.v.name_quark == env->theme->quark_height)
|
|
|
|
*result = env->rect.height;
|
|
|
|
else if (env->object_width >= 0 &&
|
|
|
|
t->d.v.name_quark == env->theme->quark_object_width)
|
|
|
|
*result = env->object_width;
|
|
|
|
else if (env->object_height >= 0 &&
|
|
|
|
t->d.v.name_quark == env->theme->quark_object_height)
|
|
|
|
*result = env->object_height;
|
|
|
|
else if (t->d.v.name_quark == env->theme->quark_left_width)
|
|
|
|
*result = env->left_width;
|
|
|
|
else if (t->d.v.name_quark == env->theme->quark_right_width)
|
|
|
|
*result = env->right_width;
|
|
|
|
else if (t->d.v.name_quark == env->theme->quark_top_height)
|
|
|
|
*result = env->top_height;
|
|
|
|
else if (t->d.v.name_quark == env->theme->quark_bottom_height)
|
|
|
|
*result = env->bottom_height;
|
|
|
|
else if (t->d.v.name_quark == env->theme->quark_mini_icon_width)
|
|
|
|
*result = env->mini_icon_width;
|
|
|
|
else if (t->d.v.name_quark == env->theme->quark_mini_icon_height)
|
|
|
|
*result = env->mini_icon_height;
|
|
|
|
else if (t->d.v.name_quark == env->theme->quark_icon_width)
|
|
|
|
*result = env->icon_width;
|
|
|
|
else if (t->d.v.name_quark == env->theme->quark_icon_height)
|
|
|
|
*result = env->icon_height;
|
|
|
|
else if (t->d.v.name_quark == env->theme->quark_title_width)
|
|
|
|
*result = env->title_width;
|
|
|
|
else if (t->d.v.name_quark == env->theme->quark_title_height)
|
|
|
|
*result = env->title_height;
|
2009-08-20 17:47:05 +00:00
|
|
|
else if (t->d.v.name_quark == env->theme->quark_frame_x_center)
|
|
|
|
*result = env->frame_x_center;
|
|
|
|
else if (t->d.v.name_quark == env->theme->quark_frame_y_center)
|
|
|
|
*result = env->frame_y_center;
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_UNKNOWN_VARIABLE,
|
|
|
|
_("Coordinate expression had unknown variable or constant \"%s\""),
|
|
|
|
t->d.v.name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
else
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
{
|
|
|
|
if (strcmp (t->d.v.name, "width") == 0)
|
|
|
|
*result = env->rect.width;
|
|
|
|
else if (strcmp (t->d.v.name, "height") == 0)
|
|
|
|
*result = env->rect.height;
|
|
|
|
else if (env->object_width >= 0 &&
|
|
|
|
strcmp (t->d.v.name, "object_width") == 0)
|
|
|
|
*result = env->object_width;
|
|
|
|
else if (env->object_height >= 0 &&
|
|
|
|
strcmp (t->d.v.name, "object_height") == 0)
|
|
|
|
*result = env->object_height;
|
|
|
|
else if (strcmp (t->d.v.name, "left_width") == 0)
|
|
|
|
*result = env->left_width;
|
|
|
|
else if (strcmp (t->d.v.name, "right_width") == 0)
|
|
|
|
*result = env->right_width;
|
|
|
|
else if (strcmp (t->d.v.name, "top_height") == 0)
|
|
|
|
*result = env->top_height;
|
|
|
|
else if (strcmp (t->d.v.name, "bottom_height") == 0)
|
|
|
|
*result = env->bottom_height;
|
|
|
|
else if (strcmp (t->d.v.name, "mini_icon_width") == 0)
|
|
|
|
*result = env->mini_icon_width;
|
|
|
|
else if (strcmp (t->d.v.name, "mini_icon_height") == 0)
|
|
|
|
*result = env->mini_icon_height;
|
|
|
|
else if (strcmp (t->d.v.name, "icon_width") == 0)
|
|
|
|
*result = env->icon_width;
|
|
|
|
else if (strcmp (t->d.v.name, "icon_height") == 0)
|
|
|
|
*result = env->icon_height;
|
|
|
|
else if (strcmp (t->d.v.name, "title_width") == 0)
|
|
|
|
*result = env->title_width;
|
|
|
|
else if (strcmp (t->d.v.name, "title_height") == 0)
|
|
|
|
*result = env->title_height;
|
2009-08-20 17:47:05 +00:00
|
|
|
else if (strcmp (t->d.v.name, "frame_x_center") == 0)
|
|
|
|
*result = env->frame_x_center;
|
|
|
|
else if (strcmp (t->d.v.name, "frame_y_center") == 0)
|
|
|
|
*result = env->frame_y_center;
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_UNKNOWN_VARIABLE,
|
|
|
|
_("Coordinate expression had unknown variable or constant \"%s\""),
|
|
|
|
t->d.v.name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2008-01-17 03:49:24 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* pos_eval_helper:
|
|
|
|
* @tokens: A list of tokens to evaluate.
|
|
|
|
* @n_tokens: How many tokens are in the list.
|
|
|
|
* @env: The environment context in which to evaluate the expression.
|
|
|
|
* @result: (out): The current value of the expression
|
|
|
|
*
|
2008-01-18 05:07:53 +00:00
|
|
|
* Evaluates a sequence of tokens within a particular environment context,
|
|
|
|
* and returns the current value. May recur if parantheses are found.
|
2008-01-17 03:49:24 +00:00
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* FIXME: Yes, we really do reparse the expression every time it's evaluated.
|
|
|
|
* We should keep the parse tree around all the time and just
|
|
|
|
* run the new values through it.
|
2008-01-17 03:49:24 +00:00
|
|
|
*/
|
2002-01-28 02:09:12 +00:00
|
|
|
static gboolean
|
2002-02-02 05:09:19 +00:00
|
|
|
pos_eval_helper (PosToken *tokens,
|
|
|
|
int n_tokens,
|
|
|
|
const MetaPositionExprEnv *env,
|
|
|
|
PosExpr *result,
|
|
|
|
GError **err)
|
2002-01-28 02:09:12 +00:00
|
|
|
{
|
2008-01-17 03:49:24 +00:00
|
|
|
/* Lazy-ass hardcoded limit on number of terms in expression */
|
2002-01-28 02:09:12 +00:00
|
|
|
#define MAX_EXPRS 32
|
|
|
|
int paren_level;
|
|
|
|
int first_paren;
|
|
|
|
int i;
|
|
|
|
PosExpr exprs[MAX_EXPRS];
|
|
|
|
int n_exprs;
|
2002-02-07 03:07:56 +00:00
|
|
|
int precedence;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
/* Our first goal is to get a list of PosExpr, essentially
|
|
|
|
* substituting variables and handling parentheses.
|
|
|
|
*/
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
first_paren = 0;
|
|
|
|
paren_level = 0;
|
|
|
|
n_exprs = 0;
|
2006-04-18 17:18:53 +00:00
|
|
|
for (i = 0; i < n_tokens; i++)
|
2002-01-28 02:09:12 +00:00
|
|
|
{
|
|
|
|
PosToken *t = &tokens[i];
|
|
|
|
|
|
|
|
if (n_exprs >= MAX_EXPRS)
|
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
2006-04-07 19:06:25 +00:00
|
|
|
_("Coordinate expression parser overflowed its buffer."));
|
2002-01-28 02:09:12 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (paren_level == 0)
|
|
|
|
{
|
|
|
|
switch (t->type)
|
|
|
|
{
|
|
|
|
case POS_TOKEN_INT:
|
|
|
|
exprs[n_exprs].type = POS_EXPR_INT;
|
|
|
|
exprs[n_exprs].d.int_val = t->d.i.val;
|
|
|
|
++n_exprs;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case POS_TOKEN_DOUBLE:
|
|
|
|
exprs[n_exprs].type = POS_EXPR_DOUBLE;
|
|
|
|
exprs[n_exprs].d.double_val = t->d.d.val;
|
|
|
|
++n_exprs;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case POS_TOKEN_OPEN_PAREN:
|
|
|
|
++paren_level;
|
|
|
|
if (paren_level == 1)
|
|
|
|
first_paren = i;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case POS_TOKEN_CLOSE_PAREN:
|
2002-02-07 03:07:56 +00:00
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_BAD_PARENS,
|
2002-01-28 02:09:12 +00:00
|
|
|
_("Coordinate expression had a close parenthesis with no open parenthesis"));
|
|
|
|
return FALSE;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
case POS_TOKEN_VARIABLE:
|
|
|
|
exprs[n_exprs].type = POS_EXPR_INT;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
|
|
|
/* FIXME we should just dump all this crap
|
|
|
|
* in a hash, maybe keep width/height out
|
|
|
|
* for optimization purposes
|
|
|
|
*/
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
if (!pos_eval_get_variable (t, &exprs[n_exprs].d.int_val, env, err))
|
|
|
|
return FALSE;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
++n_exprs;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case POS_TOKEN_OPERATOR:
|
|
|
|
exprs[n_exprs].type = POS_EXPR_OPERATOR;
|
|
|
|
exprs[n_exprs].d.operator = t->d.o.op;
|
|
|
|
++n_exprs;
|
2002-02-07 03:07:56 +00:00
|
|
|
break;
|
2002-01-28 02:09:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g_assert (paren_level > 0);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
switch (t->type)
|
|
|
|
{
|
|
|
|
case POS_TOKEN_INT:
|
|
|
|
case POS_TOKEN_DOUBLE:
|
|
|
|
case POS_TOKEN_VARIABLE:
|
|
|
|
case POS_TOKEN_OPERATOR:
|
|
|
|
break;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
case POS_TOKEN_OPEN_PAREN:
|
|
|
|
++paren_level;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case POS_TOKEN_CLOSE_PAREN:
|
|
|
|
if (paren_level == 1)
|
|
|
|
{
|
|
|
|
/* We closed a toplevel paren group, so recurse */
|
|
|
|
if (!pos_eval_helper (&tokens[first_paren+1],
|
|
|
|
i - first_paren - 1,
|
2002-02-02 05:09:19 +00:00
|
|
|
env,
|
2002-01-28 02:09:12 +00:00
|
|
|
&exprs[n_exprs],
|
|
|
|
err))
|
|
|
|
return FALSE;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
++n_exprs;
|
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
--paren_level;
|
|
|
|
break;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (paren_level > 0)
|
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_BAD_PARENS,
|
2002-01-28 02:09:12 +00:00
|
|
|
_("Coordinate expression had an open parenthesis with no close parenthesis"));
|
2002-02-07 03:07:56 +00:00
|
|
|
return FALSE;
|
2002-01-28 02:09:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Now we have no parens and no vars; so we just do all the multiplies
|
|
|
|
* and divides, then all the add and subtract.
|
|
|
|
*/
|
|
|
|
if (n_exprs == 0)
|
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
g_set_error (err, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
2002-01-28 02:09:12 +00:00
|
|
|
_("Coordinate expression doesn't seem to have any operators or operands"));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* precedence 1 ops */
|
2002-02-07 03:07:56 +00:00
|
|
|
precedence = 2;
|
|
|
|
while (precedence >= 0)
|
|
|
|
{
|
|
|
|
if (!do_operations (exprs, &n_exprs, precedence, err))
|
|
|
|
return FALSE;
|
|
|
|
--precedence;
|
|
|
|
}
|
2002-01-28 02:09:12 +00:00
|
|
|
|
|
|
|
g_assert (n_exprs == 1);
|
|
|
|
|
|
|
|
*result = *exprs;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* expr = int | double | expr * expr | expr / expr |
|
|
|
|
* expr + expr | expr - expr | (expr)
|
|
|
|
*
|
|
|
|
* so very not worth fooling with bison, yet so very painful by hand.
|
|
|
|
*/
|
2011-11-02 15:34:45 +00:00
|
|
|
|
2008-01-18 05:07:53 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* pos_eval:
|
|
|
|
* @spec: The expression to evaluate.
|
|
|
|
* @env: The environment context to evaluate the expression in.
|
|
|
|
* @val_p: (out): The integer value of the expression; if the expression
|
|
|
|
* is of type float, this will be rounded. If we return
|
|
|
|
* %FALSE because the expression is invalid, this will be
|
|
|
|
* zero.
|
|
|
|
* @err: (out): The error, if anything went wrong.
|
2008-01-18 05:07:53 +00:00
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* Evaluates an expression.
|
2008-01-18 05:07:53 +00:00
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* FIXME: Shouldn't @spec be const?
|
2008-01-18 05:07:53 +00:00
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* Returns: %TRUE if we evaluated the expression successfully; %FALSE otherwise.
|
2008-01-18 05:07:53 +00:00
|
|
|
*/
|
2002-01-28 02:09:12 +00:00
|
|
|
static gboolean
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
pos_eval (MetaDrawSpec *spec,
|
2002-02-02 05:09:19 +00:00
|
|
|
const MetaPositionExprEnv *env,
|
|
|
|
int *val_p,
|
|
|
|
GError **err)
|
2002-01-28 02:09:12 +00:00
|
|
|
{
|
|
|
|
PosExpr expr;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
*val_p = 0;
|
|
|
|
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
if (pos_eval_helper (spec->tokens, spec->n_tokens, env, &expr, err))
|
2002-01-28 02:09:12 +00:00
|
|
|
{
|
|
|
|
switch (expr.type)
|
|
|
|
{
|
|
|
|
case POS_EXPR_INT:
|
|
|
|
*val_p = expr.d.int_val;
|
|
|
|
break;
|
|
|
|
case POS_EXPR_DOUBLE:
|
|
|
|
*val_p = expr.d.double_val;
|
|
|
|
break;
|
|
|
|
case POS_EXPR_OPERATOR:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We always return both X and Y, but only one will be meaningful in
|
|
|
|
* most contexts.
|
|
|
|
*/
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2010-09-01 19:39:53 +00:00
|
|
|
/**
|
|
|
|
* meta_parse_position_expression: (skip)
|
|
|
|
*
|
|
|
|
*/
|
2002-01-28 02:09:12 +00:00
|
|
|
gboolean
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
meta_parse_position_expression (MetaDrawSpec *spec,
|
2002-02-02 05:09:19 +00:00
|
|
|
const MetaPositionExprEnv *env,
|
|
|
|
int *x_return,
|
|
|
|
int *y_return,
|
|
|
|
GError **err)
|
2002-01-28 02:09:12 +00:00
|
|
|
{
|
|
|
|
/* All positions are in a coordinate system with x, y at the origin.
|
2002-02-02 05:09:19 +00:00
|
|
|
* The expression can have -, +, *, / as operators, floating point
|
|
|
|
* or integer constants, and the variables "width" and "height" and
|
|
|
|
* optionally "object_width" and object_height". Negative numbers
|
|
|
|
* aren't allowed.
|
2002-01-28 02:09:12 +00:00
|
|
|
*/
|
|
|
|
int val;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
if (spec->constant)
|
|
|
|
val = spec->value;
|
|
|
|
else
|
2002-01-28 02:09:12 +00:00
|
|
|
{
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
if (pos_eval (spec, env, &spec->value, err) == FALSE)
|
|
|
|
{
|
|
|
|
g_assert (err == NULL || *err != NULL);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
val = spec->value;
|
2002-01-28 02:09:12 +00:00
|
|
|
}
|
|
|
|
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
if (x_return)
|
|
|
|
*x_return = env->rect.x + val;
|
|
|
|
if (y_return)
|
|
|
|
*y_return = env->rect.y + val;
|
2002-01-28 05:16:04 +00:00
|
|
|
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
return TRUE;
|
2002-01-28 05:16:04 +00:00
|
|
|
}
|
2002-01-28 02:09:12 +00:00
|
|
|
|
|
|
|
|
2010-09-01 19:39:53 +00:00
|
|
|
/**
|
|
|
|
* meta_parse_size_expression: (skip)
|
|
|
|
*
|
|
|
|
*/
|
2002-01-28 05:16:04 +00:00
|
|
|
gboolean
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
meta_parse_size_expression (MetaDrawSpec *spec,
|
2002-02-02 05:09:19 +00:00
|
|
|
const MetaPositionExprEnv *env,
|
|
|
|
int *val_return,
|
|
|
|
GError **err)
|
2002-01-28 05:16:04 +00:00
|
|
|
{
|
|
|
|
int val;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
if (spec->constant)
|
|
|
|
val = spec->value;
|
2014-05-02 13:34:02 +00:00
|
|
|
else
|
2002-01-28 05:16:04 +00:00
|
|
|
{
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
if (pos_eval (spec, env, &spec->value, err) == FALSE)
|
|
|
|
{
|
|
|
|
g_assert (err == NULL || *err != NULL);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
val = spec->value;
|
2002-01-28 02:09:12 +00:00
|
|
|
}
|
|
|
|
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
if (val_return)
|
|
|
|
*val_return = MAX (val, 1); /* require that sizes be at least 1x1 */
|
2002-01-28 05:16:04 +00:00
|
|
|
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
return TRUE;
|
2002-01-28 02:09:12 +00:00
|
|
|
}
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
/* To do this we tokenize, replace variable tokens
|
|
|
|
* that are constants, then reassemble. The purpose
|
|
|
|
* here is to optimize expressions so we don't do hash
|
|
|
|
* lookups to eval them. Obviously it's a tradeoff that
|
|
|
|
* slows down theme load times.
|
|
|
|
*/
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
gboolean
|
2002-02-07 03:07:56 +00:00
|
|
|
meta_theme_replace_constants (MetaTheme *theme,
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
PosToken *tokens,
|
|
|
|
int n_tokens,
|
2002-02-07 03:07:56 +00:00
|
|
|
GError **err)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
double dval;
|
|
|
|
int ival;
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
gboolean is_constant = TRUE;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
/* Loop through tokenized string looking for variables to replace */
|
2006-04-18 17:18:53 +00:00
|
|
|
for (i = 0; i < n_tokens; i++)
|
2002-02-07 03:07:56 +00:00
|
|
|
{
|
2014-05-02 13:34:02 +00:00
|
|
|
PosToken *t = &tokens[i];
|
2002-02-07 03:07:56 +00:00
|
|
|
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
if (t->type == POS_TOKEN_VARIABLE)
|
2002-02-07 03:07:56 +00:00
|
|
|
{
|
|
|
|
if (meta_theme_lookup_int_constant (theme, t->d.v.name, &ival))
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
{
|
2011-05-05 20:46:00 +00:00
|
|
|
g_free (t->d.v.name);
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
t->type = POS_TOKEN_INT;
|
|
|
|
t->d.i.val = ival;
|
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
else if (meta_theme_lookup_float_constant (theme, t->d.v.name, &dval))
|
|
|
|
{
|
2011-05-05 20:46:00 +00:00
|
|
|
g_free (t->d.v.name);
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
t->type = POS_TOKEN_DOUBLE;
|
|
|
|
t->d.d.val = dval;
|
2002-02-07 03:07:56 +00:00
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
else
|
2002-02-07 03:07:56 +00:00
|
|
|
{
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
/* If we've found a variable that cannot be replaced then the
|
2014-05-02 13:34:02 +00:00
|
|
|
expression is not a constant expression and we want to
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
replace it with a GQuark */
|
|
|
|
|
|
|
|
t->d.v.name_quark = g_quark_from_string (t->d.v.name);
|
|
|
|
is_constant = FALSE;
|
2002-02-07 03:07:56 +00:00
|
|
|
}
|
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
return is_constant;
|
2002-02-07 03:07:56 +00:00
|
|
|
}
|
|
|
|
|
2002-01-28 05:16:04 +00:00
|
|
|
static int
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
parse_x_position_unchecked (MetaDrawSpec *spec,
|
2002-02-02 05:09:19 +00:00
|
|
|
const MetaPositionExprEnv *env)
|
2002-01-28 05:16:04 +00:00
|
|
|
{
|
|
|
|
int retval;
|
2002-02-07 03:07:56 +00:00
|
|
|
GError *error;
|
|
|
|
|
2002-01-28 05:16:04 +00:00
|
|
|
retval = 0;
|
|
|
|
error = NULL;
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
if (!meta_parse_position_expression (spec, env, &retval, NULL, &error))
|
2002-01-28 05:16:04 +00:00
|
|
|
{
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
meta_warning (_("Theme contained an expression that resulted in an error: %s\n"),
|
|
|
|
error->message);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-01-28 05:16:04 +00:00
|
|
|
g_error_free (error);
|
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-01-28 05:16:04 +00:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
parse_y_position_unchecked (MetaDrawSpec *spec,
|
2002-02-02 05:09:19 +00:00
|
|
|
const MetaPositionExprEnv *env)
|
2002-01-28 05:16:04 +00:00
|
|
|
{
|
|
|
|
int retval;
|
2002-02-07 03:07:56 +00:00
|
|
|
GError *error;
|
|
|
|
|
2002-01-28 05:16:04 +00:00
|
|
|
retval = 0;
|
|
|
|
error = NULL;
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
if (!meta_parse_position_expression (spec, env, NULL, &retval, &error))
|
2002-01-28 05:16:04 +00:00
|
|
|
{
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
meta_warning (_("Theme contained an expression that resulted in an error: %s\n"),
|
|
|
|
error->message);
|
2002-01-28 05:16:04 +00:00
|
|
|
|
|
|
|
g_error_free (error);
|
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 05:16:04 +00:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
parse_size_unchecked (MetaDrawSpec *spec,
|
2002-02-02 05:09:19 +00:00
|
|
|
MetaPositionExprEnv *env)
|
2002-01-28 05:16:04 +00:00
|
|
|
{
|
|
|
|
int retval;
|
2002-02-07 03:07:56 +00:00
|
|
|
GError *error;
|
|
|
|
|
2002-01-28 05:16:04 +00:00
|
|
|
retval = 0;
|
|
|
|
error = NULL;
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
if (!meta_parse_size_expression (spec, env, &retval, &error))
|
2002-01-28 05:16:04 +00:00
|
|
|
{
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
meta_warning (_("Theme contained an expression that resulted in an error: %s\n"),
|
|
|
|
error->message);
|
2002-01-28 05:16:04 +00:00
|
|
|
|
|
|
|
g_error_free (error);
|
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 05:16:04 +00:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
void
|
|
|
|
meta_draw_spec_free (MetaDrawSpec *spec)
|
|
|
|
{
|
2009-02-06 04:50:50 +00:00
|
|
|
if (!spec) return;
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
free_tokens (spec->tokens, spec->n_tokens);
|
|
|
|
g_slice_free (MetaDrawSpec, spec);
|
|
|
|
}
|
|
|
|
|
2010-09-01 19:39:53 +00:00
|
|
|
/**
|
|
|
|
* meta_draw_spec_new: (skip)
|
|
|
|
*
|
|
|
|
*/
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
MetaDrawSpec *
|
|
|
|
meta_draw_spec_new (MetaTheme *theme,
|
|
|
|
const char *expr,
|
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
MetaDrawSpec *spec;
|
|
|
|
|
|
|
|
spec = g_slice_new0 (MetaDrawSpec);
|
|
|
|
|
|
|
|
pos_tokenize (expr, &spec->tokens, &spec->n_tokens, NULL);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
|
|
|
spec->constant = meta_theme_replace_constants (theme, spec->tokens,
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
spec->n_tokens, NULL);
|
2014-05-02 13:34:02 +00:00
|
|
|
if (spec->constant)
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
{
|
|
|
|
gboolean result;
|
|
|
|
|
|
|
|
result = pos_eval (spec, NULL, &spec->value, error);
|
|
|
|
if (result == FALSE)
|
|
|
|
{
|
|
|
|
meta_draw_spec_free (spec);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
return spec;
|
|
|
|
}
|
|
|
|
|
2010-09-01 19:39:53 +00:00
|
|
|
/**
|
|
|
|
* meta_draw_op_new: (skip)
|
|
|
|
*
|
|
|
|
*/
|
2002-02-02 05:09:19 +00:00
|
|
|
MetaDrawOp*
|
|
|
|
meta_draw_op_new (MetaDrawType type)
|
2002-01-28 02:09:12 +00:00
|
|
|
{
|
2002-02-02 05:09:19 +00:00
|
|
|
MetaDrawOp *op;
|
|
|
|
MetaDrawOp dummy;
|
2002-01-28 02:09:12 +00:00
|
|
|
int size;
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
size = G_STRUCT_OFFSET (MetaDrawOp, data);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
switch (type)
|
|
|
|
{
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_LINE:
|
2002-01-28 02:09:12 +00:00
|
|
|
size += sizeof (dummy.data.line);
|
|
|
|
break;
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_RECTANGLE:
|
2002-01-28 02:09:12 +00:00
|
|
|
size += sizeof (dummy.data.rectangle);
|
|
|
|
break;
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_ARC:
|
2002-01-28 02:09:12 +00:00
|
|
|
size += sizeof (dummy.data.arc);
|
|
|
|
break;
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
case META_DRAW_CLIP:
|
|
|
|
size += sizeof (dummy.data.clip);
|
|
|
|
break;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_TINT:
|
|
|
|
size += sizeof (dummy.data.tint);
|
2002-01-28 02:09:12 +00:00
|
|
|
break;
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_GRADIENT:
|
|
|
|
size += sizeof (dummy.data.gradient);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_DRAW_IMAGE:
|
|
|
|
size += sizeof (dummy.data.image);
|
|
|
|
break;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_GTK_ARROW:
|
2002-01-28 02:09:12 +00:00
|
|
|
size += sizeof (dummy.data.gtk_arrow);
|
|
|
|
break;
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_GTK_BOX:
|
2002-01-28 02:09:12 +00:00
|
|
|
size += sizeof (dummy.data.gtk_box);
|
|
|
|
break;
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_GTK_VLINE:
|
2002-01-28 02:09:12 +00:00
|
|
|
size += sizeof (dummy.data.gtk_vline);
|
|
|
|
break;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
|
|
|
case META_DRAW_ICON:
|
|
|
|
size += sizeof (dummy.data.icon);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_DRAW_TITLE:
|
|
|
|
size += sizeof (dummy.data.title);
|
|
|
|
break;
|
|
|
|
case META_DRAW_OP_LIST:
|
|
|
|
size += sizeof (dummy.data.op_list);
|
|
|
|
break;
|
2002-02-10 01:10:33 +00:00
|
|
|
case META_DRAW_TILE:
|
|
|
|
size += sizeof (dummy.data.tile);
|
|
|
|
break;
|
2002-01-28 02:09:12 +00:00
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
op = g_malloc0 (size);
|
2002-01-28 02:09:12 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
op->type = type;
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
return op;
|
2002-01-28 02:09:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-02-02 05:09:19 +00:00
|
|
|
meta_draw_op_free (MetaDrawOp *op)
|
2002-01-28 02:09:12 +00:00
|
|
|
{
|
2002-02-02 05:09:19 +00:00
|
|
|
g_return_if_fail (op != NULL);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
switch (op->type)
|
2002-01-28 02:09:12 +00:00
|
|
|
{
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_LINE:
|
2002-02-09 17:02:38 +00:00
|
|
|
if (op->data.line.color_spec)
|
|
|
|
meta_color_spec_free (op->data.line.color_spec);
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
|
|
|
meta_draw_spec_free (op->data.line.x1);
|
|
|
|
meta_draw_spec_free (op->data.line.y1);
|
|
|
|
meta_draw_spec_free (op->data.line.x2);
|
|
|
|
meta_draw_spec_free (op->data.line.y2);
|
2002-02-02 05:09:19 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case META_DRAW_RECTANGLE:
|
|
|
|
if (op->data.rectangle.color_spec)
|
|
|
|
g_free (op->data.rectangle.color_spec);
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
|
|
|
meta_draw_spec_free (op->data.rectangle.x);
|
|
|
|
meta_draw_spec_free (op->data.rectangle.y);
|
|
|
|
meta_draw_spec_free (op->data.rectangle.width);
|
|
|
|
meta_draw_spec_free (op->data.rectangle.height);
|
2002-02-02 05:09:19 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case META_DRAW_ARC:
|
|
|
|
if (op->data.arc.color_spec)
|
|
|
|
g_free (op->data.arc.color_spec);
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
|
|
|
meta_draw_spec_free (op->data.arc.x);
|
|
|
|
meta_draw_spec_free (op->data.arc.y);
|
|
|
|
meta_draw_spec_free (op->data.arc.width);
|
|
|
|
meta_draw_spec_free (op->data.arc.height);
|
2002-01-28 02:09:12 +00:00
|
|
|
break;
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
case META_DRAW_CLIP:
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
meta_draw_spec_free (op->data.clip.x);
|
|
|
|
meta_draw_spec_free (op->data.clip.y);
|
|
|
|
meta_draw_spec_free (op->data.clip.width);
|
|
|
|
meta_draw_spec_free (op->data.clip.height);
|
2002-02-07 03:07:56 +00:00
|
|
|
break;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_TINT:
|
|
|
|
if (op->data.tint.color_spec)
|
|
|
|
meta_color_spec_free (op->data.tint.color_spec);
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
2002-05-31 21:18:11 +00:00
|
|
|
if (op->data.tint.alpha_spec)
|
|
|
|
meta_alpha_gradient_spec_free (op->data.tint.alpha_spec);
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
|
|
|
meta_draw_spec_free (op->data.tint.x);
|
|
|
|
meta_draw_spec_free (op->data.tint.y);
|
|
|
|
meta_draw_spec_free (op->data.tint.width);
|
|
|
|
meta_draw_spec_free (op->data.tint.height);
|
2002-01-28 02:09:12 +00:00
|
|
|
break;
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_GRADIENT:
|
|
|
|
if (op->data.gradient.gradient_spec)
|
|
|
|
meta_gradient_spec_free (op->data.gradient.gradient_spec);
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
2002-05-31 21:18:11 +00:00
|
|
|
if (op->data.gradient.alpha_spec)
|
|
|
|
meta_alpha_gradient_spec_free (op->data.gradient.alpha_spec);
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
|
|
|
meta_draw_spec_free (op->data.gradient.x);
|
|
|
|
meta_draw_spec_free (op->data.gradient.y);
|
|
|
|
meta_draw_spec_free (op->data.gradient.width);
|
|
|
|
meta_draw_spec_free (op->data.gradient.height);
|
2002-01-28 02:09:12 +00:00
|
|
|
break;
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_IMAGE:
|
2002-05-31 21:18:11 +00:00
|
|
|
if (op->data.image.alpha_spec)
|
|
|
|
meta_alpha_gradient_spec_free (op->data.image.alpha_spec);
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
if (op->data.image.pixbuf)
|
|
|
|
g_object_unref (G_OBJECT (op->data.image.pixbuf));
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
2002-02-07 03:43:13 +00:00
|
|
|
if (op->data.image.colorize_spec)
|
|
|
|
meta_color_spec_free (op->data.image.colorize_spec);
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
2002-02-07 04:22:57 +00:00
|
|
|
if (op->data.image.colorize_cache_pixbuf)
|
|
|
|
g_object_unref (G_OBJECT (op->data.image.colorize_cache_pixbuf));
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
|
|
|
meta_draw_spec_free (op->data.image.x);
|
|
|
|
meta_draw_spec_free (op->data.image.y);
|
|
|
|
meta_draw_spec_free (op->data.image.width);
|
|
|
|
meta_draw_spec_free (op->data.image.height);
|
2002-01-28 02:09:12 +00:00
|
|
|
break;
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_GTK_ARROW:
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
meta_draw_spec_free (op->data.gtk_arrow.x);
|
|
|
|
meta_draw_spec_free (op->data.gtk_arrow.y);
|
|
|
|
meta_draw_spec_free (op->data.gtk_arrow.width);
|
|
|
|
meta_draw_spec_free (op->data.gtk_arrow.height);
|
2002-01-28 02:09:12 +00:00
|
|
|
break;
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_GTK_BOX:
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
meta_draw_spec_free (op->data.gtk_box.x);
|
|
|
|
meta_draw_spec_free (op->data.gtk_box.y);
|
|
|
|
meta_draw_spec_free (op->data.gtk_box.width);
|
|
|
|
meta_draw_spec_free (op->data.gtk_box.height);
|
2002-01-28 02:09:12 +00:00
|
|
|
break;
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_GTK_VLINE:
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
meta_draw_spec_free (op->data.gtk_vline.x);
|
|
|
|
meta_draw_spec_free (op->data.gtk_vline.y1);
|
|
|
|
meta_draw_spec_free (op->data.gtk_vline.y2);
|
2002-01-28 02:09:12 +00:00
|
|
|
break;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
|
|
|
case META_DRAW_ICON:
|
2002-05-31 21:18:11 +00:00
|
|
|
if (op->data.icon.alpha_spec)
|
|
|
|
meta_alpha_gradient_spec_free (op->data.icon.alpha_spec);
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
|
|
|
meta_draw_spec_free (op->data.icon.x);
|
|
|
|
meta_draw_spec_free (op->data.icon.y);
|
|
|
|
meta_draw_spec_free (op->data.icon.width);
|
|
|
|
meta_draw_spec_free (op->data.icon.height);
|
2002-02-07 03:07:56 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case META_DRAW_TITLE:
|
|
|
|
if (op->data.title.color_spec)
|
|
|
|
meta_color_spec_free (op->data.title.color_spec);
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
|
|
|
meta_draw_spec_free (op->data.title.x);
|
|
|
|
meta_draw_spec_free (op->data.title.y);
|
2009-08-20 19:54:11 +00:00
|
|
|
if (op->data.title.ellipsize_width)
|
|
|
|
meta_draw_spec_free (op->data.title.ellipsize_width);
|
2002-02-07 03:07:56 +00:00
|
|
|
break;
|
2002-02-10 01:10:33 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
case META_DRAW_OP_LIST:
|
|
|
|
if (op->data.op_list.op_list)
|
|
|
|
meta_draw_op_list_unref (op->data.op_list.op_list);
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
|
|
|
meta_draw_spec_free (op->data.op_list.x);
|
|
|
|
meta_draw_spec_free (op->data.op_list.y);
|
|
|
|
meta_draw_spec_free (op->data.op_list.width);
|
|
|
|
meta_draw_spec_free (op->data.op_list.height);
|
2002-02-07 03:07:56 +00:00
|
|
|
break;
|
2002-02-10 01:10:33 +00:00
|
|
|
|
|
|
|
case META_DRAW_TILE:
|
|
|
|
if (op->data.tile.op_list)
|
|
|
|
meta_draw_op_list_unref (op->data.tile.op_list);
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
|
|
|
|
meta_draw_spec_free (op->data.tile.x);
|
|
|
|
meta_draw_spec_free (op->data.tile.y);
|
|
|
|
meta_draw_spec_free (op->data.tile.width);
|
|
|
|
meta_draw_spec_free (op->data.tile.height);
|
|
|
|
meta_draw_spec_free (op->data.tile.tile_xoffset);
|
|
|
|
meta_draw_spec_free (op->data.tile.tile_yoffset);
|
|
|
|
meta_draw_spec_free (op->data.tile.tile_width);
|
|
|
|
meta_draw_spec_free (op->data.tile.tile_height);
|
2002-02-10 01:10:33 +00:00
|
|
|
break;
|
2002-01-28 02:09:12 +00:00
|
|
|
}
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
g_free (op);
|
2002-01-28 02:09:12 +00:00
|
|
|
}
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
static GdkPixbuf*
|
2002-05-31 21:18:11 +00:00
|
|
|
apply_alpha (GdkPixbuf *pixbuf,
|
|
|
|
MetaAlphaGradientSpec *spec,
|
|
|
|
gboolean force_copy)
|
2002-01-28 05:16:04 +00:00
|
|
|
{
|
2002-02-02 05:09:19 +00:00
|
|
|
GdkPixbuf *new_pixbuf;
|
2002-05-31 21:18:11 +00:00
|
|
|
gboolean needs_alpha;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-05-31 21:18:11 +00:00
|
|
|
needs_alpha = spec && (spec->n_alphas > 1 ||
|
|
|
|
spec->alphas[0] != 0xff);
|
2002-01-28 05:16:04 +00:00
|
|
|
|
2002-05-31 21:18:11 +00:00
|
|
|
if (!needs_alpha)
|
|
|
|
return pixbuf;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
if (!gdk_pixbuf_get_has_alpha (pixbuf))
|
2002-01-08 07:23:35 +00:00
|
|
|
{
|
2002-02-02 05:09:19 +00:00
|
|
|
new_pixbuf = gdk_pixbuf_add_alpha (pixbuf, FALSE, 0, 0, 0);
|
|
|
|
g_object_unref (G_OBJECT (pixbuf));
|
|
|
|
pixbuf = new_pixbuf;
|
2002-01-08 07:23:35 +00:00
|
|
|
}
|
2002-04-10 04:00:32 +00:00
|
|
|
else if (force_copy)
|
|
|
|
{
|
|
|
|
new_pixbuf = gdk_pixbuf_copy (pixbuf);
|
|
|
|
g_object_unref (G_OBJECT (pixbuf));
|
|
|
|
pixbuf = new_pixbuf;
|
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-04-10 04:00:32 +00:00
|
|
|
g_assert (gdk_pixbuf_get_has_alpha (pixbuf));
|
2001-06-06 04:47:37 +00:00
|
|
|
|
2002-05-31 21:18:11 +00:00
|
|
|
meta_gradient_add_alpha (pixbuf, spec->alphas, spec->n_alphas, spec->type);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
return pixbuf;
|
2002-01-08 07:23:35 +00:00
|
|
|
}
|
|
|
|
|
2002-05-31 22:03:34 +00:00
|
|
|
static GdkPixbuf*
|
|
|
|
pixbuf_tile (GdkPixbuf *tile,
|
|
|
|
int width,
|
|
|
|
int height)
|
|
|
|
{
|
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
int tile_width;
|
|
|
|
int tile_height;
|
|
|
|
int i, j;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-05-31 22:03:34 +00:00
|
|
|
tile_width = gdk_pixbuf_get_width (tile);
|
|
|
|
tile_height = gdk_pixbuf_get_height (tile);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-05-31 22:03:34 +00:00
|
|
|
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
|
|
|
|
gdk_pixbuf_get_has_alpha (tile),
|
|
|
|
8, width, height);
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
while (i < width)
|
|
|
|
{
|
|
|
|
j = 0;
|
|
|
|
while (j < height)
|
|
|
|
{
|
|
|
|
int w, h;
|
|
|
|
|
|
|
|
w = MIN (tile_width, width - i);
|
|
|
|
h = MIN (tile_height, height - j);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-05-31 22:03:34 +00:00
|
|
|
gdk_pixbuf_copy_area (tile,
|
|
|
|
0, 0,
|
|
|
|
w, h,
|
|
|
|
pixbuf,
|
|
|
|
i, j);
|
|
|
|
|
|
|
|
j += tile_height;
|
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-05-31 22:03:34 +00:00
|
|
|
i += tile_width;
|
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-05-31 22:03:34 +00:00
|
|
|
return pixbuf;
|
|
|
|
}
|
|
|
|
|
2002-11-04 17:55:56 +00:00
|
|
|
static GdkPixbuf *
|
|
|
|
replicate_rows (GdkPixbuf *src,
|
|
|
|
int src_x,
|
|
|
|
int src_y,
|
|
|
|
int width,
|
|
|
|
int height)
|
|
|
|
{
|
|
|
|
unsigned int n_channels = gdk_pixbuf_get_n_channels (src);
|
|
|
|
unsigned int src_rowstride = gdk_pixbuf_get_rowstride (src);
|
|
|
|
unsigned char *pixels = (gdk_pixbuf_get_pixels (src) + src_y * src_rowstride + src_x
|
|
|
|
* n_channels);
|
|
|
|
unsigned char *dest_pixels;
|
|
|
|
GdkPixbuf *result;
|
|
|
|
unsigned int dest_rowstride;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, n_channels == 4, 8,
|
|
|
|
width, height);
|
|
|
|
dest_rowstride = gdk_pixbuf_get_rowstride (result);
|
|
|
|
dest_pixels = gdk_pixbuf_get_pixels (result);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-11-04 17:55:56 +00:00
|
|
|
for (i = 0; i < height; i++)
|
|
|
|
memcpy (dest_pixels + dest_rowstride * i, pixels, n_channels * width);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GdkPixbuf *
|
|
|
|
replicate_cols (GdkPixbuf *src,
|
|
|
|
int src_x,
|
|
|
|
int src_y,
|
|
|
|
int width,
|
|
|
|
int height)
|
|
|
|
{
|
|
|
|
unsigned int n_channels = gdk_pixbuf_get_n_channels (src);
|
|
|
|
unsigned int src_rowstride = gdk_pixbuf_get_rowstride (src);
|
|
|
|
unsigned char *pixels = (gdk_pixbuf_get_pixels (src) + src_y * src_rowstride + src_x
|
|
|
|
* n_channels);
|
|
|
|
unsigned char *dest_pixels;
|
|
|
|
GdkPixbuf *result;
|
|
|
|
unsigned int dest_rowstride;
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, n_channels == 4, 8,
|
|
|
|
width, height);
|
|
|
|
dest_rowstride = gdk_pixbuf_get_rowstride (result);
|
|
|
|
dest_pixels = gdk_pixbuf_get_pixels (result);
|
|
|
|
|
|
|
|
for (i = 0; i < height; i++)
|
|
|
|
{
|
|
|
|
unsigned char *p = dest_pixels + dest_rowstride * i;
|
|
|
|
unsigned char *q = pixels + src_rowstride * i;
|
|
|
|
|
|
|
|
unsigned char r = *(q++);
|
|
|
|
unsigned char g = *(q++);
|
|
|
|
unsigned char b = *(q++);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-11-04 17:55:56 +00:00
|
|
|
if (n_channels == 4)
|
|
|
|
{
|
|
|
|
unsigned char a;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-11-04 17:55:56 +00:00
|
|
|
a = *(q++);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-11-04 17:55:56 +00:00
|
|
|
for (j = 0; j < width; j++)
|
|
|
|
{
|
|
|
|
*(p++) = r;
|
|
|
|
*(p++) = g;
|
2014-05-02 13:34:02 +00:00
|
|
|
*(p++) = b;
|
2002-11-04 17:55:56 +00:00
|
|
|
*(p++) = a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (j = 0; j < width; j++)
|
|
|
|
{
|
|
|
|
*(p++) = r;
|
|
|
|
*(p++) = g;
|
|
|
|
*(p++) = b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
static GdkPixbuf*
|
2002-05-31 21:18:11 +00:00
|
|
|
scale_and_alpha_pixbuf (GdkPixbuf *src,
|
|
|
|
MetaAlphaGradientSpec *alpha_spec,
|
2002-05-31 22:03:34 +00:00
|
|
|
MetaImageFillType fill_type,
|
2002-05-31 21:18:11 +00:00
|
|
|
int width,
|
2002-11-04 17:55:56 +00:00
|
|
|
int height,
|
|
|
|
gboolean vertical_stripes,
|
|
|
|
gboolean horizontal_stripes)
|
2002-02-07 03:07:56 +00:00
|
|
|
{
|
|
|
|
GdkPixbuf *pixbuf;
|
2002-11-04 17:55:56 +00:00
|
|
|
GdkPixbuf *temp_pixbuf;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
|
|
|
pixbuf = NULL;
|
|
|
|
|
|
|
|
pixbuf = src;
|
2002-11-04 17:55:56 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
if (gdk_pixbuf_get_width (pixbuf) == width &&
|
|
|
|
gdk_pixbuf_get_height (pixbuf) == height)
|
|
|
|
{
|
|
|
|
g_object_ref (G_OBJECT (pixbuf));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-11-04 17:55:56 +00:00
|
|
|
if (fill_type == META_IMAGE_FILL_TILE)
|
2002-05-31 22:03:34 +00:00
|
|
|
{
|
|
|
|
pixbuf = pixbuf_tile (pixbuf, width, height);
|
2002-11-04 17:55:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-11-04 20:34:25 +00:00
|
|
|
int src_h, src_w, dest_h, dest_w;
|
2002-11-04 17:55:56 +00:00
|
|
|
src_h = gdk_pixbuf_get_height (src);
|
|
|
|
src_w = gdk_pixbuf_get_width (src);
|
|
|
|
|
2002-11-04 20:34:25 +00:00
|
|
|
/* prefer to replicate_cols if possible, as that
|
|
|
|
* is faster (no memory reads)
|
|
|
|
*/
|
|
|
|
if (horizontal_stripes)
|
2002-11-04 17:55:56 +00:00
|
|
|
{
|
|
|
|
dest_w = gdk_pixbuf_get_width (src);
|
|
|
|
dest_h = height;
|
|
|
|
}
|
2002-11-04 20:34:25 +00:00
|
|
|
else if (vertical_stripes)
|
|
|
|
{
|
|
|
|
dest_w = width;
|
|
|
|
dest_h = gdk_pixbuf_get_height (src);
|
|
|
|
}
|
|
|
|
|
2002-11-04 17:55:56 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
dest_w = width;
|
|
|
|
dest_h = height;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dest_w == src_w && dest_h == src_h)
|
|
|
|
{
|
|
|
|
temp_pixbuf = src;
|
2002-11-04 20:34:25 +00:00
|
|
|
g_object_ref (G_OBJECT (temp_pixbuf));
|
2002-11-04 17:55:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
temp_pixbuf = gdk_pixbuf_scale_simple (src,
|
|
|
|
dest_w, dest_h,
|
|
|
|
GDK_INTERP_BILINEAR);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* prefer to replicate_cols if possible, as that
|
|
|
|
* is faster (no memory reads)
|
|
|
|
*/
|
|
|
|
if (horizontal_stripes)
|
|
|
|
{
|
|
|
|
pixbuf = replicate_cols (temp_pixbuf, 0, 0, width, height);
|
|
|
|
g_object_unref (G_OBJECT (temp_pixbuf));
|
|
|
|
}
|
|
|
|
else if (vertical_stripes)
|
|
|
|
{
|
|
|
|
pixbuf = replicate_rows (temp_pixbuf, 0, 0, width, height);
|
|
|
|
g_object_unref (G_OBJECT (temp_pixbuf));
|
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
else
|
2002-11-04 17:55:56 +00:00
|
|
|
{
|
|
|
|
pixbuf = temp_pixbuf;
|
|
|
|
}
|
2002-05-31 22:03:34 +00:00
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pixbuf)
|
2002-05-31 21:18:11 +00:00
|
|
|
pixbuf = apply_alpha (pixbuf, alpha_spec, pixbuf == src);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
return pixbuf;
|
|
|
|
}
|
|
|
|
|
2002-01-27 07:32:46 +00:00
|
|
|
static GdkPixbuf*
|
2002-02-02 05:09:19 +00:00
|
|
|
draw_op_as_pixbuf (const MetaDrawOp *op,
|
2011-03-18 15:42:41 +00:00
|
|
|
GtkStyleContext *context,
|
2002-02-07 03:07:56 +00:00
|
|
|
const MetaDrawInfo *info,
|
2002-02-02 05:09:19 +00:00
|
|
|
int width,
|
|
|
|
int height)
|
2002-01-27 07:32:46 +00:00
|
|
|
{
|
2002-02-02 05:09:19 +00:00
|
|
|
/* Try to get the op as a pixbuf, assuming w/h in the op
|
|
|
|
* matches the width/height passed in. return NULL
|
|
|
|
* if the op can't be converted to an equivalent pixbuf.
|
|
|
|
*/
|
|
|
|
GdkPixbuf *pixbuf;
|
2002-01-27 07:32:46 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
pixbuf = NULL;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
switch (op->type)
|
2002-01-27 07:32:46 +00:00
|
|
|
{
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_LINE:
|
|
|
|
break;
|
2002-01-27 07:32:46 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_RECTANGLE:
|
|
|
|
if (op->data.rectangle.filled)
|
2002-01-27 07:32:46 +00:00
|
|
|
{
|
2011-05-17 18:50:40 +00:00
|
|
|
GdkRGBA color;
|
2002-01-27 07:32:46 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
meta_color_spec_render (op->data.rectangle.color_spec,
|
2011-03-18 15:42:41 +00:00
|
|
|
context,
|
2002-02-02 05:09:19 +00:00
|
|
|
&color);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
|
|
|
|
FALSE,
|
|
|
|
8, width, height);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
gdk_pixbuf_fill (pixbuf, GDK_COLOR_RGBA (color));
|
|
|
|
}
|
|
|
|
break;
|
2002-01-27 07:32:46 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_ARC:
|
|
|
|
break;
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
case META_DRAW_CLIP:
|
|
|
|
break;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_TINT:
|
2002-01-08 07:23:35 +00:00
|
|
|
{
|
2011-05-17 18:50:40 +00:00
|
|
|
GdkRGBA color;
|
2002-02-02 05:09:19 +00:00
|
|
|
guint32 rgba;
|
2002-05-31 21:18:11 +00:00
|
|
|
gboolean has_alpha;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
meta_color_spec_render (op->data.rectangle.color_spec,
|
2011-03-18 15:42:41 +00:00
|
|
|
context,
|
2002-02-02 05:09:19 +00:00
|
|
|
&color);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-05-31 21:18:11 +00:00
|
|
|
has_alpha =
|
|
|
|
op->data.tint.alpha_spec &&
|
|
|
|
(op->data.tint.alpha_spec->n_alphas > 1 ||
|
|
|
|
op->data.tint.alpha_spec->alphas[0] != 0xff);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
|
2002-05-31 21:18:11 +00:00
|
|
|
has_alpha,
|
2002-02-02 05:09:19 +00:00
|
|
|
8, width, height);
|
2002-01-08 07:23:35 +00:00
|
|
|
|
2002-05-31 21:18:11 +00:00
|
|
|
if (!has_alpha)
|
|
|
|
{
|
|
|
|
rgba = GDK_COLOR_RGBA (color);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-05-31 21:18:11 +00:00
|
|
|
gdk_pixbuf_fill (pixbuf, rgba);
|
|
|
|
}
|
|
|
|
else if (op->data.tint.alpha_spec->n_alphas == 1)
|
|
|
|
{
|
|
|
|
rgba = GDK_COLOR_RGBA (color);
|
|
|
|
rgba &= ~0xff;
|
|
|
|
rgba |= op->data.tint.alpha_spec->alphas[0];
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-05-31 21:18:11 +00:00
|
|
|
gdk_pixbuf_fill (pixbuf, rgba);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rgba = GDK_COLOR_RGBA (color);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-05-31 21:18:11 +00:00
|
|
|
gdk_pixbuf_fill (pixbuf, rgba);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-05-31 21:18:11 +00:00
|
|
|
meta_gradient_add_alpha (pixbuf,
|
|
|
|
op->data.tint.alpha_spec->alphas,
|
|
|
|
op->data.tint.alpha_spec->n_alphas,
|
|
|
|
op->data.tint.alpha_spec->type);
|
|
|
|
}
|
2002-01-08 07:23:35 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_GRADIENT:
|
2002-01-08 07:23:35 +00:00
|
|
|
{
|
2002-02-02 05:09:19 +00:00
|
|
|
pixbuf = meta_gradient_spec_render (op->data.gradient.gradient_spec,
|
2011-03-18 15:42:41 +00:00
|
|
|
context, width, height);
|
2002-01-08 07:23:35 +00:00
|
|
|
|
2002-05-31 21:18:11 +00:00
|
|
|
pixbuf = apply_alpha (pixbuf,
|
|
|
|
op->data.gradient.alpha_spec,
|
|
|
|
FALSE);
|
2002-01-27 07:32:46 +00:00
|
|
|
}
|
2002-01-08 07:23:35 +00:00
|
|
|
break;
|
|
|
|
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_IMAGE:
|
2002-02-07 03:07:56 +00:00
|
|
|
{
|
2002-02-07 03:43:13 +00:00
|
|
|
if (op->data.image.colorize_spec)
|
|
|
|
{
|
2011-05-17 18:50:40 +00:00
|
|
|
GdkRGBA color;
|
2002-02-07 03:43:13 +00:00
|
|
|
|
2002-02-07 04:22:57 +00:00
|
|
|
meta_color_spec_render (op->data.image.colorize_spec,
|
2011-03-18 15:42:41 +00:00
|
|
|
context, &color);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 04:22:57 +00:00
|
|
|
if (op->data.image.colorize_cache_pixbuf == NULL ||
|
|
|
|
op->data.image.colorize_cache_pixel != GDK_COLOR_RGB (color))
|
|
|
|
{
|
|
|
|
if (op->data.image.colorize_cache_pixbuf)
|
|
|
|
g_object_unref (G_OBJECT (op->data.image.colorize_cache_pixbuf));
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 04:22:57 +00:00
|
|
|
/* const cast here */
|
|
|
|
((MetaDrawOp*)op)->data.image.colorize_cache_pixbuf =
|
|
|
|
colorize_pixbuf (op->data.image.pixbuf,
|
|
|
|
&color);
|
|
|
|
((MetaDrawOp*)op)->data.image.colorize_cache_pixel =
|
|
|
|
GDK_COLOR_RGB (color);
|
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 04:22:57 +00:00
|
|
|
if (op->data.image.colorize_cache_pixbuf)
|
|
|
|
{
|
|
|
|
pixbuf = scale_and_alpha_pixbuf (op->data.image.colorize_cache_pixbuf,
|
2002-05-31 21:18:11 +00:00
|
|
|
op->data.image.alpha_spec,
|
2002-05-31 22:03:34 +00:00
|
|
|
op->data.image.fill_type,
|
2002-11-04 17:55:56 +00:00
|
|
|
width, height,
|
|
|
|
op->data.image.vertical_stripes,
|
|
|
|
op->data.image.horizontal_stripes);
|
2002-02-07 04:22:57 +00:00
|
|
|
}
|
2002-02-07 03:43:13 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pixbuf = scale_and_alpha_pixbuf (op->data.image.pixbuf,
|
2002-11-04 17:55:56 +00:00
|
|
|
op->data.image.alpha_spec,
|
2002-05-31 22:03:34 +00:00
|
|
|
op->data.image.fill_type,
|
2002-11-04 17:55:56 +00:00
|
|
|
width, height,
|
|
|
|
op->data.image.vertical_stripes,
|
|
|
|
op->data.image.horizontal_stripes);
|
2002-02-07 03:43:13 +00:00
|
|
|
}
|
2002-05-31 21:18:11 +00:00
|
|
|
break;
|
2002-02-07 03:43:13 +00:00
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_GTK_ARROW:
|
|
|
|
case META_DRAW_GTK_BOX:
|
|
|
|
case META_DRAW_GTK_VLINE:
|
2002-02-07 03:07:56 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case META_DRAW_ICON:
|
|
|
|
if (info->mini_icon &&
|
|
|
|
width <= gdk_pixbuf_get_width (info->mini_icon) &&
|
|
|
|
height <= gdk_pixbuf_get_height (info->mini_icon))
|
|
|
|
pixbuf = scale_and_alpha_pixbuf (info->mini_icon,
|
2002-05-31 21:18:11 +00:00
|
|
|
op->data.icon.alpha_spec,
|
2002-06-04 12:35:34 +00:00
|
|
|
op->data.icon.fill_type,
|
2002-11-04 17:55:56 +00:00
|
|
|
width, height,
|
2002-11-13 04:11:52 +00:00
|
|
|
FALSE, FALSE);
|
2002-02-07 03:07:56 +00:00
|
|
|
else if (info->icon)
|
|
|
|
pixbuf = scale_and_alpha_pixbuf (info->icon,
|
2002-05-31 21:18:11 +00:00
|
|
|
op->data.icon.alpha_spec,
|
2002-06-04 12:35:34 +00:00
|
|
|
op->data.icon.fill_type,
|
2002-11-04 17:55:56 +00:00
|
|
|
width, height,
|
2002-11-13 04:11:52 +00:00
|
|
|
FALSE, FALSE);
|
2002-02-07 03:07:56 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case META_DRAW_TITLE:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_DRAW_OP_LIST:
|
2002-02-10 01:10:33 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case META_DRAW_TILE:
|
|
|
|
break;
|
2002-01-27 07:32:46 +00:00
|
|
|
}
|
2002-02-02 05:09:19 +00:00
|
|
|
|
|
|
|
return pixbuf;
|
2002-01-27 07:32:46 +00:00
|
|
|
}
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
static void
|
|
|
|
fill_env (MetaPositionExprEnv *env,
|
|
|
|
const MetaDrawInfo *info,
|
2006-04-18 17:18:53 +00:00
|
|
|
MetaRectangle logical_region)
|
2002-01-27 07:32:46 +00:00
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
/* FIXME this stuff could be raised into draw_op_list_draw() probably
|
|
|
|
*/
|
2006-04-18 17:18:53 +00:00
|
|
|
env->rect = logical_region;
|
2002-02-07 03:07:56 +00:00
|
|
|
env->object_width = -1;
|
|
|
|
env->object_height = -1;
|
|
|
|
if (info->fgeom)
|
2002-01-27 07:32:46 +00:00
|
|
|
{
|
2011-07-12 05:16:48 +00:00
|
|
|
env->left_width = info->fgeom->borders.visible.left;
|
|
|
|
env->right_width = info->fgeom->borders.visible.right;
|
|
|
|
env->top_height = info->fgeom->borders.visible.top;
|
|
|
|
env->bottom_height = info->fgeom->borders.visible.bottom;
|
2009-08-20 17:47:05 +00:00
|
|
|
env->frame_x_center = info->fgeom->width / 2 - logical_region.x;
|
|
|
|
env->frame_y_center = info->fgeom->height / 2 - logical_region.y;
|
2002-02-07 03:07:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
env->left_width = 0;
|
|
|
|
env->right_width = 0;
|
|
|
|
env->top_height = 0;
|
|
|
|
env->bottom_height = 0;
|
2009-08-20 17:47:05 +00:00
|
|
|
env->frame_x_center = 0;
|
|
|
|
env->frame_y_center = 0;
|
2002-02-07 03:07:56 +00:00
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
env->mini_icon_width = info->mini_icon ? gdk_pixbuf_get_width (info->mini_icon) : 0;
|
|
|
|
env->mini_icon_height = info->mini_icon ? gdk_pixbuf_get_height (info->mini_icon) : 0;
|
|
|
|
env->icon_width = info->icon ? gdk_pixbuf_get_width (info->icon) : 0;
|
|
|
|
env->icon_height = info->icon ? gdk_pixbuf_get_height (info->icon) : 0;
|
|
|
|
|
|
|
|
env->title_width = info->title_layout_width;
|
|
|
|
env->title_height = info->title_layout_height;
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
env->theme = meta_current_theme;
|
2002-02-07 03:07:56 +00:00
|
|
|
}
|
|
|
|
|
2010-12-09 13:52:16 +00:00
|
|
|
|
2010-07-19 15:55:00 +00:00
|
|
|
/* This code was originally rendering anti-aliased using X primitives, and
|
|
|
|
* now has been switched to draw anti-aliased using cairo. In general, the
|
|
|
|
* closest correspondence between X rendering and cairo rendering is given
|
|
|
|
* by offsetting the geometry by 0.5 pixels in both directions before rendering
|
|
|
|
* with cairo. This is because X samples at the upper left corner of the
|
|
|
|
* pixel while cairo averages over the entire pixel. However, in the cases
|
|
|
|
* where the X rendering was an exact rectangle with no "jaggies"
|
|
|
|
* we need to be a bit careful about applying the offset. We want to produce
|
|
|
|
* the exact same pixel-aligned rectangle, rather than a rectangle with
|
|
|
|
* fuzz around the edges.
|
|
|
|
*/
|
2002-02-07 03:07:56 +00:00
|
|
|
static void
|
|
|
|
meta_draw_op_draw_with_env (const MetaDrawOp *op,
|
2010-12-09 13:52:16 +00:00
|
|
|
GtkStyleContext *style_gtk,
|
2010-09-23 15:35:41 +00:00
|
|
|
cairo_t *cr,
|
2002-02-07 03:07:56 +00:00
|
|
|
const MetaDrawInfo *info,
|
2006-04-18 17:18:53 +00:00
|
|
|
MetaRectangle rect,
|
2002-02-07 03:07:56 +00:00
|
|
|
MetaPositionExprEnv *env)
|
|
|
|
{
|
2011-05-17 18:50:40 +00:00
|
|
|
GdkRGBA color;
|
2010-07-19 15:55:00 +00:00
|
|
|
|
2010-09-23 15:35:41 +00:00
|
|
|
cairo_save (cr);
|
2010-12-09 13:52:16 +00:00
|
|
|
gtk_style_context_save (style_gtk);
|
2010-07-19 15:55:00 +00:00
|
|
|
|
|
|
|
cairo_set_line_width (cr, 1.0);
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
switch (op->type)
|
|
|
|
{
|
|
|
|
case META_DRAW_LINE:
|
|
|
|
{
|
|
|
|
int x1, x2, y1, y2;
|
|
|
|
|
2011-03-18 15:42:41 +00:00
|
|
|
meta_color_spec_render (op->data.line.color_spec, style_gtk, &color);
|
2011-05-17 18:50:40 +00:00
|
|
|
gdk_cairo_set_source_rgba (cr, &color);
|
2010-07-19 15:55:00 +00:00
|
|
|
|
|
|
|
if (op->data.line.width > 0)
|
|
|
|
cairo_set_line_width (cr, op->data.line.width);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
if (op->data.line.dash_on_length > 0 &&
|
|
|
|
op->data.line.dash_off_length > 0)
|
|
|
|
{
|
2010-07-19 15:55:00 +00:00
|
|
|
double dash_list[2];
|
2002-02-02 05:09:19 +00:00
|
|
|
dash_list[0] = op->data.line.dash_on_length;
|
|
|
|
dash_list[1] = op->data.line.dash_off_length;
|
2010-07-19 15:55:00 +00:00
|
|
|
cairo_set_dash (cr, dash_list, 2, 0);
|
2002-02-02 05:09:19 +00:00
|
|
|
}
|
2002-01-27 07:32:46 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
x1 = parse_x_position_unchecked (op->data.line.x1, env);
|
2014-05-02 13:34:02 +00:00
|
|
|
y1 = parse_y_position_unchecked (op->data.line.y1, env);
|
2002-01-27 07:32:46 +00:00
|
|
|
|
2009-02-06 04:50:50 +00:00
|
|
|
if (!op->data.line.x2 &&
|
|
|
|
!op->data.line.y2 &&
|
|
|
|
op->data.line.width==0)
|
2010-07-19 15:55:00 +00:00
|
|
|
{
|
|
|
|
cairo_rectangle (cr, x1, y1, 1, 1);
|
|
|
|
cairo_fill (cr);
|
|
|
|
}
|
2009-02-06 04:50:50 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (op->data.line.x2)
|
|
|
|
x2 = parse_x_position_unchecked (op->data.line.x2, env);
|
|
|
|
else
|
|
|
|
x2 = x1;
|
|
|
|
|
|
|
|
if (op->data.line.y2)
|
|
|
|
y2 = parse_y_position_unchecked (op->data.line.y2, env);
|
|
|
|
else
|
|
|
|
y2 = y1;
|
|
|
|
|
2010-07-19 15:55:00 +00:00
|
|
|
/* This is one of the cases where we are matching the exact
|
2010-10-06 16:47:57 +00:00
|
|
|
* pixel aligned rectangle produced by X; for zero-width lines
|
|
|
|
* the generic algorithm produces the right result so we don't
|
|
|
|
* need to handle them here.
|
2010-07-19 15:55:00 +00:00
|
|
|
*/
|
2010-10-06 16:47:57 +00:00
|
|
|
if ((y1 == y2 || x1 == x2) && op->data.line.width != 0)
|
2010-07-19 15:55:00 +00:00
|
|
|
{
|
2010-10-06 16:47:57 +00:00
|
|
|
double offset = op->data.line.width % 2 ? .5 : 0;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2010-07-19 15:55:00 +00:00
|
|
|
if (y1 == y2)
|
|
|
|
{
|
|
|
|
cairo_move_to (cr, x1, y1 + offset);
|
2010-10-06 16:47:57 +00:00
|
|
|
cairo_line_to (cr, x2, y2 + offset);
|
2010-07-19 15:55:00 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cairo_move_to (cr, x1 + offset, y1);
|
2010-10-06 16:47:57 +00:00
|
|
|
cairo_line_to (cr, x2 + offset, y2);
|
2010-07-19 15:55:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-10-06 16:47:57 +00:00
|
|
|
/* zero-width lines include both end-points in X, unlike wide lines */
|
|
|
|
if (op->data.line.width == 0)
|
|
|
|
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
|
|
|
|
|
2010-07-19 15:55:00 +00:00
|
|
|
cairo_move_to (cr, x1 + .5, y1 + .5);
|
|
|
|
cairo_line_to (cr, x2 + .5, y2 + .5);
|
|
|
|
}
|
|
|
|
cairo_stroke (cr);
|
|
|
|
}
|
2002-02-02 05:09:19 +00:00
|
|
|
}
|
|
|
|
break;
|
2002-01-27 07:32:46 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_RECTANGLE:
|
|
|
|
{
|
|
|
|
int rx, ry, rwidth, rheight;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2011-03-18 15:42:41 +00:00
|
|
|
meta_color_spec_render (op->data.rectangle.color_spec,
|
|
|
|
style_gtk, &color);
|
2011-05-17 18:50:40 +00:00
|
|
|
gdk_cairo_set_source_rgba (cr, &color);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
|
|
|
rx = parse_x_position_unchecked (op->data.rectangle.x, env);
|
|
|
|
ry = parse_y_position_unchecked (op->data.rectangle.y, env);
|
|
|
|
rwidth = parse_size_unchecked (op->data.rectangle.width, env);
|
|
|
|
rheight = parse_size_unchecked (op->data.rectangle.height, env);
|
2002-01-27 07:32:46 +00:00
|
|
|
|
2010-07-19 15:55:00 +00:00
|
|
|
/* Filled and stroked rectangles are the other cases
|
|
|
|
* we pixel-align to X rasterization
|
|
|
|
*/
|
|
|
|
if (op->data.rectangle.filled)
|
|
|
|
{
|
|
|
|
cairo_rectangle (cr, rx, ry, rwidth, rheight);
|
|
|
|
cairo_fill (cr);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cairo_rectangle (cr, rx + .5, ry + .5, rwidth, rheight);
|
|
|
|
cairo_stroke (cr);
|
|
|
|
}
|
2002-01-27 07:32:46 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_ARC:
|
|
|
|
{
|
|
|
|
int rx, ry, rwidth, rheight;
|
2010-07-19 15:55:00 +00:00
|
|
|
double start_angle, end_angle;
|
|
|
|
double center_x, center_y;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2011-03-18 15:42:41 +00:00
|
|
|
meta_color_spec_render (op->data.arc.color_spec, style_gtk, &color);
|
2011-05-17 18:50:40 +00:00
|
|
|
gdk_cairo_set_source_rgba (cr, &color);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
|
|
|
rx = parse_x_position_unchecked (op->data.arc.x, env);
|
|
|
|
ry = parse_y_position_unchecked (op->data.arc.y, env);
|
|
|
|
rwidth = parse_size_unchecked (op->data.arc.width, env);
|
|
|
|
rheight = parse_size_unchecked (op->data.arc.height, env);
|
2002-02-02 05:09:19 +00:00
|
|
|
|
2010-07-19 15:55:00 +00:00
|
|
|
start_angle = op->data.arc.start_angle * (M_PI / 180.)
|
2010-10-05 19:24:09 +00:00
|
|
|
- (.5 * M_PI); /* start at 12 instead of 3 oclock */
|
2010-07-19 15:55:00 +00:00
|
|
|
end_angle = start_angle + op->data.arc.extent_angle * (M_PI / 180.);
|
|
|
|
center_x = rx + (double)rwidth / 2. + .5;
|
|
|
|
center_y = ry + (double)rheight / 2. + .5;
|
|
|
|
|
|
|
|
cairo_save (cr);
|
|
|
|
|
|
|
|
cairo_translate (cr, center_x, center_y);
|
|
|
|
cairo_scale (cr, (double)rwidth / 2., (double)rheight / 2.);
|
|
|
|
|
|
|
|
if (op->data.arc.extent_angle >= 0)
|
|
|
|
cairo_arc (cr, 0, 0, 1, start_angle, end_angle);
|
|
|
|
else
|
|
|
|
cairo_arc_negative (cr, 0, 0, 1, start_angle, end_angle);
|
|
|
|
|
|
|
|
cairo_restore (cr);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2010-07-19 15:55:00 +00:00
|
|
|
if (op->data.arc.filled)
|
|
|
|
{
|
|
|
|
cairo_line_to (cr, center_x, center_y);
|
|
|
|
cairo_fill (cr);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
cairo_stroke (cr);
|
2002-02-02 05:09:19 +00:00
|
|
|
}
|
2002-01-27 07:32:46 +00:00
|
|
|
break;
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
case META_DRAW_CLIP:
|
|
|
|
break;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_TINT:
|
2002-01-27 07:32:46 +00:00
|
|
|
{
|
2002-02-02 05:09:19 +00:00
|
|
|
int rx, ry, rwidth, rheight;
|
2002-05-31 21:18:11 +00:00
|
|
|
gboolean needs_alpha;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-05-31 21:18:11 +00:00
|
|
|
needs_alpha = op->data.tint.alpha_spec &&
|
|
|
|
(op->data.tint.alpha_spec->n_alphas > 1 ||
|
|
|
|
op->data.tint.alpha_spec->alphas[0] != 0xff);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
rx = parse_x_position_unchecked (op->data.tint.x, env);
|
|
|
|
ry = parse_y_position_unchecked (op->data.tint.y, env);
|
|
|
|
rwidth = parse_size_unchecked (op->data.tint.width, env);
|
|
|
|
rheight = parse_size_unchecked (op->data.tint.height, env);
|
2002-01-27 07:32:46 +00:00
|
|
|
|
2002-05-31 21:18:11 +00:00
|
|
|
if (!needs_alpha)
|
2002-02-02 05:09:19 +00:00
|
|
|
{
|
2011-03-18 15:42:41 +00:00
|
|
|
meta_color_spec_render (op->data.tint.color_spec,
|
|
|
|
style_gtk, &color);
|
2011-05-17 18:50:40 +00:00
|
|
|
gdk_cairo_set_source_rgba (cr, &color);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2010-09-29 14:57:25 +00:00
|
|
|
cairo_rectangle (cr, rx, ry, rwidth, rheight);
|
2010-07-19 15:55:00 +00:00
|
|
|
cairo_fill (cr);
|
2002-02-02 05:09:19 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
|
2011-03-18 15:42:41 +00:00
|
|
|
pixbuf = draw_op_as_pixbuf (op, style_gtk, info,
|
2002-02-07 03:07:56 +00:00
|
|
|
rwidth, rheight);
|
2002-02-02 05:09:19 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
if (pixbuf)
|
|
|
|
{
|
2010-07-19 15:55:00 +00:00
|
|
|
gdk_cairo_set_source_pixbuf (cr, pixbuf, rx, ry);
|
|
|
|
cairo_paint (cr);
|
2002-02-02 05:09:19 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
g_object_unref (G_OBJECT (pixbuf));
|
|
|
|
}
|
2002-02-02 05:09:19 +00:00
|
|
|
}
|
2002-01-27 07:32:46 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_GRADIENT:
|
2002-01-27 07:32:46 +00:00
|
|
|
{
|
2002-02-02 05:09:19 +00:00
|
|
|
int rx, ry, rwidth, rheight;
|
2002-01-27 07:32:46 +00:00
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
rx = parse_x_position_unchecked (op->data.gradient.x, env);
|
|
|
|
ry = parse_y_position_unchecked (op->data.gradient.y, env);
|
|
|
|
rwidth = parse_size_unchecked (op->data.gradient.width, env);
|
|
|
|
rheight = parse_size_unchecked (op->data.gradient.height, env);
|
|
|
|
|
2011-03-18 15:42:41 +00:00
|
|
|
pixbuf = draw_op_as_pixbuf (op, style_gtk, info,
|
2002-02-07 03:07:56 +00:00
|
|
|
rwidth, rheight);
|
|
|
|
|
|
|
|
if (pixbuf)
|
|
|
|
{
|
2010-07-19 15:55:00 +00:00
|
|
|
gdk_cairo_set_source_pixbuf (cr, pixbuf, rx, ry);
|
|
|
|
cairo_paint (cr);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
|
|
|
g_object_unref (G_OBJECT (pixbuf));
|
|
|
|
}
|
2002-01-27 07:32:46 +00:00
|
|
|
}
|
|
|
|
break;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_IMAGE:
|
2002-01-27 07:32:46 +00:00
|
|
|
{
|
2002-02-02 05:09:19 +00:00
|
|
|
int rx, ry, rwidth, rheight;
|
|
|
|
GdkPixbuf *pixbuf;
|
2002-01-27 07:32:46 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
if (op->data.image.pixbuf)
|
|
|
|
{
|
|
|
|
env->object_width = gdk_pixbuf_get_width (op->data.image.pixbuf);
|
|
|
|
env->object_height = gdk_pixbuf_get_height (op->data.image.pixbuf);
|
|
|
|
}
|
2002-01-27 07:32:46 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
rwidth = parse_size_unchecked (op->data.image.width, env);
|
|
|
|
rheight = parse_size_unchecked (op->data.image.height, env);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2011-03-18 15:42:41 +00:00
|
|
|
pixbuf = draw_op_as_pixbuf (op, style_gtk, info,
|
2002-02-07 03:07:56 +00:00
|
|
|
rwidth, rheight);
|
|
|
|
|
|
|
|
if (pixbuf)
|
|
|
|
{
|
|
|
|
rx = parse_x_position_unchecked (op->data.image.x, env);
|
|
|
|
ry = parse_y_position_unchecked (op->data.image.y, env);
|
|
|
|
|
2010-07-19 15:55:00 +00:00
|
|
|
gdk_cairo_set_source_pixbuf (cr, pixbuf, rx, ry);
|
|
|
|
cairo_paint (cr);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
|
|
|
g_object_unref (G_OBJECT (pixbuf));
|
|
|
|
}
|
2002-01-28 05:16:04 +00:00
|
|
|
}
|
|
|
|
break;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_GTK_ARROW:
|
|
|
|
{
|
|
|
|
int rx, ry, rwidth, rheight;
|
2010-12-09 13:52:16 +00:00
|
|
|
double angle = 0, size;
|
2002-02-02 05:09:19 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
rx = parse_x_position_unchecked (op->data.gtk_arrow.x, env);
|
|
|
|
ry = parse_y_position_unchecked (op->data.gtk_arrow.y, env);
|
|
|
|
rwidth = parse_size_unchecked (op->data.gtk_arrow.width, env);
|
|
|
|
rheight = parse_size_unchecked (op->data.gtk_arrow.height, env);
|
2002-02-02 05:09:19 +00:00
|
|
|
|
2010-12-09 13:52:16 +00:00
|
|
|
size = MAX(rwidth, rheight);
|
|
|
|
|
|
|
|
switch (op->data.gtk_arrow.arrow)
|
|
|
|
{
|
|
|
|
case GTK_ARROW_UP:
|
|
|
|
angle = 0;
|
|
|
|
break;
|
|
|
|
case GTK_ARROW_RIGHT:
|
|
|
|
angle = M_PI / 2;
|
|
|
|
break;
|
|
|
|
case GTK_ARROW_DOWN:
|
|
|
|
angle = M_PI;
|
|
|
|
break;
|
|
|
|
case GTK_ARROW_LEFT:
|
|
|
|
angle = 3 * M_PI / 2;
|
|
|
|
break;
|
|
|
|
case GTK_ARROW_NONE:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-05-18 21:32:44 +00:00
|
|
|
gtk_style_context_set_state (style_gtk, op->data.gtk_arrow.state);
|
2010-12-09 13:52:16 +00:00
|
|
|
gtk_render_arrow (style_gtk, cr, angle, rx, ry, size);
|
2002-02-02 05:09:19 +00:00
|
|
|
}
|
2002-01-28 05:16:04 +00:00
|
|
|
break;
|
2002-01-27 07:32:46 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_DRAW_GTK_BOX:
|
2002-01-28 05:16:04 +00:00
|
|
|
{
|
2002-02-02 05:09:19 +00:00
|
|
|
int rx, ry, rwidth, rheight;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
|
|
|
rx = parse_x_position_unchecked (op->data.gtk_box.x, env);
|
|
|
|
ry = parse_y_position_unchecked (op->data.gtk_box.y, env);
|
|
|
|
rwidth = parse_size_unchecked (op->data.gtk_box.width, env);
|
|
|
|
rheight = parse_size_unchecked (op->data.gtk_box.height, env);
|
2002-02-02 05:09:19 +00:00
|
|
|
|
2011-05-18 21:32:44 +00:00
|
|
|
gtk_style_context_set_state (style_gtk, op->data.gtk_box.state);
|
2010-12-09 13:52:16 +00:00
|
|
|
gtk_render_background (style_gtk, cr, rx, ry, rwidth, rheight);
|
|
|
|
gtk_render_frame (style_gtk, cr, rx, ry, rwidth, rheight);
|
2002-02-02 05:09:19 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_DRAW_GTK_VLINE:
|
|
|
|
{
|
|
|
|
int rx, ry1, ry2;
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
rx = parse_x_position_unchecked (op->data.gtk_vline.x, env);
|
|
|
|
ry1 = parse_y_position_unchecked (op->data.gtk_vline.y1, env);
|
|
|
|
ry2 = parse_y_position_unchecked (op->data.gtk_vline.y2, env);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2011-05-18 21:32:44 +00:00
|
|
|
gtk_style_context_set_state (style_gtk, op->data.gtk_vline.state);
|
2010-12-09 13:52:16 +00:00
|
|
|
gtk_render_line (style_gtk, cr, rx, ry1, rx, ry2);
|
2002-02-07 03:07:56 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_DRAW_ICON:
|
|
|
|
{
|
|
|
|
int rx, ry, rwidth, rheight;
|
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
|
|
|
|
rwidth = parse_size_unchecked (op->data.icon.width, env);
|
|
|
|
rheight = parse_size_unchecked (op->data.icon.height, env);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2011-03-18 15:42:41 +00:00
|
|
|
pixbuf = draw_op_as_pixbuf (op, style_gtk, info,
|
2002-02-07 03:07:56 +00:00
|
|
|
rwidth, rheight);
|
|
|
|
|
|
|
|
if (pixbuf)
|
|
|
|
{
|
|
|
|
rx = parse_x_position_unchecked (op->data.icon.x, env);
|
|
|
|
ry = parse_y_position_unchecked (op->data.icon.y, env);
|
|
|
|
|
2010-07-19 15:55:00 +00:00
|
|
|
gdk_cairo_set_source_pixbuf (cr, pixbuf, rx, ry);
|
|
|
|
cairo_paint (cr);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
|
|
|
g_object_unref (G_OBJECT (pixbuf));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_DRAW_TITLE:
|
|
|
|
if (info->title_layout)
|
|
|
|
{
|
|
|
|
int rx, ry;
|
2009-08-20 19:54:11 +00:00
|
|
|
PangoRectangle ink_rect, logical_rect;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2011-03-18 15:42:41 +00:00
|
|
|
meta_color_spec_render (op->data.title.color_spec,
|
|
|
|
style_gtk, &color);
|
2011-05-17 18:50:40 +00:00
|
|
|
gdk_cairo_set_source_rgba (cr, &color);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
|
|
|
rx = parse_x_position_unchecked (op->data.title.x, env);
|
|
|
|
ry = parse_y_position_unchecked (op->data.title.y, env);
|
|
|
|
|
2009-08-20 19:54:11 +00:00
|
|
|
if (op->data.title.ellipsize_width)
|
|
|
|
{
|
|
|
|
int ellipsize_width;
|
|
|
|
int right_bearing;
|
|
|
|
|
|
|
|
ellipsize_width = parse_x_position_unchecked (op->data.title.ellipsize_width, env);
|
|
|
|
/* HACK: parse_x_position_unchecked adds in env->rect.x, subtract out again */
|
|
|
|
ellipsize_width -= env->rect.x;
|
|
|
|
|
|
|
|
pango_layout_set_width (info->title_layout, -1);
|
|
|
|
pango_layout_get_pixel_extents (info->title_layout,
|
|
|
|
&ink_rect, &logical_rect);
|
|
|
|
|
|
|
|
/* Pango's idea of ellipsization is with respect to the logical rect.
|
|
|
|
* correct for this, by reducing the ellipsization width by the overflow
|
|
|
|
* of the un-ellipsized text on the right... it's always the visual
|
|
|
|
* right we want regardless of bidi, since since the X we pass in to
|
2010-07-19 15:55:00 +00:00
|
|
|
* cairo_move_to() is always the left edge of the line.
|
2009-08-20 19:54:11 +00:00
|
|
|
*/
|
|
|
|
right_bearing = (ink_rect.x + ink_rect.width) - (logical_rect.x + logical_rect.width);
|
|
|
|
right_bearing = MAX (right_bearing, 0);
|
|
|
|
|
|
|
|
ellipsize_width -= right_bearing;
|
|
|
|
ellipsize_width = MAX (ellipsize_width, 0);
|
|
|
|
|
|
|
|
/* Only ellipsizing when necessary is a performance optimization -
|
|
|
|
* pango_layout_set_width() will force a relayout if it isn't the
|
|
|
|
* same as the current width of -1.
|
|
|
|
*/
|
|
|
|
if (ellipsize_width < logical_rect.width)
|
|
|
|
pango_layout_set_width (info->title_layout, PANGO_SCALE * ellipsize_width);
|
|
|
|
}
|
|
|
|
|
2010-07-19 15:55:00 +00:00
|
|
|
cairo_move_to (cr, rx, ry);
|
|
|
|
pango_cairo_show_layout (cr, info->title_layout);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2009-08-20 19:54:11 +00:00
|
|
|
/* Remove any ellipsization we might have set; will short-circuit
|
|
|
|
* if the width is already -1 */
|
|
|
|
pango_layout_set_width (info->title_layout, -1);
|
2002-02-07 03:07:56 +00:00
|
|
|
}
|
|
|
|
break;
|
2002-02-10 01:10:33 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
case META_DRAW_OP_LIST:
|
|
|
|
{
|
2006-04-18 17:18:53 +00:00
|
|
|
MetaRectangle d_rect;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2006-04-18 17:18:53 +00:00
|
|
|
d_rect.x = parse_x_position_unchecked (op->data.op_list.x, env);
|
|
|
|
d_rect.y = parse_y_position_unchecked (op->data.op_list.y, env);
|
|
|
|
d_rect.width = parse_size_unchecked (op->data.op_list.width, env);
|
|
|
|
d_rect.height = parse_size_unchecked (op->data.op_list.height, env);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2009-01-28 01:47:18 +00:00
|
|
|
meta_draw_op_list_draw_with_style (op->data.op_list.op_list,
|
2012-03-11 20:00:57 +00:00
|
|
|
style_gtk, cr, info,
|
2006-04-18 17:18:53 +00:00
|
|
|
d_rect);
|
2002-01-08 07:23:35 +00:00
|
|
|
}
|
|
|
|
break;
|
2002-02-10 01:10:33 +00:00
|
|
|
|
|
|
|
case META_DRAW_TILE:
|
|
|
|
{
|
|
|
|
int rx, ry, rwidth, rheight;
|
2014-05-02 13:34:02 +00:00
|
|
|
int tile_xoffset, tile_yoffset;
|
2006-04-18 17:18:53 +00:00
|
|
|
MetaRectangle tile;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-10 01:10:33 +00:00
|
|
|
rx = parse_x_position_unchecked (op->data.tile.x, env);
|
|
|
|
ry = parse_y_position_unchecked (op->data.tile.y, env);
|
|
|
|
rwidth = parse_size_unchecked (op->data.tile.width, env);
|
|
|
|
rheight = parse_size_unchecked (op->data.tile.height, env);
|
|
|
|
|
2010-09-23 15:35:41 +00:00
|
|
|
cairo_save (cr);
|
2002-02-10 01:10:33 +00:00
|
|
|
|
2010-09-23 15:35:41 +00:00
|
|
|
cairo_rectangle (cr, rx, ry, rwidth, rheight);
|
|
|
|
cairo_clip (cr);
|
2002-02-10 01:10:33 +00:00
|
|
|
|
2010-09-23 15:35:41 +00:00
|
|
|
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 offset should not include x/y */
|
|
|
|
tile_xoffset -= rect.x;
|
|
|
|
tile_yoffset -= rect.y;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2010-09-23 15:35:41 +00:00
|
|
|
tile.width = parse_size_unchecked (op->data.tile.tile_width, env);
|
|
|
|
tile.height = parse_size_unchecked (op->data.tile.tile_height, env);
|
2002-02-10 01:10:33 +00:00
|
|
|
|
2010-09-23 15:35:41 +00:00
|
|
|
tile.x = rx - tile_xoffset;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2010-09-23 15:35:41 +00:00
|
|
|
while (tile.x < (rx + rwidth))
|
|
|
|
{
|
|
|
|
tile.y = ry - tile_yoffset;
|
|
|
|
while (tile.y < (ry + rheight))
|
|
|
|
{
|
|
|
|
meta_draw_op_list_draw_with_style (op->data.tile.op_list,
|
2012-03-11 20:00:57 +00:00
|
|
|
style_gtk, cr, info,
|
2010-09-23 15:35:41 +00:00
|
|
|
tile);
|
2002-02-10 01:10:33 +00:00
|
|
|
|
2010-09-23 15:35:41 +00:00
|
|
|
tile.y += tile.height;
|
2002-02-10 01:10:33 +00:00
|
|
|
}
|
2010-09-23 15:35:41 +00:00
|
|
|
|
|
|
|
tile.x += tile.width;
|
2002-02-10 01:10:33 +00:00
|
|
|
}
|
2010-09-23 15:35:41 +00:00
|
|
|
cairo_restore (cr);
|
|
|
|
|
2002-02-10 01:10:33 +00:00
|
|
|
}
|
|
|
|
break;
|
2002-01-28 05:16:04 +00:00
|
|
|
}
|
2010-07-19 15:55:00 +00:00
|
|
|
|
2010-09-23 15:35:41 +00:00
|
|
|
cairo_restore (cr);
|
2010-12-09 13:52:16 +00:00
|
|
|
gtk_style_context_restore (style_gtk);
|
2001-05-31 16:18:40 +00:00
|
|
|
}
|
2002-01-19 23:59:11 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
void
|
2009-01-28 01:47:18 +00:00
|
|
|
meta_draw_op_draw_with_style (const MetaDrawOp *op,
|
2010-12-09 13:52:16 +00:00
|
|
|
GtkStyleContext *style_gtk,
|
|
|
|
cairo_t *cr,
|
|
|
|
const MetaDrawInfo *info,
|
|
|
|
MetaRectangle logical_region)
|
2002-02-07 03:07:56 +00:00
|
|
|
{
|
|
|
|
MetaPositionExprEnv env;
|
|
|
|
|
2006-04-18 17:18:53 +00:00
|
|
|
fill_env (&env, info, logical_region);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2012-03-11 20:00:57 +00:00
|
|
|
meta_draw_op_draw_with_env (op, style_gtk, cr,
|
2006-04-18 17:18:53 +00:00
|
|
|
info, logical_region,
|
2002-02-07 03:07:56 +00:00
|
|
|
&env);
|
2006-04-18 17:18:53 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
}
|
|
|
|
|
2010-09-01 19:39:53 +00:00
|
|
|
/**
|
|
|
|
* meta_draw_op_list_new: (skip)
|
|
|
|
*
|
|
|
|
*/
|
2002-02-02 05:09:19 +00:00
|
|
|
MetaDrawOpList*
|
|
|
|
meta_draw_op_list_new (int n_preallocs)
|
|
|
|
{
|
|
|
|
MetaDrawOpList *op_list;
|
|
|
|
|
|
|
|
g_return_val_if_fail (n_preallocs >= 0, NULL);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
op_list = g_new (MetaDrawOpList, 1);
|
|
|
|
|
|
|
|
op_list->refcount = 1;
|
|
|
|
op_list->n_allocated = n_preallocs;
|
|
|
|
op_list->ops = g_new (MetaDrawOp*, op_list->n_allocated);
|
|
|
|
op_list->n_ops = 0;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
return op_list;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_draw_op_list_ref (MetaDrawOpList *op_list)
|
|
|
|
{
|
|
|
|
g_return_if_fail (op_list != NULL);
|
|
|
|
|
|
|
|
op_list->refcount += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_draw_op_list_unref (MetaDrawOpList *op_list)
|
|
|
|
{
|
|
|
|
g_return_if_fail (op_list != NULL);
|
|
|
|
g_return_if_fail (op_list->refcount > 0);
|
|
|
|
|
|
|
|
op_list->refcount -= 1;
|
|
|
|
|
|
|
|
if (op_list->refcount == 0)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2006-04-18 17:18:53 +00:00
|
|
|
for (i = 0; i < op_list->n_ops; i++)
|
|
|
|
meta_draw_op_free (op_list->ops[i]);
|
2002-02-02 05:09:19 +00:00
|
|
|
|
|
|
|
g_free (op_list->ops);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
|
|
|
DEBUG_FILL_STRUCT (op_list);
|
2002-02-02 05:09:19 +00:00
|
|
|
g_free (op_list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2009-01-28 01:47:18 +00:00
|
|
|
meta_draw_op_list_draw_with_style (const MetaDrawOpList *op_list,
|
2010-12-09 13:52:16 +00:00
|
|
|
GtkStyleContext *style_gtk,
|
|
|
|
cairo_t *cr,
|
|
|
|
const MetaDrawInfo *info,
|
|
|
|
MetaRectangle rect)
|
2002-02-02 05:09:19 +00:00
|
|
|
{
|
|
|
|
int i;
|
2002-02-07 03:07:56 +00:00
|
|
|
MetaPositionExprEnv env;
|
2002-02-02 05:09:19 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
if (op_list->n_ops == 0)
|
|
|
|
return;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2006-04-18 17:18:53 +00:00
|
|
|
fill_env (&env, info, rect);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
/* FIXME this can be optimized, potentially a lot, by
|
|
|
|
* compressing multiple ops when possible. For example,
|
|
|
|
* anything convertible to a pixbuf can be composited
|
|
|
|
* client-side, and putting a color tint over a pixbuf
|
|
|
|
* can be done without creating the solid-color pixbuf.
|
2002-02-07 03:07:56 +00:00
|
|
|
*
|
|
|
|
* To implement this my plan is to have the idea of a
|
|
|
|
* compiled draw op (with the string expressions already
|
|
|
|
* evaluated), we make an array of those, and then fold
|
|
|
|
* adjacent items when possible.
|
2002-02-02 05:09:19 +00:00
|
|
|
*/
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2010-09-23 15:35:41 +00:00
|
|
|
cairo_save (cr);
|
2006-04-18 17:18:53 +00:00
|
|
|
|
|
|
|
for (i = 0; i < op_list->n_ops; i++)
|
2002-02-02 05:09:19 +00:00
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
MetaDrawOp *op = op_list->ops[i];
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
if (op->type == META_DRAW_CLIP)
|
|
|
|
{
|
2010-09-23 15:35:41 +00:00
|
|
|
cairo_restore (cr);
|
|
|
|
|
2014-05-02 13:34:02 +00:00
|
|
|
cairo_rectangle (cr,
|
2010-09-23 15:35:41 +00:00
|
|
|
parse_x_position_unchecked (op->data.clip.x, &env),
|
|
|
|
parse_y_position_unchecked (op->data.clip.y, &env),
|
|
|
|
parse_size_unchecked (op->data.clip.width, &env),
|
|
|
|
parse_size_unchecked (op->data.clip.height, &env));
|
|
|
|
cairo_clip (cr);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2010-09-23 15:35:41 +00:00
|
|
|
cairo_save (cr);
|
2002-02-07 03:07:56 +00:00
|
|
|
}
|
2010-09-23 15:35:41 +00:00
|
|
|
else if (gdk_cairo_get_clip_rectangle (cr, NULL))
|
2002-02-07 03:07:56 +00:00
|
|
|
{
|
|
|
|
meta_draw_op_draw_with_env (op,
|
2012-03-11 20:00:57 +00:00
|
|
|
style_gtk, cr, info,
|
2006-04-18 17:18:53 +00:00
|
|
|
rect,
|
2002-02-07 03:07:56 +00:00
|
|
|
&env);
|
|
|
|
}
|
2002-02-02 05:09:19 +00:00
|
|
|
}
|
2010-09-23 15:35:41 +00:00
|
|
|
|
|
|
|
cairo_restore (cr);
|
2002-02-02 05:09:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_draw_op_list_append (MetaDrawOpList *op_list,
|
|
|
|
MetaDrawOp *op)
|
|
|
|
{
|
|
|
|
if (op_list->n_ops == op_list->n_allocated)
|
|
|
|
{
|
|
|
|
op_list->n_allocated *= 2;
|
|
|
|
op_list->ops = g_renew (MetaDrawOp*, op_list->ops, op_list->n_allocated);
|
|
|
|
}
|
|
|
|
|
|
|
|
op_list->ops[op_list->n_ops] = op;
|
|
|
|
op_list->n_ops += 1;
|
|
|
|
}
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
gboolean
|
|
|
|
meta_draw_op_list_validate (MetaDrawOpList *op_list,
|
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (op_list != NULL, FALSE);
|
|
|
|
|
|
|
|
/* empty lists are OK, nothing else to check really */
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This is not done in validate, since we wouldn't know the name
|
|
|
|
* of the list to report the error. It might be nice to
|
|
|
|
* store names inside the list sometime.
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
meta_draw_op_list_contains (MetaDrawOpList *op_list,
|
|
|
|
MetaDrawOpList *child)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* mmm, huge tree recursion */
|
2006-04-18 17:18:53 +00:00
|
|
|
|
|
|
|
for (i = 0; i < op_list->n_ops; i++)
|
2002-02-07 03:07:56 +00:00
|
|
|
{
|
|
|
|
if (op_list->ops[i]->type == META_DRAW_OP_LIST)
|
|
|
|
{
|
|
|
|
if (op_list->ops[i]->data.op_list.op_list == child)
|
|
|
|
return TRUE;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
if (meta_draw_op_list_contains (op_list->ops[i]->data.op_list.op_list,
|
|
|
|
child))
|
|
|
|
return TRUE;
|
|
|
|
}
|
2002-02-10 01:10:33 +00:00
|
|
|
else if (op_list->ops[i]->type == META_DRAW_TILE)
|
|
|
|
{
|
|
|
|
if (op_list->ops[i]->data.tile.op_list == child)
|
|
|
|
return TRUE;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-10 01:10:33 +00:00
|
|
|
if (meta_draw_op_list_contains (op_list->ops[i]->data.tile.op_list,
|
|
|
|
child))
|
|
|
|
return TRUE;
|
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-01-22 04:00:35 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* meta_frame_style_new:
|
|
|
|
* @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.
|
2008-01-22 04:00:35 +00:00
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* Constructor for a MetaFrameStyle.
|
2008-01-22 04:00:35 +00:00
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* Returns: (transfer full): The newly-constructed style.
|
2008-01-22 04:00:35 +00:00
|
|
|
*/
|
2002-01-19 23:59:11 +00:00
|
|
|
MetaFrameStyle*
|
2002-01-28 02:09:12 +00:00
|
|
|
meta_frame_style_new (MetaFrameStyle *parent)
|
2002-01-19 23:59:11 +00:00
|
|
|
{
|
|
|
|
MetaFrameStyle *style;
|
|
|
|
|
|
|
|
style = g_new0 (MetaFrameStyle, 1);
|
|
|
|
|
|
|
|
style->refcount = 1;
|
2002-01-28 02:09:12 +00:00
|
|
|
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
/* Default alpha is fully opaque */
|
|
|
|
style->window_background_alpha = 255;
|
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
style->parent = parent;
|
|
|
|
if (parent)
|
|
|
|
meta_frame_style_ref (parent);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-19 23:59:11 +00:00
|
|
|
return style;
|
|
|
|
}
|
|
|
|
|
2008-01-22 04:00:35 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* meta_frame_style_ref:
|
|
|
|
* @style: The style.
|
2008-01-22 04:00:35 +00:00
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* Increases the reference count of a frame style.
|
2008-01-22 04:00:35 +00:00
|
|
|
*/
|
2002-01-19 23:59:11 +00:00
|
|
|
void
|
|
|
|
meta_frame_style_ref (MetaFrameStyle *style)
|
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-19 23:59:11 +00:00
|
|
|
style->refcount += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2002-02-02 05:09:19 +00:00
|
|
|
free_button_ops (MetaDrawOpList *op_lists[META_BUTTON_TYPE_LAST][META_BUTTON_STATE_LAST])
|
2002-01-19 23:59:11 +00:00
|
|
|
{
|
|
|
|
int i, j;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2006-04-18 17:18:53 +00:00
|
|
|
for (i = 0; i < META_BUTTON_TYPE_LAST; i++)
|
|
|
|
for (j = 0; j < META_BUTTON_STATE_LAST; j++)
|
|
|
|
if (op_lists[i][j])
|
|
|
|
meta_draw_op_list_unref (op_lists[i][j]);
|
2002-01-19 23:59:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_frame_style_unref (MetaFrameStyle *style)
|
|
|
|
{
|
|
|
|
g_return_if_fail (style != NULL);
|
|
|
|
g_return_if_fail (style->refcount > 0);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-19 23:59:11 +00:00
|
|
|
style->refcount -= 1;
|
|
|
|
|
|
|
|
if (style->refcount == 0)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
free_button_ops (style->buttons);
|
|
|
|
|
2006-04-18 17:18:53 +00:00
|
|
|
for (i = 0; i < META_FRAME_PIECE_LAST; i++)
|
|
|
|
if (style->pieces[i])
|
|
|
|
meta_draw_op_list_unref (style->pieces[i]);
|
2002-01-19 23:59:11 +00:00
|
|
|
|
|
|
|
if (style->layout)
|
2002-02-07 03:07:56 +00:00
|
|
|
meta_frame_layout_unref (style->layout);
|
2002-01-28 02:09:12 +00:00
|
|
|
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
if (style->window_background_color)
|
|
|
|
meta_color_spec_free (style->window_background_color);
|
|
|
|
|
2002-01-28 02:09:12 +00:00
|
|
|
/* we hold a reference to any parent style */
|
|
|
|
if (style->parent)
|
|
|
|
meta_frame_style_unref (style->parent);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
|
|
|
DEBUG_FILL_STRUCT (style);
|
2002-01-19 23:59:11 +00:00
|
|
|
g_free (style);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-02 00:16:10 +00:00
|
|
|
static MetaButtonState
|
|
|
|
map_button_state (MetaButtonType button_type,
|
|
|
|
const MetaFrameGeometry *fgeom,
|
|
|
|
int middle_bg_offset,
|
|
|
|
MetaButtonState button_states[META_BUTTON_TYPE_LAST])
|
|
|
|
{
|
|
|
|
MetaButtonFunction function = META_BUTTON_FUNCTION_LAST;
|
|
|
|
|
|
|
|
switch (button_type)
|
|
|
|
{
|
|
|
|
/* First hande functions, which map directly */
|
|
|
|
case META_BUTTON_TYPE_SHADE:
|
|
|
|
case META_BUTTON_TYPE_ABOVE:
|
|
|
|
case META_BUTTON_TYPE_STICK:
|
|
|
|
case META_BUTTON_TYPE_UNSHADE:
|
|
|
|
case META_BUTTON_TYPE_UNABOVE:
|
|
|
|
case META_BUTTON_TYPE_UNSTICK:
|
|
|
|
case META_BUTTON_TYPE_MENU:
|
|
|
|
case META_BUTTON_TYPE_MINIMIZE:
|
|
|
|
case META_BUTTON_TYPE_MAXIMIZE:
|
|
|
|
case META_BUTTON_TYPE_CLOSE:
|
|
|
|
return button_states[button_type];
|
|
|
|
|
|
|
|
/* Map position buttons to the corresponding function */
|
|
|
|
case META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND:
|
2010-12-03 00:14:13 +00:00
|
|
|
case META_BUTTON_TYPE_RIGHT_SINGLE_BACKGROUND:
|
2010-12-02 00:16:10 +00:00
|
|
|
if (fgeom->n_right_buttons > 0)
|
|
|
|
function = fgeom->button_layout.right_buttons[0];
|
|
|
|
break;
|
|
|
|
case META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND:
|
|
|
|
if (fgeom->n_right_buttons > 0)
|
|
|
|
function = fgeom->button_layout.right_buttons[fgeom->n_right_buttons - 1];
|
|
|
|
break;
|
|
|
|
case META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND:
|
|
|
|
if (middle_bg_offset + 1 < fgeom->n_right_buttons)
|
|
|
|
function = fgeom->button_layout.right_buttons[middle_bg_offset + 1];
|
|
|
|
break;
|
|
|
|
case META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND:
|
2010-12-03 00:14:13 +00:00
|
|
|
case META_BUTTON_TYPE_LEFT_SINGLE_BACKGROUND:
|
2010-12-02 00:16:10 +00:00
|
|
|
if (fgeom->n_left_buttons > 0)
|
|
|
|
function = fgeom->button_layout.left_buttons[0];
|
|
|
|
break;
|
|
|
|
case META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND:
|
|
|
|
if (fgeom->n_left_buttons > 0)
|
|
|
|
function = fgeom->button_layout.left_buttons[fgeom->n_left_buttons - 1];
|
|
|
|
break;
|
|
|
|
case META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND:
|
|
|
|
if (middle_bg_offset + 1 < fgeom->n_left_buttons)
|
|
|
|
function = fgeom->button_layout.left_buttons[middle_bg_offset + 1];
|
|
|
|
break;
|
|
|
|
case META_BUTTON_TYPE_LAST:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (function != META_BUTTON_FUNCTION_LAST)
|
|
|
|
return button_states[map_button_function_to_type (function)];
|
|
|
|
|
|
|
|
return META_BUTTON_STATE_LAST;
|
|
|
|
}
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
static MetaDrawOpList*
|
|
|
|
get_button (MetaFrameStyle *style,
|
|
|
|
MetaButtonType type,
|
|
|
|
MetaButtonState state)
|
|
|
|
{
|
|
|
|
MetaDrawOpList *op_list;
|
|
|
|
MetaFrameStyle *parent;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
parent = style;
|
|
|
|
op_list = NULL;
|
|
|
|
while (parent && op_list == NULL)
|
|
|
|
{
|
|
|
|
op_list = parent->buttons[type][state];
|
|
|
|
parent = parent->parent;
|
|
|
|
}
|
|
|
|
|
2010-12-03 00:14:13 +00:00
|
|
|
/* We fall back to the side buttons if we don't have
|
|
|
|
* single button backgrounds, and to middle button
|
|
|
|
* backgrounds if we don't have the ones on the sides
|
2002-10-04 02:59:07 +00:00
|
|
|
*/
|
|
|
|
|
2010-12-03 00:14:13 +00:00
|
|
|
if (op_list == NULL &&
|
|
|
|
type == META_BUTTON_TYPE_LEFT_SINGLE_BACKGROUND)
|
|
|
|
return get_button (style, META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND, state);
|
|
|
|
|
|
|
|
if (op_list == NULL &&
|
|
|
|
type == META_BUTTON_TYPE_RIGHT_SINGLE_BACKGROUND)
|
|
|
|
return get_button (style, META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND, state);
|
|
|
|
|
2002-10-04 02:59:07 +00:00
|
|
|
if (op_list == NULL &&
|
|
|
|
(type == META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND ||
|
|
|
|
type == META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND))
|
|
|
|
return get_button (style, META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND,
|
|
|
|
state);
|
|
|
|
|
|
|
|
if (op_list == NULL &&
|
|
|
|
(type == META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND ||
|
|
|
|
type == META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND))
|
|
|
|
return get_button (style, META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND,
|
|
|
|
state);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2007-04-01 15:31:24 +00:00
|
|
|
/* We fall back to normal if no prelight */
|
|
|
|
if (op_list == NULL &&
|
|
|
|
state == META_BUTTON_STATE_PRELIGHT)
|
|
|
|
return get_button (style, type, META_BUTTON_STATE_NORMAL);
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
return op_list;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
meta_frame_style_validate (MetaFrameStyle *style,
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
guint current_theme_version,
|
2002-02-07 03:07:56 +00:00
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
int i, j;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
g_return_val_if_fail (style != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (style->layout != NULL, FALSE);
|
|
|
|
|
2006-04-18 17:18:53 +00:00
|
|
|
for (i = 0; i < META_BUTTON_TYPE_LAST; i++)
|
2002-02-07 03:07:56 +00:00
|
|
|
{
|
2002-08-04 20:02:45 +00:00
|
|
|
/* for now the "positional" buttons are optional */
|
|
|
|
if (i >= META_BUTTON_TYPE_CLOSE)
|
|
|
|
{
|
2006-04-18 17:18:53 +00:00
|
|
|
for (j = 0; j < META_BUTTON_STATE_LAST; j++)
|
2002-02-07 03:07:56 +00:00
|
|
|
{
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
if (get_button (style, i, j) == NULL &&
|
|
|
|
meta_theme_earliest_version_with_button (i) <= current_theme_version
|
|
|
|
)
|
2002-08-04 20:02:45 +00:00
|
|
|
{
|
|
|
|
g_set_error (error, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
|
|
|
_("<button function=\"%s\" state=\"%s\" draw_ops=\"whatever\"/> must be specified for this frame style"),
|
|
|
|
meta_button_type_to_string (i),
|
|
|
|
meta_button_state_to_string (j));
|
|
|
|
return FALSE;
|
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2002-01-28 05:16:04 +00:00
|
|
|
static void
|
2002-10-04 02:28:57 +00:00
|
|
|
button_rect (MetaButtonType type,
|
2002-02-07 03:07:56 +00:00
|
|
|
const MetaFrameGeometry *fgeom,
|
2002-10-04 02:59:07 +00:00
|
|
|
int middle_background_offset,
|
2002-10-04 02:28:57 +00:00
|
|
|
GdkRectangle *rect)
|
2002-01-28 05:16:04 +00:00
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
2002-10-04 02:28:57 +00:00
|
|
|
case META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND:
|
|
|
|
*rect = fgeom->left_left_background;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND:
|
2002-10-04 02:59:07 +00:00
|
|
|
*rect = fgeom->left_middle_backgrounds[middle_background_offset];
|
2002-10-04 02:28:57 +00:00
|
|
|
break;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
case META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND:
|
|
|
|
*rect = fgeom->left_right_background;
|
|
|
|
break;
|
2010-12-03 00:14:13 +00:00
|
|
|
|
|
|
|
case META_BUTTON_TYPE_LEFT_SINGLE_BACKGROUND:
|
|
|
|
*rect = fgeom->left_single_background;
|
|
|
|
break;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
case META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND:
|
|
|
|
*rect = fgeom->right_left_background;
|
|
|
|
break;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
case META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND:
|
2002-10-04 02:59:07 +00:00
|
|
|
*rect = fgeom->right_middle_backgrounds[middle_background_offset];
|
2002-10-04 02:28:57 +00:00
|
|
|
break;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-08-04 20:02:45 +00:00
|
|
|
case META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND:
|
2002-10-04 02:28:57 +00:00
|
|
|
*rect = fgeom->right_right_background;
|
|
|
|
break;
|
2010-12-03 00:14:13 +00:00
|
|
|
|
|
|
|
case META_BUTTON_TYPE_RIGHT_SINGLE_BACKGROUND:
|
|
|
|
*rect = fgeom->right_single_background;
|
|
|
|
break;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-01-28 05:16:04 +00:00
|
|
|
case META_BUTTON_TYPE_CLOSE:
|
2006-08-07 18:01:21 +00:00
|
|
|
*rect = fgeom->close_rect.visible;
|
2002-01-28 05:16:04 +00:00
|
|
|
break;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
case META_BUTTON_TYPE_SHADE:
|
|
|
|
*rect = fgeom->shade_rect.visible;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_BUTTON_TYPE_UNSHADE:
|
|
|
|
*rect = fgeom->unshade_rect.visible;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_BUTTON_TYPE_ABOVE:
|
|
|
|
*rect = fgeom->above_rect.visible;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_BUTTON_TYPE_UNABOVE:
|
|
|
|
*rect = fgeom->unabove_rect.visible;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_BUTTON_TYPE_STICK:
|
|
|
|
*rect = fgeom->stick_rect.visible;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_BUTTON_TYPE_UNSTICK:
|
|
|
|
*rect = fgeom->unstick_rect.visible;
|
|
|
|
break;
|
|
|
|
|
2002-01-28 05:16:04 +00:00
|
|
|
case META_BUTTON_TYPE_MAXIMIZE:
|
2006-08-07 18:01:21 +00:00
|
|
|
*rect = fgeom->max_rect.visible;
|
2002-01-28 05:16:04 +00:00
|
|
|
break;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 05:16:04 +00:00
|
|
|
case META_BUTTON_TYPE_MINIMIZE:
|
2006-08-07 18:01:21 +00:00
|
|
|
*rect = fgeom->min_rect.visible;
|
2002-01-28 05:16:04 +00:00
|
|
|
break;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 05:16:04 +00:00
|
|
|
case META_BUTTON_TYPE_MENU:
|
2006-08-07 18:01:21 +00:00
|
|
|
*rect = fgeom->menu_rect.visible;
|
2002-01-28 05:16:04 +00:00
|
|
|
break;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-01-28 05:16:04 +00:00
|
|
|
case META_BUTTON_TYPE_LAST:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-27 05:16:57 +00:00
|
|
|
static void
|
2009-01-28 01:47:18 +00:00
|
|
|
meta_frame_style_draw_with_style (MetaFrameStyle *style,
|
2010-12-09 13:52:16 +00:00
|
|
|
GtkStyleContext *style_gtk,
|
|
|
|
cairo_t *cr,
|
|
|
|
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)
|
2002-01-28 05:16:04 +00:00
|
|
|
{
|
2002-06-12 21:12:53 +00:00
|
|
|
int i, j;
|
2011-07-12 05:16:48 +00:00
|
|
|
GdkRectangle visible_rect;
|
2002-01-28 05:16:04 +00:00
|
|
|
GdkRectangle titlebar_rect;
|
|
|
|
GdkRectangle left_titlebar_edge;
|
|
|
|
GdkRectangle right_titlebar_edge;
|
|
|
|
GdkRectangle bottom_titlebar_edge;
|
|
|
|
GdkRectangle top_titlebar_edge;
|
|
|
|
GdkRectangle left_edge, right_edge, bottom_edge;
|
2009-08-20 19:54:11 +00:00
|
|
|
PangoRectangle logical_rect;
|
2002-02-07 03:07:56 +00:00
|
|
|
MetaDrawInfo draw_info;
|
2011-07-12 05:16:48 +00:00
|
|
|
const MetaFrameBorders *borders;
|
|
|
|
|
|
|
|
borders = &fgeom->borders;
|
|
|
|
|
|
|
|
visible_rect.x = borders->invisible.left;
|
|
|
|
visible_rect.y = borders->invisible.top;
|
|
|
|
visible_rect.width = fgeom->width - borders->invisible.left - borders->invisible.right;
|
|
|
|
visible_rect.height = fgeom->height - borders->invisible.top - borders->invisible.bottom;
|
|
|
|
|
|
|
|
titlebar_rect.x = visible_rect.x;
|
|
|
|
titlebar_rect.y = visible_rect.y;
|
|
|
|
titlebar_rect.width = visible_rect.width;
|
|
|
|
titlebar_rect.height = borders->visible.top;
|
2002-01-28 05:16:04 +00:00
|
|
|
|
|
|
|
left_titlebar_edge.x = titlebar_rect.x;
|
2002-02-07 03:07:56 +00:00
|
|
|
left_titlebar_edge.y = titlebar_rect.y + fgeom->top_titlebar_edge;
|
|
|
|
left_titlebar_edge.width = fgeom->left_titlebar_edge;
|
|
|
|
left_titlebar_edge.height = titlebar_rect.height - fgeom->top_titlebar_edge - fgeom->bottom_titlebar_edge;
|
2002-01-28 05:16:04 +00:00
|
|
|
|
|
|
|
right_titlebar_edge.y = left_titlebar_edge.y;
|
|
|
|
right_titlebar_edge.height = left_titlebar_edge.height;
|
2002-02-07 03:07:56 +00:00
|
|
|
right_titlebar_edge.width = fgeom->right_titlebar_edge;
|
2002-01-28 05:16:04 +00:00
|
|
|
right_titlebar_edge.x = titlebar_rect.x + titlebar_rect.width - right_titlebar_edge.width;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 05:16:04 +00:00
|
|
|
top_titlebar_edge.x = titlebar_rect.x;
|
|
|
|
top_titlebar_edge.y = titlebar_rect.y;
|
|
|
|
top_titlebar_edge.width = titlebar_rect.width;
|
2002-02-07 03:07:56 +00:00
|
|
|
top_titlebar_edge.height = fgeom->top_titlebar_edge;
|
2002-01-28 05:16:04 +00:00
|
|
|
|
|
|
|
bottom_titlebar_edge.x = titlebar_rect.x;
|
|
|
|
bottom_titlebar_edge.width = titlebar_rect.width;
|
2002-02-07 03:07:56 +00:00
|
|
|
bottom_titlebar_edge.height = fgeom->bottom_titlebar_edge;
|
|
|
|
bottom_titlebar_edge.y = titlebar_rect.y + titlebar_rect.height - bottom_titlebar_edge.height;
|
2002-01-28 05:16:04 +00:00
|
|
|
|
2011-07-12 05:16:48 +00:00
|
|
|
left_edge.x = visible_rect.x;
|
|
|
|
left_edge.y = visible_rect.y + borders->visible.top;
|
|
|
|
left_edge.width = borders->visible.left;
|
|
|
|
left_edge.height = visible_rect.height - borders->visible.top - borders->visible.bottom;
|
2002-01-28 05:16:04 +00:00
|
|
|
|
2011-07-12 05:16:48 +00:00
|
|
|
right_edge.x = visible_rect.x + visible_rect.width - borders->visible.right;
|
|
|
|
right_edge.y = visible_rect.y + borders->visible.top;
|
|
|
|
right_edge.width = borders->visible.right;
|
|
|
|
right_edge.height = visible_rect.height - borders->visible.top - borders->visible.bottom;
|
2002-01-28 05:16:04 +00:00
|
|
|
|
2011-07-12 05:16:48 +00:00
|
|
|
bottom_edge.x = visible_rect.x;
|
|
|
|
bottom_edge.y = visible_rect.y + visible_rect.height - borders->visible.bottom;
|
|
|
|
bottom_edge.width = visible_rect.width;
|
|
|
|
bottom_edge.height = borders->visible.bottom;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
|
|
|
if (title_layout)
|
|
|
|
pango_layout_get_pixel_extents (title_layout,
|
2009-08-20 19:54:11 +00:00
|
|
|
NULL, &logical_rect);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
|
|
|
draw_info.mini_icon = mini_icon;
|
|
|
|
draw_info.icon = icon;
|
|
|
|
draw_info.title_layout = title_layout;
|
2009-08-20 19:54:11 +00:00
|
|
|
draw_info.title_layout_width = title_layout ? logical_rect.width : 0;
|
|
|
|
draw_info.title_layout_height = title_layout ? logical_rect.height : 0;
|
2002-02-07 03:07:56 +00:00
|
|
|
draw_info.fgeom = fgeom;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-01-28 05:16:04 +00:00
|
|
|
/* The enum is in the order the pieces should be rendered. */
|
|
|
|
i = 0;
|
|
|
|
while (i < META_FRAME_PIECE_LAST)
|
|
|
|
{
|
|
|
|
GdkRectangle rect;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
switch ((MetaFramePiece) i)
|
2002-01-28 05:16:04 +00:00
|
|
|
{
|
|
|
|
case META_FRAME_PIECE_ENTIRE_BACKGROUND:
|
2011-07-12 05:16:48 +00:00
|
|
|
rect = visible_rect;
|
2002-01-28 05:16:04 +00:00
|
|
|
break;
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
case META_FRAME_PIECE_TITLEBAR:
|
2002-01-28 05:16:04 +00:00
|
|
|
rect = titlebar_rect;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_FRAME_PIECE_LEFT_TITLEBAR_EDGE:
|
|
|
|
rect = left_titlebar_edge;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_FRAME_PIECE_RIGHT_TITLEBAR_EDGE:
|
|
|
|
rect = right_titlebar_edge;
|
|
|
|
break;
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_FRAME_PIECE_TOP_TITLEBAR_EDGE:
|
|
|
|
rect = top_titlebar_edge;
|
2002-01-28 05:16:04 +00:00
|
|
|
break;
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_FRAME_PIECE_BOTTOM_TITLEBAR_EDGE:
|
|
|
|
rect = bottom_titlebar_edge;
|
2002-01-28 05:16:04 +00:00
|
|
|
break;
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_FRAME_PIECE_TITLEBAR_MIDDLE:
|
|
|
|
rect.x = left_titlebar_edge.x + left_titlebar_edge.width;
|
|
|
|
rect.y = top_titlebar_edge.y + top_titlebar_edge.height;
|
|
|
|
rect.width = titlebar_rect.width - left_titlebar_edge.width -
|
|
|
|
right_titlebar_edge.width;
|
|
|
|
rect.height = titlebar_rect.height - top_titlebar_edge.height - bottom_titlebar_edge.height;
|
|
|
|
break;
|
2002-01-28 05:16:04 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
case META_FRAME_PIECE_TITLE:
|
|
|
|
rect = fgeom->title_rect;
|
2002-01-28 05:16:04 +00:00
|
|
|
break;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-01-28 05:16:04 +00:00
|
|
|
case META_FRAME_PIECE_LEFT_EDGE:
|
|
|
|
rect = left_edge;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_FRAME_PIECE_RIGHT_EDGE:
|
|
|
|
rect = right_edge;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_FRAME_PIECE_BOTTOM_EDGE:
|
|
|
|
rect = bottom_edge;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_FRAME_PIECE_OVERLAY:
|
2011-07-12 05:16:48 +00:00
|
|
|
rect = visible_rect;
|
2002-01-28 05:16:04 +00:00
|
|
|
break;
|
2002-02-02 05:09:19 +00:00
|
|
|
|
|
|
|
case META_FRAME_PIECE_LAST:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
2002-01-28 05:16:04 +00:00
|
|
|
}
|
2002-01-28 07:30:44 +00:00
|
|
|
|
2010-09-23 15:35:41 +00:00
|
|
|
cairo_save (cr);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2010-09-23 15:35:41 +00:00
|
|
|
gdk_cairo_rectangle (cr, &rect);
|
|
|
|
cairo_clip (cr);
|
2002-01-28 05:16:04 +00:00
|
|
|
|
2010-09-23 15:35:41 +00:00
|
|
|
if (gdk_cairo_get_clip_rectangle (cr, NULL))
|
2002-01-28 05:16:04 +00:00
|
|
|
{
|
2002-02-02 05:09:19 +00:00
|
|
|
MetaDrawOpList *op_list;
|
2002-01-28 05:16:04 +00:00
|
|
|
MetaFrameStyle *parent;
|
|
|
|
|
|
|
|
parent = style;
|
2002-02-02 05:09:19 +00:00
|
|
|
op_list = NULL;
|
|
|
|
while (parent && op_list == NULL)
|
2002-01-28 05:16:04 +00:00
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
op_list = parent->pieces[i];
|
|
|
|
parent = parent->parent;
|
2002-01-28 05:16:04 +00:00
|
|
|
}
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
if (op_list)
|
2006-04-18 17:18:53 +00:00
|
|
|
{
|
|
|
|
MetaRectangle m_rect;
|
|
|
|
m_rect = meta_rect (rect.x, rect.y, rect.width, rect.height);
|
2009-01-28 01:47:18 +00:00
|
|
|
meta_draw_op_list_draw_with_style (op_list,
|
|
|
|
style_gtk,
|
2010-12-09 13:52:16 +00:00
|
|
|
cr,
|
|
|
|
&draw_info,
|
|
|
|
m_rect);
|
2006-04-18 17:18:53 +00:00
|
|
|
}
|
2002-01-28 05:16:04 +00:00
|
|
|
}
|
|
|
|
|
2010-09-23 15:35:41 +00:00
|
|
|
cairo_restore (cr);
|
2002-01-28 05:16:04 +00:00
|
|
|
|
2002-06-12 21:12:53 +00:00
|
|
|
/* Draw buttons just before overlay */
|
|
|
|
if ((i + 1) == META_FRAME_PIECE_OVERLAY)
|
2002-01-28 05:16:04 +00:00
|
|
|
{
|
2010-09-23 15:35:41 +00:00
|
|
|
MetaDrawOpList *op_list;
|
2002-10-04 02:59:07 +00:00
|
|
|
int middle_bg_offset;
|
|
|
|
|
|
|
|
middle_bg_offset = 0;
|
2002-06-12 21:12:53 +00:00
|
|
|
j = 0;
|
|
|
|
while (j < META_BUTTON_TYPE_LAST)
|
2006-04-18 17:18:53 +00:00
|
|
|
{
|
2010-12-02 00:16:10 +00:00
|
|
|
MetaButtonState button_state;
|
|
|
|
|
2002-10-04 02:59:07 +00:00
|
|
|
button_rect (j, fgeom, middle_bg_offset, &rect);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2010-12-02 00:16:10 +00:00
|
|
|
button_state = map_button_state (j, fgeom, middle_bg_offset, button_states);
|
|
|
|
|
|
|
|
op_list = get_button (style, j, button_state);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2010-09-23 15:35:41 +00:00
|
|
|
if (op_list)
|
2002-06-12 21:12:53 +00:00
|
|
|
{
|
2010-09-23 15:35:41 +00:00
|
|
|
cairo_save (cr);
|
|
|
|
gdk_cairo_rectangle (cr, &rect);
|
|
|
|
cairo_clip (cr);
|
|
|
|
|
|
|
|
if (gdk_cairo_get_clip_rectangle (cr, NULL))
|
2006-04-18 17:18:53 +00:00
|
|
|
{
|
|
|
|
MetaRectangle m_rect;
|
2010-09-23 15:35:41 +00:00
|
|
|
|
2006-04-18 17:18:53 +00:00
|
|
|
m_rect = meta_rect (rect.x, rect.y,
|
|
|
|
rect.width, rect.height);
|
2010-09-23 15:35:41 +00:00
|
|
|
|
2009-01-28 01:47:18 +00:00
|
|
|
meta_draw_op_list_draw_with_style (op_list,
|
|
|
|
style_gtk,
|
2010-09-23 15:35:41 +00:00
|
|
|
cr,
|
|
|
|
&draw_info,
|
|
|
|
m_rect);
|
2006-04-18 17:18:53 +00:00
|
|
|
}
|
2010-09-23 15:35:41 +00:00
|
|
|
|
|
|
|
cairo_restore (cr);
|
2002-06-12 21:12:53 +00:00
|
|
|
}
|
2002-10-04 02:59:07 +00:00
|
|
|
|
|
|
|
/* MIDDLE_BACKGROUND type may get drawn more than once */
|
|
|
|
if ((j == META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND ||
|
|
|
|
j == META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND) &&
|
|
|
|
middle_bg_offset < MAX_MIDDLE_BACKGROUNDS)
|
|
|
|
{
|
|
|
|
++middle_bg_offset;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
middle_bg_offset = 0;
|
|
|
|
++j;
|
|
|
|
}
|
2002-06-12 21:12:53 +00:00
|
|
|
}
|
2002-01-28 05:16:04 +00:00
|
|
|
}
|
2010-09-23 15:35:41 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MetaFrameStyleSet*
|
|
|
|
meta_frame_style_set_new (MetaFrameStyleSet *parent)
|
|
|
|
{
|
|
|
|
MetaFrameStyleSet *style_set;
|
|
|
|
|
|
|
|
style_set = g_new0 (MetaFrameStyleSet, 1);
|
|
|
|
|
|
|
|
style_set->parent = parent;
|
|
|
|
if (parent)
|
|
|
|
meta_frame_style_set_ref (parent);
|
|
|
|
|
|
|
|
style_set->refcount = 1;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
return style_set;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
free_focus_styles (MetaFrameStyle *focus_styles[META_FRAME_FOCUS_LAST])
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2006-04-18 17:18:53 +00:00
|
|
|
for (i = 0; i < META_FRAME_FOCUS_LAST; i++)
|
|
|
|
if (focus_styles[i])
|
|
|
|
meta_frame_style_unref (focus_styles[i]);
|
2002-02-07 03:07:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_frame_style_set_ref (MetaFrameStyleSet *style_set)
|
|
|
|
{
|
|
|
|
g_return_if_fail (style_set != NULL);
|
|
|
|
|
|
|
|
style_set->refcount += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_frame_style_set_unref (MetaFrameStyleSet *style_set)
|
|
|
|
{
|
|
|
|
g_return_if_fail (style_set != NULL);
|
|
|
|
g_return_if_fail (style_set->refcount > 0);
|
|
|
|
|
|
|
|
style_set->refcount -= 1;
|
|
|
|
|
|
|
|
if (style_set->refcount == 0)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2006-04-18 17:18:53 +00:00
|
|
|
for (i = 0; i < META_FRAME_RESIZE_LAST; i++)
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
{
|
|
|
|
free_focus_styles (style_set->normal_styles[i]);
|
|
|
|
free_focus_styles (style_set->shaded_styles[i]);
|
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
|
|
|
|
free_focus_styles (style_set->maximized_styles);
|
2010-12-08 01:16:35 +00:00
|
|
|
free_focus_styles (style_set->tiled_left_styles);
|
|
|
|
free_focus_styles (style_set->tiled_right_styles);
|
2002-02-07 03:07:56 +00:00
|
|
|
free_focus_styles (style_set->maximized_and_shaded_styles);
|
2010-12-08 01:16:35 +00:00
|
|
|
free_focus_styles (style_set->tiled_left_and_shaded_styles);
|
|
|
|
free_focus_styles (style_set->tiled_right_and_shaded_styles);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
|
|
|
if (style_set->parent)
|
|
|
|
meta_frame_style_set_unref (style_set->parent);
|
|
|
|
|
|
|
|
DEBUG_FILL_STRUCT (style_set);
|
|
|
|
g_free (style_set);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static MetaFrameStyle*
|
|
|
|
get_style (MetaFrameStyleSet *style_set,
|
|
|
|
MetaFrameState state,
|
|
|
|
MetaFrameResize resize,
|
|
|
|
MetaFrameFocus focus)
|
|
|
|
{
|
2014-05-02 13:34:02 +00:00
|
|
|
MetaFrameStyle *style;
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
style = NULL;
|
|
|
|
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
switch (state)
|
2002-02-07 03:07:56 +00:00
|
|
|
{
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
case META_FRAME_STATE_NORMAL:
|
|
|
|
case META_FRAME_STATE_SHADED:
|
|
|
|
{
|
|
|
|
if (state == META_FRAME_STATE_SHADED)
|
|
|
|
style = style_set->shaded_styles[resize][focus];
|
|
|
|
else
|
|
|
|
style = style_set->normal_styles[resize][focus];
|
2002-02-07 03:07:56 +00:00
|
|
|
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
/* Try parent if we failed here */
|
|
|
|
if (style == NULL && style_set->parent)
|
|
|
|
style = get_style (style_set->parent, state, resize, focus);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
/* Allow people to omit the vert/horz/none resize modes */
|
|
|
|
if (style == NULL &&
|
|
|
|
resize != META_FRAME_RESIZE_BOTH)
|
|
|
|
style = get_style (style_set, state, META_FRAME_RESIZE_BOTH, focus);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
MetaFrameStyle **styles;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
styles = NULL;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
switch (state)
|
|
|
|
{
|
|
|
|
case META_FRAME_STATE_MAXIMIZED:
|
|
|
|
styles = style_set->maximized_styles;
|
|
|
|
break;
|
2010-12-08 01:16:35 +00:00
|
|
|
case META_FRAME_STATE_TILED_LEFT:
|
|
|
|
styles = style_set->tiled_left_styles;
|
|
|
|
break;
|
|
|
|
case META_FRAME_STATE_TILED_RIGHT:
|
|
|
|
styles = style_set->tiled_right_styles;
|
|
|
|
break;
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
case META_FRAME_STATE_MAXIMIZED_AND_SHADED:
|
|
|
|
styles = style_set->maximized_and_shaded_styles;
|
|
|
|
break;
|
2010-12-08 01:16:35 +00:00
|
|
|
case META_FRAME_STATE_TILED_LEFT_AND_SHADED:
|
|
|
|
styles = style_set->tiled_left_and_shaded_styles;
|
|
|
|
break;
|
|
|
|
case META_FRAME_STATE_TILED_RIGHT_AND_SHADED:
|
|
|
|
styles = style_set->tiled_right_and_shaded_styles;
|
|
|
|
break;
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
case META_FRAME_STATE_NORMAL:
|
|
|
|
case META_FRAME_STATE_SHADED:
|
|
|
|
case META_FRAME_STATE_LAST:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
style = styles[focus];
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2010-12-08 01:16:35 +00:00
|
|
|
/* Tiled states are optional, try falling back to non-tiled states */
|
|
|
|
if (style == NULL)
|
|
|
|
{
|
|
|
|
if (state == META_FRAME_STATE_TILED_LEFT ||
|
|
|
|
state == META_FRAME_STATE_TILED_RIGHT)
|
|
|
|
style = get_style (style_set, META_FRAME_STATE_NORMAL,
|
|
|
|
resize, focus);
|
|
|
|
else if (state == META_FRAME_STATE_TILED_LEFT_AND_SHADED ||
|
|
|
|
state == META_FRAME_STATE_TILED_RIGHT_AND_SHADED)
|
|
|
|
style = get_style (style_set, META_FRAME_STATE_SHADED,
|
|
|
|
resize, focus);
|
|
|
|
}
|
|
|
|
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
/* Try parent if we failed here */
|
|
|
|
if (style == NULL && style_set->parent)
|
2014-05-02 13:34:02 +00:00
|
|
|
style = get_style (style_set->parent, state, resize, focus);
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return style;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
check_state (MetaFrameStyleSet *style_set,
|
|
|
|
MetaFrameState state,
|
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
int i;
|
2006-04-18 17:18:53 +00:00
|
|
|
|
|
|
|
for (i = 0; i < META_FRAME_FOCUS_LAST; i++)
|
2002-02-07 03:07:56 +00:00
|
|
|
{
|
|
|
|
if (get_style (style_set, state,
|
|
|
|
META_FRAME_RESIZE_NONE, i) == NULL)
|
|
|
|
{
|
An attempt to make life a little easier for our beloved translators; this
2008-10-12 Thomas Thurman <tthurman@gnome.org>
An attempt to make life a little easier for our beloved translators;
this has the same behaviour as before, but removes over thirty
translation strings.
* src/core/session.c (start_element_handler): all "attribute not found
on element" strings are identical
* src/ui/theme-parser.c (locate_attributes): allow attribute names to
be preceded with "!" (in the code) to show they're required.
(parse_aspect_ratio, parse_distance, parse_toplevel_element,
parse_style_element, parse_gradient_element, static, parse_border,
parse_style_set_element, parse_draw_op_element): use the new "!"
prefix for locate_attributes(), or in some cases just the identical
constant, for generating this error.
* src/ui/theme.c (check_state, meta_theme_validate): add
translator comments
* src/ui/resizepopup.c (update_size_window): add
translator comments
svn path=/trunk/; revision=3949
2008-10-12 14:34:54 +00:00
|
|
|
/* Translators: This error occurs when a <frame> tag is missing
|
|
|
|
* in theme XML. The "<frame ...>" is intended as a noun phrase,
|
|
|
|
* and the "missing" qualifies it. You should translate "whatever".
|
|
|
|
*/
|
2002-02-07 03:07:56 +00:00
|
|
|
g_set_error (error, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
|
|
|
_("Missing <frame state=\"%s\" resize=\"%s\" focus=\"%s\" style=\"whatever\"/>"),
|
|
|
|
meta_frame_state_to_string (state),
|
|
|
|
meta_frame_resize_to_string (META_FRAME_RESIZE_NONE),
|
|
|
|
meta_frame_focus_to_string (i));
|
|
|
|
return FALSE;
|
|
|
|
}
|
2002-01-28 05:16:04 +00:00
|
|
|
}
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
meta_frame_style_set_validate (MetaFrameStyleSet *style_set,
|
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
int i, j;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
g_return_val_if_fail (style_set != NULL, FALSE);
|
|
|
|
|
2006-04-18 17:18:53 +00:00
|
|
|
for (i = 0; i < META_FRAME_RESIZE_LAST; i++)
|
|
|
|
for (j = 0; j < META_FRAME_FOCUS_LAST; j++)
|
|
|
|
if (get_style (style_set, META_FRAME_STATE_NORMAL, i, j) == NULL)
|
2002-02-07 03:07:56 +00:00
|
|
|
{
|
2006-04-18 17:18:53 +00:00
|
|
|
g_set_error (error, META_THEME_ERROR,
|
|
|
|
META_THEME_ERROR_FAILED,
|
|
|
|
_("Missing <frame state=\"%s\" resize=\"%s\" focus=\"%s\" style=\"whatever\"/>"),
|
|
|
|
meta_frame_state_to_string (META_FRAME_STATE_NORMAL),
|
|
|
|
meta_frame_resize_to_string (i),
|
|
|
|
meta_frame_focus_to_string (j));
|
|
|
|
return FALSE;
|
2002-02-07 03:07:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!check_state (style_set, META_FRAME_STATE_SHADED, error))
|
|
|
|
return FALSE;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
if (!check_state (style_set, META_FRAME_STATE_MAXIMIZED, error))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (!check_state (style_set, META_FRAME_STATE_MAXIMIZED_AND_SHADED, error))
|
|
|
|
return FALSE;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-09-01 19:39:53 +00:00
|
|
|
/**
|
|
|
|
* meta_theme_get_current: (skip)
|
|
|
|
*
|
|
|
|
*/
|
2002-02-07 03:07:56 +00:00
|
|
|
MetaTheme*
|
|
|
|
meta_theme_get_current (void)
|
|
|
|
{
|
|
|
|
return meta_current_theme;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-08-13 13:50:59 +00:00
|
|
|
meta_theme_set_current (const char *name)
|
2002-02-07 03:07:56 +00:00
|
|
|
{
|
|
|
|
MetaTheme *new_theme;
|
|
|
|
GError *err;
|
|
|
|
|
2002-02-08 03:34:26 +00:00
|
|
|
meta_topic (META_DEBUG_THEMES, "Setting current theme to \"%s\"\n", name);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2013-07-18 03:15:02 +00:00
|
|
|
if (meta_current_theme &&
|
2002-02-07 03:07:56 +00:00
|
|
|
strcmp (name, meta_current_theme->name) == 0)
|
|
|
|
return;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
err = NULL;
|
|
|
|
new_theme = meta_theme_load (name, &err);
|
|
|
|
|
|
|
|
if (new_theme == NULL)
|
|
|
|
{
|
2002-02-10 04:28:33 +00:00
|
|
|
meta_warning (_("Failed to load theme \"%s\": %s\n"),
|
2002-02-07 03:07:56 +00:00
|
|
|
name, err->message);
|
|
|
|
g_error_free (err);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (meta_current_theme)
|
|
|
|
meta_theme_free (meta_current_theme);
|
|
|
|
|
|
|
|
meta_current_theme = new_theme;
|
|
|
|
|
2002-02-08 03:34:26 +00:00
|
|
|
meta_topic (META_DEBUG_THEMES, "New theme is \"%s\"\n", meta_current_theme->name);
|
2002-02-07 03:07:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-09-01 19:39:53 +00:00
|
|
|
/**
|
|
|
|
* meta_theme_new: (skip)
|
|
|
|
*
|
|
|
|
*/
|
2002-02-07 03:07:56 +00:00
|
|
|
MetaTheme*
|
|
|
|
meta_theme_new (void)
|
|
|
|
{
|
|
|
|
MetaTheme *theme;
|
|
|
|
|
|
|
|
theme = g_new0 (MetaTheme, 1);
|
|
|
|
|
|
|
|
theme->images_by_filename =
|
|
|
|
g_hash_table_new_full (g_str_hash,
|
|
|
|
g_str_equal,
|
|
|
|
g_free,
|
|
|
|
(GDestroyNotify) g_object_unref);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
theme->layouts_by_name =
|
|
|
|
g_hash_table_new_full (g_str_hash,
|
|
|
|
g_str_equal,
|
|
|
|
g_free,
|
|
|
|
(GDestroyNotify) meta_frame_layout_unref);
|
|
|
|
|
|
|
|
theme->draw_op_lists_by_name =
|
|
|
|
g_hash_table_new_full (g_str_hash,
|
|
|
|
g_str_equal,
|
|
|
|
g_free,
|
|
|
|
(GDestroyNotify) meta_draw_op_list_unref);
|
|
|
|
|
|
|
|
theme->styles_by_name =
|
|
|
|
g_hash_table_new_full (g_str_hash,
|
|
|
|
g_str_equal,
|
|
|
|
g_free,
|
|
|
|
(GDestroyNotify) meta_frame_style_unref);
|
|
|
|
|
|
|
|
theme->style_sets_by_name =
|
|
|
|
g_hash_table_new_full (g_str_hash,
|
|
|
|
g_str_equal,
|
|
|
|
g_free,
|
|
|
|
(GDestroyNotify) meta_frame_style_set_unref);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
Merge compositor branch.
2007-12-18 Iain Holmes <iain@gnome.org>
* configure.in, src/theme.c, src/display.c,
src/theme.h, src/display.h, src/theme-parser.c,
src/compositor.c, src/c-screen.c, src/compositor.h,
src/c-screen.h, src/ui.c, src/screen.c, src/ui.h,
src/screen.h, src/c-window.c, src/c-window.h,
src/theme-viewer.c, src/Makefile.am: Merge compositor branch.
svn path=/trunk/; revision=3483
2007-12-19 03:49:50 +00:00
|
|
|
/* Create our variable quarks so we can look up variables without
|
|
|
|
having to strcmp for the names */
|
|
|
|
theme->quark_width = g_quark_from_static_string ("width");
|
|
|
|
theme->quark_height = g_quark_from_static_string ("height");
|
|
|
|
theme->quark_object_width = g_quark_from_static_string ("object_width");
|
|
|
|
theme->quark_object_height = g_quark_from_static_string ("object_height");
|
|
|
|
theme->quark_left_width = g_quark_from_static_string ("left_width");
|
|
|
|
theme->quark_right_width = g_quark_from_static_string ("right_width");
|
|
|
|
theme->quark_top_height = g_quark_from_static_string ("top_height");
|
|
|
|
theme->quark_bottom_height = g_quark_from_static_string ("bottom_height");
|
|
|
|
theme->quark_mini_icon_width = g_quark_from_static_string ("mini_icon_width");
|
|
|
|
theme->quark_mini_icon_height = g_quark_from_static_string ("mini_icon_height");
|
|
|
|
theme->quark_icon_width = g_quark_from_static_string ("icon_width");
|
|
|
|
theme->quark_icon_height = g_quark_from_static_string ("icon_height");
|
|
|
|
theme->quark_title_width = g_quark_from_static_string ("title_width");
|
|
|
|
theme->quark_title_height = g_quark_from_static_string ("title_height");
|
2009-08-20 17:47:05 +00:00
|
|
|
theme->quark_frame_x_center = g_quark_from_static_string ("frame_x_center");
|
|
|
|
theme->quark_frame_y_center = g_quark_from_static_string ("frame_y_center");
|
2002-02-07 03:07:56 +00:00
|
|
|
return theme;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_theme_free (MetaTheme *theme)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
g_return_if_fail (theme != NULL);
|
|
|
|
|
|
|
|
g_free (theme->name);
|
|
|
|
g_free (theme->dirname);
|
|
|
|
g_free (theme->filename);
|
|
|
|
g_free (theme->readable_name);
|
|
|
|
g_free (theme->date);
|
|
|
|
g_free (theme->description);
|
|
|
|
g_free (theme->author);
|
|
|
|
g_free (theme->copyright);
|
|
|
|
|
2006-01-21 21:26:55 +00:00
|
|
|
/* be more careful when destroying the theme hash tables,
|
|
|
|
since they are only constructed as needed, and may be NULL. */
|
|
|
|
if (theme->integer_constants)
|
|
|
|
g_hash_table_destroy (theme->integer_constants);
|
|
|
|
if (theme->images_by_filename)
|
|
|
|
g_hash_table_destroy (theme->images_by_filename);
|
|
|
|
if (theme->layouts_by_name)
|
|
|
|
g_hash_table_destroy (theme->layouts_by_name);
|
2014-05-02 13:34:02 +00:00
|
|
|
if (theme->draw_op_lists_by_name)
|
2006-01-21 21:26:55 +00:00
|
|
|
g_hash_table_destroy (theme->draw_op_lists_by_name);
|
2014-05-02 13:34:02 +00:00
|
|
|
if (theme->styles_by_name)
|
2006-01-21 21:26:55 +00:00
|
|
|
g_hash_table_destroy (theme->styles_by_name);
|
2014-05-02 13:34:02 +00:00
|
|
|
if (theme->style_sets_by_name)
|
2006-01-21 21:26:55 +00:00
|
|
|
g_hash_table_destroy (theme->style_sets_by_name);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2006-04-18 17:18:53 +00:00
|
|
|
for (i = 0; i < META_FRAME_TYPE_LAST; i++)
|
|
|
|
if (theme->style_sets_by_type[i])
|
|
|
|
meta_frame_style_set_unref (theme->style_sets_by_type[i]);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
|
|
|
DEBUG_FILL_STRUCT (theme);
|
|
|
|
g_free (theme);
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
meta_theme_validate (MetaTheme *theme,
|
|
|
|
GError **error)
|
|
|
|
{
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
int i;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
g_return_val_if_fail (theme != NULL, FALSE);
|
|
|
|
|
|
|
|
/* FIXME what else should be checked? */
|
|
|
|
|
|
|
|
g_assert (theme->name);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
if (theme->readable_name == NULL)
|
|
|
|
{
|
An attempt to make life a little easier for our beloved translators; this
2008-10-12 Thomas Thurman <tthurman@gnome.org>
An attempt to make life a little easier for our beloved translators;
this has the same behaviour as before, but removes over thirty
translation strings.
* src/core/session.c (start_element_handler): all "attribute not found
on element" strings are identical
* src/ui/theme-parser.c (locate_attributes): allow attribute names to
be preceded with "!" (in the code) to show they're required.
(parse_aspect_ratio, parse_distance, parse_toplevel_element,
parse_style_element, parse_gradient_element, static, parse_border,
parse_style_set_element, parse_draw_op_element): use the new "!"
prefix for locate_attributes(), or in some cases just the identical
constant, for generating this error.
* src/ui/theme.c (check_state, meta_theme_validate): add
translator comments
* src/ui/resizepopup.c (update_size_window): add
translator comments
svn path=/trunk/; revision=3949
2008-10-12 14:34:54 +00:00
|
|
|
/* Translators: This error means that a necessary XML tag (whose name
|
|
|
|
* is given in angle brackets) was not found in a given theme (whose
|
|
|
|
* name is given second, in quotation marks).
|
|
|
|
*/
|
2002-02-07 03:07:56 +00:00
|
|
|
g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
|
2002-09-24 20:43:45 +00:00
|
|
|
_("No <%s> set for theme \"%s\""), "name", theme->name);
|
2002-02-07 03:07:56 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (theme->author == NULL)
|
|
|
|
{
|
|
|
|
g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
|
2002-09-24 20:43:45 +00:00
|
|
|
_("No <%s> set for theme \"%s\""), "author", theme->name);
|
2002-02-07 03:07:56 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (theme->date == NULL)
|
|
|
|
{
|
|
|
|
g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
|
2002-09-24 20:43:45 +00:00
|
|
|
_("No <%s> set for theme \"%s\""), "date", theme->name);
|
2002-02-07 03:07:56 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (theme->description == NULL)
|
|
|
|
{
|
|
|
|
g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
|
2002-09-24 20:43:45 +00:00
|
|
|
_("No <%s> set for theme \"%s\""), "description", theme->name);
|
2002-02-07 03:07:56 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (theme->copyright == NULL)
|
|
|
|
{
|
|
|
|
g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
|
2002-09-24 20:43:45 +00:00
|
|
|
_("No <%s> set for theme \"%s\""), "copyright", theme->name);
|
2002-02-07 03:07:56 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2006-04-18 17:18:53 +00:00
|
|
|
for (i = 0; i < (int)META_FRAME_TYPE_LAST; i++)
|
2010-11-04 16:11:54 +00:00
|
|
|
if (i != (int)META_FRAME_TYPE_ATTACHED && theme->style_sets_by_type[i] == NULL)
|
2006-04-18 17:18:53 +00:00
|
|
|
{
|
|
|
|
g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
|
|
|
|
_("No frame style set for window type \"%s\" in theme \"%s\", add a <window type=\"%s\" style_set=\"whatever\"/> element"),
|
|
|
|
meta_frame_type_to_string (i),
|
|
|
|
theme->name,
|
|
|
|
meta_frame_type_to_string (i));
|
2014-05-02 13:34:02 +00:00
|
|
|
|
|
|
|
return FALSE;
|
2006-04-18 17:18:53 +00:00
|
|
|
}
|
2002-01-28 05:16:04 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-09-01 19:39:53 +00:00
|
|
|
/**
|
|
|
|
* meta_theme_load_image: (skip)
|
|
|
|
*
|
|
|
|
*/
|
2002-02-07 03:07:56 +00:00
|
|
|
GdkPixbuf*
|
|
|
|
meta_theme_load_image (MetaTheme *theme,
|
|
|
|
const char *filename,
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
guint size_of_theme_icons,
|
2002-02-07 03:07:56 +00:00
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
|
|
|
|
pixbuf = g_hash_table_lookup (theme->images_by_filename,
|
|
|
|
filename);
|
|
|
|
|
|
|
|
if (pixbuf == NULL)
|
|
|
|
{
|
2014-05-02 13:34:02 +00:00
|
|
|
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
if (g_str_has_prefix (filename, "theme:") &&
|
|
|
|
META_THEME_ALLOWS (theme, META_THEME_IMAGES_FROM_ICON_THEMES))
|
2002-02-07 03:07:56 +00:00
|
|
|
{
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
pixbuf = gtk_icon_theme_load_icon (
|
|
|
|
gtk_icon_theme_get_default (),
|
|
|
|
filename+6,
|
|
|
|
size_of_theme_icons,
|
|
|
|
0,
|
|
|
|
error);
|
|
|
|
if (pixbuf == NULL) return NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char *full_path;
|
|
|
|
full_path = g_build_filename (theme->dirname, filename, NULL);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
pixbuf = gdk_pixbuf_new_from_file (full_path, error);
|
|
|
|
if (pixbuf == NULL)
|
|
|
|
{
|
|
|
|
g_free (full_path);
|
|
|
|
return NULL;
|
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
g_free (full_path);
|
2014-05-02 13:34:02 +00:00
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
g_hash_table_replace (theme->images_by_filename,
|
|
|
|
g_strdup (filename),
|
|
|
|
pixbuf);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_assert (pixbuf);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
g_object_ref (G_OBJECT (pixbuf));
|
|
|
|
|
|
|
|
return pixbuf;
|
|
|
|
}
|
|
|
|
|
|
|
|
static MetaFrameStyle*
|
|
|
|
theme_get_style (MetaTheme *theme,
|
|
|
|
MetaFrameType type,
|
|
|
|
MetaFrameFlags flags)
|
|
|
|
{
|
|
|
|
MetaFrameState state;
|
|
|
|
MetaFrameResize resize;
|
|
|
|
MetaFrameFocus focus;
|
|
|
|
MetaFrameStyle *style;
|
|
|
|
MetaFrameStyleSet *style_set;
|
|
|
|
|
|
|
|
style_set = theme->style_sets_by_type[type];
|
|
|
|
|
2010-11-04 16:11:54 +00:00
|
|
|
if (style_set == NULL && type == META_FRAME_TYPE_ATTACHED)
|
|
|
|
style_set = theme->style_sets_by_type[META_FRAME_TYPE_BORDER];
|
|
|
|
|
|
|
|
/* Right now the parser forces a style set for all other types,
|
2002-02-07 03:07:56 +00:00
|
|
|
* but this fallback code is here in case I take that out.
|
|
|
|
*/
|
|
|
|
if (style_set == NULL)
|
|
|
|
style_set = theme->style_sets_by_type[META_FRAME_TYPE_NORMAL];
|
|
|
|
if (style_set == NULL)
|
|
|
|
return NULL;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2010-12-08 01:16:35 +00:00
|
|
|
switch (flags & (META_FRAME_MAXIMIZED | META_FRAME_SHADED |
|
|
|
|
META_FRAME_TILED_LEFT | META_FRAME_TILED_RIGHT))
|
2002-02-07 03:07:56 +00:00
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
state = META_FRAME_STATE_NORMAL;
|
|
|
|
break;
|
|
|
|
case META_FRAME_MAXIMIZED:
|
|
|
|
state = META_FRAME_STATE_MAXIMIZED;
|
|
|
|
break;
|
2010-12-08 01:16:35 +00:00
|
|
|
case META_FRAME_TILED_LEFT:
|
|
|
|
state = META_FRAME_STATE_TILED_LEFT;
|
|
|
|
break;
|
|
|
|
case META_FRAME_TILED_RIGHT:
|
|
|
|
state = META_FRAME_STATE_TILED_RIGHT;
|
|
|
|
break;
|
2002-02-07 03:07:56 +00:00
|
|
|
case META_FRAME_SHADED:
|
|
|
|
state = META_FRAME_STATE_SHADED;
|
|
|
|
break;
|
|
|
|
case (META_FRAME_MAXIMIZED | META_FRAME_SHADED):
|
|
|
|
state = META_FRAME_STATE_MAXIMIZED_AND_SHADED;
|
|
|
|
break;
|
2010-12-08 01:16:35 +00:00
|
|
|
case (META_FRAME_TILED_LEFT | META_FRAME_SHADED):
|
|
|
|
state = META_FRAME_STATE_TILED_LEFT_AND_SHADED;
|
|
|
|
break;
|
|
|
|
case (META_FRAME_TILED_RIGHT | META_FRAME_SHADED):
|
|
|
|
state = META_FRAME_STATE_TILED_RIGHT_AND_SHADED;
|
|
|
|
break;
|
2002-02-07 03:07:56 +00:00
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
state = META_FRAME_STATE_LAST; /* compiler */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (flags & (META_FRAME_ALLOWS_VERTICAL_RESIZE | META_FRAME_ALLOWS_HORIZONTAL_RESIZE))
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
resize = META_FRAME_RESIZE_NONE;
|
|
|
|
break;
|
|
|
|
case META_FRAME_ALLOWS_VERTICAL_RESIZE:
|
|
|
|
resize = META_FRAME_RESIZE_VERTICAL;
|
|
|
|
break;
|
|
|
|
case META_FRAME_ALLOWS_HORIZONTAL_RESIZE:
|
|
|
|
resize = META_FRAME_RESIZE_HORIZONTAL;
|
|
|
|
break;
|
|
|
|
case (META_FRAME_ALLOWS_VERTICAL_RESIZE | META_FRAME_ALLOWS_HORIZONTAL_RESIZE):
|
|
|
|
resize = META_FRAME_RESIZE_BOTH;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
resize = META_FRAME_RESIZE_LAST; /* compiler */
|
|
|
|
break;
|
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2003-01-28 15:07:43 +00:00
|
|
|
/* re invert the styles used for focus/unfocussed while flashing a frame */
|
|
|
|
if (((flags & META_FRAME_HAS_FOCUS) && !(flags & META_FRAME_IS_FLASHING))
|
|
|
|
|| (!(flags & META_FRAME_HAS_FOCUS) && (flags & META_FRAME_IS_FLASHING)))
|
2002-02-07 03:07:56 +00:00
|
|
|
focus = META_FRAME_FOCUS_YES;
|
|
|
|
else
|
|
|
|
focus = META_FRAME_FOCUS_NO;
|
|
|
|
|
|
|
|
style = get_style (style_set, state, resize, focus);
|
|
|
|
|
|
|
|
return style;
|
|
|
|
}
|
|
|
|
|
2002-02-15 02:32:48 +00:00
|
|
|
MetaFrameStyle*
|
|
|
|
meta_theme_get_frame_style (MetaTheme *theme,
|
|
|
|
MetaFrameType type,
|
|
|
|
MetaFrameFlags flags)
|
|
|
|
{
|
|
|
|
MetaFrameStyle *style;
|
|
|
|
|
|
|
|
g_return_val_if_fail (type < META_FRAME_TYPE_LAST, NULL);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-15 02:32:48 +00:00
|
|
|
style = theme_get_style (theme, type, flags);
|
|
|
|
|
|
|
|
return style;
|
|
|
|
}
|
|
|
|
|
2002-02-09 17:02:38 +00:00
|
|
|
double
|
|
|
|
meta_theme_get_title_scale (MetaTheme *theme,
|
|
|
|
MetaFrameType type,
|
|
|
|
MetaFrameFlags flags)
|
|
|
|
{
|
|
|
|
MetaFrameStyle *style;
|
|
|
|
|
|
|
|
g_return_val_if_fail (type < META_FRAME_TYPE_LAST, 1.0);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-09 17:02:38 +00:00
|
|
|
style = theme_get_style (theme, type, flags);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-09 17:02:38 +00:00
|
|
|
/* Parser is not supposed to allow this currently */
|
|
|
|
if (style == NULL)
|
|
|
|
return 1.0;
|
|
|
|
|
|
|
|
return style->layout->title_scale;
|
|
|
|
}
|
|
|
|
|
2012-12-16 22:54:33 +00:00
|
|
|
GtkStyleContext *
|
|
|
|
meta_theme_create_style_context (GdkScreen *screen,
|
|
|
|
const gchar *variant)
|
|
|
|
{
|
|
|
|
GtkWidgetPath *path;
|
|
|
|
GtkStyleContext *style;
|
|
|
|
char *theme_name;
|
|
|
|
|
|
|
|
g_object_get (gtk_settings_get_for_screen (screen),
|
|
|
|
"gtk-theme-name", &theme_name,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
style = gtk_style_context_new ();
|
|
|
|
path = gtk_widget_path_new ();
|
|
|
|
gtk_widget_path_append_type (path, META_TYPE_FRAMES);
|
2013-01-10 21:17:29 +00:00
|
|
|
gtk_widget_path_iter_add_class (path, -1, GTK_STYLE_CLASS_BACKGROUND);
|
2012-12-16 22:54:33 +00:00
|
|
|
gtk_style_context_set_path (style, path);
|
|
|
|
gtk_widget_path_unref (path);
|
|
|
|
|
|
|
|
if (theme_name && *theme_name)
|
|
|
|
{
|
|
|
|
GtkCssProvider *provider;
|
|
|
|
|
|
|
|
provider = gtk_css_provider_get_named (theme_name, variant);
|
|
|
|
gtk_style_context_add_provider (style,
|
|
|
|
GTK_STYLE_PROVIDER (provider),
|
|
|
|
GTK_STYLE_PROVIDER_PRIORITY_SETTINGS);
|
|
|
|
}
|
|
|
|
|
2013-01-10 21:15:38 +00:00
|
|
|
g_free (theme_name);
|
|
|
|
|
2012-12-16 22:54:33 +00:00
|
|
|
return style;
|
|
|
|
}
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
void
|
2012-12-16 22:31:00 +00:00
|
|
|
meta_theme_draw_frame (MetaTheme *theme,
|
|
|
|
GtkStyleContext *style_gtk,
|
|
|
|
cairo_t *cr,
|
|
|
|
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)
|
2002-02-07 03:07:56 +00:00
|
|
|
{
|
|
|
|
MetaFrameGeometry fgeom;
|
|
|
|
MetaFrameStyle *style;
|
|
|
|
|
|
|
|
g_return_if_fail (type < META_FRAME_TYPE_LAST);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
style = theme_get_style (theme, type, flags);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
/* Parser is not supposed to allow this currently */
|
|
|
|
if (style == NULL)
|
|
|
|
return;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
meta_frame_layout_calc_geometry (style->layout,
|
|
|
|
text_height,
|
|
|
|
flags,
|
|
|
|
client_width, client_height,
|
2002-10-04 02:28:57 +00:00
|
|
|
button_layout,
|
2011-09-14 23:06:02 +00:00
|
|
|
type,
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
&fgeom,
|
2014-05-02 13:34:02 +00:00
|
|
|
theme);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2009-01-28 01:47:18 +00:00
|
|
|
meta_frame_style_draw_with_style (style,
|
|
|
|
style_gtk,
|
2010-09-23 15:35:41 +00:00
|
|
|
cr,
|
2009-01-28 01:47:18 +00:00
|
|
|
&fgeom,
|
|
|
|
client_width, client_height,
|
|
|
|
title_layout,
|
|
|
|
text_height,
|
|
|
|
button_states,
|
|
|
|
mini_icon, icon);
|
|
|
|
}
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
void
|
2011-07-12 04:37:41 +00:00
|
|
|
meta_theme_get_frame_borders (MetaTheme *theme,
|
|
|
|
MetaFrameType type,
|
|
|
|
int text_height,
|
|
|
|
MetaFrameFlags flags,
|
|
|
|
MetaFrameBorders *borders)
|
2002-02-07 03:07:56 +00:00
|
|
|
{
|
|
|
|
MetaFrameStyle *style;
|
|
|
|
|
|
|
|
g_return_if_fail (type < META_FRAME_TYPE_LAST);
|
2011-07-12 04:37:41 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
style = theme_get_style (theme, type, flags);
|
2011-07-12 04:37:41 +00:00
|
|
|
|
2011-07-12 04:59:12 +00:00
|
|
|
meta_frame_borders_clear (borders);
|
2011-07-12 04:37:41 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
/* Parser is not supposed to allow this currently */
|
|
|
|
if (style == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
meta_frame_layout_get_borders (style->layout,
|
|
|
|
text_height,
|
2011-09-14 23:06:02 +00:00
|
|
|
flags, type,
|
2011-07-12 04:37:41 +00:00
|
|
|
borders);
|
2002-02-07 03:07:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-10-04 02:28:57 +00:00
|
|
|
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)
|
2002-02-07 03:07:56 +00:00
|
|
|
{
|
|
|
|
MetaFrameStyle *style;
|
|
|
|
|
|
|
|
g_return_if_fail (type < META_FRAME_TYPE_LAST);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
style = theme_get_style (theme, type, flags);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
/* Parser is not supposed to allow this currently */
|
|
|
|
if (style == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
meta_frame_layout_calc_geometry (style->layout,
|
|
|
|
text_height,
|
|
|
|
flags,
|
|
|
|
client_width, client_height,
|
2002-10-04 02:28:57 +00:00
|
|
|
button_layout,
|
2011-09-14 23:06:02 +00:00
|
|
|
type,
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
fgeom,
|
|
|
|
theme);
|
2002-02-07 03:07:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MetaFrameLayout*
|
|
|
|
meta_theme_lookup_layout (MetaTheme *theme,
|
|
|
|
const char *name)
|
|
|
|
{
|
|
|
|
return g_hash_table_lookup (theme->layouts_by_name, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_theme_insert_layout (MetaTheme *theme,
|
|
|
|
const char *name,
|
|
|
|
MetaFrameLayout *layout)
|
|
|
|
{
|
|
|
|
meta_frame_layout_ref (layout);
|
|
|
|
g_hash_table_replace (theme->layouts_by_name, g_strdup (name), layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
MetaDrawOpList*
|
|
|
|
meta_theme_lookup_draw_op_list (MetaTheme *theme,
|
|
|
|
const char *name)
|
|
|
|
{
|
|
|
|
return g_hash_table_lookup (theme->draw_op_lists_by_name, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_theme_insert_draw_op_list (MetaTheme *theme,
|
|
|
|
const char *name,
|
|
|
|
MetaDrawOpList *op_list)
|
|
|
|
{
|
|
|
|
meta_draw_op_list_ref (op_list);
|
|
|
|
g_hash_table_replace (theme->draw_op_lists_by_name, g_strdup (name), op_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
MetaFrameStyle*
|
|
|
|
meta_theme_lookup_style (MetaTheme *theme,
|
|
|
|
const char *name)
|
|
|
|
{
|
|
|
|
return g_hash_table_lookup (theme->styles_by_name, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_theme_insert_style (MetaTheme *theme,
|
|
|
|
const char *name,
|
|
|
|
MetaFrameStyle *style)
|
|
|
|
{
|
|
|
|
meta_frame_style_ref (style);
|
|
|
|
g_hash_table_replace (theme->styles_by_name, g_strdup (name), style);
|
|
|
|
}
|
|
|
|
|
|
|
|
MetaFrameStyleSet*
|
|
|
|
meta_theme_lookup_style_set (MetaTheme *theme,
|
|
|
|
const char *name)
|
|
|
|
{
|
|
|
|
return g_hash_table_lookup (theme->style_sets_by_name, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_theme_insert_style_set (MetaTheme *theme,
|
|
|
|
const char *name,
|
|
|
|
MetaFrameStyleSet *style_set)
|
|
|
|
{
|
|
|
|
meta_frame_style_set_ref (style_set);
|
|
|
|
g_hash_table_replace (theme->style_sets_by_name, g_strdup (name), style_set);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
first_uppercase (const char *str)
|
2014-05-02 13:34:02 +00:00
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
return g_ascii_isupper (*str);
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
meta_theme_define_int_constant (MetaTheme *theme,
|
|
|
|
const char *name,
|
|
|
|
int value,
|
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
if (theme->integer_constants == NULL)
|
|
|
|
theme->integer_constants = g_hash_table_new_full (g_str_hash,
|
|
|
|
g_str_equal,
|
|
|
|
g_free,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
if (!first_uppercase (name))
|
|
|
|
{
|
|
|
|
g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
|
|
|
|
_("User-defined constants must begin with a capital letter; \"%s\" does not"),
|
|
|
|
name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
if (g_hash_table_lookup_extended (theme->integer_constants, name, NULL, NULL))
|
|
|
|
{
|
|
|
|
g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
|
|
|
|
_("Constant \"%s\" has already been defined"),
|
|
|
|
name);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_hash_table_insert (theme->integer_constants,
|
|
|
|
g_strdup (name),
|
|
|
|
GINT_TO_POINTER (value));
|
2002-08-04 20:02:45 +00:00
|
|
|
|
|
|
|
return TRUE;
|
2002-02-07 03:07:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
meta_theme_lookup_int_constant (MetaTheme *theme,
|
|
|
|
const char *name,
|
|
|
|
int *value)
|
|
|
|
{
|
|
|
|
gpointer old_value;
|
|
|
|
|
|
|
|
*value = 0;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
if (theme->integer_constants == NULL)
|
|
|
|
return FALSE;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
if (g_hash_table_lookup_extended (theme->integer_constants,
|
|
|
|
name, NULL, &old_value))
|
|
|
|
{
|
|
|
|
*value = GPOINTER_TO_INT (old_value);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
2002-01-28 05:16:04 +00:00
|
|
|
}
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
gboolean
|
|
|
|
meta_theme_define_float_constant (MetaTheme *theme,
|
|
|
|
const char *name,
|
|
|
|
double value,
|
|
|
|
GError **error)
|
2002-01-19 23:59:11 +00:00
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
double *d;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
if (theme->float_constants == NULL)
|
|
|
|
theme->float_constants = g_hash_table_new_full (g_str_hash,
|
|
|
|
g_str_equal,
|
|
|
|
g_free,
|
|
|
|
g_free);
|
2002-01-19 23:59:11 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
if (!first_uppercase (name))
|
|
|
|
{
|
|
|
|
g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
|
|
|
|
_("User-defined constants must begin with a capital letter; \"%s\" does not"),
|
|
|
|
name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
if (g_hash_table_lookup_extended (theme->float_constants, name, NULL, NULL))
|
|
|
|
{
|
|
|
|
g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
|
|
|
|
_("Constant \"%s\" has already been defined"),
|
|
|
|
name);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2002-01-19 23:59:11 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
d = g_new (double, 1);
|
|
|
|
*d = value;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
g_hash_table_insert (theme->float_constants,
|
2002-08-04 20:02:45 +00:00
|
|
|
g_strdup (name), d);
|
|
|
|
|
|
|
|
return TRUE;
|
2002-01-19 23:59:11 +00:00
|
|
|
}
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
gboolean
|
|
|
|
meta_theme_lookup_float_constant (MetaTheme *theme,
|
|
|
|
const char *name,
|
|
|
|
double *value)
|
2002-01-27 08:21:53 +00:00
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
double *d;
|
2002-01-27 08:21:53 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
*value = 0.0;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
if (theme->float_constants == NULL)
|
|
|
|
return FALSE;
|
2002-01-27 08:21:53 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
d = g_hash_table_lookup (theme->float_constants, name);
|
|
|
|
|
|
|
|
if (d)
|
|
|
|
{
|
|
|
|
*value = *d;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return FALSE;
|
2002-01-27 08:21:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
gboolean
|
|
|
|
meta_theme_define_color_constant (MetaTheme *theme,
|
|
|
|
const char *name,
|
|
|
|
const char *value,
|
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
if (theme->color_constants == NULL)
|
|
|
|
theme->color_constants = g_hash_table_new_full (g_str_hash,
|
|
|
|
g_str_equal,
|
|
|
|
g_free,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
if (!first_uppercase (name))
|
|
|
|
{
|
|
|
|
g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
|
|
|
|
_("User-defined constants must begin with a capital letter; \"%s\" does not"),
|
|
|
|
name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
if (g_hash_table_lookup_extended (theme->color_constants, name, NULL, NULL))
|
|
|
|
{
|
|
|
|
g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FAILED,
|
|
|
|
_("Constant \"%s\" has already been defined"),
|
|
|
|
name);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_hash_table_insert (theme->color_constants,
|
|
|
|
g_strdup (name),
|
|
|
|
g_strdup (value));
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2009-02-07 23:55:39 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* meta_theme_lookup_color_constant:
|
|
|
|
* @theme: the theme containing the constant
|
|
|
|
* @name: the name of the constant
|
|
|
|
* @value: (out): the string representation of the colour, or %NULL if it
|
|
|
|
* doesn't exist
|
|
|
|
*
|
2009-02-07 23:55:39 +00:00
|
|
|
* Looks up a colour constant.
|
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* Returns: %TRUE if it exists, %FALSE otherwise
|
2009-02-07 23:55:39 +00:00
|
|
|
*/
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
gboolean
|
|
|
|
meta_theme_lookup_color_constant (MetaTheme *theme,
|
|
|
|
const char *name,
|
|
|
|
char **value)
|
|
|
|
{
|
|
|
|
char *result;
|
|
|
|
|
|
|
|
*value = NULL;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
if (theme->color_constants == NULL)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
result = g_hash_table_lookup (theme->color_constants, name);
|
|
|
|
|
|
|
|
if (result)
|
|
|
|
{
|
|
|
|
*value = result;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-09 17:02:38 +00:00
|
|
|
PangoFontDescription*
|
|
|
|
meta_gtk_widget_get_font_desc (GtkWidget *widget,
|
2002-05-24 02:55:54 +00:00
|
|
|
double scale,
|
|
|
|
const PangoFontDescription *override)
|
2002-02-09 17:02:38 +00:00
|
|
|
{
|
2010-12-09 13:52:16 +00:00
|
|
|
GtkStyleContext *style;
|
2002-02-09 17:02:38 +00:00
|
|
|
PangoFontDescription *font_desc;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2010-04-11 18:30:44 +00:00
|
|
|
g_return_val_if_fail (gtk_widget_get_realized (widget), NULL);
|
2002-02-09 17:02:38 +00:00
|
|
|
|
2010-12-09 13:52:16 +00:00
|
|
|
style = gtk_widget_get_style_context (widget);
|
2012-12-16 23:41:42 +00:00
|
|
|
gtk_style_context_get (style, GTK_STATE_FLAG_NORMAL, "font", &font_desc, NULL);
|
2002-02-09 17:02:38 +00:00
|
|
|
|
2002-05-24 02:55:54 +00:00
|
|
|
if (override)
|
|
|
|
pango_font_description_merge (font_desc, override, TRUE);
|
|
|
|
|
2002-02-09 17:02:38 +00:00
|
|
|
pango_font_description_set_size (font_desc,
|
|
|
|
MAX (pango_font_description_get_size (font_desc) * scale, 1));
|
|
|
|
|
|
|
|
return font_desc;
|
|
|
|
}
|
|
|
|
|
2009-02-07 23:55:39 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* meta_pango_font_desc_get_text_height:
|
|
|
|
* @font_desc: the font
|
|
|
|
* @context: the context of the font
|
|
|
|
*
|
2009-02-07 23:55:39 +00:00
|
|
|
* Returns the height of the letters in a particular font.
|
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* Returns: the height of the letters
|
2009-02-07 23:55:39 +00:00
|
|
|
*/
|
2002-02-07 03:07:56 +00:00
|
|
|
int
|
2004-01-10 17:16:07 +00:00
|
|
|
meta_pango_font_desc_get_text_height (const PangoFontDescription *font_desc,
|
2002-02-09 17:02:38 +00:00
|
|
|
PangoContext *context)
|
2002-01-28 02:09:12 +00:00
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
PangoFontMetrics *metrics;
|
|
|
|
PangoLanguage *lang;
|
|
|
|
int retval;
|
2002-02-13 22:50:57 +00:00
|
|
|
|
2002-02-09 17:02:38 +00:00
|
|
|
lang = pango_context_get_language (context);
|
2002-02-13 22:50:57 +00:00
|
|
|
metrics = pango_context_get_metrics (context, font_desc, lang);
|
|
|
|
|
2014-05-02 13:34:02 +00:00
|
|
|
retval = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
|
2002-02-07 03:07:56 +00:00
|
|
|
pango_font_metrics_get_descent (metrics));
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
pango_font_metrics_unref (metrics);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
return retval;
|
2002-01-28 02:09:12 +00:00
|
|
|
}
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
MetaGtkColorComponent
|
|
|
|
meta_color_component_from_string (const char *str)
|
2002-01-28 02:09:12 +00:00
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
if (strcmp ("fg", str) == 0)
|
|
|
|
return META_GTK_COLOR_FG;
|
|
|
|
else if (strcmp ("bg", str) == 0)
|
|
|
|
return META_GTK_COLOR_BG;
|
|
|
|
else if (strcmp ("light", str) == 0)
|
|
|
|
return META_GTK_COLOR_LIGHT;
|
|
|
|
else if (strcmp ("dark", str) == 0)
|
|
|
|
return META_GTK_COLOR_DARK;
|
|
|
|
else if (strcmp ("mid", str) == 0)
|
|
|
|
return META_GTK_COLOR_MID;
|
|
|
|
else if (strcmp ("text", str) == 0)
|
|
|
|
return META_GTK_COLOR_TEXT;
|
|
|
|
else if (strcmp ("base", str) == 0)
|
|
|
|
return META_GTK_COLOR_BASE;
|
|
|
|
else if (strcmp ("text_aa", str) == 0)
|
|
|
|
return META_GTK_COLOR_TEXT_AA;
|
|
|
|
else
|
|
|
|
return META_GTK_COLOR_LAST;
|
|
|
|
}
|
2002-01-28 02:09:12 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
MetaButtonState
|
|
|
|
meta_button_state_from_string (const char *str)
|
|
|
|
{
|
|
|
|
if (strcmp ("normal", str) == 0)
|
|
|
|
return META_BUTTON_STATE_NORMAL;
|
|
|
|
else if (strcmp ("pressed", str) == 0)
|
|
|
|
return META_BUTTON_STATE_PRESSED;
|
|
|
|
else if (strcmp ("prelight", str) == 0)
|
|
|
|
return META_BUTTON_STATE_PRELIGHT;
|
|
|
|
else
|
|
|
|
return META_BUTTON_STATE_LAST;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char*
|
|
|
|
meta_button_state_to_string (MetaButtonState state)
|
|
|
|
{
|
|
|
|
switch (state)
|
2002-01-28 02:09:12 +00:00
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
case META_BUTTON_STATE_NORMAL:
|
|
|
|
return "normal";
|
|
|
|
case META_BUTTON_STATE_PRESSED:
|
|
|
|
return "pressed";
|
|
|
|
case META_BUTTON_STATE_PRELIGHT:
|
|
|
|
return "prelight";
|
|
|
|
case META_BUTTON_STATE_LAST:
|
|
|
|
break;
|
|
|
|
}
|
2002-01-28 02:09:12 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
return "<unknown>";
|
|
|
|
}
|
2002-01-28 02:09:12 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
MetaButtonType
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
meta_button_type_from_string (const char *str, MetaTheme *theme)
|
2002-02-07 03:07:56 +00:00
|
|
|
{
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
if (META_THEME_ALLOWS(theme, META_THEME_SHADE_STICK_ABOVE_BUTTONS))
|
|
|
|
{
|
|
|
|
if (strcmp ("shade", str) == 0)
|
|
|
|
return META_BUTTON_TYPE_SHADE;
|
|
|
|
else if (strcmp ("above", str) == 0)
|
|
|
|
return META_BUTTON_TYPE_ABOVE;
|
|
|
|
else if (strcmp ("stick", str) == 0)
|
|
|
|
return META_BUTTON_TYPE_STICK;
|
|
|
|
else if (strcmp ("unshade", str) == 0)
|
|
|
|
return META_BUTTON_TYPE_UNSHADE;
|
|
|
|
else if (strcmp ("unabove", str) == 0)
|
|
|
|
return META_BUTTON_TYPE_UNABOVE;
|
|
|
|
else if (strcmp ("unstick", str) == 0)
|
|
|
|
return META_BUTTON_TYPE_UNSTICK;
|
|
|
|
}
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
if (strcmp ("close", str) == 0)
|
|
|
|
return META_BUTTON_TYPE_CLOSE;
|
|
|
|
else if (strcmp ("maximize", str) == 0)
|
|
|
|
return META_BUTTON_TYPE_MAXIMIZE;
|
|
|
|
else if (strcmp ("minimize", str) == 0)
|
|
|
|
return META_BUTTON_TYPE_MINIMIZE;
|
|
|
|
else if (strcmp ("menu", str) == 0)
|
|
|
|
return META_BUTTON_TYPE_MENU;
|
2002-08-04 20:02:45 +00:00
|
|
|
else if (strcmp ("left_left_background", str) == 0)
|
|
|
|
return META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND;
|
|
|
|
else if (strcmp ("left_middle_background", str) == 0)
|
|
|
|
return META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND;
|
|
|
|
else if (strcmp ("left_right_background", str) == 0)
|
|
|
|
return META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND;
|
2010-12-03 00:14:13 +00:00
|
|
|
else if (strcmp ("left_single_background", str) == 0)
|
|
|
|
return META_BUTTON_TYPE_LEFT_SINGLE_BACKGROUND;
|
2002-08-04 20:02:45 +00:00
|
|
|
else if (strcmp ("right_left_background", str) == 0)
|
|
|
|
return META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND;
|
|
|
|
else if (strcmp ("right_middle_background", str) == 0)
|
|
|
|
return META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND;
|
|
|
|
else if (strcmp ("right_right_background", str) == 0)
|
|
|
|
return META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND;
|
2010-12-03 00:14:13 +00:00
|
|
|
else if (strcmp ("right_single_background", str) == 0)
|
|
|
|
return META_BUTTON_TYPE_RIGHT_SINGLE_BACKGROUND;
|
2002-02-07 03:07:56 +00:00
|
|
|
else
|
|
|
|
return META_BUTTON_TYPE_LAST;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char*
|
|
|
|
meta_button_type_to_string (MetaButtonType type)
|
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case META_BUTTON_TYPE_CLOSE:
|
|
|
|
return "close";
|
|
|
|
case META_BUTTON_TYPE_MAXIMIZE:
|
|
|
|
return "maximize";
|
|
|
|
case META_BUTTON_TYPE_MINIMIZE:
|
|
|
|
return "minimize";
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
case META_BUTTON_TYPE_SHADE:
|
|
|
|
return "shade";
|
|
|
|
case META_BUTTON_TYPE_ABOVE:
|
|
|
|
return "above";
|
|
|
|
case META_BUTTON_TYPE_STICK:
|
|
|
|
return "stick";
|
|
|
|
case META_BUTTON_TYPE_UNSHADE:
|
|
|
|
return "unshade";
|
|
|
|
case META_BUTTON_TYPE_UNABOVE:
|
|
|
|
return "unabove";
|
|
|
|
case META_BUTTON_TYPE_UNSTICK:
|
|
|
|
return "unstick";
|
|
|
|
case META_BUTTON_TYPE_MENU:
|
2002-02-07 03:07:56 +00:00
|
|
|
return "menu";
|
2002-08-04 20:02:45 +00:00
|
|
|
case META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND:
|
|
|
|
return "left_left_background";
|
|
|
|
case META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND:
|
|
|
|
return "left_middle_background";
|
|
|
|
case META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND:
|
|
|
|
return "left_right_background";
|
2010-12-03 00:14:13 +00:00
|
|
|
case META_BUTTON_TYPE_LEFT_SINGLE_BACKGROUND:
|
|
|
|
return "left_single_background";
|
2002-08-04 20:02:45 +00:00
|
|
|
case META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND:
|
|
|
|
return "right_left_background";
|
|
|
|
case META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND:
|
|
|
|
return "right_middle_background";
|
|
|
|
case META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND:
|
2014-05-02 13:34:02 +00:00
|
|
|
return "right_right_background";
|
2010-12-03 00:14:13 +00:00
|
|
|
case META_BUTTON_TYPE_RIGHT_SINGLE_BACKGROUND:
|
|
|
|
return "right_single_background";
|
2002-02-07 03:07:56 +00:00
|
|
|
case META_BUTTON_TYPE_LAST:
|
|
|
|
break;
|
2002-01-28 02:09:12 +00:00
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
|
|
|
|
return "<unknown>";
|
2002-01-28 02:09:12 +00:00
|
|
|
}
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
MetaFramePiece
|
|
|
|
meta_frame_piece_from_string (const char *str)
|
|
|
|
{
|
|
|
|
if (strcmp ("entire_background", str) == 0)
|
|
|
|
return META_FRAME_PIECE_ENTIRE_BACKGROUND;
|
|
|
|
else if (strcmp ("titlebar", str) == 0)
|
|
|
|
return META_FRAME_PIECE_TITLEBAR;
|
|
|
|
else if (strcmp ("titlebar_middle", str) == 0)
|
|
|
|
return META_FRAME_PIECE_TITLEBAR_MIDDLE;
|
|
|
|
else if (strcmp ("left_titlebar_edge", str) == 0)
|
|
|
|
return META_FRAME_PIECE_LEFT_TITLEBAR_EDGE;
|
|
|
|
else if (strcmp ("right_titlebar_edge", str) == 0)
|
|
|
|
return META_FRAME_PIECE_RIGHT_TITLEBAR_EDGE;
|
|
|
|
else if (strcmp ("top_titlebar_edge", str) == 0)
|
|
|
|
return META_FRAME_PIECE_TOP_TITLEBAR_EDGE;
|
|
|
|
else if (strcmp ("bottom_titlebar_edge", str) == 0)
|
|
|
|
return META_FRAME_PIECE_BOTTOM_TITLEBAR_EDGE;
|
|
|
|
else if (strcmp ("title", str) == 0)
|
|
|
|
return META_FRAME_PIECE_TITLE;
|
|
|
|
else if (strcmp ("left_edge", str) == 0)
|
|
|
|
return META_FRAME_PIECE_LEFT_EDGE;
|
|
|
|
else if (strcmp ("right_edge", str) == 0)
|
|
|
|
return META_FRAME_PIECE_RIGHT_EDGE;
|
|
|
|
else if (strcmp ("bottom_edge", str) == 0)
|
|
|
|
return META_FRAME_PIECE_BOTTOM_EDGE;
|
|
|
|
else if (strcmp ("overlay", str) == 0)
|
|
|
|
return META_FRAME_PIECE_OVERLAY;
|
|
|
|
else
|
|
|
|
return META_FRAME_PIECE_LAST;
|
|
|
|
}
|
2002-01-28 02:09:12 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
MetaFrameState
|
|
|
|
meta_frame_state_from_string (const char *str)
|
2002-01-19 23:59:11 +00:00
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
if (strcmp ("normal", str) == 0)
|
|
|
|
return META_FRAME_STATE_NORMAL;
|
|
|
|
else if (strcmp ("maximized", str) == 0)
|
|
|
|
return META_FRAME_STATE_MAXIMIZED;
|
2010-12-08 01:16:35 +00:00
|
|
|
else if (strcmp ("tiled_left", str) == 0)
|
|
|
|
return META_FRAME_STATE_TILED_LEFT;
|
|
|
|
else if (strcmp ("tiled_right", str) == 0)
|
|
|
|
return META_FRAME_STATE_TILED_RIGHT;
|
2002-02-07 03:07:56 +00:00
|
|
|
else if (strcmp ("shaded", str) == 0)
|
|
|
|
return META_FRAME_STATE_SHADED;
|
|
|
|
else if (strcmp ("maximized_and_shaded", str) == 0)
|
|
|
|
return META_FRAME_STATE_MAXIMIZED_AND_SHADED;
|
2010-12-08 01:16:35 +00:00
|
|
|
else if (strcmp ("tiled_left_and_shaded", str) == 0)
|
|
|
|
return META_FRAME_STATE_TILED_LEFT_AND_SHADED;
|
|
|
|
else if (strcmp ("tiled_right_and_shaded", str) == 0)
|
|
|
|
return META_FRAME_STATE_TILED_RIGHT_AND_SHADED;
|
2002-02-07 03:07:56 +00:00
|
|
|
else
|
|
|
|
return META_FRAME_STATE_LAST;
|
|
|
|
}
|
2002-01-28 02:09:12 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
const char*
|
|
|
|
meta_frame_state_to_string (MetaFrameState state)
|
|
|
|
{
|
|
|
|
switch (state)
|
|
|
|
{
|
|
|
|
case META_FRAME_STATE_NORMAL:
|
|
|
|
return "normal";
|
|
|
|
case META_FRAME_STATE_MAXIMIZED:
|
|
|
|
return "maximized";
|
2010-12-08 01:16:35 +00:00
|
|
|
case META_FRAME_STATE_TILED_LEFT:
|
|
|
|
return "tiled_left";
|
|
|
|
case META_FRAME_STATE_TILED_RIGHT:
|
|
|
|
return "tiled_right";
|
2002-02-07 03:07:56 +00:00
|
|
|
case META_FRAME_STATE_SHADED:
|
|
|
|
return "shaded";
|
|
|
|
case META_FRAME_STATE_MAXIMIZED_AND_SHADED:
|
|
|
|
return "maximized_and_shaded";
|
2010-12-08 01:16:35 +00:00
|
|
|
case META_FRAME_STATE_TILED_LEFT_AND_SHADED:
|
|
|
|
return "tiled_left_and_shaded";
|
|
|
|
case META_FRAME_STATE_TILED_RIGHT_AND_SHADED:
|
|
|
|
return "tiled_right_and_shaded";
|
2002-02-07 03:07:56 +00:00
|
|
|
case META_FRAME_STATE_LAST:
|
|
|
|
break;
|
|
|
|
}
|
2002-01-28 02:09:12 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
return "<unknown>";
|
|
|
|
}
|
2002-01-19 23:59:11 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
MetaFrameResize
|
|
|
|
meta_frame_resize_from_string (const char *str)
|
|
|
|
{
|
|
|
|
if (strcmp ("none", str) == 0)
|
|
|
|
return META_FRAME_RESIZE_NONE;
|
|
|
|
else if (strcmp ("vertical", str) == 0)
|
|
|
|
return META_FRAME_RESIZE_VERTICAL;
|
|
|
|
else if (strcmp ("horizontal", str) == 0)
|
|
|
|
return META_FRAME_RESIZE_HORIZONTAL;
|
|
|
|
else if (strcmp ("both", str) == 0)
|
|
|
|
return META_FRAME_RESIZE_BOTH;
|
|
|
|
else
|
|
|
|
return META_FRAME_RESIZE_LAST;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char*
|
|
|
|
meta_frame_resize_to_string (MetaFrameResize resize)
|
|
|
|
{
|
|
|
|
switch (resize)
|
2002-01-19 23:59:11 +00:00
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
case META_FRAME_RESIZE_NONE:
|
|
|
|
return "none";
|
|
|
|
case META_FRAME_RESIZE_VERTICAL:
|
|
|
|
return "vertical";
|
|
|
|
case META_FRAME_RESIZE_HORIZONTAL:
|
|
|
|
return "horizontal";
|
|
|
|
case META_FRAME_RESIZE_BOTH:
|
|
|
|
return "both";
|
|
|
|
case META_FRAME_RESIZE_LAST:
|
|
|
|
break;
|
2002-01-19 23:59:11 +00:00
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
|
|
|
|
return "<unknown>";
|
2002-01-19 23:59:11 +00:00
|
|
|
}
|
2002-01-28 07:30:44 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
MetaFrameFocus
|
|
|
|
meta_frame_focus_from_string (const char *str)
|
2002-01-28 07:30:44 +00:00
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
if (strcmp ("no", str) == 0)
|
|
|
|
return META_FRAME_FOCUS_NO;
|
|
|
|
else if (strcmp ("yes", str) == 0)
|
|
|
|
return META_FRAME_FOCUS_YES;
|
|
|
|
else
|
|
|
|
return META_FRAME_FOCUS_LAST;
|
|
|
|
}
|
2002-02-02 05:09:19 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
const char*
|
|
|
|
meta_frame_focus_to_string (MetaFrameFocus focus)
|
|
|
|
{
|
|
|
|
switch (focus)
|
|
|
|
{
|
|
|
|
case META_FRAME_FOCUS_NO:
|
|
|
|
return "no";
|
|
|
|
case META_FRAME_FOCUS_YES:
|
|
|
|
return "yes";
|
|
|
|
case META_FRAME_FOCUS_LAST:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return "<unknown>";
|
2002-01-28 07:30:44 +00:00
|
|
|
}
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
MetaFrameType
|
|
|
|
meta_frame_type_from_string (const char *str)
|
|
|
|
{
|
|
|
|
if (strcmp ("normal", str) == 0)
|
|
|
|
return META_FRAME_TYPE_NORMAL;
|
|
|
|
else if (strcmp ("dialog", str) == 0)
|
|
|
|
return META_FRAME_TYPE_DIALOG;
|
|
|
|
else if (strcmp ("modal_dialog", str) == 0)
|
|
|
|
return META_FRAME_TYPE_MODAL_DIALOG;
|
|
|
|
else if (strcmp ("utility", str) == 0)
|
|
|
|
return META_FRAME_TYPE_UTILITY;
|
|
|
|
else if (strcmp ("menu", str) == 0)
|
|
|
|
return META_FRAME_TYPE_MENU;
|
2002-06-22 03:23:02 +00:00
|
|
|
else if (strcmp ("border", str) == 0)
|
|
|
|
return META_FRAME_TYPE_BORDER;
|
2010-11-04 16:11:54 +00:00
|
|
|
else if (strcmp ("attached", str) == 0)
|
|
|
|
return META_FRAME_TYPE_ATTACHED;
|
2002-02-07 03:07:56 +00:00
|
|
|
#if 0
|
|
|
|
else if (strcmp ("toolbar", str) == 0)
|
|
|
|
return META_FRAME_TYPE_TOOLBAR;
|
|
|
|
#endif
|
|
|
|
else
|
|
|
|
return META_FRAME_TYPE_LAST;
|
|
|
|
}
|
2002-01-28 07:30:44 +00:00
|
|
|
|
2010-11-11 21:14:07 +00:00
|
|
|
/**
|
|
|
|
* meta_frame_type_to_string:
|
2013-02-15 18:42:08 +00:00
|
|
|
* @type: a #MetaFrameType
|
2010-11-11 21:14:07 +00:00
|
|
|
*
|
|
|
|
* Converts a frame type enum value to the name string that would
|
|
|
|
* appear in the theme definition file.
|
|
|
|
*
|
|
|
|
* Return value: the string value
|
|
|
|
*/
|
2002-02-07 03:07:56 +00:00
|
|
|
const char*
|
|
|
|
meta_frame_type_to_string (MetaFrameType type)
|
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case META_FRAME_TYPE_NORMAL:
|
|
|
|
return "normal";
|
|
|
|
case META_FRAME_TYPE_DIALOG:
|
|
|
|
return "dialog";
|
|
|
|
case META_FRAME_TYPE_MODAL_DIALOG:
|
|
|
|
return "modal_dialog";
|
|
|
|
case META_FRAME_TYPE_UTILITY:
|
|
|
|
return "utility";
|
|
|
|
case META_FRAME_TYPE_MENU:
|
|
|
|
return "menu";
|
2002-06-22 03:23:02 +00:00
|
|
|
case META_FRAME_TYPE_BORDER:
|
|
|
|
return "border";
|
2010-11-04 16:11:54 +00:00
|
|
|
case META_FRAME_TYPE_ATTACHED:
|
|
|
|
return "attached";
|
2002-02-07 03:07:56 +00:00
|
|
|
#if 0
|
|
|
|
case META_FRAME_TYPE_TOOLBAR:
|
|
|
|
return "toolbar";
|
|
|
|
#endif
|
|
|
|
case META_FRAME_TYPE_LAST:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return "<unknown>";
|
|
|
|
}
|
2002-02-02 05:09:19 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
MetaGradientType
|
|
|
|
meta_gradient_type_from_string (const char *str)
|
|
|
|
{
|
|
|
|
if (strcmp ("vertical", str) == 0)
|
|
|
|
return META_GRADIENT_VERTICAL;
|
|
|
|
else if (strcmp ("horizontal", str) == 0)
|
|
|
|
return META_GRADIENT_HORIZONTAL;
|
|
|
|
else if (strcmp ("diagonal", str) == 0)
|
|
|
|
return META_GRADIENT_DIAGONAL;
|
|
|
|
else
|
|
|
|
return META_GRADIENT_LAST;
|
|
|
|
}
|
2002-01-28 07:30:44 +00:00
|
|
|
|
2011-05-18 21:32:44 +00:00
|
|
|
GtkStateFlags
|
2002-02-07 03:07:56 +00:00
|
|
|
meta_gtk_state_from_string (const char *str)
|
|
|
|
{
|
2010-12-04 22:19:44 +00:00
|
|
|
if (g_ascii_strcasecmp ("normal", str) == 0)
|
2011-05-18 21:32:44 +00:00
|
|
|
return GTK_STATE_FLAG_NORMAL;
|
2010-12-04 22:19:44 +00:00
|
|
|
else if (g_ascii_strcasecmp ("prelight", str) == 0)
|
2011-05-18 21:32:44 +00:00
|
|
|
return GTK_STATE_FLAG_PRELIGHT;
|
2010-12-04 22:19:44 +00:00
|
|
|
else if (g_ascii_strcasecmp ("active", str) == 0)
|
2011-05-18 21:32:44 +00:00
|
|
|
return GTK_STATE_FLAG_ACTIVE;
|
2010-12-04 22:19:44 +00:00
|
|
|
else if (g_ascii_strcasecmp ("selected", str) == 0)
|
2011-05-18 21:32:44 +00:00
|
|
|
return GTK_STATE_FLAG_SELECTED;
|
2010-12-04 22:19:44 +00:00
|
|
|
else if (g_ascii_strcasecmp ("insensitive", str) == 0)
|
2011-05-18 21:32:44 +00:00
|
|
|
return GTK_STATE_FLAG_INSENSITIVE;
|
2010-12-04 22:19:44 +00:00
|
|
|
else if (g_ascii_strcasecmp ("inconsistent", str) == 0)
|
2011-05-18 21:32:44 +00:00
|
|
|
return GTK_STATE_FLAG_INCONSISTENT;
|
2010-12-04 22:19:44 +00:00
|
|
|
else if (g_ascii_strcasecmp ("focused", str) == 0)
|
2011-05-18 21:32:44 +00:00
|
|
|
return GTK_STATE_FLAG_FOCUSED;
|
2012-01-10 00:03:07 +00:00
|
|
|
else if (g_ascii_strcasecmp ("backdrop", str) == 0)
|
|
|
|
return GTK_STATE_FLAG_BACKDROP;
|
2002-02-07 03:07:56 +00:00
|
|
|
else
|
|
|
|
return -1; /* hack */
|
|
|
|
}
|
2002-01-28 07:30:44 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
GtkShadowType
|
|
|
|
meta_gtk_shadow_from_string (const char *str)
|
|
|
|
{
|
|
|
|
if (strcmp ("none", str) == 0)
|
|
|
|
return GTK_SHADOW_NONE;
|
|
|
|
else if (strcmp ("in", str) == 0)
|
|
|
|
return GTK_SHADOW_IN;
|
|
|
|
else if (strcmp ("out", str) == 0)
|
|
|
|
return GTK_SHADOW_OUT;
|
|
|
|
else if (strcmp ("etched_in", str) == 0)
|
|
|
|
return GTK_SHADOW_ETCHED_IN;
|
|
|
|
else if (strcmp ("etched_out", str) == 0)
|
|
|
|
return GTK_SHADOW_ETCHED_OUT;
|
|
|
|
else
|
|
|
|
return -1;
|
2002-01-28 07:30:44 +00:00
|
|
|
}
|
2002-02-02 05:09:19 +00:00
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
GtkArrowType
|
|
|
|
meta_gtk_arrow_from_string (const char *str)
|
|
|
|
{
|
|
|
|
if (strcmp ("up", str) == 0)
|
|
|
|
return GTK_ARROW_UP;
|
|
|
|
else if (strcmp ("down", str) == 0)
|
|
|
|
return GTK_ARROW_DOWN;
|
|
|
|
else if (strcmp ("left", str) == 0)
|
|
|
|
return GTK_ARROW_LEFT;
|
|
|
|
else if (strcmp ("right", str) == 0)
|
|
|
|
return GTK_ARROW_RIGHT;
|
2006-09-13 03:14:16 +00:00
|
|
|
else if (strcmp ("none", str) == 0)
|
|
|
|
return GTK_ARROW_NONE;
|
2002-02-07 03:07:56 +00:00
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
}
|
2002-02-02 05:09:19 +00:00
|
|
|
|
2009-02-07 23:55:39 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* meta_image_fill_type_from_string:
|
|
|
|
* @str: a string representing a fill_type
|
|
|
|
*
|
2009-02-07 23:55:39 +00:00
|
|
|
* Returns a fill_type from a string. The inverse of
|
|
|
|
* meta_image_fill_type_to_string().
|
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* Returns: the fill type, or -1 if it represents no fill type.
|
2009-02-07 23:55:39 +00:00
|
|
|
*/
|
2002-05-31 22:03:34 +00:00
|
|
|
MetaImageFillType
|
|
|
|
meta_image_fill_type_from_string (const char *str)
|
|
|
|
{
|
|
|
|
if (strcmp ("tile", str) == 0)
|
|
|
|
return META_IMAGE_FILL_TILE;
|
|
|
|
else if (strcmp ("scale", str) == 0)
|
|
|
|
return META_IMAGE_FILL_SCALE;
|
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2009-02-07 23:55:39 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* gtk_style_shade:
|
|
|
|
* @a: the starting colour
|
|
|
|
* @b: (out): the resulting colour
|
|
|
|
* @k: amount to scale lightness and saturation by
|
|
|
|
*
|
2009-02-07 23:55:39 +00:00
|
|
|
* Takes a colour "a", scales the lightness and saturation by a certain amount,
|
|
|
|
* and sets "b" to the resulting colour.
|
|
|
|
* gtkstyle.c cut-and-pastage.
|
2014-05-02 13:34:02 +00:00
|
|
|
*/
|
2002-06-06 04:00:22 +00:00
|
|
|
static void
|
2011-05-17 18:50:40 +00:00
|
|
|
gtk_style_shade (GdkRGBA *a,
|
|
|
|
GdkRGBA *b,
|
2002-06-06 04:00:22 +00:00
|
|
|
gdouble k)
|
|
|
|
{
|
|
|
|
gdouble red;
|
|
|
|
gdouble green;
|
|
|
|
gdouble blue;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2011-05-17 18:50:40 +00:00
|
|
|
red = a->red;
|
|
|
|
green = a->green;
|
|
|
|
blue = a->blue;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
rgb_to_hls (&red, &green, &blue);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
green *= k;
|
|
|
|
if (green > 1.0)
|
|
|
|
green = 1.0;
|
|
|
|
else if (green < 0.0)
|
|
|
|
green = 0.0;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
blue *= k;
|
|
|
|
if (blue > 1.0)
|
|
|
|
blue = 1.0;
|
|
|
|
else if (blue < 0.0)
|
|
|
|
blue = 0.0;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
hls_to_rgb (&red, &green, &blue);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2011-05-17 18:50:40 +00:00
|
|
|
b->red = red;
|
|
|
|
b->green = green;
|
|
|
|
b->blue = blue;
|
2002-06-06 04:00:22 +00:00
|
|
|
}
|
|
|
|
|
2009-02-07 23:55:39 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* rgb_to_hls:
|
|
|
|
* @r: on input, red; on output, hue
|
|
|
|
* @g: on input, green; on output, lightness
|
|
|
|
* @b: on input, blue; on output, saturation
|
2009-02-07 23:55:39 +00:00
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* Converts a red/green/blue triplet to a hue/lightness/saturation triplet.
|
2009-02-07 23:55:39 +00:00
|
|
|
*/
|
2002-06-06 04:00:22 +00:00
|
|
|
static void
|
|
|
|
rgb_to_hls (gdouble *r,
|
|
|
|
gdouble *g,
|
|
|
|
gdouble *b)
|
|
|
|
{
|
|
|
|
gdouble min;
|
|
|
|
gdouble max;
|
|
|
|
gdouble red;
|
|
|
|
gdouble green;
|
|
|
|
gdouble blue;
|
|
|
|
gdouble h, l, s;
|
|
|
|
gdouble delta;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
red = *r;
|
|
|
|
green = *g;
|
|
|
|
blue = *b;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
if (red > green)
|
|
|
|
{
|
|
|
|
if (red > blue)
|
|
|
|
max = red;
|
|
|
|
else
|
|
|
|
max = blue;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
if (green < blue)
|
|
|
|
min = green;
|
|
|
|
else
|
|
|
|
min = blue;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (green > blue)
|
|
|
|
max = green;
|
|
|
|
else
|
|
|
|
max = blue;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
if (red < blue)
|
|
|
|
min = red;
|
|
|
|
else
|
|
|
|
min = blue;
|
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
l = (max + min) / 2;
|
|
|
|
s = 0;
|
|
|
|
h = 0;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
if (max != min)
|
|
|
|
{
|
|
|
|
if (l <= 0.5)
|
|
|
|
s = (max - min) / (max + min);
|
|
|
|
else
|
|
|
|
s = (max - min) / (2 - max - min);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
delta = max -min;
|
|
|
|
if (red == max)
|
|
|
|
h = (green - blue) / delta;
|
|
|
|
else if (green == max)
|
|
|
|
h = 2 + (blue - red) / delta;
|
|
|
|
else if (blue == max)
|
|
|
|
h = 4 + (red - green) / delta;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
h *= 60;
|
|
|
|
if (h < 0.0)
|
|
|
|
h += 360;
|
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
*r = h;
|
|
|
|
*g = l;
|
|
|
|
*b = s;
|
|
|
|
}
|
|
|
|
|
2009-02-07 23:55:39 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* hls_to_rgb:
|
|
|
|
* @h: on input, hue; on output, red
|
|
|
|
* @l: on input, lightness; on output, green
|
|
|
|
* @s: on input, saturation; on output, blue
|
2009-02-07 23:55:39 +00:00
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* Converts a hue/lightness/saturation triplet to a red/green/blue triplet.
|
2009-02-07 23:55:39 +00:00
|
|
|
*/
|
2002-06-06 04:00:22 +00:00
|
|
|
static void
|
|
|
|
hls_to_rgb (gdouble *h,
|
|
|
|
gdouble *l,
|
|
|
|
gdouble *s)
|
|
|
|
{
|
|
|
|
gdouble hue;
|
|
|
|
gdouble lightness;
|
|
|
|
gdouble saturation;
|
|
|
|
gdouble m1, m2;
|
|
|
|
gdouble r, g, b;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
lightness = *l;
|
|
|
|
saturation = *s;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
if (lightness <= 0.5)
|
|
|
|
m2 = lightness * (1 + saturation);
|
|
|
|
else
|
|
|
|
m2 = lightness + saturation - lightness * saturation;
|
|
|
|
m1 = 2 * lightness - m2;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
if (saturation == 0)
|
|
|
|
{
|
|
|
|
*h = lightness;
|
|
|
|
*l = lightness;
|
|
|
|
*s = lightness;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
hue = *h + 120;
|
|
|
|
while (hue > 360)
|
|
|
|
hue -= 360;
|
|
|
|
while (hue < 0)
|
|
|
|
hue += 360;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
if (hue < 60)
|
|
|
|
r = m1 + (m2 - m1) * hue / 60;
|
|
|
|
else if (hue < 180)
|
|
|
|
r = m2;
|
|
|
|
else if (hue < 240)
|
|
|
|
r = m1 + (m2 - m1) * (240 - hue) / 60;
|
|
|
|
else
|
|
|
|
r = m1;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
hue = *h;
|
|
|
|
while (hue > 360)
|
|
|
|
hue -= 360;
|
|
|
|
while (hue < 0)
|
|
|
|
hue += 360;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
if (hue < 60)
|
|
|
|
g = m1 + (m2 - m1) * hue / 60;
|
|
|
|
else if (hue < 180)
|
|
|
|
g = m2;
|
|
|
|
else if (hue < 240)
|
|
|
|
g = m1 + (m2 - m1) * (240 - hue) / 60;
|
|
|
|
else
|
|
|
|
g = m1;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
hue = *h - 120;
|
|
|
|
while (hue > 360)
|
|
|
|
hue -= 360;
|
|
|
|
while (hue < 0)
|
|
|
|
hue += 360;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
if (hue < 60)
|
|
|
|
b = m1 + (m2 - m1) * hue / 60;
|
|
|
|
else if (hue < 180)
|
|
|
|
b = m2;
|
|
|
|
else if (hue < 240)
|
|
|
|
b = m1 + (m2 - m1) * (240 - hue) / 60;
|
|
|
|
else
|
|
|
|
b = m1;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-06-06 04:00:22 +00:00
|
|
|
*h = r;
|
|
|
|
*l = g;
|
|
|
|
*s = b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
#if 0
|
|
|
|
/* These are some functions I'm saving to use in optimizing
|
|
|
|
* MetaDrawOpList, namely to pre-composite pixbufs on client side
|
|
|
|
* prior to rendering to the server
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
draw_bg_solid_composite (const MetaTextureSpec *bg,
|
|
|
|
const MetaTextureSpec *fg,
|
|
|
|
double alpha,
|
|
|
|
GtkWidget *widget,
|
|
|
|
GdkDrawable *drawable,
|
|
|
|
const GdkRectangle *clip,
|
|
|
|
MetaTextureDrawMode mode,
|
|
|
|
double xalign,
|
|
|
|
double yalign,
|
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int width,
|
|
|
|
int height)
|
|
|
|
{
|
2011-05-17 18:50:40 +00:00
|
|
|
GdkRGBA bg_color;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
g_assert (bg->type == META_TEXTURE_SOLID);
|
|
|
|
g_assert (fg->type != META_TEXTURE_COMPOSITE);
|
|
|
|
g_assert (fg->type != META_TEXTURE_SHAPE_LIST);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
meta_color_spec_render (bg->data.solid.color_spec,
|
|
|
|
widget,
|
2002-02-07 03:07:56 +00:00
|
|
|
&bg_color);
|
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
switch (fg->type)
|
|
|
|
{
|
|
|
|
case META_TEXTURE_SOLID:
|
|
|
|
{
|
2011-05-17 18:50:40 +00:00
|
|
|
GdkRGBA fg_color;
|
2002-02-02 05:09:19 +00:00
|
|
|
|
|
|
|
meta_color_spec_render (fg->data.solid.color_spec,
|
|
|
|
widget,
|
|
|
|
&fg_color);
|
|
|
|
|
|
|
|
color_composite (&bg_color, &fg_color,
|
|
|
|
alpha, &fg_color);
|
|
|
|
|
|
|
|
draw_color_rectangle (widget, drawable, &fg_color, clip,
|
|
|
|
x, y, width, height);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_TEXTURE_GRADIENT:
|
|
|
|
/* FIXME I think we could just composite all the colors in
|
|
|
|
* the gradient prior to generating the gradient?
|
|
|
|
*/
|
|
|
|
/* FALL THRU */
|
|
|
|
case META_TEXTURE_IMAGE:
|
|
|
|
{
|
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
GdkPixbuf *composited;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
pixbuf = meta_texture_spec_render (fg, widget, mode, 255,
|
|
|
|
width, height);
|
|
|
|
|
|
|
|
if (pixbuf == NULL)
|
|
|
|
return;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
composited = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
|
|
|
|
gdk_pixbuf_get_has_alpha (pixbuf), 8,
|
|
|
|
gdk_pixbuf_get_width (pixbuf),
|
|
|
|
gdk_pixbuf_get_height (pixbuf));
|
|
|
|
|
|
|
|
if (composited == NULL)
|
|
|
|
{
|
|
|
|
g_object_unref (G_OBJECT (pixbuf));
|
|
|
|
return;
|
|
|
|
}
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
gdk_pixbuf_composite_color (pixbuf,
|
|
|
|
composited,
|
|
|
|
0, 0,
|
|
|
|
gdk_pixbuf_get_width (pixbuf),
|
|
|
|
gdk_pixbuf_get_height (pixbuf),
|
|
|
|
0.0, 0.0, /* offsets */
|
|
|
|
1.0, 1.0, /* scale */
|
|
|
|
GDK_INTERP_BILINEAR,
|
|
|
|
255 * alpha,
|
|
|
|
0, 0, /* check offsets */
|
|
|
|
0, /* check size */
|
|
|
|
GDK_COLOR_RGB (bg_color),
|
|
|
|
GDK_COLOR_RGB (bg_color));
|
|
|
|
|
|
|
|
/* Need to draw background since pixbuf is not
|
|
|
|
* necessarily covering the whole thing
|
|
|
|
*/
|
|
|
|
draw_color_rectangle (widget, drawable, &bg_color, clip,
|
|
|
|
x, y, width, height);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
render_pixbuf_aligned (drawable, clip, composited,
|
|
|
|
xalign, yalign,
|
|
|
|
x, y, width, height);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
g_object_unref (G_OBJECT (pixbuf));
|
|
|
|
g_object_unref (G_OBJECT (composited));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
case META_TEXTURE_BLANK:
|
2002-02-02 05:09:19 +00:00
|
|
|
case META_TEXTURE_COMPOSITE:
|
|
|
|
case META_TEXTURE_SHAPE_LIST:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
draw_bg_gradient_composite (const MetaTextureSpec *bg,
|
|
|
|
const MetaTextureSpec *fg,
|
|
|
|
double alpha,
|
|
|
|
GtkWidget *widget,
|
|
|
|
GdkDrawable *drawable,
|
|
|
|
const GdkRectangle *clip,
|
|
|
|
MetaTextureDrawMode mode,
|
|
|
|
double xalign,
|
|
|
|
double yalign,
|
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int width,
|
|
|
|
int height)
|
|
|
|
{
|
|
|
|
g_assert (bg->type == META_TEXTURE_GRADIENT);
|
|
|
|
g_assert (fg->type != META_TEXTURE_COMPOSITE);
|
|
|
|
g_assert (fg->type != META_TEXTURE_SHAPE_LIST);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
switch (fg->type)
|
|
|
|
{
|
|
|
|
case META_TEXTURE_SOLID:
|
|
|
|
case META_TEXTURE_GRADIENT:
|
|
|
|
case META_TEXTURE_IMAGE:
|
|
|
|
{
|
|
|
|
GdkPixbuf *bg_pixbuf;
|
|
|
|
GdkPixbuf *fg_pixbuf;
|
|
|
|
GdkPixbuf *composited;
|
|
|
|
int fg_width, fg_height;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
bg_pixbuf = meta_texture_spec_render (bg, widget, mode, 255,
|
|
|
|
width, height);
|
|
|
|
|
|
|
|
if (bg_pixbuf == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
fg_pixbuf = meta_texture_spec_render (fg, widget, mode, 255,
|
|
|
|
width, height);
|
|
|
|
|
|
|
|
if (fg_pixbuf == NULL)
|
|
|
|
{
|
2002-02-07 03:07:56 +00:00
|
|
|
g_object_unref (G_OBJECT (bg_pixbuf));
|
2002-02-02 05:09:19 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* gradients always fill the entire target area */
|
|
|
|
g_assert (gdk_pixbuf_get_width (bg_pixbuf) == width);
|
|
|
|
g_assert (gdk_pixbuf_get_height (bg_pixbuf) == height);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
composited = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
|
|
|
|
gdk_pixbuf_get_has_alpha (bg_pixbuf), 8,
|
|
|
|
gdk_pixbuf_get_width (bg_pixbuf),
|
|
|
|
gdk_pixbuf_get_height (bg_pixbuf));
|
|
|
|
|
|
|
|
if (composited == NULL)
|
|
|
|
{
|
|
|
|
g_object_unref (G_OBJECT (bg_pixbuf));
|
|
|
|
g_object_unref (G_OBJECT (fg_pixbuf));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
fg_width = gdk_pixbuf_get_width (fg_pixbuf);
|
|
|
|
fg_height = gdk_pixbuf_get_height (fg_pixbuf);
|
|
|
|
|
|
|
|
/* If we wanted to be all cool we could deal with the
|
|
|
|
* offsets and try to composite only in the clip rectangle,
|
|
|
|
* but I just don't care enough to figure it out.
|
|
|
|
*/
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
gdk_pixbuf_composite (fg_pixbuf,
|
|
|
|
composited,
|
|
|
|
x + (width - fg_width) * xalign,
|
|
|
|
y + (height - fg_height) * yalign,
|
|
|
|
gdk_pixbuf_get_width (fg_pixbuf),
|
|
|
|
gdk_pixbuf_get_height (fg_pixbuf),
|
|
|
|
0.0, 0.0, /* offsets */
|
|
|
|
1.0, 1.0, /* scale */
|
|
|
|
GDK_INTERP_BILINEAR,
|
|
|
|
255 * alpha);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2010-07-19 15:55:00 +00:00
|
|
|
gdk_cairo_set_source_pixbuf (cr, composited, x, y);
|
|
|
|
cairo_paint (cr);
|
2002-02-07 03:07:56 +00:00
|
|
|
|
2002-02-02 05:09:19 +00:00
|
|
|
g_object_unref (G_OBJECT (bg_pixbuf));
|
|
|
|
g_object_unref (G_OBJECT (fg_pixbuf));
|
|
|
|
g_object_unref (G_OBJECT (composited));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_TEXTURE_BLANK:
|
|
|
|
case META_TEXTURE_SHAPE_LIST:
|
|
|
|
case META_TEXTURE_COMPOSITE:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
|
2009-02-07 23:55:39 +00:00
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* meta_theme_earliest_version_with_button:
|
|
|
|
* @type: the button type
|
|
|
|
*
|
2009-02-07 23:55:39 +00:00
|
|
|
* Returns the earliest version of the theme format which required support
|
|
|
|
* for a particular button. (For example, "shade" first appeared in v2, and
|
|
|
|
* "close" in v1.)
|
|
|
|
*
|
2011-11-02 15:34:45 +00:00
|
|
|
* Returns: the number of the theme format
|
2009-02-07 23:55:39 +00:00
|
|
|
*/
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
guint
|
|
|
|
meta_theme_earliest_version_with_button (MetaButtonType type)
|
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case META_BUTTON_TYPE_CLOSE:
|
|
|
|
case META_BUTTON_TYPE_MAXIMIZE:
|
|
|
|
case META_BUTTON_TYPE_MINIMIZE:
|
|
|
|
case META_BUTTON_TYPE_MENU:
|
|
|
|
case META_BUTTON_TYPE_LEFT_LEFT_BACKGROUND:
|
|
|
|
case META_BUTTON_TYPE_LEFT_MIDDLE_BACKGROUND:
|
|
|
|
case META_BUTTON_TYPE_LEFT_RIGHT_BACKGROUND:
|
|
|
|
case META_BUTTON_TYPE_RIGHT_LEFT_BACKGROUND:
|
|
|
|
case META_BUTTON_TYPE_RIGHT_MIDDLE_BACKGROUND:
|
|
|
|
case META_BUTTON_TYPE_RIGHT_RIGHT_BACKGROUND:
|
2009-08-19 22:41:00 +00:00
|
|
|
return 1000;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
case META_BUTTON_TYPE_SHADE:
|
|
|
|
case META_BUTTON_TYPE_ABOVE:
|
|
|
|
case META_BUTTON_TYPE_STICK:
|
|
|
|
case META_BUTTON_TYPE_UNSHADE:
|
|
|
|
case META_BUTTON_TYPE_UNABOVE:
|
|
|
|
case META_BUTTON_TYPE_UNSTICK:
|
2009-08-19 22:41:00 +00:00
|
|
|
return 2000;
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
|
2010-12-03 00:14:13 +00:00
|
|
|
case META_BUTTON_TYPE_LEFT_SINGLE_BACKGROUND:
|
|
|
|
case META_BUTTON_TYPE_RIGHT_SINGLE_BACKGROUND:
|
|
|
|
return 3003;
|
|
|
|
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
default:
|
|
|
|
meta_warning("Unknown button %d\n", type);
|
2009-08-19 22:41:00 +00:00
|
|
|
return 1000;
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
}
|
|
|
|
}
|