[gtk+] Support -gtk-icon-size for builtins
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Support -gtk-icon-size for builtins
- Date: Wed, 15 Nov 2017 19:24:02 +0000 (UTC)
commit 43a9b82797d0b05d1092d38fea477b8f86421c69
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Nov 15 08:11:01 2017 -0500
Support -gtk-icon-size for builtins
This makes css icons more similar to themed icons, which
is the overall goal here.
gtk/gtkicon.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkicon.c b/gtk/gtkicon.c
index 5424e15..8f08af6 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]