diff options
author | Matthias Clasen <mclasen@redhat.com> | 2016-09-04 09:43:51 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2016-09-04 09:43:51 -0400 |
commit | 5b21c7d79f91613aa3e529026c288dd75fc94266 (patch) | |
tree | 171bfc13da9cc181ebe21a0d85f9889ced0c42f2 /gtk/gtkrange.c | |
parent | 9ddd40f61e9b4bcb861ec8c66a877da0f65dc5f2 (diff) | |
download | gtk+-5b21c7d79f91613aa3e529026c288dd75fc94266.tar.gz |
range: Ensure we don't underallocate the highlight gadget
This was causing warnings in HighContrast.
https://bugzilla.gnome.org/show_bug.cgi?id=770614
Diffstat (limited to 'gtk/gtkrange.c')
-rw-r--r-- | gtk/gtkrange.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c index 282110f1cf..30075c3426 100644 --- a/gtk/gtkrange.c +++ b/gtk/gtkrange.c @@ -1997,33 +1997,43 @@ gtk_range_allocate_trough (GtkCssGadget *gadget, if (priv->has_origin) { GtkAllocation highlight_alloc, highlight_clip; + int min, nat; + + gtk_css_gadget_get_preferred_size (priv->highlight_gadget, + priv->orientation, -1, + &min, &nat, + NULL, NULL); highlight_alloc = *allocation; if (priv->orientation == GTK_ORIENTATION_HORIZONTAL) { + int x = slider_alloc.x + slider_alloc.width / 2; + if (!should_invert (range)) { highlight_alloc.x = allocation->x; - highlight_alloc.width = slider_alloc.x + slider_alloc.width / 2 - allocation->x; + highlight_alloc.width = MAX (x - allocation->x, min); } else { - highlight_alloc.x = slider_alloc.x + slider_alloc.width / 2; - highlight_alloc.width = allocation->x + allocation->width - highlight_alloc.x; + highlight_alloc.width = MAX (allocation->x + allocation->width - x, min); + highlight_alloc.x = allocation->x + allocation->width - highlight_alloc.width; } } else { + int y = slider_alloc.y + slider_alloc.height / 2; + if (!should_invert (range)) { highlight_alloc.y = allocation->y; - highlight_alloc.height = slider_alloc.y + slider_alloc.height / 2 - allocation->y; + highlight_alloc.height = MAX (y - allocation->y, min); } else { - highlight_alloc.y = slider_alloc.y + slider_alloc.height / 2; - highlight_alloc.height = allocation->y + allocation->height - highlight_alloc.y; + highlight_alloc.height = MAX (allocation->y + allocation->height - y, min); + highlight_alloc.y = allocation->y + allocation->height - highlight_alloc.height; } } |