[epiphany] HiDPI scaled favicons in tab labels
- From: Jan-Michael Brummer <jbrummer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] HiDPI scaled favicons in tab labels
- Date: Sat, 18 Jul 2020 10:24:19 +0000 (UTC)
commit 728d924e74d24c287a792cb57177d3d7d94d185b
Author: Stephan Verbuecheln <verbuecheln posteo de>
Date: Mon Jul 13 07:20:52 2020 +0200
HiDPI scaled favicons in tab labels
Fixes: https://gitlab.gnome.org/GNOME/epiphany/-/issues/999
embed/ephy-web-view.c | 6 ++++--
src/ephy-tab-label.c | 7 ++++++-
2 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 5c700e0f5..ec9d7b048 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -570,8 +570,10 @@ _ephy_web_view_update_icon (EphyWebView *view)
if (view->address) {
cairo_surface_t *icon_surface = webkit_web_view_get_favicon (WEBKIT_WEB_VIEW (view));
- if (icon_surface)
- view->icon = ephy_pixbuf_get_from_surface_scaled (icon_surface, FAVICON_SIZE, FAVICON_SIZE);
+ if (icon_surface) {
+ gint scale = gdk_window_get_scale_factor (gtk_widget_get_window (GTK_WIDGET (view)));
+ view->icon = ephy_pixbuf_get_from_surface_scaled (icon_surface, scale * FAVICON_SIZE, scale *
FAVICON_SIZE);
+ }
}
g_object_notify_by_pspec (G_OBJECT (view), obj_properties[PROP_ICON]);
diff --git a/src/ephy-tab-label.c b/src/ephy-tab-label.c
index d3a78f23a..748cbd7a5 100644
--- a/src/ephy-tab-label.c
+++ b/src/ephy-tab-label.c
@@ -103,6 +103,7 @@ ephy_tab_label_set_property (GObject *object,
{
EphyTabLabel *self = EPHY_TAB_LABEL (object);
const gchar *str;
+ cairo_surface_t *surface;
switch (prop_id) {
case PROP_LABEL_TEXT:
@@ -121,7 +122,11 @@ ephy_tab_label_set_property (GObject *object,
}
break;
case PROP_ICON_BUF:
- gtk_image_set_from_pixbuf (GTK_IMAGE (self->icon), g_value_get_object (value));
+ surface = gdk_cairo_surface_create_from_pixbuf (g_value_get_object (value),
+ 0,
+ gtk_widget_get_window (GTK_WIDGET (self)));
+ gtk_image_set_from_surface (GTK_IMAGE (self->icon), surface);
+ cairo_surface_destroy (surface);
self->has_icon = g_value_get_object (value) != NULL;
ephy_tab_label_update_icon (self);
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]