summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/core.c4
-rw-r--r--src/core/screen.c19
-rw-r--r--src/core/window-private.h4
-rw-r--r--src/core/window.c24
4 files changed, 18 insertions, 33 deletions
diff --git a/src/core/core.c b/src/core/core.c
index 37459d8f..cdf98d4d 100644
--- a/src/core/core.c
+++ b/src/core/core.c
@@ -176,10 +176,10 @@ meta_core_get (Display *xdisplay,
break;
}
case META_CORE_GET_MINI_ICON:
- *((GdkPixbuf**)answer) = window->mini_icon;
+ *((cairo_surface_t**)answer) = window->mini_icon;
break;
case META_CORE_GET_ICON:
- *((GdkPixbuf**)answer) = window->icon;
+ *((cairo_surface_t**)answer) = window->icon;
break;
case META_CORE_GET_X:
meta_window_get_position (window, (int*)answer, NULL);
diff --git a/src/core/screen.c b/src/core/screen.c
index 99932393..ca43c232 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -1282,7 +1282,6 @@ meta_screen_ensure_tab_popup (MetaScreen *screen,
int len;
int i;
gint border;
- int scale;
if (screen->tab_popup)
return;
@@ -1293,7 +1292,6 @@ meta_screen_ensure_tab_popup (MetaScreen *screen,
screen->active_workspace);
len = g_list_length (tab_list);
- scale = gdk_window_get_scale_factor (gdk_get_default_root_window ());
entries = g_new (MetaTabEntry, len + 1);
entries[len].key = NULL;
@@ -1316,7 +1314,7 @@ meta_screen_ensure_tab_popup (MetaScreen *screen,
entries[i].title = window->title;
entries[i].win_surface = NULL;
- entries[i].icon = g_object_ref (window->icon);
+ entries[i].icon = cairo_surface_reference (window->icon);
/* Only get the window thumbnail surface if the user has a compositor
* enabled and does NOT have compositing-fast-alt-tab-set to true in
@@ -1330,7 +1328,7 @@ meta_screen_ensure_tab_popup (MetaScreen *screen,
if (win_surface != NULL)
{
- cairo_surface_t *surface, *icon;
+ cairo_surface_t *surface;
cairo_t *cr;
int width, height, icon_width, icon_height;
@@ -1348,15 +1346,12 @@ meta_screen_ensure_tab_popup (MetaScreen *screen,
cairo_set_source_surface (cr, win_surface, 0, 0);
cairo_paint (cr);
- /* Get the window icon as a surface */
- icon = gdk_cairo_surface_create_from_pixbuf (window->icon, scale, NULL);
-
- icon_width = cairo_image_surface_get_width (icon) / scale;
- icon_height = cairo_image_surface_get_height (icon) / scale;
+ icon_width = cairo_image_surface_get_width (window->icon);
+ icon_height = cairo_image_surface_get_height (window->icon);
/* Overlap the window icon surface over the window thumbnail */
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
- cairo_set_source_surface (cr, icon,
+ cairo_set_source_surface (cr, window->icon,
width - icon_width - ICON_OFFSET,
height - icon_height - ICON_OFFSET);
cairo_paint (cr);
@@ -1364,7 +1359,6 @@ meta_screen_ensure_tab_popup (MetaScreen *screen,
entries[i].win_surface = surface;
cairo_destroy (cr);
- cairo_surface_destroy (icon);
cairo_surface_destroy (win_surface);
}
}
@@ -1414,7 +1408,8 @@ meta_screen_ensure_tab_popup (MetaScreen *screen,
for (i = 0; i < len; i++)
{
- g_object_unref (entries[i].icon);
+ if (entries[i].icon)
+ cairo_surface_destroy (entries[i].icon);
if (entries[i].win_surface)
cairo_surface_destroy (entries[i].win_surface);
}
diff --git a/src/core/window-private.h b/src/core/window-private.h
index 02b7df42..ca0a6e41 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -114,8 +114,8 @@ struct _MetaWindow
char *title;
char *icon_name;
- GdkPixbuf *icon;
- GdkPixbuf *mini_icon;
+ cairo_surface_t *icon;
+ cairo_surface_t *mini_icon;
MetaIconCache icon_cache;
Pixmap wm_hints_pixmap;
Pixmap wm_hints_mask;
diff --git a/src/core/window.c b/src/core/window.c
index 08cd99c7..7a1ddb3b 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -6126,24 +6126,14 @@ meta_window_update_icon_now (MetaWindow *window)
&icon,
icon_size,
&mini_icon,
- META_MINI_ICON_SIZE,
+ META_MINI_ICON_SIZE * scale,
scale))
{
- if (window->icon)
- g_object_unref (G_OBJECT (window->icon));
+ g_clear_pointer (&window->icon, cairo_surface_destroy);
+ g_clear_pointer (&window->mini_icon, cairo_surface_destroy);
- if (window->mini_icon)
- g_object_unref (G_OBJECT (window->mini_icon));
-
- window->icon = gdk_pixbuf_get_from_surface (icon,
- 0, 0,
- icon_size, icon_size);
- cairo_surface_destroy (icon);
-
- window->mini_icon = gdk_pixbuf_get_from_surface (mini_icon,
- 0, 0,
- META_MINI_ICON_SIZE, META_MINI_ICON_SIZE);
- cairo_surface_destroy (mini_icon);
+ window->icon = icon;
+ window->mini_icon = mini_icon;
redraw_icon (window);
}
@@ -9003,8 +8993,8 @@ meta_window_finalize (GObject *object)
window = META_WINDOW (object);
- g_clear_object (&window->icon);
- g_clear_object (&window->mini_icon);
+ g_clear_pointer (&window->icon, cairo_surface_destroy);
+ g_clear_pointer (&window->mini_icon, cairo_surface_destroy);
g_clear_pointer (&window->frame_bounds, cairo_region_destroy);