From 9eb97b045c766f2e9f49771ef8ab501bae104e17 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Mon, 5 Aug 2002 21:22:22 +0000 Subject: [PATCH] Patch from Soeren Sandmann to improve GtkLabel behavior when it gets a too Mon Aug 5 17:20:45 2002 Owen Taylor * gtk/gtklabel.c: Patch from Soeren Sandmann to improve GtkLabel behavior when it gets a too small allocation. (Always display the initial portion.) (#71742) --- ChangeLog | 7 +++++++ ChangeLog.pre-2-10 | 7 +++++++ ChangeLog.pre-2-2 | 7 +++++++ ChangeLog.pre-2-4 | 7 +++++++ ChangeLog.pre-2-6 | 7 +++++++ ChangeLog.pre-2-8 | 7 +++++++ gtk/gtklabel.c | 22 ++++++++++++++-------- 7 files changed, 56 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 720e6ba9f2..b361f4211b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Mon Aug 5 17:20:45 2002 Owen Taylor + + * gtk/gtklabel.c: Patch from Soeren Sandmann + to improve GtkLabel behavior when it gets + a too small allocation. (Always display the + initial portion.) (#71742) + Mon Aug 5 17:01:30 2002 Owen Taylor * gdk/Makefile.am (LDFLAGS): When overriding LDFLAGS, diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 720e6ba9f2..b361f4211b 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +Mon Aug 5 17:20:45 2002 Owen Taylor + + * gtk/gtklabel.c: Patch from Soeren Sandmann + to improve GtkLabel behavior when it gets + a too small allocation. (Always display the + initial portion.) (#71742) + Mon Aug 5 17:01:30 2002 Owen Taylor * gdk/Makefile.am (LDFLAGS): When overriding LDFLAGS, diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 720e6ba9f2..b361f4211b 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,10 @@ +Mon Aug 5 17:20:45 2002 Owen Taylor + + * gtk/gtklabel.c: Patch from Soeren Sandmann + to improve GtkLabel behavior when it gets + a too small allocation. (Always display the + initial portion.) (#71742) + Mon Aug 5 17:01:30 2002 Owen Taylor * gdk/Makefile.am (LDFLAGS): When overriding LDFLAGS, diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 720e6ba9f2..b361f4211b 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,10 @@ +Mon Aug 5 17:20:45 2002 Owen Taylor + + * gtk/gtklabel.c: Patch from Soeren Sandmann + to improve GtkLabel behavior when it gets + a too small allocation. (Always display the + initial portion.) (#71742) + Mon Aug 5 17:01:30 2002 Owen Taylor * gdk/Makefile.am (LDFLAGS): When overriding LDFLAGS, diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 720e6ba9f2..b361f4211b 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +Mon Aug 5 17:20:45 2002 Owen Taylor + + * gtk/gtklabel.c: Patch from Soeren Sandmann + to improve GtkLabel behavior when it gets + a too small allocation. (Always display the + initial portion.) (#71742) + Mon Aug 5 17:01:30 2002 Owen Taylor * gdk/Makefile.am (LDFLAGS): When overriding LDFLAGS, diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 720e6ba9f2..b361f4211b 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +Mon Aug 5 17:20:45 2002 Owen Taylor + + * gtk/gtklabel.c: Patch from Soeren Sandmann + to improve GtkLabel behavior when it gets + a too small allocation. (Always display the + initial portion.) (#71742) + Mon Aug 5 17:01:30 2002 Owen Taylor * gdk/Makefile.am (LDFLAGS): When overriding LDFLAGS, diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 8b9ca6aceb..16912a52ff 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -1648,15 +1648,21 @@ get_layout_location (GtkLabel *label, xalign = misc->xalign; else xalign = 1.0 - misc->xalign; - - x = floor (widget->allocation.x + (gint)misc->xpad - + ((widget->allocation.width - widget->requisition.width) * xalign) - + 0.5); - + + x = floor (widget->allocation.x + (gint)misc->xpad + + xalign * (widget->allocation.width - widget->requisition.width) + + 0.5); + + if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) + x = MAX (x, widget->allocation.x + misc->xpad); + else + x = MIN (x, + widget->allocation.x + widget->allocation.width - + widget->requisition.width - misc->xpad); + y = floor (widget->allocation.y + (gint)misc->ypad - + ((widget->allocation.height - widget->requisition.height) * misc->yalign) - + 0.5); - + + MAX (((widget->allocation.height - widget->requisition.height) * misc->yalign) + + 0.5, 0)); if (xp) *xp = x;