[metacity] libmetacity: don't expose MetaButtonLayout



commit defee6ef4b6a5a04cd35601a03bff65acf7e1ede
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Wed Aug 17 17:29:05 2016 +0300

    libmetacity: don't expose MetaButtonLayout

 libmetacity/Makefile.am                            |    3 +--
 ...utton-layout.h => meta-button-layout-private.h} |   10 +++++-----
 libmetacity/meta-button-layout.c                   |    2 +-
 libmetacity/meta-theme-gtk.c                       |    2 +-
 libmetacity/meta-theme-impl-private.h              |    3 ++-
 libmetacity/meta-theme-metacity.c                  |   19 +++++++++++--------
 libmetacity/meta-theme.c                           |    3 ++-
 libmetacity/meta-theme.h                           |    2 --
 8 files changed, 23 insertions(+), 21 deletions(-)
---
diff --git a/libmetacity/Makefile.am b/libmetacity/Makefile.am
index ed252d5..426cb8c 100644
--- a/libmetacity/Makefile.am
+++ b/libmetacity/Makefile.am
@@ -5,7 +5,7 @@ lib_LTLIBRARIES = libmetacity.la
 libmetacity_la_SOURCES = \
        meta-button-enums.h \
        meta-button-layout.c \
-       meta-button-layout.h \
+       meta-button-layout-private.h \
        meta-button-private.h \
        meta-color.c \
        meta-color.h \
@@ -70,7 +70,6 @@ libmetacity_la_LIBADD = \
 libmetacity_includedir = $(includedir)/metacity/libmetacity
 libmetacity_include_HEADERS = \
        meta-button-enums.h \
-       meta-button-layout.h \
        meta-color.h \
        meta-enum-types.h \
        meta-frame-borders.h \
diff --git a/libmetacity/meta-button-layout.h b/libmetacity/meta-button-layout-private.h
similarity index 82%
rename from libmetacity/meta-button-layout.h
rename to libmetacity/meta-button-layout-private.h
index d6b0695..31341a5 100644
--- a/libmetacity/meta-button-layout.h
+++ b/libmetacity/meta-button-layout-private.h
@@ -16,10 +16,10 @@
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef META_BUTTON_LAYOUT_H
-#define META_BUTTON_LAYOUT_H
+#ifndef META_BUTTON_LAYOUT_PRIVATE_H
+#define META_BUTTON_LAYOUT_PRIVATE_H
 
-#include <libmetacity/meta-button-enums.h>
+#include "meta-button-enums.h"
 
 G_BEGIN_DECLS
 
@@ -27,11 +27,11 @@ typedef struct
 {
   /* buttons in the group on the left side */
   MetaButtonType left_buttons[META_BUTTON_TYPE_LAST];
-  gboolean left_buttons_has_spacer[META_BUTTON_TYPE_LAST];
+  gboolean       left_buttons_has_spacer[META_BUTTON_TYPE_LAST];
 
   /* buttons in the group on the right side */
   MetaButtonType right_buttons[META_BUTTON_TYPE_LAST];
-  gboolean right_buttons_has_spacer[META_BUTTON_TYPE_LAST];
+  gboolean       right_buttons_has_spacer[META_BUTTON_TYPE_LAST];
 } MetaButtonLayout;
 
 MetaButtonLayout meta_button_layout_new (const gchar *str,
diff --git a/libmetacity/meta-button-layout.c b/libmetacity/meta-button-layout.c
index 80be75f..239d949 100644
--- a/libmetacity/meta-button-layout.c
+++ b/libmetacity/meta-button-layout.c
@@ -18,7 +18,7 @@
 
 #include "config.h"
 
-#include "meta-button-layout.h"
+#include "meta-button-layout-private.h"
 
 static MetaButtonType
 meta_button_type_from_string (const gchar *str)
diff --git a/libmetacity/meta-theme-gtk.c b/libmetacity/meta-theme-gtk.c
index a61b862..0b374c7 100644
--- a/libmetacity/meta-theme-gtk.c
+++ b/libmetacity/meta-theme-gtk.c
@@ -589,7 +589,6 @@ meta_theme_gtk_calc_geometry (MetaThemeImpl          *impl,
     }
 
   /* Save the button layout */
-  fgeom->button_layout = *button_layout;
   fgeom->n_left_buttons = n_left;
   fgeom->n_right_buttons = n_right;
 
@@ -741,6 +740,7 @@ meta_theme_gtk_draw_frame (MetaThemeImpl           *impl,
                            const MetaFrameGeometry *fgeom,
                            PangoLayout             *title_layout,
                            MetaFrameFlags           flags,
+                           const MetaButtonLayout  *button_layout,
                            MetaButtonState          button_states[META_BUTTON_TYPE_LAST],
                            GdkPixbuf               *mini_icon,
                            GdkPixbuf               *icon)
diff --git a/libmetacity/meta-theme-impl-private.h b/libmetacity/meta-theme-impl-private.h
index 77b679e..58d4afc 100644
--- a/libmetacity/meta-theme-impl-private.h
+++ b/libmetacity/meta-theme-impl-private.h
@@ -18,7 +18,7 @@
 #ifndef META_THEME_IMPL_PRIVATE_H
 #define META_THEME_IMPL_PRIVATE_H
 
-#include "meta-button-layout.h"
+#include "meta-button-layout-private.h"
 #include "meta-frame-borders.h"
 #include "meta-frame-enums.h"
 #include "meta-frame-style-private.h"
@@ -67,6 +67,7 @@ struct _MetaThemeImplClass
                                     const MetaFrameGeometry  *fgeom,
                                     PangoLayout              *title_layout,
                                     MetaFrameFlags            flags,
+                                    const MetaButtonLayout   *button_layout,
                                     MetaButtonState           button_states[META_BUTTON_TYPE_LAST],
                                     GdkPixbuf                *mini_icon,
                                     GdkPixbuf                *icon);
