[gtk+] entry: Use gtk_render_layout()



commit c70907256794a8a76ed75fa754110f6e5cd3d403
Author: Benjamin Otte <otte redhat com>
Date:   Mon Jan 25 00:07:23 2016 +0100

    entry: Use gtk_render_layout()
    
    It's funny that nobody has yet noticed that we don't draw the text using
    the theme.
    
    We had no text-shadow in entries!!!!!

 gtk/gtkentry.c |   14 ++------------
 1 files changed, 2 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 67b14c5..031e88b 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -6467,7 +6467,6 @@ gtk_entry_draw_text (GtkEntry *entry,
 {
   GtkEntryPrivate *priv = entry->priv;
   GtkWidget *widget = GTK_WIDGET (entry);
-  GdkRGBA text_color;
   GtkStyleContext *context;
   PangoLayout *layout;
   gint x, y;
@@ -6482,10 +6481,6 @@ gtk_entry_draw_text (GtkEntry *entry,
   gtk_widget_get_allocation (GTK_WIDGET (entry), &allocation);
   layout = gtk_entry_ensure_layout (entry, TRUE);
 
-  gtk_style_context_get_color (context,
-                               gtk_style_context_get_state (context),
-                               &text_color);
-
   cairo_save (cr);
 
   cairo_rectangle (cr,
@@ -6499,9 +6494,7 @@ gtk_entry_draw_text (GtkEntry *entry,
   if (show_placeholder_text (entry))
     pango_layout_set_width (layout, PANGO_SCALE * gdk_window_get_width (entry->priv->text_area));
 
-  cairo_move_to (cr, x, y);
-  gdk_cairo_set_source_rgba (cr, &text_color);
-  pango_cairo_show_layout (cr, layout);
+  gtk_render_layout (context, cr, x, y, layout);
 
   if (gtk_editable_get_selection_bounds (GTK_EDITABLE (entry), &start_pos, &end_pos))
     {
@@ -6522,10 +6515,7 @@ gtk_entry_draw_text (GtkEntry *entry,
                              0, 0,
                              allocation.width, allocation.height);
 
-      cairo_move_to (cr, x, y);
-      gtk_style_context_get_color (context, gtk_style_context_get_state (context), &text_color);
-      gdk_cairo_set_source_rgba (cr, &text_color);
-      pango_cairo_show_layout (cr, layout);
+      gtk_render_layout (context, cr, x, y, layout);
 
       gtk_style_context_restore (context);
     }


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