From 011e2ddb2e7663b015f6c30730753188cc6f11ee Mon Sep 17 00:00:00 2001 From: jacob berkman Date: Thu, 7 Jun 2001 15:50:51 +0000 Subject: we can ignore the border, as e-text takes care of that for us 2001-06-07 jacob berkman * gal/e-text/e-entry.c (canvas_size_allocate): we can ignore the border, as e-text takes care of that for us (canvas_size_request): correctly handle when borders should be drawn * gal/e-text/e-completion-view.c (e_completion_view_paint): fix a small bug in the drawing-2-pixel-border change to my patch svn path=/trunk/; revision=10149 --- widgets/text/e-completion-view.c | 4 ++-- widgets/text/e-entry.c | 35 +++++++++++++---------------------- 2 files changed, 15 insertions(+), 24 deletions(-) (limited to 'widgets/text') diff --git a/widgets/text/e-completion-view.c b/widgets/text/e-completion-view.c index aac38ccec9..e62209efe6 100644 --- a/widgets/text/e-completion-view.c +++ b/widgets/text/e-completion-view.c @@ -84,8 +84,8 @@ e_completion_view_paint (GtkWidget *widget, GdkRectangle *area) gdk_draw_rectangle (widget->window, widget->style->black_gc, FALSE, i, i, - widget->allocation.width-1-i, - widget->allocation.height-1-i); + widget->allocation.width-1-2*i, + widget->allocation.height-1-2*i); } diff --git a/widgets/text/e-entry.c b/widgets/text/e-entry.c index 7d87b76587..648f8603ba 100644 --- a/widgets/text/e-entry.c +++ b/widgets/text/e-entry.c @@ -58,7 +58,6 @@ #endif #define MIN_ENTRY_WIDTH 150 -#define INNER_BORDER 2 #define PARENT_TYPE gtk_table_get_type () @@ -143,8 +142,6 @@ static void canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, EEntry *entry) { - gint xthick; - gint ythick; gnome_canvas_set_scroll_region (entry->canvas, 0, 0, alloc->width, alloc->height); gtk_object_set (GTK_OBJECT (entry->item), @@ -152,26 +149,18 @@ canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, "clip_height", (double) (alloc->height), NULL); - if (!entry->priv->draw_borders) { - xthick = 0; - ythick = 0; - } else { - xthick = widget->style->klass->xthickness; - ythick = widget->style->klass->ythickness; - } - switch (entry->priv->justification) { case GTK_JUSTIFY_RIGHT: e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(entry->item), - alloc->width - xthick, ythick); + alloc->width, 0); break; case GTK_JUSTIFY_CENTER: e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(entry->item), - alloc->width / 2, ythick); + alloc->width / 2, 0); break; default: e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(entry->item), - xthick, ythick); + 0, 0); break; } } @@ -180,21 +169,23 @@ static void canvas_size_request (GtkWidget *widget, GtkRequisition *requisition, EEntry *entry) { - int border; + int xthick, ythick; g_return_if_fail (widget != NULL); g_return_if_fail (GNOME_IS_CANVAS (widget)); g_return_if_fail (requisition != NULL); - if (entry->priv->draw_borders) - border = INNER_BORDER; - else - border = 0; + if (entry->priv->draw_borders) { + xthick = 2 * widget->style->klass->xthickness; + ythick = 2 * widget->style->klass->ythickness; + } else { + xthick = ythick = 0; + } - requisition->width = MIN_ENTRY_WIDTH + (widget->style->klass->xthickness + border) * 2; - requisition->height = (widget->style->font->ascent + + requisition->width = 2 + MIN_ENTRY_WIDTH + xthick; + requisition->height = (2 + widget->style->font->ascent + widget->style->font->descent + - (widget->style->klass->ythickness + border) * 2); + ythick); } static gint -- cgit v1.2.3