diff options
-rw-r--r-- | src/tab.c | 26 |
1 files changed, 20 insertions, 6 deletions
@@ -28,9 +28,9 @@ #include "tab-body.h" static void -update_tab_image(MqTab *tab, cairo_surface_t *favicon) +update_tab_image(MqTab *tab, GdkPixbuf *favicon) { - gtk_image_set_from_surface(GTK_IMAGE(tab->tab_image), favicon); + gtk_image_set_from_pixbuf(GTK_IMAGE(tab->tab_image), favicon); } static void @@ -284,10 +284,24 @@ static void favicon_cb(WebKitWebView __attribute__((unused)) *web_view, GParamSpec __attribute__((unused)) *paramspec, MqTab *tab) { - cairo_surface_t *favicon; - - favicon = webkit_web_view_get_favicon(tab->web_view); - update_tab_image(tab, favicon); + cairo_surface_t *surface; + GdkPixbuf *pixbuf; + GdkPixbuf *scaled_pixbuf; + + surface = webkit_web_view_get_favicon(tab->web_view); + if (surface) { + pixbuf = gdk_pixbuf_get_from_surface(surface, 0, 0, + cairo_image_surface_get_width(surface), + cairo_image_surface_get_height(surface)); + if (pixbuf) { + scaled_pixbuf = gdk_pixbuf_scale_simple(pixbuf, 16, 16, + GDK_INTERP_BILINEAR); + g_object_unref(pixbuf); + if (scaled_pixbuf) { + update_tab_image(tab, scaled_pixbuf); + } + } + } } static void |