[metacity] libmetacity: add meta-frame-layout.[c/h]
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [metacity] libmetacity: add meta-frame-layout.[c/h]
- Date: Sun, 31 Jan 2016 05:25:15 +0000 (UTC)
commit 8bf8bbdb131910288985f7766432c0a2f762cc71
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sun Jan 31 02:51:30 2016 +0200
libmetacity: add meta-frame-layout.[c/h]
libmetacity/Makefile.am | 3 +
libmetacity/meta-frame-layout.c | 242 +++++++++++++++++++++++++++++++++++++++
libmetacity/meta-frame-layout.h | 145 +++++++++++++++++++++++
po/POTFILES.in | 1 +
src/ui/theme-private.h | 114 +------------------
src/ui/theme.c | 224 ------------------------------------
6 files changed, 392 insertions(+), 337 deletions(-)
---
diff --git a/libmetacity/Makefile.am b/libmetacity/Makefile.am
index 88679d9..4c1278c 100644
--- a/libmetacity/Makefile.am
+++ b/libmetacity/Makefile.am
@@ -19,6 +19,8 @@ libmetacity_la_SOURCES = \
meta-frame-borders.c \
meta-frame-borders.h \
meta-frame-flags.h \
+ meta-frame-layout.c \
+ meta-frame-layout.h \
meta-frame-type.h \
meta-gradient.c \
meta-gradient.h \
@@ -69,6 +71,7 @@ libmetacity_include_HEADERS = \
meta-draw-spec.h \
meta-frame-borders.h \
meta-frame-flags.h \
+ meta-frame-layout.h \
meta-frame-type.h \
meta-gradient.h \
meta-gradient-spec.h \
diff --git a/libmetacity/meta-frame-layout.c b/libmetacity/meta-frame-layout.c
new file mode 100644
index 0000000..27d7515
--- /dev/null
+++ b/libmetacity/meta-frame-layout.c
@@ -0,0 +1,242 @@
+/*
+ * Copyright (C) 2001 Havoc Pennington
+ * Copyright (C) 2016 Alberts Muktupāvels
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <glib/gi18n-lib.h>
+
+#include "meta-frame-layout.h"
+#include "meta-theme.h"
+
+/**
+ * Sets all the fields of a border to dummy values.
+ *
+ * \param border The border whose fields should be reset.
+ */
+static void
+init_border (GtkBorder *border)
+{
+ border->top = -1;
+ border->bottom = -1;
+ border->left = -1;
+ border->right = -1;
+}
+
+static gboolean
+validate_border (const GtkBorder *border,
+ const char **bad)
+{
+ *bad = NULL;
+
+ 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;
+}
+
+
+/**
+ * Ensures that the theme supplied a particular dimension. When a
+ * MetaFrameLayout is created, all its integer fields are set to -1
+ * by meta_frame_layout_new(). After an instance of this type
+ * should have been initialised, this function checks that
+ * a given field is not still at -1. It is never called directly, but
+ * rather via the CHECK_GEOMETRY_VALUE and CHECK_GEOMETRY_BORDER
+ * macros.
+ *
+ * \param val The value to check
+ * \param name The name to use in the error message
+ * \param[out] error Set to an error if val was not initialised
+ */
+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;
+ }
+
+ 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;
+ }
+
+ return TRUE;
+}
+
+/**
+ * Creates a new, empty MetaFrameLayout. The fields will be set to dummy
+ * values.
+ *
+ * \return The newly created MetaFrameLayout.
+ */
+MetaFrameLayout*
+meta_frame_layout_new (void)
+{
+ MetaFrameLayout *layout;
+
+ layout = g_new0 (MetaFrameLayout, 1);
+
+ layout->refcount = 1;
+
+ /* Fill with -1 values to detect invalid themes */
+ layout->left_width = -1;
+ layout->right_width = -1;
+ layout->top_height = 0; /* only used by GTK+ theme */
+ layout->bottom_height = -1;
+
+ layout->invisible_border.left = 10;
+ layout->invisible_border.right = 10;
+ layout->invisible_border.bottom = 10;
+ layout->invisible_border.top = 10;
+
+ init_border (&layout->title_border);
+
+ layout->title_vertical_pad = -1;
+
+ layout->right_titlebar_edge = -1;
+ layout->left_titlebar_edge = -1;
+
+ layout->button_sizing = META_BUTTON_SIZING_LAST;
+ layout->button_aspect = 1.0;
+ layout->button_width = -1;
+ layout->button_height = -1;
+
+ /* Spacing as hardcoded in GTK+:
+ * https://git.gnome.org/browse/gtk+/tree/gtk/gtkheaderbar.c?h=gtk-3-14#n53
+ */
+ layout->titlebar_spacing = 6;
+ layout->has_title = TRUE;
+ layout->title_scale = 1.0;
+ layout->icon_size = 16; /* was META_MINI_ICON_WIDTH from common.h */
+
+ init_border (&layout->button_border);
+
+ return layout;
+}
+
+MetaFrameLayout *
+meta_frame_layout_copy (const MetaFrameLayout *src)
+{
+ MetaFrameLayout *layout;
+
+ layout = g_new0 (MetaFrameLayout, 1);
+
+ *layout = *src;
+
+ layout->refcount = 1;
+
+ return layout;
+}
+
+void
+meta_frame_layout_ref (MetaFrameLayout *layout)
+{
+ g_return_if_fail (layout != NULL);
+
+ 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)
+ g_free (layout);
+}
+
+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);
+
+ 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:
+ default:
+ g_set_error (error, META_THEME_ERROR, META_THEME_ERROR_FRAME_GEOMETRY,
+ _("Frame geometry does not specify size of buttons"));
+
+ return FALSE;
+ }
+
+ CHECK_GEOMETRY_BORDER (button_border);
+
+ return TRUE;
+}
diff --git a/libmetacity/meta-frame-layout.h b/libmetacity/meta-frame-layout.h
new file mode 100644
index 0000000..015eed7
--- /dev/null
+++ b/libmetacity/meta-frame-layout.h
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2001 Havoc Pennington
+ * Copyright (C) 2016 Alberts Muktupāvels
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef META_FRAME_LAYOUT_H
+#define META_FRAME_LAYOUT_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+typedef struct _MetaFrameLayout MetaFrameLayout;
+
+/**
+ * Whether a button's size is calculated from the area around it (aspect
+ * sizing) or is given as a fixed height and width in pixels (fixed sizing).
+ *
+ * \bug This could be done away with; see the comment at the top of
+ * MetaFrameLayout.
+ */
+typedef enum
+{
+ META_BUTTON_SIZING_ASPECT,
+ META_BUTTON_SIZING_FIXED,
+ META_BUTTON_SIZING_LAST
+} MetaButtonSizing;
+
+/**
+ * Various parameters used to calculate the geometry of a frame.
+ * They are used inside a MetaFrameStyle.
+ * This corresponds closely to the <frame_geometry> tag in a theme file.
+ *
+ * \bug button_sizing isn't really necessary, because we could easily say
+ * that if button_aspect is zero, the height and width are fixed values.
+ * This would also mean that MetaButtonSizing didn't need to exist, and
+ * save code.
+ **/
+struct _MetaFrameLayout
+{
+ /** Reference count. */
+ int refcount;
+
+ /** Size of left side */
+ int left_width;
+ /** Size of right side */
+ int right_width;
+ /** Size of top side */
+ int top_height;
+ /** Size of bottom side */
+ int bottom_height;
+
+ /** Invisible border */
+ GtkBorder invisible_border;
+
+ /** Border of blue title region
+ * \bug (blue?!)
+ **/
+ GtkBorder title_border;
+
+ /** Extra height for inside of title region, above the font height */
+ int title_vertical_pad;
+
+ /** Right indent of buttons from edges of frame */
+ int right_titlebar_edge;
+ /** Left indent of buttons from edges of frame */
+ int left_titlebar_edge;
+
+ /**
+ * Sizing rule of buttons, either META_BUTTON_SIZING_ASPECT
+ * (in which case button_aspect will be honoured, and
+ * button_width and button_height set from it), or
+ * META_BUTTON_SIZING_FIXED (in which case we read the width
+ * and height directly).
+ */
+ MetaButtonSizing button_sizing;
+
+ /**
+ * Ratio of height/width. Honoured only if
+ * button_sizing==META_BUTTON_SIZING_ASPECT.
+ * Otherwise we figure out the height from the button_border.
+ */
+ double button_aspect;
+
+ /** Width of a button; set even when we are using aspect sizing */
+ int button_width;
+
+ /** Height of a button; set even when we are using aspect sizing */
+ int button_height;
+
+ /** Space around buttons */
+ GtkBorder button_border;
+
+ /** Size of images in buttons */
+ guint icon_size;
+
+ /** Space between titlebar elements */
+ guint titlebar_spacing;
+
+ /** scale factor for title text */
+ double title_scale;
+
+ /** Whether title text will be displayed */
+ guint has_title : 1;
+
+ /** Whether we should hide the buttons */
+ guint hide_buttons : 1;
+
+ /** Radius of the top left-hand corner; 0 if not rounded */
+ guint top_left_corner_rounded_radius;
+ /** Radius of the top right-hand corner; 0 if not rounded */
+ guint top_right_corner_rounded_radius;
+ /** Radius of the bottom left-hand corner; 0 if not rounded */
+ guint bottom_left_corner_rounded_radius;
+ /** Radius of the bottom right-hand corner; 0 if not rounded */
+ guint bottom_right_corner_rounded_radius;
+};
+
+MetaFrameLayout *meta_frame_layout_new (void);
+
+MetaFrameLayout *meta_frame_layout_copy (const MetaFrameLayout *src);
+
+void meta_frame_layout_ref (MetaFrameLayout *layout);
+
+void meta_frame_layout_unref (MetaFrameLayout *layout);
+
+gboolean meta_frame_layout_validate (const MetaFrameLayout *layout,
+ GError **error);
+
+G_END_DECLS
+
+#endif
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 9b6e1c3..c549c11 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -3,6 +3,7 @@
libmetacity/meta-color-spec.c
libmetacity/meta-draw-op.c
libmetacity/meta-draw-spec.c
+libmetacity/meta-frame-layout.c
libmetacity/meta-gradient-spec.c
libmetacity/meta-theme-metacity.c
src/50-metacity-navigation.xml.in
diff --git a/src/ui/theme-private.h b/src/ui/theme-private.h
index 3667d9c..3493b48 100644
--- a/src/ui/theme-private.h
+++ b/src/ui/theme-private.h
@@ -20,13 +20,13 @@
#include <libmetacity/meta-color-spec.h>
#include <libmetacity/meta-draw-op.h>
+#include <libmetacity/meta-frame-layout.h>
#include <libmetacity/meta-theme-impl.h>
#include "theme.h"
G_BEGIN_DECLS
-typedef struct _MetaFrameLayout MetaFrameLayout;
typedef struct _MetaFrameStyle MetaFrameStyle;
typedef struct _MetaFrameStyleSet MetaFrameStyleSet;
@@ -120,110 +120,6 @@ typedef enum
} MetaFrameFocus;
/**
- * Whether a button's size is calculated from the area around it (aspect
- * sizing) or is given as a fixed height and width in pixels (fixed sizing).
- *
- * \bug This could be done away with; see the comment at the top of
- * MetaFrameLayout.
- */
-typedef enum
-{
- META_BUTTON_SIZING_ASPECT,
- META_BUTTON_SIZING_FIXED,
- META_BUTTON_SIZING_LAST
-} MetaButtonSizing;
-
-/**
- * Various parameters used to calculate the geometry of a frame.
- * They are used inside a MetaFrameStyle.
- * This corresponds closely to the <frame_geometry> tag in a theme file.
- *
- * \bug button_sizing isn't really necessary, because we could easily say
- * that if button_aspect is zero, the height and width are fixed values.
- * This would also mean that MetaButtonSizing didn't need to exist, and
- * save code.
- **/
-struct _MetaFrameLayout
-{
- /** Reference count. */
- int refcount;
-
- /** Size of left side */
- int left_width;
- /** Size of right side */
- int right_width;
- /** Size of top side */
- int top_height;
- /** Size of bottom side */
- int bottom_height;
-
- /** Invisible border */
- GtkBorder invisible_border;
-
- /** Border of blue title region
- * \bug (blue?!)
- **/
- GtkBorder title_border;
-
- /** Extra height for inside of title region, above the font height */
- int title_vertical_pad;
-
- /** Right indent of buttons from edges of frame */
- int right_titlebar_edge;
- /** Left indent of buttons from edges of frame */
- int left_titlebar_edge;
-
- /**
- * Sizing rule of buttons, either META_BUTTON_SIZING_ASPECT
- * (in which case button_aspect will be honoured, and
- * button_width and button_height set from it), or
- * META_BUTTON_SIZING_FIXED (in which case we read the width
- * and height directly).
- */
- MetaButtonSizing button_sizing;
-
- /**
- * Ratio of height/width. Honoured only if
- * button_sizing==META_BUTTON_SIZING_ASPECT.
- * Otherwise we figure out the height from the button_border.
- */
- double button_aspect;
-
- /** Width of a button; set even when we are using aspect sizing */
- int button_width;
-
- /** Height of a button; set even when we are using aspect sizing */
- int button_height;
-
- /** Space around buttons */
- GtkBorder button_border;
-
- /** Size of images in buttons */
- guint icon_size;
-
- /** Space between titlebar elements */
- guint titlebar_spacing;
-
- /** scale factor for title text */
- double title_scale;
-
- /** Whether title text will be displayed */
- guint has_title : 1;
-
- /** Whether we should hide the buttons */
- guint hide_buttons : 1;
-
- /** Radius of the top left-hand corner; 0 if not rounded */
- guint top_left_corner_rounded_radius;
- /** Radius of the top right-hand corner; 0 if not rounded */
- guint top_right_corner_rounded_radius;
- /** Radius of the bottom left-hand corner; 0 if not rounded */
- guint bottom_left_corner_rounded_radius;
- /** Radius of the bottom right-hand corner; 0 if not rounded */
- guint bottom_right_corner_rounded_radius;
-};
-
-/**
* How to draw a frame in a particular state (say, a focussed, non-maximised,
* resizable frame). This corresponds closely to the <frame_style> tag
* in a theme file.
@@ -331,14 +227,6 @@ struct _MetaTheme
MetaThemeImpl *impl;
};
-MetaFrameLayout *meta_frame_layout_new (void);
-MetaFrameLayout *meta_frame_layout_copy (const MetaFrameLayout *src);
-void meta_frame_layout_ref (MetaFrameLayout *layout);
-void meta_frame_layout_unref (MetaFrameLayout *layout);
-
-gboolean meta_frame_layout_validate (const MetaFrameLayout *layout,
- GError **error);
-
MetaFrameStyle *meta_frame_style_new (MetaFrameStyle *parent);
void meta_frame_style_ref (MetaFrameStyle *style);
void meta_frame_style_unref (MetaFrameStyle *style);
diff --git a/src/ui/theme.c b/src/ui/theme.c
index f2ab4b4..77c12c5 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -51,7 +51,6 @@
*/
#include <config.h>
-#include "common.h" /* for META_MINI_ICON_WIDTH */
#include "theme-private.h"
#include "util.h"
#include <gtk/gtk.h>
@@ -71,229 +70,6 @@
*/
static MetaTheme *meta_current_theme = NULL;
-/**
- * Sets all the fields of a border to dummy values.
- *
- * \param border The border whose fields should be reset.
- */
-static void
-init_border (GtkBorder *border)
-{
- border->top = -1;
- border->bottom = -1;
- border->left = -1;
- border->right = -1;
-}
-
-/**
- * Creates a new, empty MetaFrameLayout. The fields will be set to dummy
- * values.
- *
- * \return The newly created MetaFrameLayout.
- */
-MetaFrameLayout*
-meta_frame_layout_new (void)
-{
- MetaFrameLayout *layout;
-
- layout = g_new0 (MetaFrameLayout, 1);
-
- layout->refcount = 1;
-
- /* Fill with -1 values to detect invalid themes */
- layout->left_width = -1;
- layout->right_width = -1;
- layout->top_height = 0; /* only used by GTK+ theme */
- layout->bottom_height = -1;
-
- layout->invisible_border.left = 10;
- layout->invisible_border.right = 10;
- layout->invisible_border.bottom = 10;
- layout->invisible_border.top = 10;
-
- init_border (&layout->title_border);
-
- layout->title_vertical_pad = -1;
-
- layout->right_titlebar_edge = -1;
- layout->left_titlebar_edge = -1;
-
- layout->button_sizing = META_BUTTON_SIZING_LAST;
- layout->button_aspect = 1.0;
- layout->button_width = -1;
- layout->button_height = -1;
-
- /* Spacing as hardcoded in GTK+:
- * https://git.gnome.org/browse/gtk+/tree/gtk/gtkheaderbar.c?h=gtk-3-14#n53
- */
- layout->titlebar_spacing = 6;
- layout->has_title = TRUE;
- layout->title_scale = 1.0;
- layout->icon_size = META_MINI_ICON_WIDTH;
-
- init_border (&layout->button_border);
-
- return layout;
-}
-
-/**
- *
- */
-static gboolean
-validate_border (const GtkBorder *border,
- const char **bad)
-{
- *bad = NULL;
-
- 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;
-}
-
-/**
- * Ensures that the theme supplied a particular dimension. When a
- * MetaFrameLayout is created, all its integer fields are set to -1
- * by meta_frame_layout_new(). After an instance of this type
- * should have been initialised, this function checks that
- * a given field is not still at -1. It is never called directly, but
- * rather via the CHECK_GEOMETRY_VALUE and CHECK_GEOMETRY_BORDER
- * macros.
- *
- * \param val The value to check
- * \param name The name to use in the error message
- * \param[out] error Set to an error if val was not initialised
- */
-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);
-
- 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:
- default:
- g_set_error (error, META_THEME_ERROR,
- META_THEME_ERROR_FRAME_GEOMETRY,
- _("Frame geometry does not specify size of buttons"));
- return FALSE;
- }
-
- 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;
-
- return layout;
-}
-
-void
-meta_frame_layout_ref (MetaFrameLayout *layout)
-{
- g_return_if_fail (layout != NULL);
-
- 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);
- }
-}
-
static void
meta_frame_layout_get_borders (MetaTheme *theme,
const MetaFrameLayout *layout,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]