From 76fc58683c2dc35e0ff8fef2e97662d7cd352264 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberts=20Muktup=C4=81vels?= Date: Sun, 7 Feb 2016 23:38:39 +0200 Subject: libmetacity: don't expose MetaFrameLayout --- libmetacity/Makefile.am | 3 +- libmetacity/meta-frame-layout-private.h | 171 ++++++++++++++++++++++++++++++++ libmetacity/meta-frame-layout.c | 2 +- libmetacity/meta-frame-layout.h | 166 ------------------------------- libmetacity/meta-frame-style.c | 1 + libmetacity/meta-frame-style.h | 3 +- libmetacity/meta-theme-gtk.c | 1 + libmetacity/meta-theme-metacity.c | 2 +- libmetacity/meta-theme.c | 1 + 9 files changed, 179 insertions(+), 171 deletions(-) create mode 100644 libmetacity/meta-frame-layout-private.h delete mode 100644 libmetacity/meta-frame-layout.h diff --git a/libmetacity/Makefile.am b/libmetacity/Makefile.am index 03c31569..e063d73a 100644 --- a/libmetacity/Makefile.am +++ b/libmetacity/Makefile.am @@ -21,7 +21,7 @@ libmetacity_la_SOURCES = \ meta-frame-borders.h \ meta-frame-enums.h \ meta-frame-layout.c \ - meta-frame-layout.h \ + meta-frame-layout-private.h \ meta-frame-style.c \ meta-frame-style.h \ meta-gradient.c \ @@ -73,7 +73,6 @@ libmetacity_include_HEADERS = \ meta-enum-types.h \ meta-frame-borders.h \ meta-frame-enums.h \ - meta-frame-layout.h \ meta-frame-style.h \ meta-theme.h \ $(NULL) diff --git a/libmetacity/meta-frame-layout-private.h b/libmetacity/meta-frame-layout-private.h new file mode 100644 index 00000000..584ee4bf --- /dev/null +++ b/libmetacity/meta-frame-layout-private.h @@ -0,0 +1,171 @@ +/* + * 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 . + */ + +#ifndef META_FRAME_LAYOUT_PRIVATE_H +#define META_FRAME_LAYOUT_PRIVATE_H + +#include + +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 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 +{ + gint refcount; + + struct { + /** Border/padding of the entire frame */ + GtkBorder frame_border; + + /** Shadow border used in invisible resize area */ + GtkBorder shadow_border; + + /** Border/padding of the titlebar region */ + GtkBorder titlebar_border; + /** Border/padding of titlebar buttons */ + + /** Size of images in buttons */ + guint icon_size; + + /** Space between titlebar elements */ + guint titlebar_spacing; + + /** Margin of title */ + GtkBorder title_margin; + /** Margin of titlebar buttons */ + GtkBorder button_margin; + + /** Min size of titlebar region */ + GtkRequisition titlebar_min_size; + /** Min size of titlebar buttons */ + GtkRequisition button_min_size; + } gtk; + + struct { + /** Size of left side */ + gint left_width; + /** Size of right side */ + gint right_width; + /** Size of bottom side */ + gint bottom_height; + + /** 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 */ + gint button_width; + + /** Height of a button; set even when we are using aspect sizing */ + gint button_height; + } metacity; + + /** Invisible resize area border */ + GtkBorder invisible_resize_border; + + /** Space around buttons */ + GtkBorder button_border; + + /** 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; +}; + +G_GNUC_INTERNAL +MetaFrameLayout *meta_frame_layout_new (void); + +G_GNUC_INTERNAL +MetaFrameLayout *meta_frame_layout_copy (const MetaFrameLayout *src); + +G_GNUC_INTERNAL +void meta_frame_layout_ref (MetaFrameLayout *layout); + +G_GNUC_INTERNAL +void meta_frame_layout_unref (MetaFrameLayout *layout); + +G_GNUC_INTERNAL +gboolean meta_frame_layout_validate (const MetaFrameLayout *layout, + GError **error); + +G_END_DECLS + +#endif diff --git a/libmetacity/meta-frame-layout.c b/libmetacity/meta-frame-layout.c index 5cf6ae02..9634a9e0 100644 --- a/libmetacity/meta-frame-layout.c +++ b/libmetacity/meta-frame-layout.c @@ -20,7 +20,7 @@ #include -#include "meta-frame-layout.h" +#include "meta-frame-layout-private.h" #include "meta-theme.h" /** diff --git a/libmetacity/meta-frame-layout.h b/libmetacity/meta-frame-layout.h deleted file mode 100644 index edcf270a..00000000 --- a/libmetacity/meta-frame-layout.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - * 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 . - */ - -#ifndef META_FRAME_LAYOUT_H -#define META_FRAME_LAYOUT_H - -#include - -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 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 -{ - gint refcount; - - struct { - /** Border/padding of the entire frame */ - GtkBorder frame_border; - - /** Shadow border used in invisible resize area */ - GtkBorder shadow_border; - - /** Border/padding of the titlebar region */ - GtkBorder titlebar_border; - /** Border/padding of titlebar buttons */ - - /** Size of images in buttons */ - guint icon_size; - - /** Space between titlebar elements */ - guint titlebar_spacing; - - /** Margin of title */ - GtkBorder title_margin; - /** Margin of titlebar buttons */ - GtkBorder button_margin; - - /** Min size of titlebar region */ - GtkRequisition titlebar_min_size; - /** Min size of titlebar buttons */ - GtkRequisition button_min_size; - } gtk; - - struct { - /** Size of left side */ - gint left_width; - /** Size of right side */ - gint right_width; - /** Size of bottom side */ - gint bottom_height; - - /** 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 */ - gint button_width; - - /** Height of a button; set even when we are using aspect sizing */ - gint button_height; - } metacity; - - /** Invisible resize area border */ - GtkBorder invisible_resize_border; - - /** Space around buttons */ - GtkBorder button_border; - - /** 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/libmetacity/meta-frame-style.c b/libmetacity/meta-frame-style.c index 449312ef..15bd4f5f 100644 --- a/libmetacity/meta-frame-style.c +++ b/libmetacity/meta-frame-style.c @@ -22,6 +22,7 @@ #include "meta-color-spec-private.h" #include "meta-draw-op-private.h" +#include "meta-frame-layout-private.h" #include "meta-frame-style.h" #include "meta-theme.h" #include "meta-theme-metacity-private.h" diff --git a/libmetacity/meta-frame-style.h b/libmetacity/meta-frame-style.h index c7428c6c..511c25ac 100644 --- a/libmetacity/meta-frame-style.h +++ b/libmetacity/meta-frame-style.h @@ -19,13 +19,14 @@ #ifndef META_FRAME_STYLE_H #define META_FRAME_STYLE_H +#include #include #include -#include G_BEGIN_DECLS typedef struct _MetaColorSpec MetaColorSpec; +typedef struct _MetaFrameLayout MetaFrameLayout; typedef struct _MetaFrameStyle MetaFrameStyle; typedef struct _MetaFrameStyleSet MetaFrameStyleSet; typedef struct _MetaDrawOpList MetaDrawOpList; diff --git a/libmetacity/meta-theme-gtk.c b/libmetacity/meta-theme-gtk.c index 85463358..8269f1ce 100644 --- a/libmetacity/meta-theme-gtk.c +++ b/libmetacity/meta-theme-gtk.c @@ -21,6 +21,7 @@ #include #include +#include "meta-frame-layout-private.h" #include "meta-frame-style.h" #include "meta-theme-gtk-private.h" #include "meta-theme.h" diff --git a/libmetacity/meta-theme-metacity.c b/libmetacity/meta-theme-metacity.c index c8fa0a27..fbeaa6dd 100644 --- a/libmetacity/meta-theme-metacity.c +++ b/libmetacity/meta-theme-metacity.c @@ -24,7 +24,7 @@ #include #include "meta-draw-op-private.h" -#include "meta-frame-layout.h" +#include "meta-frame-layout-private.h" #include "meta-frame-style.h" #include "meta-theme.h" #include "meta-theme-metacity-private.h" diff --git a/libmetacity/meta-theme.c b/libmetacity/meta-theme.c index f3d24710..48a83c9c 100644 --- a/libmetacity/meta-theme.c +++ b/libmetacity/meta-theme.c @@ -21,6 +21,7 @@ #include #include "meta-enum-types.h" +#include "meta-frame-layout-private.h" #include "meta-theme.h" #include "meta-theme-gtk-private.h" #include "meta-theme-impl-private.h" -- cgit v1.2.1