[metacity] libmetacity: add composited to MetaThemeImpl



commit 430f8f962efe2927df2afde5988f5745b278e95f
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Jun 3 03:00:34 2016 +0300

    libmetacity: add composited to MetaThemeImpl

 libmetacity/meta-theme-gtk.c          |    9 ++---
 libmetacity/meta-theme-impl-private.h |   41 ++++++++++++----------
 libmetacity/meta-theme-impl.c         |   23 ++++++++++++
 libmetacity/meta-theme-metacity.c     |    7 +---
 libmetacity/meta-theme.c              |   61 +++++++++++----------------------
 5 files changed, 72 insertions(+), 69 deletions(-)
---
diff --git a/libmetacity/meta-theme-gtk.c b/libmetacity/meta-theme-gtk.c
index f4ff47e..af951fe 100644
--- a/libmetacity/meta-theme-gtk.c
+++ b/libmetacity/meta-theme-gtk.c
@@ -208,16 +208,17 @@ static void
 meta_theme_gtk_get_frame_borders (MetaThemeImpl    *impl,
                                   MetaFrameLayout  *layout,
                                   MetaStyleInfo    *style_info,
-                                  gboolean          composited,
                                   gint              text_height,
                                   MetaFrameFlags    flags,
                                   MetaFrameType     type,
                                   MetaFrameBorders *borders)
 {
+  gboolean composited;
   gint buttons_height;
   gint content_height;
   gint scale;
 
+  composited = meta_theme_impl_get_composited (impl);
   frame_layout_sync_with_style (layout, style_info, composited, flags);
 
   meta_frame_borders_clear (borders);
@@ -401,7 +402,6 @@ static void
 meta_theme_gtk_calc_geometry (MetaThemeImpl          *impl,
                               MetaFrameLayout        *layout,
                               MetaStyleInfo          *style_info,
-                              gboolean                composited,
                               gint                    text_height,
                               MetaFrameFlags          flags,
                               gint                    client_width,
@@ -430,9 +430,8 @@ meta_theme_gtk_calc_geometry (MetaThemeImpl          *impl,
   gboolean right_buttons_has_spacer[META_BUTTON_FUNCTION_LAST];
 
   META_THEME_IMPL_GET_CLASS (impl)->get_frame_borders (impl, layout,
-                                                       style_info, composited,
-                                                       text_height, flags,
-                                                       type, &borders);
+                                                       style_info, text_height,
+                                                       flags, type, &borders);
 
   fgeom->borders = borders;
 
diff --git a/libmetacity/meta-theme-impl-private.h b/libmetacity/meta-theme-impl-private.h
index 1ec87b4..0ee88f3 100644
--- a/libmetacity/meta-theme-impl-private.h
+++ b/libmetacity/meta-theme-impl-private.h
@@ -43,7 +43,6 @@ struct _MetaThemeImplClass
   void       (* get_frame_borders) (MetaThemeImpl            *impl,
                                     MetaFrameLayout          *layout,
                                     MetaStyleInfo            *style_info,
-                                    gboolean                  composited,
                                     gint                      text_height,
                                     MetaFrameFlags            flags,
                                     MetaFrameType             type,
@@ -52,7 +51,6 @@ struct _MetaThemeImplClass
   void       (* calc_geometry)     (MetaThemeImpl            *impl,
                                     MetaFrameLayout          *layout,
                                     MetaStyleInfo            *style_info,
-                                    gboolean                  composited,
                                     gint                      text_height,
                                     MetaFrameFlags            flags,
                                     gint                      client_width,
@@ -74,32 +72,39 @@ struct _MetaThemeImplClass
 };
 
 G_GNUC_INTERNAL
-void               meta_theme_impl_add_style_set (MetaThemeImpl           *impl,
-                                                  MetaFrameType            type,
-                                                  MetaFrameStyleSet       *style_set);
+void               meta_theme_impl_set_composited (MetaThemeImpl           *impl,
+                                                   gboolean                 composited);
 
 G_GNUC_INTERNAL
-MetaFrameStyleSet *meta_theme_impl_get_style_set (MetaThemeImpl           *impl,
-                                                  MetaFrameType            type);
+gboolean           meta_theme_impl_get_composited (MetaThemeImpl           *impl);
 
 G_GNUC_INTERNAL
-void               get_button_rect               (MetaButtonType           type,
-                                                  const MetaFrameGeometry *fgeom,
-                                                  gint                     middle_background_offset,
-                                                  GdkRectangle            *rect);
+void               meta_theme_impl_add_style_set  (MetaThemeImpl           *impl,
+                                                   MetaFrameType            type,
+                                                   MetaFrameStyleSet       *style_set);
 
 G_GNUC_INTERNAL
-MetaButtonState    map_button_state              (MetaButtonType           button_type,
-                                                  const MetaFrameGeometry *fgeom,
-                                                  gint                     middle_bg_offset,
-                                                  MetaButtonState          
button_states[META_BUTTON_TYPE_LAST]);
+MetaFrameStyleSet *meta_theme_impl_get_style_set  (MetaThemeImpl           *impl,
+                                                   MetaFrameType            type);
 
 G_GNUC_INTERNAL
-void               scale_border                  (GtkBorder               *border,
-                                                  double                   factor);
+void               get_button_rect                (MetaButtonType           type,
+                                                   const MetaFrameGeometry *fgeom,
+                                                   gint                     middle_background_offset,
+                                                   GdkRectangle            *rect);
 
 G_GNUC_INTERNAL
-int                get_window_scaling_factor     (void);
+MetaButtonState    map_button_state               (MetaButtonType           button_type,
+                                                   const MetaFrameGeometry *fgeom,
+                                                   gint                     middle_bg_offset,
+                                                   MetaButtonState          
button_states[META_BUTTON_TYPE_LAST]);
+
+G_GNUC_INTERNAL
+void               scale_border                   (GtkBorder               *border,
+                                                   double                   factor);
+
+G_GNUC_INTERNAL
+int                get_window_scaling_factor      (void);
 
 G_END_DECLS
 
diff --git a/libmetacity/meta-theme-impl.c b/libmetacity/meta-theme-impl.c
index 1002adf..64a8f79 100644
--- a/libmetacity/meta-theme-impl.c
+++ b/libmetacity/meta-theme-impl.c
@@ -25,6 +25,8 @@
 
 typedef struct
 {
+  gboolean           composited;
+
   MetaFrameStyleSet *style_sets_by_type[META_FRAME_TYPE_LAST];
 } MetaThemeImplPrivate;
 
@@ -120,6 +122,27 @@ meta_theme_impl_init (MetaThemeImpl *impl)
 }
 
 void
+meta_theme_impl_set_composited (MetaThemeImpl *impl,
+                                gboolean       composited)
+{
+  MetaThemeImplPrivate *priv;
+
+  priv = meta_theme_impl_get_instance_private (impl);
+
+  priv->composited = composited;
+}
+
+gboolean
+meta_theme_impl_get_composited (MetaThemeImpl *impl)
+{
+  MetaThemeImplPrivate *priv;
+
+  priv = meta_theme_impl_get_instance_private (impl);
+
+  return priv->composited;
+}
+
+void
 meta_theme_impl_add_style_set (MetaThemeImpl     *impl,
                                MetaFrameType      type,
                                MetaFrameStyleSet *style_set)
diff --git a/libmetacity/meta-theme-metacity.c b/libmetacity/meta-theme-metacity.c
index 35c3791..533bd37 100644
--- a/libmetacity/meta-theme-metacity.c
+++ b/libmetacity/meta-theme-metacity.c
@@ -4603,7 +4603,6 @@ static void
 meta_theme_metacity_get_frame_borders (MetaThemeImpl    *impl,
                                        MetaFrameLayout  *layout,
                                        MetaStyleInfo    *style_info,
-                                       gboolean          composited,
                                        gint              text_height,
                                        MetaFrameFlags    flags,
                                        MetaFrameType     type,
@@ -4815,7 +4814,6 @@ static void
 meta_theme_metacity_calc_geometry (MetaThemeImpl          *impl,
                                    MetaFrameLayout        *layout,
                                    MetaStyleInfo          *style_info,
-                                   gboolean                composited,
                                    gint                    text_height,
                                    MetaFrameFlags          flags,
                                    gint                    client_width,
@@ -4846,9 +4844,8 @@ meta_theme_metacity_calc_geometry (MetaThemeImpl          *impl,
   gboolean right_buttons_has_spacer[META_BUTTON_FUNCTION_LAST];
 
   META_THEME_IMPL_GET_CLASS (impl)->get_frame_borders (impl, layout,
-                                                       style_info, composited,
-                                                       text_height, flags,
-                                                       type, &borders);
+                                                       style_info, text_height,
+                                                       flags, type, &borders);
 
   fgeom->borders = borders;
 
diff --git a/libmetacity/meta-theme.c b/libmetacity/meta-theme.c
index 61f3c3e..2be6fb4 100644
--- a/libmetacity/meta-theme.c
+++ b/libmetacity/meta-theme.c
@@ -98,6 +98,8 @@ meta_theme_constructed (GObject *object)
     theme->impl = g_object_new (META_TYPE_THEME_METACITY, NULL);
   else
     g_assert_not_reached ();
+
+  meta_theme_impl_set_composited (theme->impl, theme->composited);
 }
 
 static void
@@ -252,6 +254,7 @@ meta_theme_set_composited (MetaTheme *theme,
 
   theme->composited = composited;
 
+  meta_theme_impl_set_composited (theme->impl, composited);
   meta_theme_invalidate (theme);
 }
 
@@ -436,6 +439,7 @@ meta_theme_get_frame_borders (MetaTheme        *theme,
 {
   MetaFrameStyle *style;
   MetaStyleInfo *style_info;
+  MetaThemeImplClass *impl_class;
 
   g_return_if_fail (type < META_FRAME_TYPE_LAST);
 
@@ -448,15 +452,10 @@ meta_theme_get_frame_borders (MetaTheme        *theme,
     return;
 
   style_info = meta_theme_get_style_info (theme, theme_variant);
+  impl_class = META_THEME_IMPL_GET_CLASS (theme->impl);
 
-  META_THEME_IMPL_GET_CLASS (theme->impl)->get_frame_borders (theme->impl,
-                                                              style->layout,
-                                                              style_info,
-                                                              theme->composited,
-                                                              text_height,
-                                                              flags,
-                                                              type,
-                                                              borders);
+  impl_class->get_frame_borders (theme->impl, style->layout, style_info,
+                                 text_height, flags, type, borders);
 }
 
 void
@@ -472,6 +471,7 @@ meta_theme_calc_geometry (MetaTheme              *theme,
 {
   MetaFrameStyle *style;
   MetaStyleInfo *style_info;
+  MetaThemeImplClass *impl_class;
 
   g_return_if_fail (type < META_FRAME_TYPE_LAST);
 
@@ -482,18 +482,11 @@ meta_theme_calc_geometry (MetaTheme              *theme,
     return;
 
   style_info = meta_theme_get_style_info (theme, theme_variant);
+  impl_class = META_THEME_IMPL_GET_CLASS (theme->impl);
 
-  META_THEME_IMPL_GET_CLASS (theme->impl)->calc_geometry (theme->impl,
-                                                          style->layout,
-                                                          style_info,
-                                                          theme->composited,
-                                                          text_height,
-                                                          flags,
-                                                          client_width,
-                                                          client_height,
-                                                          button_layout,
-                                                          type,
-                                                          fgeom);
+  impl_class->calc_geometry (theme->impl, style->layout, style_info,
+                             text_height, flags, client_width, client_height,
+                             button_layout, type, fgeom);
 }
 
 void
@@ -513,6 +506,7 @@ meta_theme_draw_frame (MetaTheme              *theme,
 {
   MetaFrameStyle *style;
   MetaStyleInfo *style_info;
+  MetaThemeImplClass *impl_class;
   MetaFrameGeometry fgeom;
 
   g_return_if_fail (type < META_FRAME_TYPE_LAST);
@@ -524,27 +518,12 @@ meta_theme_draw_frame (MetaTheme              *theme,
     return;
 
   style_info = meta_theme_get_style_info (theme, theme_variant);
+  impl_class = META_THEME_IMPL_GET_CLASS (theme->impl);
+
+  impl_class->calc_geometry (theme->impl, style->layout, style_info,
+                             text_height, flags, client_width, client_height,
+                             button_layout, type, &fgeom);
 
-  META_THEME_IMPL_GET_CLASS (theme->impl)->calc_geometry (theme->impl,
-                                                          style->layout,
-                                                          style_info,
-                                                          theme->composited,
-                                                          text_height,
-                                                          flags,
-                                                          client_width,
-                                                          client_height,
-                                                          button_layout,
-                                                          type,
-                                                          &fgeom);
-
-  META_THEME_IMPL_GET_CLASS (theme->impl)->draw_frame (theme->impl,
-                                                       style,
-                                                       style_info,
-                                                       cr,
-                                                       &fgeom,
-                                                       title_layout,
-                                                       flags,
-                                                       button_states,
-                                                       mini_icon,
-                                                       icon);
+  impl_class->draw_frame (theme->impl, style, style_info, cr, &fgeom,
+                          title_layout, flags, button_states, mini_icon, icon);
 }


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