[gtk+] label: Don't use _gtk_mis_get_padding_and_border()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] label: Don't use _gtk_mis_get_padding_and_border()
- Date: Sat, 19 Dec 2015 05:14:46 +0000 (UTC)
commit dd90e020a2380c284b54094d331436e29c518eac
Author: Benjamin Otte <otte redhat com>
Date: Sat Dec 19 06:10:37 2015 +0100
label: Don't use _gtk_mis_get_padding_and_border()
The function takes into account CSS padding and border, which these days
is handled by the gadget code. Use gtk_misc_get_padding() instead.
gtk/gtklabel.c | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index e87139a..3f41d25 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -3404,17 +3404,17 @@ gtk_label_update_layout_width (GtkLabel *label)
if (priv->ellipsize || priv->wrap)
{
GtkAllocation allocation;
- GtkBorder border;
+ int xpad, ypad;
PangoRectangle logical;
gint width, height;
gtk_css_gadget_get_content_allocation (priv->gadget, &allocation, NULL);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- _gtk_misc_get_padding_and_border (GTK_MISC (label), &border);
+ gtk_misc_get_padding (GTK_MISC (label), &xpad, &ypad);
G_GNUC_END_IGNORE_DEPRECATIONS
- width = allocation.width - border.left - border.right;
- height = allocation.height - border.top - border.bottom;
+ width = allocation.width - 2 * xpad;
+ height = allocation.height - 2 * ypad;
if (priv->have_transform)
{
@@ -3976,7 +3976,7 @@ get_layout_location (GtkLabel *label,
GtkAllocation allocation;
GtkWidget *widget;
GtkLabelPrivate *priv;
- GtkBorder border;
+ gint xpad, ypad;
gint req_width, x, y;
gint req_height;
gfloat xalign, yalign;
@@ -3990,7 +3990,7 @@ get_layout_location (GtkLabel *label,
yalign = priv->yalign;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- _gtk_misc_get_padding_and_border (GTK_MISC (label), &border);
+ gtk_misc_get_padding (GTK_MISC (label), &xpad, &ypad);
G_GNUC_END_IGNORE_DEPRECATIONS
if (gtk_widget_get_direction (widget) != GTK_TEXT_DIR_LTR)
@@ -4010,14 +4010,14 @@ G_GNUC_END_IGNORE_DEPRECATIONS
req_width = logical.width;
req_height = logical.height;
- req_width += border.left + border.right;
- req_height += border.top + border.bottom;
+ req_width += 2 * xpad;
+ req_height += 2 * ypad;
gtk_css_gadget_get_content_allocation (priv->gadget,
&allocation,
&baseline);
- x = floor (allocation.x + border.left + xalign * (allocation.width - req_width) - logical.x);
+ x = floor (allocation.x + xpad + xalign * (allocation.width - req_width) - logical.x);
baseline_offset = 0;
if (baseline != -1 && !priv->have_transform)
@@ -4041,9 +4041,9 @@ G_GNUC_END_IGNORE_DEPRECATIONS
* middle". You want to read the first line, at least, to get some context.
*/
if (pango_layout_get_line_count (priv->layout) == 1)
- y = floor (allocation.y + border.top + (allocation.height - req_height) * yalign) - logical.y +
baseline_offset;
+ y = floor (allocation.y + ypad + (allocation.height - req_height) * yalign) - logical.y +
baseline_offset;
else
- y = floor (allocation.y + border.top + MAX ((allocation.height - req_height) * yalign, 0)) - logical.y +
baseline_offset;
+ y = floor (allocation.y + ypad + MAX ((allocation.height - req_height) * yalign, 0)) - logical.y +
baseline_offset;
if (xp)
*xp = x;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]