[vte/vte-next] Draw the background colour



commit cacdbb1f4a497379c19a32b04eaafb7a0e4e7e2f
Author: Christian Persch <chpe gnome org>
Date:   Mon May 16 14:08:32 2011 +0200

    Draw the background colour

 src/vte.c     |    6 ++++--
 src/vtedraw.c |   36 ++++++++++++++++++++++++++++--------
 src/vtedraw.h |    3 ++-
 3 files changed, 34 insertions(+), 11 deletions(-)
---
diff --git a/src/vte.c b/src/vte.c
index 8b5a7a4..f285a37 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -10225,7 +10225,8 @@ vte_terminal_paint_im_preedit_string(VteTerminal *terminal)
 				col * width + terminal->pvt->padding.left,
 				row * height + terminal->pvt->padding.top,
 				width * columns,
-				height);
+				height,
+                                &terminal->pvt->palette[VTE_DEF_BG]);
 		fore = screen->defaults.attr.fore;
 		back = screen->defaults.attr.back;
 		vte_terminal_draw_cells_with_attributes(terminal,
@@ -10335,7 +10336,8 @@ vte_terminal_draw(GtkWidget *widget,
         }
 
         _vte_draw_clear (terminal->pvt->draw, 0, 0,
-                         allocated_width, allocated_height);
+                         allocated_width, allocated_height,
+                         &terminal->pvt->palette[VTE_DEF_BG]);
 
         /* Calculate the bounding rectangle. */
         {
diff --git a/src/vtedraw.c b/src/vtedraw.c
index 91ca1a5..fc009ee 100644
--- a/src/vtedraw.c
+++ b/src/vtedraw.c
@@ -802,19 +802,39 @@ _vte_draw_set_background_scroll (struct _vte_draw *draw,
 }
 
 void
-_vte_draw_clear (struct _vte_draw *draw, gint x, gint y, gint width, gint height)
+_vte_draw_clear (struct _vte_draw *draw,
+                 gint x,
+                 gint y,
+                 gint width,
+                 gint height,
+                 const GdkRGBA *background)
 {
 	_vte_debug_print (VTE_DEBUG_DRAW, "draw_clear (%d, %d, %d, %d)\n",
 			  x,y,width, height);
 
-        if (draw->bg_pattern == NULL)
-                return;
-
         g_assert(draw->cr);
-        cairo_rectangle (draw->cr, x, y, width, height);
-	cairo_set_operator (draw->cr, CAIRO_OPERATOR_SOURCE);
-	cairo_set_source (draw->cr, draw->bg_pattern);
-	cairo_fill (draw->cr);
+
+        cairo_save (draw->cr);
+
+        if (draw->bg_pattern != NULL) {
+                cairo_rectangle (draw->cr, x, y, width, height);
+
+                cairo_set_operator (draw->cr, CAIRO_OPERATOR_SOURCE);
+                cairo_set_source (draw->cr, draw->bg_pattern);
+                cairo_fill (draw->cr);
+        }
+
+        if (background) {
+                cairo_rectangle (draw->cr, x, y, width, height);
+
+                cairo_set_operator (draw->cr,
+                                    draw->bg_pattern ? CAIRO_OPERATOR_OVER
+                                                     : CAIRO_OPERATOR_SOURCE);
+                gdk_cairo_set_source_rgba (draw->cr, background);
+                cairo_fill (draw->cr);
+        }
+
+        cairo_restore (draw->cr);
 }
 
 void
diff --git a/src/vtedraw.h b/src/vtedraw.h
index 8391459..9b7e162 100644
--- a/src/vtedraw.h
+++ b/src/vtedraw.h
@@ -70,7 +70,8 @@ void _vte_draw_set_background_scroll(struct _vte_draw *draw,
 				     gint x, gint y);
 
 void _vte_draw_clear(struct _vte_draw *draw,
-		     gint x, gint y, gint width, gint height);
+		     gint x, gint y, gint width, gint height,
+                     const GdkRGBA *background);
 
 void _vte_draw_set_text_font(struct _vte_draw *draw,
                              GtkWidget *widget,



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