[mutter/wip/cb2eb3: 24/55] Add simple dumb CSS rendering



commit 58f04c72846ce9dab9008b93791e150de242ac91
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Apr 27 02:29:52 2012 -0400

    Add simple dumb CSS rendering

 src/ui/theme.c |   47 ++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 38 insertions(+), 9 deletions(-)
---
diff --git a/src/ui/theme.c b/src/ui/theme.c
index c759063..2f5ee86 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -4107,6 +4107,7 @@ button_rect (MetaButtonType           type,
 static void
 meta_frame_style_draw_with_style (MetaFrameStyle          *style,
                                   GtkStyleContext         *style_gtk,
+                                  MetaFrameFlags           flags,
                                   cairo_t                 *cr,
                                   const MetaFrameGeometry *fgeom,
                                   int                      client_width,
@@ -4117,16 +4118,8 @@ meta_frame_style_draw_with_style (MetaFrameStyle          *style,
                                   GdkPixbuf               *mini_icon,
                                   GdkPixbuf               *icon)
 {
-  int i, j;
+  GtkStateFlags gtk_flags;
   GdkRectangle visible_rect;
-  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;
-  PangoRectangle logical_rect;
-  MetaDrawInfo draw_info;
   const MetaFrameBorders *borders;
 
   borders = &fgeom->borders;
@@ -4136,6 +4129,40 @@ meta_frame_style_draw_with_style (MetaFrameStyle          *style,
   visible_rect.width = fgeom->width - borders->invisible.left - borders->invisible.right;
   visible_rect.height = fgeom->height - borders->invisible.top - borders->invisible.bottom;
 
+  gtk_flags = GTK_STATE_FLAG_NORMAL;
+
+  if ((flags & META_FRAME_HAS_FOCUS) == 0)
+    gtk_flags |= GTK_STATE_FLAG_BACKDROP;
+
+  gtk_style_context_save (style_gtk);
+
+  gtk_style_context_set_state (style_gtk, gtk_flags);
+
+  gtk_render_background (style_gtk, cr,
+                         visible_rect.x,
+                         visible_rect.y,
+                         visible_rect.width,
+                         visible_rect.height);
+
+  gtk_render_frame (style_gtk, cr,
+                    visible_rect.x,
+                    visible_rect.y,
+                    visible_rect.width,
+                    visible_rect.height);
+
+  gtk_style_context_restore (style_gtk);
+
+#if 0
+  int i, j;
+  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;
+  PangoRectangle logical_rect;
+  MetaDrawInfo draw_info;
+
   titlebar_rect.x = visible_rect.x;
   titlebar_rect.y = visible_rect.y;
   titlebar_rect.width = visible_rect.width;
@@ -4342,6 +4369,7 @@ meta_frame_style_draw_with_style (MetaFrameStyle          *style,
 
       ++i;
     }
+#endif
 }
 
 MetaFrameStyleSet*
@@ -5069,6 +5097,7 @@ meta_theme_draw_frame_with_style (MetaTheme              *theme,
 
   meta_frame_style_draw_with_style (style,
                                     style_gtk,
+                                    flags,
                                     cr,
                                     &fgeom,
                                     client_width, client_height,


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