mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 06:10:21 +00:00
progressbar: fix highlight clipping
Clipping using OVERFLOW_HIDDEN relies on widget's padding box. This prevents the highlight to paint itself over the trough's borders. Use the border box instead, with a custom snapshot implementation. Fixes #6332
This commit is contained in:
parent
82fd0d7eef
commit
e82606a538
@ -28,12 +28,14 @@
|
|||||||
|
|
||||||
#include "gtkaccessiblerange.h"
|
#include "gtkaccessiblerange.h"
|
||||||
#include "gtkboxlayout.h"
|
#include "gtkboxlayout.h"
|
||||||
|
#include "gtkcssboxesprivate.h"
|
||||||
#include "gtkgizmoprivate.h"
|
#include "gtkgizmoprivate.h"
|
||||||
#include <glib/gi18n-lib.h>
|
#include <glib/gi18n-lib.h>
|
||||||
#include "gtklabel.h"
|
#include "gtklabel.h"
|
||||||
#include "gtkorientable.h"
|
#include "gtkorientable.h"
|
||||||
#include "gtkprogresstrackerprivate.h"
|
#include "gtkprogresstrackerprivate.h"
|
||||||
#include "gtkprivate.h"
|
#include "gtkprivate.h"
|
||||||
|
#include "gtksnapshot.h"
|
||||||
#include "gtkwidgetprivate.h"
|
#include "gtkwidgetprivate.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -438,7 +440,24 @@ allocate_trough (GtkGizmo *gizmo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_size_allocate (pbar->progress_widget, &alloc, -1);
|
gtk_widget_size_allocate (pbar->progress_widget, &alloc, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
snapshot_trough (GtkGizmo *gizmo,
|
||||||
|
GtkSnapshot *snapshot)
|
||||||
|
|
||||||
|
{
|
||||||
|
GtkWidget *widget = gtk_widget_get_parent (GTK_WIDGET (gizmo));
|
||||||
|
GtkProgressBar *pbar = GTK_PROGRESS_BAR (widget);
|
||||||
|
|
||||||
|
if (pbar->progress_widget)
|
||||||
|
{
|
||||||
|
GtkCssBoxes boxes;
|
||||||
|
gtk_css_boxes_init (&boxes, GTK_WIDGET (gizmo));
|
||||||
|
gtk_snapshot_push_rounded_clip (snapshot, gtk_css_boxes_get_border_box (&boxes));
|
||||||
|
gtk_widget_snapshot_child (GTK_WIDGET (gizmo), pbar->progress_widget, snapshot);
|
||||||
|
gtk_snapshot_pop (snapshot);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -459,10 +478,9 @@ gtk_progress_bar_init (GtkProgressBar *pbar)
|
|||||||
GTK_ACCESSIBLE_ROLE_NONE,
|
GTK_ACCESSIBLE_ROLE_NONE,
|
||||||
NULL,
|
NULL,
|
||||||
allocate_trough,
|
allocate_trough,
|
||||||
NULL,
|
snapshot_trough,
|
||||||
NULL,
|
NULL,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
gtk_widget_set_overflow (pbar->trough_widget, GTK_OVERFLOW_HIDDEN);
|
|
||||||
gtk_widget_set_parent (pbar->trough_widget, GTK_WIDGET (pbar));
|
gtk_widget_set_parent (pbar->trough_widget, GTK_WIDGET (pbar));
|
||||||
|
|
||||||
pbar->progress_widget = gtk_gizmo_new_with_role ("progress",
|
pbar->progress_widget = gtk_gizmo_new_with_role ("progress",
|
||||||
|
Loading…
Reference in New Issue
Block a user