diff options
author | Victor Kareh <[email protected]> | 2018-05-01 00:24:38 -0400 |
---|---|---|
committer | raveit65 <[email protected]> | 2018-05-12 21:15:34 +0200 |
commit | 10b2021f0a98f1575400aac2beffd8e3c47ecdd5 (patch) | |
tree | d625ff63f823fcb481f47fc7f11b502f4418ac2f /applets/clock/clock.c | |
parent | f775e8987f8279ea2fb259126e61d0b26cf78817 (diff) | |
download | mate-panel-10b2021f0a98f1575400aac2beffd8e3c47ecdd5.tar.bz2 mate-panel-10b2021f0a98f1575400aac2beffd8e3c47ecdd5.tar.xz |
Convert launcher icons to cairo surfaces
This improves support for HiDPI by loading properly scaled surfaces for
launcher and drawer icons.
It also Fixes the Show Desktop wncklet to show a surface icon. Other
wncklets have their icons determined by libwnck, so they remain as
pixbufs.
Fixes mate-desktop/mate-desktop#314
Diffstat (limited to 'applets/clock/clock.c')
-rw-r--r-- | applets/clock/clock.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/applets/clock/clock.c b/applets/clock/clock.c index ad659fe5..bfbc96bc 100644 --- a/applets/clock/clock.c +++ b/applets/clock/clock.c @@ -1975,7 +1975,8 @@ location_weather_updated_cb (ClockLocation *location, const gchar *icon_name; const gchar *temp; GtkIconTheme *theme; - GdkPixbuf *pixbuf; + cairo_surface_t *surface; + gint icon_size, icon_scale; if (!info || !weather_info_is_valid (info)) return; @@ -1984,15 +1985,23 @@ location_weather_updated_cb (ClockLocation *location, return; icon_name = weather_info_get_icon_name (info); - /* FIXME: mmh, screen please? Also, don't hardcode to 16 */ - theme = gtk_icon_theme_get_default (); - pixbuf = gtk_icon_theme_load_icon (theme, icon_name, 16, - GTK_ICON_LOOKUP_GENERIC_FALLBACK, NULL); + if (icon_name == NULL) + return; + + theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (cd->applet))); + + icon_size = mate_panel_applet_get_size (MATE_PANEL_APPLET (cd->applet)); + icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (cd->applet)); + + surface = gtk_icon_theme_load_surface (theme, icon_name, icon_size, icon_scale, + NULL, GTK_ICON_LOOKUP_GENERIC_FALLBACK, NULL); temp = weather_info_get_temp_summary (info); - gtk_image_set_from_pixbuf (GTK_IMAGE (cd->panel_weather_icon), pixbuf); + gtk_image_set_from_surface (GTK_IMAGE (cd->panel_weather_icon), surface); gtk_label_set_text (GTK_LABEL (cd->panel_temperature_label), temp); + + cairo_surface_destroy (surface); } static void |