entry: Simplify drawing code

This commit is contained in:
Benjamin Otte 2016-02-02 15:44:28 +01:00
parent 207a842bfd
commit 3316d69abb

View File

@ -428,7 +428,6 @@ static void gtk_entry_get_preferred_height_and_baseline_for_width (GtkWidget *w
static void gtk_entry_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_entry_draw_progress (GtkWidget *widget,
GtkStyleContext *context,
cairo_t *cr);
static gint gtk_entry_draw (GtkWidget *widget,
cairo_t *cr);
@ -3863,13 +3862,14 @@ get_progress_area (GtkWidget *widget,
static void
gtk_entry_draw_progress (GtkWidget *widget,
GtkStyleContext *context,
cairo_t *cr)
{
GtkEntry *entry = GTK_ENTRY (widget);
GtkStyleContext *context;
GtkAllocation allocation;
gint x, y, width, height;
context = gtk_widget_get_style_context (widget);
get_progress_area (widget, &x, &y, &width, &height);
gtk_widget_get_allocation (widget, &allocation);
x -= allocation.x;
@ -3942,7 +3942,6 @@ gtk_entry_render (GtkCssGadget *gadget,
{
GtkWidget *widget;
GtkEntry *entry;
GtkStyleContext *context;
GtkEntryPrivate *priv;
int i;
@ -3950,12 +3949,8 @@ gtk_entry_render (GtkCssGadget *gadget,
entry = GTK_ENTRY (widget);
priv = entry->priv;
if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
{
context = gtk_widget_get_style_context (widget);
/* Draw progress */
gtk_entry_draw_progress (widget, context, cr);
gtk_entry_draw_progress (widget, cr);
/* Draw text and cursor */
cairo_save (cr);
@ -3983,7 +3978,6 @@ gtk_entry_render (GtkCssGadget *gadget,
}
gtk_entry_draw_undershoot (entry, cr);
}
return FALSE;
}