diff options
author | Benjamin Otte <otte@redhat.com> | 2011-04-16 21:49:01 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2011-04-16 22:31:24 +0200 |
commit | fd9aac8225564c3eb9993f9c4bdb0074d4bab2ef (patch) | |
tree | 009387900d56f419d8c95db037ed84fc30441672 /gtk/gtkentry.c | |
parent | 7ef113ce56a75641175af31267e2075f634267e0 (diff) | |
download | gtk+-fd9aac8225564c3eb9993f9c4bdb0074d4bab2ef.tar.gz |
entry: Add the ability to query frame size in two ways
TRUE: relative to widget->window
FALSE: relative to widget
For now, no caller has beeen changed.
Diffstat (limited to 'gtk/gtkentry.c')
-rw-r--r-- | gtk/gtkentry.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 2732d30e97..a7c73d60f5 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -563,6 +563,7 @@ static void get_text_area_size (GtkEntry *entry, gint *width, gint *height); static void get_frame_size (GtkEntry *entry, + gboolean relative_to_window, gint *x, gint *y, gint *width, @@ -2894,7 +2895,7 @@ gtk_entry_realize (GtkWidget *widget) get_text_area_size (entry, &attributes.x, &attributes.y, &attributes.width, &attributes.height); - get_frame_size (entry, &frame_x, &frame_y, NULL, NULL); + get_frame_size (entry, TRUE, &frame_x, &frame_y, NULL, NULL); attributes.x += frame_x; attributes.y += frame_y; @@ -3115,7 +3116,7 @@ place_windows (GtkEntry *entry) GtkAllocation secondary; EntryIconInfo *icon_info = NULL; - get_frame_size (entry, &frame_x, &frame_y, NULL, NULL); + get_frame_size (entry, TRUE, &frame_x, &frame_y, NULL, NULL); get_text_area_size (entry, &x, &y, &width, &height); get_icon_allocations (entry, &primary, &secondary); @@ -3167,7 +3168,7 @@ gtk_entry_get_text_area_size (GtkEntry *entry, _gtk_entry_get_borders (entry, &xborder, &yborder); if (gtk_widget_get_realized (widget)) - get_frame_size (entry, NULL, NULL, NULL, &frame_height); + get_frame_size (entry, TRUE, NULL, NULL, NULL, &frame_height); else frame_height = requisition.height; @@ -3207,6 +3208,7 @@ get_text_area_size (GtkEntry *entry, static void get_frame_size (GtkEntry *entry, + gboolean relative_to_window, gint *x, gint *y, gint *width, @@ -3221,14 +3223,17 @@ get_frame_size (GtkEntry *entry, gtk_widget_get_allocation (widget, &allocation); if (x) - *x = allocation.x; + *x = relative_to_window ? allocation.x : 0; if (y) { if (priv->is_cell_renderer) - *y = allocation.y; + *y = 0; else - *y = allocation.y + (allocation.height - requisition.height) / 2; + *y = (allocation.height - requisition.height) / 2; + + if (relative_to_window) + *y += allocation.y; } if (width) @@ -3400,7 +3405,7 @@ gtk_entry_draw_frame (GtkWidget *widget, cairo_save (cr); - get_frame_size (GTK_ENTRY (widget), &frame_x, &frame_y, &width, &height); + get_frame_size (GTK_ENTRY (widget), TRUE, &frame_x, &frame_y, &width, &height); gtk_widget_get_allocation (widget, &allocation); cairo_translate (cr, frame_x - allocation.x, frame_y - allocation.y); @@ -8287,7 +8292,7 @@ gtk_entry_get_icon_at_pos (GtkEntry *entry, g_return_val_if_fail (GTK_IS_ENTRY (entry), -1); - get_frame_size (entry, &frame_x, &frame_y, NULL, NULL); + get_frame_size (entry, TRUE, &frame_x, &frame_y, NULL, NULL); x -= frame_x; y -= frame_y; |