diff --git a/libmetacity/meta-theme-metacity.c b/libmetacity/meta-theme-metacity.c
index df65b7e..554e541 100644
--- a/libmetacity/meta-theme-metacity.c
+++ b/libmetacity/meta-theme-metacity.c
@@ -5090,7 +5090,6 @@ meta_theme_metacity_calc_geometry (MetaThemeImpl          *impl,
     }
 
   /* Save the button layout */
-  fgeom->button_layout = *button_layout;
   fgeom->n_left_buttons = n_left;
   fgeom->n_right_buttons = n_right;
 
@@ -5382,6 +5381,7 @@ static MetaButtonState
 map_button_state (MetaButtonFunction       button_function,
                   const MetaFrameGeometry *fgeom,
                   gint                     middle_bg_offset,
+                  const MetaButtonLayout  *button_layout,
                   MetaButtonState          button_states[META_BUTTON_TYPE_LAST])
 {
   MetaButtonType type = META_BUTTON_TYPE_LAST;
@@ -5427,28 +5427,28 @@ map_button_state (MetaButtonFunction       button_function,
     case META_BUTTON_FUNCTION_RIGHT_LEFT_BACKGROUND:
     case META_BUTTON_FUNCTION_RIGHT_SINGLE_BACKGROUND:
       if (fgeom->n_right_buttons > 0)
-        type = fgeom->button_layout.right_buttons[0];
+        type = button_layout->right_buttons[0];
       break;
     case META_BUTTON_FUNCTION_RIGHT_RIGHT_BACKGROUND:
       if (fgeom->n_right_buttons > 0)
-        type = fgeom->button_layout.right_buttons[fgeom->n_right_buttons - 1];
+        type = button_layout->right_buttons[fgeom->n_right_buttons - 1];
       break;
     case META_BUTTON_FUNCTION_RIGHT_MIDDLE_BACKGROUND:
       if (middle_bg_offset + 1 < fgeom->n_right_buttons)
-        type = fgeom->button_layout.right_buttons[middle_bg_offset + 1];
+        type = button_layout->right_buttons[middle_bg_offset + 1];
       break;
     case META_BUTTON_FUNCTION_LEFT_LEFT_BACKGROUND:
     case META_BUTTON_FUNCTION_LEFT_SINGLE_BACKGROUND:
       if (fgeom->n_left_buttons > 0)
-        type = fgeom->button_layout.left_buttons[0];
+        type = button_layout->left_buttons[0];
       break;
     case META_BUTTON_FUNCTION_LEFT_RIGHT_BACKGROUND:
       if (fgeom->n_left_buttons > 0)
-        type = fgeom->button_layout.left_buttons[fgeom->n_left_buttons - 1];
+        type = button_layout->left_buttons[fgeom->n_left_buttons - 1];
       break;
     case META_BUTTON_FUNCTION_LEFT_MIDDLE_BACKGROUND:
       if (middle_bg_offset + 1 < fgeom->n_left_buttons)
-        type = fgeom->button_layout.left_buttons[middle_bg_offset + 1];
+        type = button_layout->left_buttons[middle_bg_offset + 1];
       break;
     case META_BUTTON_FUNCTION_LAST:
       break;
@@ -5470,6 +5470,7 @@ meta_theme_metacity_draw_frame (MetaThemeImpl           *impl,
                                 const MetaFrameGeometry *fgeom,
                                 PangoLayout             *title_layout,
                                 MetaFrameFlags           flags,
+                                const MetaButtonLayout  *button_layout,
                                 MetaButtonState          button_states[META_BUTTON_TYPE_LAST],
                                 GdkPixbuf               *mini_icon,
                                 GdkPixbuf               *icon)
@@ -5703,7 +5704,9 @@ meta_theme_metacity_draw_frame (MetaThemeImpl           *impl,
               rect.width = tmp_rect.width / scale;
               rect.height = tmp_rect.height / scale;
 
-              button_state = map_button_state (j, fgeom, middle_bg_offset, button_states);
+              button_state = map_button_state (j, fgeom, middle_bg_offset,
+                                               button_layout, button_states);
+
               op_list = meta_frame_style_get_button (style, j, button_state);
 
               if (op_list)
diff --git a/libmetacity/meta-theme.c b/libmetacity/meta-theme.c
index cd0f85e..4699661 100644
--- a/libmetacity/meta-theme.c
+++ b/libmetacity/meta-theme.c
@@ -703,7 +703,8 @@ meta_theme_draw_frame (MetaTheme           *theme,
     }
 
   impl_class->draw_frame (theme->impl, style, style_info, cr, &fgeom,
-                          title_layout, flags, button_states, mini_icon, icon);
+                          title_layout, flags, &theme->button_layout,
+                          button_states, mini_icon, icon);
 
   g_object_unref (title_layout);
 }
diff --git a/libmetacity/meta-theme.h b/libmetacity/meta-theme.h
index 565f965..9229051 100644
--- a/libmetacity/meta-theme.h
+++ b/libmetacity/meta-theme.h
@@ -21,7 +21,6 @@
 
 #include <gtk/gtk.h>
 #include <libmetacity/meta-button-enums.h>
-#include <libmetacity/meta-button-layout.h>
 #include <libmetacity/meta-frame-borders.h>
 #include <libmetacity/meta-frame-enums.h>
 
@@ -137,7 +136,6 @@ struct _MetaFrameGeometry
   /* End of button rects (if changed adjust memset hack) */
 
   /* Saved button layout */
-  MetaButtonLayout button_layout;
   int n_left_buttons;
   int n_right_buttons;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]