linux-packaging-mono/external/bockbuild/packages/patches/gtk/0057-widget-Add-_scaled-variants-for-icon-rendering.patch
Xamarin Public Jenkins (auto-signing) 6bdd276d05 Imported Upstream version 5.0.0.42
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
2017-04-10 11:41:01 +00:00

70 lines
2.5 KiB
Diff

From de10316fb1045f610072ef7c2addbe969e0fe617 Mon Sep 17 00:00:00 2001
From: Carlos Garnacho <carlosg@gnome.org>
Date: Tue, 12 Feb 2013 14:01:15 +0100
Subject: [PATCH 57/68] widget: Add _scaled() variants for icon rendering
Likewise to the iconfactory changes, this API allows to
deal with stock icons at sizes that are suitable for
gdk_window_get_scale_factor()
---
gtk/gtkwidget.c | 27 +++++++++++++++++++++++++++
gtk/gtkwidget.h | 5 +++++
2 files changed, 32 insertions(+)
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index c812bb9..f093c39 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -7502,6 +7502,33 @@ gtk_widget_render_icon (GtkWidget *widget,
return retval;
}
+GdkPixbuf*
+gtk_widget_render_icon_scaled (GtkWidget *widget,
+ const gchar *stock_id,
+ GtkIconSize size,
+ const gchar *detail,
+ gdouble *real_scale)
+{
+ GtkIconSet *icon_set;
+ GdkPixbuf *retval;
+
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
+ g_return_val_if_fail (stock_id != NULL, NULL);
+ g_return_val_if_fail (size > GTK_ICON_SIZE_INVALID || size == -1, NULL);
+
+ gtk_widget_ensure_style (widget);
+
+ icon_set = gtk_style_lookup_icon_set (widget->style, stock_id);
+
+ if (icon_set == NULL)
+ return NULL;
+
+ return gtk_icon_set_render_icon_scaled (icon_set, widget->style,
+ gtk_widget_get_direction (widget),
+ gtk_widget_get_state (widget),
+ size, widget, detail, real_scale);
+}
+
/**
* gtk_widget_set_parent_window:
* @widget: a #GtkWidget.
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index cee16cd..f7ebf9b 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -1194,6 +1194,11 @@ GdkPixbuf *gtk_widget_render_icon (GtkWidget *widget,
const gchar *stock_id,
GtkIconSize size,
const gchar *detail);
+GdkPixbuf *gtk_widget_render_icon_scaled (GtkWidget *widget,
+ const gchar *stock_id,
+ GtkIconSize size,
+ const gchar *detail,
+ gdouble *real_scale);
/* handle composite names for GTK_COMPOSITE_CHILD widgets,
* the returned name is newly allocated.
--
1.7.10.2 (Apple Git-33)