summaryrefslogtreecommitdiff
path: root/gtk/gtkpopover.c
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2014-12-13 18:02:29 +0100
committerCarlos Garnacho <carlosg@gnome.org>2014-12-13 18:02:29 +0100
commitba22ae8cceb8d74bf50742d94cc887e15e4f232e (patch)
tree5c574793fd3a57c6379e67e38ed87d5a4e9e40f8 /gtk/gtkpopover.c
parent99791007a77abef9375c171c62592e4b3b397d24 (diff)
downloadgtk+-ba22ae8cceb8d74bf50742d94cc887e15e4f232e.tar.gz
popover: Clamp tail gap limits by the tail height on that side
All popover sides have extra margins to possibly hold the tail, this is accounted for in gtk_popover_get_rect_coords(), and should be accounted for too in the tail position calculation. This fixes the gtk_render_frame_gap() warnings seen when a popover is pushed far too close to window sides.
Diffstat (limited to 'gtk/gtkpopover.c')
-rw-r--r--gtk/gtkpopover.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index a3a190222d..8627ca84c4 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -568,16 +568,16 @@ gtk_popover_get_gap_coords (GtkPopover *popover,
{
tip_pos = rect.x + (rect.width / 2);
initial_x = CLAMP (tip_pos - TAIL_GAP_WIDTH / 2,
- border_radius + margin.left,
- allocation.width - TAIL_GAP_WIDTH - margin.right - border_radius);
+ border_radius + margin.left + TAIL_HEIGHT,
+ allocation.width - TAIL_GAP_WIDTH - margin.right - border_radius - TAIL_HEIGHT);
initial_y = base;
tip_x = CLAMP (tip_pos, 0, allocation.width);
tip_y = tip;
final_x = CLAMP (tip_pos + TAIL_GAP_WIDTH / 2,
- border_radius + margin.left + TAIL_GAP_WIDTH,
- allocation.width - margin.right - border_radius);
+ border_radius + margin.left + TAIL_GAP_WIDTH + TAIL_HEIGHT,
+ allocation.width - margin.right - border_radius - TAIL_HEIGHT);
final_y = base;
}
else
@@ -586,16 +586,16 @@ gtk_popover_get_gap_coords (GtkPopover *popover,
initial_x = base;
initial_y = CLAMP (tip_pos - TAIL_GAP_WIDTH / 2,
- border_radius + margin.top,
- allocation.height - TAIL_GAP_WIDTH - margin.bottom - border_radius);
+ border_radius + margin.top + TAIL_HEIGHT,
+ allocation.height - TAIL_GAP_WIDTH - margin.bottom - border_radius - TAIL_HEIGHT);
tip_x = tip;
tip_y = CLAMP (tip_pos, 0, allocation.height);
final_x = base;
final_y = CLAMP (tip_pos + TAIL_GAP_WIDTH / 2,
- border_radius + margin.top + TAIL_GAP_WIDTH,
- allocation.height - margin.right - border_radius);
+ border_radius + margin.top + TAIL_GAP_WIDTH + TAIL_HEIGHT,
+ allocation.height - margin.right - border_radius - TAIL_HEIGHT);
}
if (initial_x_out)