summaryrefslogtreecommitdiff
path: root/mate-panel/panel-util.c
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2018-05-01 00:24:38 -0400
committerraveit65 <[email protected]>2018-05-12 21:15:34 +0200
commit10b2021f0a98f1575400aac2beffd8e3c47ecdd5 (patch)
treed625ff63f823fcb481f47fc7f11b502f4418ac2f /mate-panel/panel-util.c
parentf775e8987f8279ea2fb259126e61d0b26cf78817 (diff)
downloadmate-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 'mate-panel/panel-util.c')
-rw-r--r--mate-panel/panel-util.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/mate-panel/panel-util.c b/mate-panel/panel-util.c
index a958a761..f9832473 100644
--- a/mate-panel/panel-util.c
+++ b/mate-panel/panel-util.c
@@ -327,7 +327,7 @@ panel_find_icon (GtkIconTheme *icon_theme,
return retval;
}
-GdkPixbuf *
+cairo_surface_t *
panel_load_icon (GtkIconTheme *icon_theme,
const char *icon_name,
int size,
@@ -335,7 +335,8 @@ panel_load_icon (GtkIconTheme *icon_theme,
int desired_height,
char **error_msg)
{
- GdkPixbuf *retval;
+ GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
char *file;
GError *error;
@@ -351,19 +352,25 @@ panel_load_icon (GtkIconTheme *icon_theme,
}
error = NULL;
- retval = gdk_pixbuf_new_from_file_at_size (file,
+ pixbuf = gdk_pixbuf_new_from_file_at_scale (file,
desired_width,
desired_height,
+ TRUE,
&error);
if (error) {
if (error_msg)
*error_msg = g_strdup (error->message);
g_error_free (error);
+ surface = NULL;
+ }
+ else {
+ surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, 0, NULL);
}
g_free (file);
+ g_object_unref (pixbuf);
- return retval;
+ return surface;
}
static char* panel_lock_screen_action_get_command(const char* action)