From da1f618b096973704bd0b7db071baa1444ef5c7b Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 19 Apr 2011 21:28:21 +0200 Subject: [PATCH] entry: Translate progress region properly when drawing text --- gtk/gtkentry.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 03a2e76b8d..d644b71bdd 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -5744,7 +5744,6 @@ gtk_entry_draw_text (GtkEntry *entry, GtkStateFlags state = 0; GdkRGBA text_color, bar_text_color; GtkStyleContext *context; - gint pos_x, pos_y; gint width, height; gint progress_x, progress_y, progress_width, progress_height; gint clip_width, clip_height; @@ -5784,6 +5783,8 @@ gtk_entry_draw_text (GtkEntry *entry, } else { + int frame_x, frame_y, area_x, area_y; + width = gdk_window_get_width (priv->text_area); height = gdk_window_get_height (priv->text_area); @@ -5792,9 +5793,12 @@ gtk_entry_draw_text (GtkEntry *entry, cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD); cairo_rectangle (cr, 0, 0, width, height); - gdk_window_get_position (priv->text_area, &pos_x, &pos_y); - progress_x -= pos_x; - progress_y -= pos_y; + /* progres area is frame-relative, we need it text-area window + * relative */ + get_frame_size (entry, TRUE, &frame_x, &frame_y, NULL, NULL); + gdk_window_get_position (priv->text_area, &area_x, &area_y); + progress_x += frame_x - area_x; + progress_y += frame_y - area_y; cairo_rectangle (cr, progress_x, progress_y, progress_width, progress_height);