gint *width,
gint *height);
static void get_frame_size (GtkEntry *entry,
+ gboolean relative_to_window,
gint *x,
gint *y,
gint *width,
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;
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);
_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;
static void
get_frame_size (GtkEntry *entry,
+ gboolean relative_to_window,
gint *x,
gint *y,
gint *width,
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)
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);
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;