summaryrefslogtreecommitdiff
path: root/mate-panel/launcher.c
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2018-05-01 00:24:38 -0400
committerraveit65 <[email protected]>2018-05-12 21:23:54 +0200
commit5c4eb86ea1bb117805cc8fccb4ba3d96a53f2813 (patch)
treebb18949947cbcc5e446ac1e666594be23cf34ba1 /mate-panel/launcher.c
parent6e0188bf03c24558cc1ecd1dd6244eda8137b48e (diff)
downloadmate-panel-5c4eb86ea1bb117805cc8fccb4ba3d96a53f2813.tar.bz2
mate-panel-5c4eb86ea1bb117805cc8fccb4ba3d96a53f2813.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/launcher.c')
-rw-r--r--mate-panel/launcher.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/mate-panel/launcher.c b/mate-panel/launcher.c
index d8d65ad1..67746b06 100644
--- a/mate-panel/launcher.c
+++ b/mate-panel/launcher.c
@@ -184,15 +184,15 @@ drag_data_received_cb (GtkWidget *widget,
GList *file_list;
if (panel_global_config_get_enable_animations ()) {
- GdkPixbuf *pixbuf;
- pixbuf = button_widget_get_pixbuf (BUTTON_WIDGET (widget));
+ cairo_surface_t *surface;
+ surface = button_widget_get_surface (BUTTON_WIDGET (widget));
xstuff_zoom_animate (widget,
- pixbuf,
+ surface,
button_widget_get_orientation (BUTTON_WIDGET (widget)),
NULL);
- g_object_unref (pixbuf);
+ cairo_surface_destroy (surface);
}
-
+
file_list = NULL;
uris = g_uri_list_extract_uris ((const char *) gtk_selection_data_get_data (selection_data));
for (i = 0; uris[i]; i++)
@@ -402,13 +402,13 @@ clicked_cb (Launcher *launcher,
GtkWidget *widget)
{
if (panel_global_config_get_enable_animations ()) {
- GdkPixbuf *pixbuf;
- pixbuf = button_widget_get_pixbuf (BUTTON_WIDGET (widget));
+ cairo_surface_t *surface;
+ surface = button_widget_get_surface (BUTTON_WIDGET (widget));
xstuff_zoom_animate (widget,
- pixbuf,
+ surface,
button_widget_get_orientation (BUTTON_WIDGET (widget)),
NULL);
- g_object_unref (pixbuf);
+ cairo_surface_destroy (surface);
}
launcher_launch (launcher, NULL);
@@ -1157,7 +1157,7 @@ void
panel_launcher_set_dnd_enabled (Launcher *launcher,
gboolean dnd_enabled)
{
- GdkPixbuf *pixbuf;
+ cairo_surface_t *surface;
if (dnd_enabled) {
static GtkTargetEntry dnd_targets[] = {
@@ -1170,16 +1170,20 @@ panel_launcher_set_dnd_enabled (Launcher *launcher,
GDK_BUTTON1_MASK,
dnd_targets, 2,
GDK_ACTION_COPY | GDK_ACTION_MOVE);
- //FIXME: this doesn't work since the pixbuf isn't loaded yet
- pixbuf = button_widget_get_pixbuf (BUTTON_WIDGET (launcher->button));
- if (pixbuf) {
+ surface = button_widget_get_surface (BUTTON_WIDGET (launcher->button));
+ if (surface) {
+ GdkPixbuf *pixbuf;
+ pixbuf = gdk_pixbuf_get_from_surface (surface,
+ 0,
+ 0,
+ cairo_image_surface_get_width (surface),
+ cairo_image_surface_get_height (surface));
gtk_drag_source_set_icon_pixbuf (launcher->button,
pixbuf);
g_object_unref (pixbuf);
+ cairo_surface_destroy (surface);
}
gtk_widget_set_has_window (launcher->button, FALSE);
-
-
} else
gtk_drag_source_unset (launcher->button);
}