Support -gtk-icon-size for builtins

This makes css icons more similar to themed icons, which
is the overall goal here.
This commit is contained in:
Matthias Clasen 2017-11-15 08:11:01 -05:00
parent 0d23606653
commit 43a9b82797

View File

@ -21,6 +21,8 @@
#include "config.h"
#include "gtkcssnodeprivate.h"
#include "gtkstylecontextprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkiconprivate.h"
#include "gtkwidgetprivate.h"
#include "gtkrendericonprivate.h"
@ -50,12 +52,28 @@ gtk_icon_snapshot (GtkWidget *widget,
self->image);
}
static void
gtk_icon_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
GtkCssValue *icon_size;
icon_size = _gtk_style_context_peek_property (gtk_widget_get_style_context (widget), GTK_CSS_PROPERTY_ICON_SIZE);
*minimum = *natural = _gtk_css_number_value_get (icon_size, 100);
}
static void
gtk_icon_class_init (GtkIconClass *klass)
{
GtkWidgetClass *wclass = GTK_WIDGET_CLASS (klass);
wclass->snapshot = gtk_icon_snapshot;
wclass->measure = gtk_icon_measure;
}
static void