summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2017-11-15 08:11:01 -0500
committerMatthias Clasen <mclasen@redhat.com>2017-11-15 08:11:01 -0500
commit2ea8dcc435284aea5b97329229b0a1beb6bfd459 (patch)
tree8e2985c6d00bbbee8aa1f2f1b162133c6360a2c4
parentc52009173acc4f3d822d3dfa611e3a8dad5d3871 (diff)
downloadgtk+-wip/matthiasc/icon-size.tar.gz
Support -gtk-icon-size for builtinswip/matthiasc/icon-size
This makes css icons more similar to themed icons, which is the overall goal here.
-rw-r--r--gtk/gtkicon.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gtk/gtkicon.c b/gtk/gtkicon.c
index 5424e15ee2..8f08af6b8d 100644
--- a/gtk/gtkicon.c
+++ b/gtk/gtkicon.c
@@ -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"
@@ -51,11 +53,27 @@ gtk_icon_snapshot (GtkWidget *widget,
}
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