[gtk+] gtkpopover: Fix allocation of child widget wrt margins
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gtkpopover: Fix allocation of child widget wrt margins
- Date: Thu, 13 Nov 2014 19:34:32 +0000 (UTC)
commit 733f70ea8482074f74620d4d1f7843a18bc878fb
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Nov 13 20:20:37 2014 +0100
gtkpopover: Fix allocation of child widget wrt margins
During size request, all sides' margins are ensured to be as big
as TAIL_HEIGHT, just to avoid possible relocation loops if the
popover doesn't fit in its original position. This must be
accounted for in size_allocate() as well.
gtk/gtkpopover.c | 25 ++++---------------------
1 files changed, 4 insertions(+), 21 deletions(-)
---
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 1ebe2f1..2a31982 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -598,9 +598,7 @@ gtk_popover_get_rect_coords (GtkPopover *popover,
gint *y2_out)
{
GtkWidget *widget = GTK_WIDGET (popover);
- GtkPopoverPrivate *priv = popover->priv;
GtkAllocation allocation;
- GtkPositionType pos;
gint x1, x2, y1, y2;
GtkBorder margin;
@@ -618,25 +616,10 @@ gtk_popover_get_rect_coords (GtkPopover *popover,
y2 = allocation.height -
gtk_widget_get_margin_bottom (widget) + y1;
- pos = get_effective_position (popover, priv->final_position);
-
- if (pos == GTK_POS_TOP)
- y2 -= MAX (TAIL_HEIGHT, margin.bottom);
- else if (pos == GTK_POS_BOTTOM)
- y1 += MAX (TAIL_HEIGHT, margin.top);
- else if (pos == GTK_POS_LEFT)
- x2 -= MAX (TAIL_HEIGHT, margin.right);
- else if (pos == GTK_POS_RIGHT)
- x1 += MAX (TAIL_HEIGHT, margin.left);
-
- if (pos != GTK_POS_BOTTOM)
- y1 += margin.top;
- if (pos != GTK_POS_TOP)
- y2 -= margin.bottom;
- if (pos != GTK_POS_RIGHT)
- x1 += margin.left;
- if (pos != GTK_POS_LEFT)
- x2 -= margin.right;
+ x1 += MAX (TAIL_HEIGHT, margin.left);
+ y1 += MAX (TAIL_HEIGHT, margin.top);
+ x2 -= MAX (TAIL_HEIGHT, margin.right);
+ y2 -= MAX (TAIL_HEIGHT, margin.bottom);
if (x1_out)
*x1_out = x1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]