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