From aa4324b9348dc985f89ced274644ca1efcadd3a1 Mon Sep 17 00:00:00 2001 From: raveit65 Date: Mon, 19 Sep 2022 17:56:43 +0200 Subject: [PATCH] - update to 43.0 --- .gitignore | 1 + libwnck3.spec | 21 +- ...0001-Expose-window-scaling-factor_43.patch | 26 +- ...not-change-workspace-size-from-size_.patch | 98 + ...s-move-WnckIconCache-to-its-own-file.patch | 1663 ----------------- ...se-cairo-surfaces-to-render-icons_43.patch | 186 +- ...nge-icons-to-being-cairo-surfaces_43.patch | 154 +- ...ark-GdkPixbuf-icons-as-deprecated_43.patch | 42 +- ...klist-Add-surface-loader-function_43.patch | 30 +- sources | 2 +- 10 files changed, 305 insertions(+), 1918 deletions(-) rename libwnck_0001-Expose-window-scaling-factor.patch => libwnck_0001-Expose-window-scaling-factor_43.patch (64%) create mode 100644 libwnck_0001-Revert-pager-do-not-change-workspace-size-from-size_.patch delete mode 100644 libwnck_0001-xutils-move-WnckIconCache-to-its-own-file.patch rename libwnck_0002-icons-Use-cairo-surfaces-to-render-icons.patch => libwnck_0002-icons-Use-cairo-surfaces-to-render-icons_43.patch (89%) rename libwnck_0003-xutils-Change-icons-to-being-cairo-surfaces.patch => libwnck_0003-xutils-Change-icons-to-being-cairo-surfaces_43.patch (84%) rename libwnck_0004-icons-Mark-GdkPixbuf-icons-as-deprecated.patch => libwnck_0004-icons-Mark-GdkPixbuf-icons-as-deprecated_43.patch (84%) rename libwnck_0005-tasklist-Add-surface-loader-function.patch => libwnck_0005-tasklist-Add-surface-loader-function_43.patch (88%) diff --git a/.gitignore b/.gitignore index 02f46c5..8563c53 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,4 @@ libwnck-2.30.3.tar.bz2 /libwnck-3.36.0.tar.xz /libwnck-40.0.tar.xz /libwnck-40.1.tar.xz +/libwnck-43.0.tar.xz diff --git a/libwnck3.spec b/libwnck3.spec index ab0e4cc..85e462a 100644 --- a/libwnck3.spec +++ b/libwnck3.spec @@ -2,20 +2,20 @@ Summary: Window Navigator Construction Kit Name: libwnck3 -Version: 40.1 -Release: 2%{?dist} +Version: 43.0 +Release: 1%{?dist} URL: http://download.gnome.org/sources/%{source_name}/ Source0: http://download.gnome.org/sources/%{source_name}/40/%{source_name}-%{version}.tar.xz License: LGPLv2+ -# https://gitlab.gnome.org/GNOME/libwnck/-/commit/bd8ab37 -Patch2: libwnck_0001-xutils-move-WnckIconCache-to-its-own-file.patch +# fix wnck-pager +Patch1: libwnck_0001-Revert-pager-do-not-change-workspace-size-from-size_.patch # https://gitlab.gnome.org/GNOME/libwnck/-/merge_requests/10 -Patch3: libwnck_0001-Expose-window-scaling-factor.patch -Patch4: libwnck_0002-icons-Use-cairo-surfaces-to-render-icons.patch -Patch5: libwnck_0003-xutils-Change-icons-to-being-cairo-surfaces.patch -Patch6: libwnck_0004-icons-Mark-GdkPixbuf-icons-as-deprecated.patch -Patch7: libwnck_0005-tasklist-Add-surface-loader-function.patch +Patch2: libwnck_0001-Expose-window-scaling-factor_43.patch +Patch3: libwnck_0002-icons-Use-cairo-surfaces-to-render-icons_43.patch +Patch4: libwnck_0003-xutils-Change-icons-to-being-cairo-surfaces_43.patch +Patch5: libwnck_0004-icons-Mark-GdkPixbuf-icons-as-deprecated_43.patch +Patch6: libwnck_0005-tasklist-Add-surface-loader-function_43.patch BuildRequires: gcc BuildRequires: meson @@ -79,6 +79,9 @@ developing applications that use %{name}. %changelog +* Sat Feb 19 2022 Wolfgang Ulbrich - 43.0-1 +- update to 43.0 + * Thu Jul 21 2022 Fedora Release Engineering - 40.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild diff --git a/libwnck_0001-Expose-window-scaling-factor.patch b/libwnck_0001-Expose-window-scaling-factor_43.patch similarity index 64% rename from libwnck_0001-Expose-window-scaling-factor.patch rename to libwnck_0001-Expose-window-scaling-factor_43.patch index 75baa59..2fa6e8b 100644 --- a/libwnck_0001-Expose-window-scaling-factor.patch +++ b/libwnck_0001-Expose-window-scaling-factor_43.patch @@ -1,4 +1,4 @@ -From 42c7798ccd4d488a4a927af62f1b8b4e404e9dd4 Mon Sep 17 00:00:00 2001 +From 27b7ebb8092a36f0fb32e3277577ff9f09d309e6 Mon Sep 17 00:00:00 2001 From: Victor Kareh Date: Tue, 6 Aug 2019 09:59:59 -0400 Subject: [PATCH 1/5] Expose window scaling factor @@ -9,24 +9,24 @@ Subject: [PATCH 1/5] Expose window scaling factor 2 files changed, 23 insertions(+) diff --git a/libwnck/private.h b/libwnck/private.h -index f1a4af2..199d2b4 100644 +index d5e48d9..6741e1e 100644 --- a/libwnck/private.h +++ b/libwnck/private.h -@@ -43,6 +43,8 @@ WnckHandle *_wnck_get_handle (void); +@@ -37,6 +37,8 @@ G_BEGIN_DECLS - WnckClientType _wnck_get_client_type (void); + WnckHandle *_wnck_get_handle (void); +int _wnck_get_window_scaling_factor (void); + - gsize _wnck_get_default_icon_size (void); - gsize _wnck_get_default_mini_icon_size (void); - + void _wnck_application_process_property_notify (WnckApplication *app, + XEvent *xevent); + void _wnck_window_process_property_notify (WnckWindow *window, diff --git a/libwnck/util.c b/libwnck/util.c -index b3d8750..d51ee05 100644 +index 83659dc..a58a99e 100644 --- a/libwnck/util.c +++ b/libwnck/util.c -@@ -680,6 +680,27 @@ _wnck_get_client_type (void) - return _wnck_handle_get_client_type (_wnck_get_handle ()); +@@ -164,6 +164,27 @@ _wnck_get_handle (void) + return wnck_handle; } +/** @@ -50,9 +50,9 @@ index b3d8750..d51ee05 100644 + return 1; +} + - static gsize default_icon_size = WNCK_DEFAULT_ICON_SIZE; - /** + * wnck_set_default_icon_size: + * @size: the default size for windows and application standard icons. -- -2.31.1 +2.37.2 diff --git a/libwnck_0001-Revert-pager-do-not-change-workspace-size-from-size_.patch b/libwnck_0001-Revert-pager-do-not-change-workspace-size-from-size_.patch new file mode 100644 index 0000000..528f747 --- /dev/null +++ b/libwnck_0001-Revert-pager-do-not-change-workspace-size-from-size_.patch @@ -0,0 +1,98 @@ +From 89a5825eb20bfa91b91055e5a3dfe6445e6b9bd2 Mon Sep 17 00:00:00 2001 +From: raveit65 +Date: Fri, 11 Jun 2021 21:26:40 +0200 +Subject: [PATCH] Revert "pager: do not change workspace size from + size_allocate" + +This reverts commit 3456b747b6381f17d48629dd8fdd4d511e739b10. +--- + libwnck/pager.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 59 insertions(+) + +diff --git a/libwnck/pager.c b/libwnck/pager.c +index c769d62..a563a4d 100644 +--- a/libwnck/pager.c ++++ b/libwnck/pager.c +@@ -122,6 +122,8 @@ static void wnck_pager_get_preferred_height_for_width (GtkWidget *widget, + int width, + int *minimum_height, + int *natural_height); ++static void wnck_pager_size_allocate (GtkWidget *widget, ++ GtkAllocation *allocation); + static gboolean wnck_pager_draw (GtkWidget *widget, + cairo_t *cr); + static gboolean wnck_pager_button_press (GtkWidget *widget, +@@ -247,6 +249,7 @@ wnck_pager_class_init (WnckPagerClass *klass) + widget_class->get_preferred_width_for_height = wnck_pager_get_preferred_width_for_height; + widget_class->get_preferred_height = wnck_pager_get_preferred_height; + widget_class->get_preferred_height_for_width = wnck_pager_get_preferred_height_for_width; ++ widget_class->size_allocate = wnck_pager_size_allocate; + widget_class->draw = wnck_pager_draw; + widget_class->button_press_event = wnck_pager_button_press; + widget_class->button_release_event = wnck_pager_button_release; +@@ -684,6 +687,62 @@ wnck_pager_get_preferred_height_for_width (GtkWidget *widget, + *natural_height = *minimum_height = MAX (height, 0); + } + ++static gboolean ++_wnck_pager_queue_resize (gpointer data) ++{ ++ gtk_widget_queue_resize (GTK_WIDGET (data)); ++ return FALSE; ++} ++ ++static void ++wnck_pager_size_allocate (GtkWidget *widget, ++ GtkAllocation *allocation) ++{ ++ WnckPager *pager; ++ int workspace_size; ++ GtkBorder padding; ++ int width; ++ int height; ++ ++ pager = WNCK_PAGER (widget); ++ ++ width = allocation->width; ++ height = allocation->height; ++ ++ _wnck_pager_get_padding (pager, &padding); ++ width -= padding.left + padding.right; ++ height -= padding.top + padding.bottom; ++ ++ g_assert (pager->priv->n_rows > 0); ++ ++ if (pager->priv->orientation == GTK_ORIENTATION_VERTICAL) ++ { ++ if (pager->priv->show_all_workspaces) ++ workspace_size = (width - (pager->priv->n_rows - 1)) / pager->priv->n_rows; ++ else ++ workspace_size = width; ++ } ++ else ++ { ++ if (pager->priv->show_all_workspaces) ++ workspace_size = (height - (pager->priv->n_rows - 1))/ pager->priv->n_rows; ++ else ++ workspace_size = height; ++ } ++ ++ workspace_size = MAX (workspace_size, 1); ++ ++ if (workspace_size != pager->priv->workspace_size) ++ { ++ pager->priv->workspace_size = workspace_size; ++ g_idle_add (_wnck_pager_queue_resize, pager); ++ return; ++ } ++ ++ GTK_WIDGET_CLASS (wnck_pager_parent_class)->size_allocate (widget, ++ allocation); ++} ++ + static void + get_workspace_rect (WnckPager *pager, + int space, +-- +2.31.1 + diff --git a/libwnck_0001-xutils-move-WnckIconCache-to-its-own-file.patch b/libwnck_0001-xutils-move-WnckIconCache-to-its-own-file.patch deleted file mode 100644 index 2b72c66..0000000 --- a/libwnck_0001-xutils-move-WnckIconCache-to-its-own-file.patch +++ /dev/null @@ -1,1663 +0,0 @@ -From bd8ab37c271c065c0bcd09362222ca37f05aedf7 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Alberts=20Muktup=C4=81vels?= -Date: Tue, 11 May 2021 21:00:01 +0300 -Subject: [PATCH 1/6] xutils: move WnckIconCache to its own file - ---- - libwnck/application.c | 1 + - libwnck/meson.build | 2 + - libwnck/window.c | 1 + - libwnck/wnck-icon-cache-private.h | 51 ++ - libwnck/wnck-icon-cache.c | 756 ++++++++++++++++++++++++++++++ - libwnck/xutils.c | 729 +--------------------------- - libwnck/xutils.h | 22 +- - 7 files changed, 815 insertions(+), 747 deletions(-) - create mode 100644 libwnck/wnck-icon-cache-private.h - create mode 100644 libwnck/wnck-icon-cache.c - -diff --git a/libwnck/application.c b/libwnck/application.c -index 9a03342..8d78209 100644 ---- a/libwnck/application.c -+++ b/libwnck/application.c -@@ -25,6 +25,7 @@ - #include - #include "application.h" - #include "private.h" -+#include "wnck-icon-cache-private.h" - - /** - * SECTION:application -diff --git a/libwnck/meson.build b/libwnck/meson.build -index eef9de5..aa60e83 100644 ---- a/libwnck/meson.build -+++ b/libwnck/meson.build -@@ -59,6 +59,8 @@ sources = [ - 'window.c', - 'wnck-handle-private.h', - 'wnck-handle.c', -+ 'wnck-icon-cache-private.h', -+ 'wnck-icon-cache.c', - 'wnck-image-menu-item-private.h', - 'wnck-image-menu-item.c', - 'workspace.c', -diff --git a/libwnck/window.c b/libwnck/window.c -index 66a4386..25c56a5 100644 ---- a/libwnck/window.c -+++ b/libwnck/window.c -@@ -33,6 +33,7 @@ - #include "xutils.h" - #include "private.h" - #include "wnck-enum-types.h" -+#include "wnck-icon-cache-private.h" - - /** - * SECTION:window -diff --git a/libwnck/wnck-icon-cache-private.h b/libwnck/wnck-icon-cache-private.h -new file mode 100644 -index 0000000..6a3d5ec ---- /dev/null -+++ b/libwnck/wnck-icon-cache-private.h -@@ -0,0 +1,51 @@ -+/* -+ * Copyright (C) 2001 Havoc Pennington -+ * Copyright (C) 2005-2007 Vincent Untz -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Library General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Library General Public License for more details. -+ * -+ * You should have received a copy of the GNU Library General Public -+ * License along with this library; if not, see . -+ */ -+ -+#ifndef WNCK_ICON_CACHE_PRIVATE_H -+#define WNCK_ICON_CACHE_PRIVATE_H -+ -+#include -+#include -+ -+#include -+#include -+ -+G_BEGIN_DECLS -+ -+typedef struct _WnckIconCache WnckIconCache; -+ -+WnckIconCache *_wnck_icon_cache_new (void); -+void _wnck_icon_cache_free (WnckIconCache *icon_cache); -+void _wnck_icon_cache_property_changed (WnckIconCache *icon_cache, -+ Atom atom); -+gboolean _wnck_icon_cache_get_icon_invalidated (WnckIconCache *icon_cache); -+void _wnck_icon_cache_set_want_fallback (WnckIconCache *icon_cache, -+ gboolean setting); -+gboolean _wnck_icon_cache_get_is_fallback (WnckIconCache *icon_cache); -+ -+gboolean _wnck_read_icons (WnckScreen *screen, -+ Window xwindow, -+ WnckIconCache *icon_cache, -+ GdkPixbuf **iconp, -+ int ideal_size, -+ GdkPixbuf **mini_iconp, -+ int ideal_mini_size); -+ -+G_END_DECLS -+ -+#endif -diff --git a/libwnck/wnck-icon-cache.c b/libwnck/wnck-icon-cache.c -new file mode 100644 -index 0000000..1749585 ---- /dev/null -+++ b/libwnck/wnck-icon-cache.c -@@ -0,0 +1,756 @@ -+/* -+ * Copyright (C) 2001 Havoc Pennington -+ * Copyright (C) 2005-2007 Vincent Untz -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Library General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Library General Public License for more details. -+ * -+ * You should have received a copy of the GNU Library General Public -+ * License along with this library; if not, see . -+ */ -+ -+#include "config.h" -+#include "wnck-icon-cache-private.h" -+ -+#include -+#if HAVE_CAIRO_XLIB_XRENDER -+#include -+#endif -+ -+#include "private.h" -+#include "xutils.h" -+ -+typedef enum -+{ -+ /* These MUST be in ascending order of preference; -+ * i.e. if we get _NET_WM_ICON and already have -+ * WM_HINTS, we prefer _NET_WM_ICON -+ */ -+ USING_NO_ICON, -+ USING_FALLBACK_ICON, -+ USING_KWM_WIN_ICON, -+ USING_WM_HINTS, -+ USING_NET_WM_ICON -+} IconOrigin; -+ -+struct _WnckIconCache -+{ -+ IconOrigin origin; -+ Pixmap prev_pixmap; -+ Pixmap prev_mask; -+ GdkPixbuf *icon; -+ GdkPixbuf *mini_icon; -+ int ideal_size; -+ int ideal_mini_size; -+ guint want_fallback : 1; -+ /* TRUE if these props have changed */ -+ guint wm_hints_dirty : 1; -+ guint kwm_win_icon_dirty : 1; -+ guint net_wm_icon_dirty : 1; -+}; -+ -+static gboolean -+find_best_size (gulong *data, -+ gulong nitems, -+ int ideal_size, -+ int *width, -+ int *height, -+ gulong **start) -+{ -+ int best_w; -+ int best_h; -+ gulong *best_start; -+ -+ *width = 0; -+ *height = 0; -+ *start = NULL; -+ -+ best_w = 0; -+ best_h = 0; -+ best_start = NULL; -+ -+ while (nitems > 0) -+ { -+ int w, h; -+ gboolean replace; -+ -+ replace = FALSE; -+ -+ if (nitems < 3) -+ return FALSE; /* no space for w, h */ -+ -+ w = data[0]; -+ h = data[1]; -+ -+ if (nitems < ((gulong) (w * h) + 2)) -+ break; /* not enough data */ -+ -+ if (best_start == NULL) -+ { -+ replace = TRUE; -+ } -+ else -+ { -+ /* work with averages */ -+ int best_size = (best_w + best_h) / 2; -+ int this_size = (w + h) / 2; -+ -+ /* larger than desired is always better than smaller */ -+ if (best_size < ideal_size && -+ this_size >= ideal_size) -+ replace = TRUE; -+ /* if we have too small, pick anything bigger */ -+ else if (best_size < ideal_size && -+ this_size > best_size) -+ replace = TRUE; -+ /* if we have too large, pick anything smaller -+ * but still >= the ideal -+ */ -+ else if (best_size > ideal_size && -+ this_size >= ideal_size && -+ this_size < best_size) -+ replace = TRUE; -+ } -+ -+ if (replace) -+ { -+ best_start = data + 2; -+ best_w = w; -+ best_h = h; -+ } -+ -+ data += (w * h) + 2; -+ nitems -= (w * h) + 2; -+ } -+ -+ if (best_start) -+ { -+ *start = best_start; -+ *width = best_w; -+ *height = best_h; -+ return TRUE; -+ } -+ else -+ return FALSE; -+} -+ -+static void -+argbdata_to_pixdata (gulong *argb_data, int len, guchar **pixdata) -+{ -+ guchar *p; -+ int i; -+ -+ *pixdata = g_new (guchar, len * 4); -+ p = *pixdata; -+ -+ /* One could speed this up a lot. */ -+ i = 0; -+ while (i < len) -+ { -+ guint argb; -+ guint rgba; -+ -+ argb = argb_data[i]; -+ rgba = (argb << 8) | (argb >> 24); -+ -+ *p = rgba >> 24; -+ ++p; -+ *p = (rgba >> 16) & 0xff; -+ ++p; -+ *p = (rgba >> 8) & 0xff; -+ ++p; -+ *p = rgba & 0xff; -+ ++p; -+ -+ ++i; -+ } -+} -+ -+static gboolean -+read_rgb_icon (Screen *screen, -+ Window xwindow, -+ int ideal_size, -+ int ideal_mini_size, -+ int *width, -+ int *height, -+ guchar **pixdata, -+ int *mini_width, -+ int *mini_height, -+ guchar **mini_pixdata) -+{ -+ Display *display; -+ Atom type; -+ int format; -+ gulong nitems; -+ gulong bytes_after; -+ int result, err; -+ gulong *data; -+ gulong *best; -+ int w, h; -+ gulong *best_mini; -+ int mini_w, mini_h; -+ -+ display = DisplayOfScreen (screen); -+ -+ _wnck_error_trap_push (display); -+ type = None; -+ data = NULL; -+ result = XGetWindowProperty (display, -+ xwindow, -+ _wnck_atom_get ("_NET_WM_ICON"), -+ 0, G_MAXLONG, -+ False, XA_CARDINAL, &type, &format, &nitems, -+ &bytes_after, (void*)&data); -+ -+ err = _wnck_error_trap_pop (display); -+ -+ if (err != Success || -+ result != Success) -+ return FALSE; -+ -+ if (type != XA_CARDINAL) -+ { -+ XFree (data); -+ return FALSE; -+ } -+ -+ if (!find_best_size (data, nitems, ideal_size, &w, &h, &best)) -+ { -+ XFree (data); -+ return FALSE; -+ } -+ -+ if (!find_best_size (data, nitems, -+ ideal_mini_size, -+ &mini_w, &mini_h, &best_mini)) -+ { -+ XFree (data); -+ return FALSE; -+ } -+ -+ *width = w; -+ *height = h; -+ -+ *mini_width = mini_w; -+ *mini_height = mini_h; -+ -+ argbdata_to_pixdata (best, w * h, pixdata); -+ argbdata_to_pixdata (best_mini, mini_w * mini_h, mini_pixdata); -+ -+ XFree (data); -+ -+ return TRUE; -+} -+ -+static gboolean -+try_pixmap_and_mask (Screen *screen, -+ Pixmap src_pixmap, -+ Pixmap src_mask, -+ GdkPixbuf **iconp, -+ int ideal_size, -+ GdkPixbuf **mini_iconp, -+ int ideal_mini_size) -+{ -+ cairo_surface_t *surface, *mask_surface, *image; -+ GdkDisplay *gdk_display; -+ GdkPixbuf *unscaled; -+ int width, height; -+ cairo_t *cr; -+ -+ if (src_pixmap == None) -+ return FALSE; -+ -+ surface = _wnck_cairo_surface_get_from_pixmap (screen, src_pixmap); -+ -+ if (surface && src_mask != None) -+ mask_surface = _wnck_cairo_surface_get_from_pixmap (screen, src_mask); -+ else -+ mask_surface = NULL; -+ -+ if (surface == NULL) -+ return FALSE; -+ -+ gdk_display = gdk_x11_lookup_xdisplay (XDisplayOfScreen (screen)); -+ g_assert (gdk_display != NULL); -+ -+ gdk_x11_display_error_trap_push (gdk_display); -+ -+ width = cairo_xlib_surface_get_width (surface); -+ height = cairo_xlib_surface_get_height (surface); -+ -+ image = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, -+ width, height); -+ cr = cairo_create (image); -+ -+ /* Need special code for alpha-only surfaces. We only get those -+ * for bitmaps. And in that case, it's a differentiation between -+ * foreground (white) and background (black). -+ */ -+ if (cairo_surface_get_content (surface) & CAIRO_CONTENT_ALPHA) -+ { -+ cairo_push_group (cr); -+ -+ /* black background */ -+ cairo_set_source_rgb (cr, 0, 0, 0); -+ cairo_paint (cr); -+ /* mask with white foreground */ -+ cairo_set_source_rgb (cr, 1, 1, 1); -+ cairo_mask_surface (cr, surface, 0, 0); -+ -+ cairo_pop_group_to_source (cr); -+ } -+ else -+ cairo_set_source_surface (cr, surface, 0, 0); -+ -+ if (mask_surface) -+ { -+ cairo_mask_surface (cr, mask_surface, 0, 0); -+ cairo_surface_destroy (mask_surface); -+ } -+ else -+ cairo_paint (cr); -+ -+ cairo_surface_destroy (surface); -+ cairo_destroy (cr); -+ -+ if (gdk_x11_display_error_trap_pop (gdk_display) != Success) -+ { -+ cairo_surface_destroy (image); -+ return FALSE; -+ } -+ -+ unscaled = gdk_pixbuf_get_from_surface (image, -+ 0, 0, -+ width, height); -+ -+ cairo_surface_destroy (image); -+ -+ if (unscaled) -+ { -+ *iconp = -+ gdk_pixbuf_scale_simple (unscaled, -+ ideal_size, -+ ideal_size, -+ GDK_INTERP_BILINEAR); -+ *mini_iconp = -+ gdk_pixbuf_scale_simple (unscaled, -+ ideal_mini_size, -+ ideal_mini_size, -+ GDK_INTERP_BILINEAR); -+ -+ g_object_unref (G_OBJECT (unscaled)); -+ return TRUE; -+ } -+ else -+ return FALSE; -+} -+ -+static void -+get_kwm_win_icon (Screen *screen, -+ Window xwindow, -+ Pixmap *pixmap, -+ Pixmap *mask) -+{ -+ Display *display; -+ Atom type; -+ int format; -+ gulong nitems; -+ gulong bytes_after; -+ Pixmap *icons; -+ int err, result; -+ -+ display = DisplayOfScreen (screen); -+ -+ *pixmap = None; -+ *mask = None; -+ -+ _wnck_error_trap_push (display); -+ icons = NULL; -+ result = XGetWindowProperty (display, xwindow, -+ _wnck_atom_get ("KWM_WIN_ICON"), -+ 0, G_MAXLONG, -+ False, -+ _wnck_atom_get ("KWM_WIN_ICON"), -+ &type, &format, &nitems, -+ &bytes_after, (void*)&icons); -+ -+ err = _wnck_error_trap_pop (display); -+ if (err != Success || -+ result != Success) -+ return; -+ -+ if (type != _wnck_atom_get ("KWM_WIN_ICON")) -+ { -+ XFree (icons); -+ return; -+ } -+ -+ *pixmap = icons[0]; -+ *mask = icons[1]; -+ -+ XFree (icons); -+ -+ return; -+} -+ -+static void -+clear_icon_cache (WnckIconCache *icon_cache, -+ gboolean dirty_all) -+{ -+ if (icon_cache->icon) -+ g_object_unref (G_OBJECT (icon_cache->icon)); -+ icon_cache->icon = NULL; -+ -+ if (icon_cache->mini_icon) -+ g_object_unref (G_OBJECT (icon_cache->mini_icon)); -+ icon_cache->mini_icon = NULL; -+ -+ icon_cache->origin = USING_NO_ICON; -+ -+ if (dirty_all) -+ { -+ icon_cache->wm_hints_dirty = TRUE; -+ icon_cache->kwm_win_icon_dirty = TRUE; -+ icon_cache->net_wm_icon_dirty = TRUE; -+ } -+} -+ -+static void -+replace_cache (WnckIconCache *icon_cache, -+ IconOrigin origin, -+ GdkPixbuf *new_icon, -+ GdkPixbuf *new_mini_icon) -+{ -+ clear_icon_cache (icon_cache, FALSE); -+ -+ icon_cache->origin = origin; -+ -+ if (new_icon) -+ g_object_ref (G_OBJECT (new_icon)); -+ -+ icon_cache->icon = new_icon; -+ -+ if (new_mini_icon) -+ g_object_ref (G_OBJECT (new_mini_icon)); -+ -+ icon_cache->mini_icon = new_mini_icon; -+} -+ -+static void -+free_pixels (guchar *pixels, -+ gpointer data) -+{ -+ g_free (pixels); -+} -+ -+static GdkPixbuf* -+scaled_from_pixdata (guchar *pixdata, -+ int w, -+ int h, -+ int new_w, -+ int new_h) -+{ -+ GdkPixbuf *src; -+ GdkPixbuf *dest; -+ -+ src = gdk_pixbuf_new_from_data (pixdata, -+ GDK_COLORSPACE_RGB, -+ TRUE, -+ 8, -+ w, h, w * 4, -+ free_pixels, -+ NULL); -+ -+ if (src == NULL) -+ return NULL; -+ -+ if (w != h) -+ { -+ GdkPixbuf *tmp; -+ int size; -+ -+ size = MAX (w, h); -+ -+ tmp = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, size, size); -+ -+ if (tmp != NULL) -+ { -+ gdk_pixbuf_fill (tmp, 0); -+ gdk_pixbuf_copy_area (src, 0, 0, w, h, -+ tmp, -+ (size - w) / 2, (size - h) / 2); -+ -+ g_object_unref (src); -+ src = tmp; -+ } -+ } -+ -+ if (w != new_w || h != new_h) -+ { -+ dest = gdk_pixbuf_scale_simple (src, new_w, new_h, GDK_INTERP_BILINEAR); -+ -+ g_object_unref (G_OBJECT (src)); -+ } -+ else -+ { -+ dest = src; -+ } -+ -+ return dest; -+} -+ -+WnckIconCache* -+_wnck_icon_cache_new (void) -+{ -+ WnckIconCache *icon_cache; -+ -+ icon_cache = g_slice_new0 (WnckIconCache); -+ -+ icon_cache->origin = USING_NO_ICON; -+ icon_cache->prev_pixmap = None; -+ icon_cache->icon = NULL; -+ icon_cache->mini_icon = NULL; -+ icon_cache->ideal_size = -1; /* won't be a legit size */ -+ icon_cache->ideal_mini_size = -1; -+ icon_cache->want_fallback = TRUE; -+ icon_cache->wm_hints_dirty = TRUE; -+ icon_cache->kwm_win_icon_dirty = TRUE; -+ icon_cache->net_wm_icon_dirty = TRUE; -+ -+ return icon_cache; -+} -+ -+void -+_wnck_icon_cache_free (WnckIconCache *icon_cache) -+{ -+ clear_icon_cache (icon_cache, FALSE); -+ -+ g_slice_free (WnckIconCache, icon_cache); -+} -+ -+void -+_wnck_icon_cache_property_changed (WnckIconCache *icon_cache, -+ Atom atom) -+{ -+ if (atom == _wnck_atom_get ("_NET_WM_ICON")) -+ icon_cache->net_wm_icon_dirty = TRUE; -+ else if (atom == _wnck_atom_get ("KWM_WIN_ICON")) -+ icon_cache->kwm_win_icon_dirty = TRUE; -+ else if (atom == _wnck_atom_get ("WM_HINTS")) -+ icon_cache->wm_hints_dirty = TRUE; -+} -+ -+gboolean -+_wnck_icon_cache_get_icon_invalidated (WnckIconCache *icon_cache) -+{ -+ if (icon_cache->origin <= USING_KWM_WIN_ICON && -+ icon_cache->kwm_win_icon_dirty) -+ return TRUE; -+ else if (icon_cache->origin <= USING_WM_HINTS && -+ icon_cache->wm_hints_dirty) -+ return TRUE; -+ else if (icon_cache->origin <= USING_NET_WM_ICON && -+ icon_cache->net_wm_icon_dirty) -+ return TRUE; -+ else if (icon_cache->origin < USING_FALLBACK_ICON && -+ icon_cache->want_fallback) -+ return TRUE; -+ else if (icon_cache->origin == USING_NO_ICON) -+ return TRUE; -+ else if (icon_cache->origin == USING_FALLBACK_ICON && -+ !icon_cache->want_fallback) -+ return TRUE; -+ else -+ return FALSE; -+} -+ -+void -+_wnck_icon_cache_set_want_fallback (WnckIconCache *icon_cache, -+ gboolean setting) -+{ -+ icon_cache->want_fallback = setting; -+} -+ -+gboolean -+_wnck_icon_cache_get_is_fallback (WnckIconCache *icon_cache) -+{ -+ return icon_cache->origin == USING_FALLBACK_ICON; -+} -+ -+gboolean -+_wnck_read_icons (WnckScreen *screen, -+ Window xwindow, -+ WnckIconCache *icon_cache, -+ GdkPixbuf **iconp, -+ int ideal_size, -+ GdkPixbuf **mini_iconp, -+ int ideal_mini_size) -+{ -+ Screen *xscreen; -+ Display *display; -+ guchar *pixdata; -+ int w, h; -+ guchar *mini_pixdata; -+ int mini_w, mini_h; -+ Pixmap pixmap; -+ Pixmap mask; -+ XWMHints *hints; -+ -+ /* Return value is whether the icon changed */ -+ -+ g_return_val_if_fail (icon_cache != NULL, FALSE); -+ -+ xscreen = _wnck_screen_get_xscreen (screen); -+ display = DisplayOfScreen (xscreen); -+ -+ *iconp = NULL; -+ *mini_iconp = NULL; -+ -+ if (ideal_size != icon_cache->ideal_size || -+ ideal_mini_size != icon_cache->ideal_mini_size) -+ clear_icon_cache (icon_cache, TRUE); -+ -+ icon_cache->ideal_size = ideal_size; -+ icon_cache->ideal_mini_size = ideal_mini_size; -+ -+ if (!_wnck_icon_cache_get_icon_invalidated (icon_cache)) -+ return FALSE; /* we have no new info to use */ -+ -+ pixdata = NULL; -+ -+ /* Our algorithm here assumes that we can't have for example origin -+ * < USING_NET_WM_ICON and icon_cache->net_wm_icon_dirty == FALSE -+ * unless we have tried to read NET_WM_ICON. -+ * -+ * Put another way, if an icon origin is not dirty, then we have -+ * tried to read it at the current size. If it is dirty, then -+ * we haven't done that since the last change. -+ */ -+ -+ if (icon_cache->origin <= USING_NET_WM_ICON && -+ icon_cache->net_wm_icon_dirty) -+ -+ { -+ icon_cache->net_wm_icon_dirty = FALSE; -+ -+ if (read_rgb_icon (xscreen, xwindow, -+ ideal_size, -+ ideal_mini_size, -+ &w, &h, &pixdata, -+ &mini_w, &mini_h, &mini_pixdata)) -+ { -+ *iconp = scaled_from_pixdata (pixdata, w, h, ideal_size, ideal_size); -+ -+ *mini_iconp = scaled_from_pixdata (mini_pixdata, mini_w, mini_h, -+ ideal_mini_size, ideal_mini_size); -+ -+ replace_cache (icon_cache, USING_NET_WM_ICON, -+ *iconp, *mini_iconp); -+ -+ return TRUE; -+ } -+ } -+ -+ if (icon_cache->origin <= USING_WM_HINTS && -+ icon_cache->wm_hints_dirty) -+ { -+ icon_cache->wm_hints_dirty = FALSE; -+ -+ _wnck_error_trap_push (display); -+ hints = XGetWMHints (display, xwindow); -+ _wnck_error_trap_pop (display); -+ pixmap = None; -+ mask = None; -+ if (hints) -+ { -+ if (hints->flags & IconPixmapHint) -+ pixmap = hints->icon_pixmap; -+ if (hints->flags & IconMaskHint) -+ mask = hints->icon_mask; -+ -+ XFree (hints); -+ hints = NULL; -+ } -+ -+ /* We won't update if pixmap is unchanged; -+ * avoids a get_from_drawable() on every geometry -+ * hints change -+ */ -+ if ((pixmap != icon_cache->prev_pixmap || -+ mask != icon_cache->prev_mask) && -+ pixmap != None) -+ { -+ if (try_pixmap_and_mask (xscreen, pixmap, mask, -+ iconp, ideal_size, -+ mini_iconp, ideal_mini_size)) -+ { -+ icon_cache->prev_pixmap = pixmap; -+ icon_cache->prev_mask = mask; -+ -+ replace_cache (icon_cache, USING_WM_HINTS, -+ *iconp, *mini_iconp); -+ -+ return TRUE; -+ } -+ } -+ } -+ -+ if (icon_cache->origin <= USING_KWM_WIN_ICON && -+ icon_cache->kwm_win_icon_dirty) -+ { -+ icon_cache->kwm_win_icon_dirty = FALSE; -+ -+ get_kwm_win_icon (xscreen, xwindow, &pixmap, &mask); -+ -+ if ((pixmap != icon_cache->prev_pixmap || -+ mask != icon_cache->prev_mask) && -+ pixmap != None) -+ { -+ if (try_pixmap_and_mask (xscreen, pixmap, mask, -+ iconp, ideal_size, -+ mini_iconp, ideal_mini_size)) -+ { -+ icon_cache->prev_pixmap = pixmap; -+ icon_cache->prev_mask = mask; -+ -+ replace_cache (icon_cache, USING_KWM_WIN_ICON, -+ *iconp, *mini_iconp); -+ -+ return TRUE; -+ } -+ } -+ } -+ -+ if (icon_cache->want_fallback && -+ icon_cache->origin < USING_FALLBACK_ICON) -+ { -+ _wnck_get_fallback_icons (iconp, -+ ideal_size, -+ mini_iconp, -+ ideal_mini_size); -+ -+ replace_cache (icon_cache, USING_FALLBACK_ICON, -+ *iconp, *mini_iconp); -+ -+ return TRUE; -+ } -+ -+ if (!icon_cache->want_fallback && -+ icon_cache->origin == USING_FALLBACK_ICON) -+ { -+ /* Get rid of current icon */ -+ clear_icon_cache (icon_cache, FALSE); -+ -+ return TRUE; -+ } -+ -+ /* found nothing new */ -+ return FALSE; -+} -diff --git a/libwnck/xutils.c b/libwnck/xutils.c -index 8c14234..58873dc 100644 ---- a/libwnck/xutils.c -+++ b/libwnck/xutils.c -@@ -1451,206 +1451,7 @@ _wnck_select_input (Screen *screen, - return old_mask; - } - --static gboolean --find_best_size (gulong *data, -- gulong nitems, -- int ideal_size, -- int *width, -- int *height, -- gulong **start) --{ -- int best_w; -- int best_h; -- gulong *best_start; -- -- *width = 0; -- *height = 0; -- *start = NULL; -- -- best_w = 0; -- best_h = 0; -- best_start = NULL; -- -- while (nitems > 0) -- { -- int w, h; -- gboolean replace; -- -- replace = FALSE; -- -- if (nitems < 3) -- return FALSE; /* no space for w, h */ -- -- w = data[0]; -- h = data[1]; -- -- if (nitems < ((gulong) (w * h) + 2)) -- break; /* not enough data */ -- -- if (best_start == NULL) -- { -- replace = TRUE; -- } -- else -- { -- /* work with averages */ -- int best_size = (best_w + best_h) / 2; -- int this_size = (w + h) / 2; -- -- /* larger than desired is always better than smaller */ -- if (best_size < ideal_size && -- this_size >= ideal_size) -- replace = TRUE; -- /* if we have too small, pick anything bigger */ -- else if (best_size < ideal_size && -- this_size > best_size) -- replace = TRUE; -- /* if we have too large, pick anything smaller -- * but still >= the ideal -- */ -- else if (best_size > ideal_size && -- this_size >= ideal_size && -- this_size < best_size) -- replace = TRUE; -- } -- -- if (replace) -- { -- best_start = data + 2; -- best_w = w; -- best_h = h; -- } -- -- data += (w * h) + 2; -- nitems -= (w * h) + 2; -- } -- -- if (best_start) -- { -- *start = best_start; -- *width = best_w; -- *height = best_h; -- return TRUE; -- } -- else -- return FALSE; --} -- --static void --argbdata_to_pixdata (gulong *argb_data, int len, guchar **pixdata) --{ -- guchar *p; -- int i; -- -- *pixdata = g_new (guchar, len * 4); -- p = *pixdata; -- -- /* One could speed this up a lot. */ -- i = 0; -- while (i < len) -- { -- guint argb; -- guint rgba; -- -- argb = argb_data[i]; -- rgba = (argb << 8) | (argb >> 24); -- -- *p = rgba >> 24; -- ++p; -- *p = (rgba >> 16) & 0xff; -- ++p; -- *p = (rgba >> 8) & 0xff; -- ++p; -- *p = rgba & 0xff; -- ++p; -- -- ++i; -- } --} -- --static gboolean --read_rgb_icon (Screen *screen, -- Window xwindow, -- int ideal_size, -- int ideal_mini_size, -- int *width, -- int *height, -- guchar **pixdata, -- int *mini_width, -- int *mini_height, -- guchar **mini_pixdata) --{ -- Display *display; -- Atom type; -- int format; -- gulong nitems; -- gulong bytes_after; -- int result, err; -- gulong *data; -- gulong *best; -- int w, h; -- gulong *best_mini; -- int mini_w, mini_h; -- -- display = DisplayOfScreen (screen); -- -- _wnck_error_trap_push (display); -- type = None; -- data = NULL; -- result = XGetWindowProperty (display, -- xwindow, -- _wnck_atom_get ("_NET_WM_ICON"), -- 0, G_MAXLONG, -- False, XA_CARDINAL, &type, &format, &nitems, -- &bytes_after, (void*)&data); -- -- err = _wnck_error_trap_pop (display); -- -- if (err != Success || -- result != Success) -- return FALSE; -- -- if (type != XA_CARDINAL) -- { -- XFree (data); -- return FALSE; -- } -- -- if (!find_best_size (data, nitems, ideal_size, &w, &h, &best)) -- { -- XFree (data); -- return FALSE; -- } -- -- if (!find_best_size (data, nitems, -- ideal_mini_size, -- &mini_w, &mini_h, &best_mini)) -- { -- XFree (data); -- return FALSE; -- } -- -- *width = w; -- *height = h; -- -- *mini_width = mini_w; -- *mini_height = mini_h; -- -- argbdata_to_pixdata (best, w * h, pixdata); -- argbdata_to_pixdata (best_mini, mini_w * mini_h, mini_pixdata); -- -- XFree (data); -- -- return TRUE; --} -- --static void --free_pixels (guchar *pixels, gpointer data) --{ -- g_free (pixels); --} -- --static cairo_surface_t * -+cairo_surface_t * - _wnck_cairo_surface_get_from_pixmap (Screen *screen, - Pixmap xpixmap) - { -@@ -1741,534 +1542,6 @@ _wnck_gdk_pixbuf_get_from_pixmap (Screen *screen, - return retval; - } - --static gboolean --try_pixmap_and_mask (Screen *screen, -- Pixmap src_pixmap, -- Pixmap src_mask, -- GdkPixbuf **iconp, -- int ideal_size, -- GdkPixbuf **mini_iconp, -- int ideal_mini_size) --{ -- cairo_surface_t *surface, *mask_surface, *image; -- GdkDisplay *gdk_display; -- GdkPixbuf *unscaled; -- int width, height; -- cairo_t *cr; -- -- if (src_pixmap == None) -- return FALSE; -- -- surface = _wnck_cairo_surface_get_from_pixmap (screen, src_pixmap); -- -- if (surface && src_mask != None) -- mask_surface = _wnck_cairo_surface_get_from_pixmap (screen, src_mask); -- else -- mask_surface = NULL; -- -- if (surface == NULL) -- return FALSE; -- -- gdk_display = gdk_x11_lookup_xdisplay (XDisplayOfScreen (screen)); -- g_assert (gdk_display != NULL); -- -- gdk_x11_display_error_trap_push (gdk_display); -- -- width = cairo_xlib_surface_get_width (surface); -- height = cairo_xlib_surface_get_height (surface); -- -- image = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, -- width, height); -- cr = cairo_create (image); -- -- /* Need special code for alpha-only surfaces. We only get those -- * for bitmaps. And in that case, it's a differentiation between -- * foreground (white) and background (black). -- */ -- if (cairo_surface_get_content (surface) & CAIRO_CONTENT_ALPHA) -- { -- cairo_push_group (cr); -- -- /* black background */ -- cairo_set_source_rgb (cr, 0, 0, 0); -- cairo_paint (cr); -- /* mask with white foreground */ -- cairo_set_source_rgb (cr, 1, 1, 1); -- cairo_mask_surface (cr, surface, 0, 0); -- -- cairo_pop_group_to_source (cr); -- } -- else -- cairo_set_source_surface (cr, surface, 0, 0); -- -- if (mask_surface) -- { -- cairo_mask_surface (cr, mask_surface, 0, 0); -- cairo_surface_destroy (mask_surface); -- } -- else -- cairo_paint (cr); -- -- cairo_surface_destroy (surface); -- cairo_destroy (cr); -- -- if (gdk_x11_display_error_trap_pop (gdk_display) != Success) -- { -- cairo_surface_destroy (image); -- return FALSE; -- } -- -- unscaled = gdk_pixbuf_get_from_surface (image, -- 0, 0, -- width, height); -- -- cairo_surface_destroy (image); -- -- if (unscaled) -- { -- *iconp = -- gdk_pixbuf_scale_simple (unscaled, -- ideal_size, -- ideal_size, -- GDK_INTERP_BILINEAR); -- *mini_iconp = -- gdk_pixbuf_scale_simple (unscaled, -- ideal_mini_size, -- ideal_mini_size, -- GDK_INTERP_BILINEAR); -- -- g_object_unref (G_OBJECT (unscaled)); -- return TRUE; -- } -- else -- return FALSE; --} -- --static void --get_kwm_win_icon (Screen *screen, -- Window xwindow, -- Pixmap *pixmap, -- Pixmap *mask) --{ -- Display *display; -- Atom type; -- int format; -- gulong nitems; -- gulong bytes_after; -- Pixmap *icons; -- int err, result; -- -- display = DisplayOfScreen (screen); -- -- *pixmap = None; -- *mask = None; -- -- _wnck_error_trap_push (display); -- icons = NULL; -- result = XGetWindowProperty (display, xwindow, -- _wnck_atom_get ("KWM_WIN_ICON"), -- 0, G_MAXLONG, -- False, -- _wnck_atom_get ("KWM_WIN_ICON"), -- &type, &format, &nitems, -- &bytes_after, (void*)&icons); -- -- err = _wnck_error_trap_pop (display); -- if (err != Success || -- result != Success) -- return; -- -- if (type != _wnck_atom_get ("KWM_WIN_ICON")) -- { -- XFree (icons); -- return; -- } -- -- *pixmap = icons[0]; -- *mask = icons[1]; -- -- XFree (icons); -- -- return; --} -- --typedef enum --{ -- /* These MUST be in ascending order of preference; -- * i.e. if we get _NET_WM_ICON and already have -- * WM_HINTS, we prefer _NET_WM_ICON -- */ -- USING_NO_ICON, -- USING_FALLBACK_ICON, -- USING_KWM_WIN_ICON, -- USING_WM_HINTS, -- USING_NET_WM_ICON --} IconOrigin; -- --struct _WnckIconCache --{ -- IconOrigin origin; -- Pixmap prev_pixmap; -- Pixmap prev_mask; -- GdkPixbuf *icon; -- GdkPixbuf *mini_icon; -- int ideal_size; -- int ideal_mini_size; -- guint want_fallback : 1; -- /* TRUE if these props have changed */ -- guint wm_hints_dirty : 1; -- guint kwm_win_icon_dirty : 1; -- guint net_wm_icon_dirty : 1; --}; -- --WnckIconCache* --_wnck_icon_cache_new (void) --{ -- WnckIconCache *icon_cache; -- -- icon_cache = g_slice_new0 (WnckIconCache); -- -- icon_cache->origin = USING_NO_ICON; -- icon_cache->prev_pixmap = None; -- icon_cache->icon = NULL; -- icon_cache->mini_icon = NULL; -- icon_cache->ideal_size = -1; /* won't be a legit size */ -- icon_cache->ideal_mini_size = -1; -- icon_cache->want_fallback = TRUE; -- icon_cache->wm_hints_dirty = TRUE; -- icon_cache->kwm_win_icon_dirty = TRUE; -- icon_cache->net_wm_icon_dirty = TRUE; -- -- return icon_cache; --} -- --static void --clear_icon_cache (WnckIconCache *icon_cache, -- gboolean dirty_all) --{ -- if (icon_cache->icon) -- g_object_unref (G_OBJECT (icon_cache->icon)); -- icon_cache->icon = NULL; -- -- if (icon_cache->mini_icon) -- g_object_unref (G_OBJECT (icon_cache->mini_icon)); -- icon_cache->mini_icon = NULL; -- -- icon_cache->origin = USING_NO_ICON; -- -- if (dirty_all) -- { -- icon_cache->wm_hints_dirty = TRUE; -- icon_cache->kwm_win_icon_dirty = TRUE; -- icon_cache->net_wm_icon_dirty = TRUE; -- } --} -- --void --_wnck_icon_cache_free (WnckIconCache *icon_cache) --{ -- clear_icon_cache (icon_cache, FALSE); -- -- g_slice_free (WnckIconCache, icon_cache); --} -- --void --_wnck_icon_cache_property_changed (WnckIconCache *icon_cache, -- Atom atom) --{ -- if (atom == _wnck_atom_get ("_NET_WM_ICON")) -- icon_cache->net_wm_icon_dirty = TRUE; -- else if (atom == _wnck_atom_get ("KWM_WIN_ICON")) -- icon_cache->kwm_win_icon_dirty = TRUE; -- else if (atom == _wnck_atom_get ("WM_HINTS")) -- icon_cache->wm_hints_dirty = TRUE; --} -- --gboolean --_wnck_icon_cache_get_icon_invalidated (WnckIconCache *icon_cache) --{ -- if (icon_cache->origin <= USING_KWM_WIN_ICON && -- icon_cache->kwm_win_icon_dirty) -- return TRUE; -- else if (icon_cache->origin <= USING_WM_HINTS && -- icon_cache->wm_hints_dirty) -- return TRUE; -- else if (icon_cache->origin <= USING_NET_WM_ICON && -- icon_cache->net_wm_icon_dirty) -- return TRUE; -- else if (icon_cache->origin < USING_FALLBACK_ICON && -- icon_cache->want_fallback) -- return TRUE; -- else if (icon_cache->origin == USING_NO_ICON) -- return TRUE; -- else if (icon_cache->origin == USING_FALLBACK_ICON && -- !icon_cache->want_fallback) -- return TRUE; -- else -- return FALSE; --} -- --void --_wnck_icon_cache_set_want_fallback (WnckIconCache *icon_cache, -- gboolean setting) --{ -- icon_cache->want_fallback = setting; --} -- --gboolean --_wnck_icon_cache_get_is_fallback (WnckIconCache *icon_cache) --{ -- return icon_cache->origin == USING_FALLBACK_ICON; --} -- --static void --replace_cache (WnckIconCache *icon_cache, -- IconOrigin origin, -- GdkPixbuf *new_icon, -- GdkPixbuf *new_mini_icon) --{ -- clear_icon_cache (icon_cache, FALSE); -- -- icon_cache->origin = origin; -- -- if (new_icon) -- g_object_ref (G_OBJECT (new_icon)); -- -- icon_cache->icon = new_icon; -- -- if (new_mini_icon) -- g_object_ref (G_OBJECT (new_mini_icon)); -- -- icon_cache->mini_icon = new_mini_icon; --} -- --static GdkPixbuf* --scaled_from_pixdata (guchar *pixdata, -- int w, -- int h, -- int new_w, -- int new_h) --{ -- GdkPixbuf *src; -- GdkPixbuf *dest; -- -- src = gdk_pixbuf_new_from_data (pixdata, -- GDK_COLORSPACE_RGB, -- TRUE, -- 8, -- w, h, w * 4, -- free_pixels, -- NULL); -- -- if (src == NULL) -- return NULL; -- -- if (w != h) -- { -- GdkPixbuf *tmp; -- int size; -- -- size = MAX (w, h); -- -- tmp = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, size, size); -- -- if (tmp != NULL) -- { -- gdk_pixbuf_fill (tmp, 0); -- gdk_pixbuf_copy_area (src, 0, 0, w, h, -- tmp, -- (size - w) / 2, (size - h) / 2); -- -- g_object_unref (src); -- src = tmp; -- } -- } -- -- if (w != new_w || h != new_h) -- { -- dest = gdk_pixbuf_scale_simple (src, new_w, new_h, GDK_INTERP_BILINEAR); -- -- g_object_unref (G_OBJECT (src)); -- } -- else -- { -- dest = src; -- } -- -- return dest; --} -- --gboolean --_wnck_read_icons (WnckScreen *screen, -- Window xwindow, -- WnckIconCache *icon_cache, -- GdkPixbuf **iconp, -- int ideal_size, -- GdkPixbuf **mini_iconp, -- int ideal_mini_size) --{ -- Screen *xscreen; -- Display *display; -- guchar *pixdata; -- int w, h; -- guchar *mini_pixdata; -- int mini_w, mini_h; -- Pixmap pixmap; -- Pixmap mask; -- XWMHints *hints; -- -- /* Return value is whether the icon changed */ -- -- g_return_val_if_fail (icon_cache != NULL, FALSE); -- -- xscreen = _wnck_screen_get_xscreen (screen); -- display = DisplayOfScreen (xscreen); -- -- *iconp = NULL; -- *mini_iconp = NULL; -- -- if (ideal_size != icon_cache->ideal_size || -- ideal_mini_size != icon_cache->ideal_mini_size) -- clear_icon_cache (icon_cache, TRUE); -- -- icon_cache->ideal_size = ideal_size; -- icon_cache->ideal_mini_size = ideal_mini_size; -- -- if (!_wnck_icon_cache_get_icon_invalidated (icon_cache)) -- return FALSE; /* we have no new info to use */ -- -- pixdata = NULL; -- -- /* Our algorithm here assumes that we can't have for example origin -- * < USING_NET_WM_ICON and icon_cache->net_wm_icon_dirty == FALSE -- * unless we have tried to read NET_WM_ICON. -- * -- * Put another way, if an icon origin is not dirty, then we have -- * tried to read it at the current size. If it is dirty, then -- * we haven't done that since the last change. -- */ -- -- if (icon_cache->origin <= USING_NET_WM_ICON && -- icon_cache->net_wm_icon_dirty) -- -- { -- icon_cache->net_wm_icon_dirty = FALSE; -- -- if (read_rgb_icon (xscreen, xwindow, -- ideal_size, -- ideal_mini_size, -- &w, &h, &pixdata, -- &mini_w, &mini_h, &mini_pixdata)) -- { -- *iconp = scaled_from_pixdata (pixdata, w, h, ideal_size, ideal_size); -- -- *mini_iconp = scaled_from_pixdata (mini_pixdata, mini_w, mini_h, -- ideal_mini_size, ideal_mini_size); -- -- replace_cache (icon_cache, USING_NET_WM_ICON, -- *iconp, *mini_iconp); -- -- return TRUE; -- } -- } -- -- if (icon_cache->origin <= USING_WM_HINTS && -- icon_cache->wm_hints_dirty) -- { -- icon_cache->wm_hints_dirty = FALSE; -- -- _wnck_error_trap_push (display); -- hints = XGetWMHints (display, xwindow); -- _wnck_error_trap_pop (display); -- pixmap = None; -- mask = None; -- if (hints) -- { -- if (hints->flags & IconPixmapHint) -- pixmap = hints->icon_pixmap; -- if (hints->flags & IconMaskHint) -- mask = hints->icon_mask; -- -- XFree (hints); -- hints = NULL; -- } -- -- /* We won't update if pixmap is unchanged; -- * avoids a get_from_drawable() on every geometry -- * hints change -- */ -- if ((pixmap != icon_cache->prev_pixmap || -- mask != icon_cache->prev_mask) && -- pixmap != None) -- { -- if (try_pixmap_and_mask (xscreen, pixmap, mask, -- iconp, ideal_size, -- mini_iconp, ideal_mini_size)) -- { -- icon_cache->prev_pixmap = pixmap; -- icon_cache->prev_mask = mask; -- -- replace_cache (icon_cache, USING_WM_HINTS, -- *iconp, *mini_iconp); -- -- return TRUE; -- } -- } -- } -- -- if (icon_cache->origin <= USING_KWM_WIN_ICON && -- icon_cache->kwm_win_icon_dirty) -- { -- icon_cache->kwm_win_icon_dirty = FALSE; -- -- get_kwm_win_icon (xscreen, xwindow, &pixmap, &mask); -- -- if ((pixmap != icon_cache->prev_pixmap || -- mask != icon_cache->prev_mask) && -- pixmap != None) -- { -- if (try_pixmap_and_mask (xscreen, pixmap, mask, -- iconp, ideal_size, -- mini_iconp, ideal_mini_size)) -- { -- icon_cache->prev_pixmap = pixmap; -- icon_cache->prev_mask = mask; -- -- replace_cache (icon_cache, USING_KWM_WIN_ICON, -- *iconp, *mini_iconp); -- -- return TRUE; -- } -- } -- } -- -- if (icon_cache->want_fallback && -- icon_cache->origin < USING_FALLBACK_ICON) -- { -- _wnck_get_fallback_icons (iconp, -- ideal_size, -- mini_iconp, -- ideal_mini_size); -- -- replace_cache (icon_cache, USING_FALLBACK_ICON, -- *iconp, *mini_iconp); -- -- return TRUE; -- } -- -- if (!icon_cache->want_fallback && -- icon_cache->origin == USING_FALLBACK_ICON) -- { -- /* Get rid of current icon */ -- clear_icon_cache (icon_cache, FALSE); -- -- return TRUE; -- } -- -- /* found nothing new */ -- return FALSE; --} -- - static GdkPixbuf* - default_icon_at_size (int size) - { -diff --git a/libwnck/xutils.h b/libwnck/xutils.h -index e5ef85d..2af255d 100644 ---- a/libwnck/xutils.h -+++ b/libwnck/xutils.h -@@ -159,25 +159,6 @@ void _wnck_keyboard_size (WnckScreen *screen, - void _wnck_toggle_showing_desktop (Screen *screen, - gboolean show); - --typedef struct _WnckIconCache WnckIconCache; -- --WnckIconCache *_wnck_icon_cache_new (void); --void _wnck_icon_cache_free (WnckIconCache *icon_cache); --void _wnck_icon_cache_property_changed (WnckIconCache *icon_cache, -- Atom atom); --gboolean _wnck_icon_cache_get_icon_invalidated (WnckIconCache *icon_cache); --void _wnck_icon_cache_set_want_fallback (WnckIconCache *icon_cache, -- gboolean setting); --gboolean _wnck_icon_cache_get_is_fallback (WnckIconCache *icon_cache); -- --gboolean _wnck_read_icons (WnckScreen *screen, -- Window xwindow, -- WnckIconCache *icon_cache, -- GdkPixbuf **iconp, -- int ideal_size, -- GdkPixbuf **mini_iconp, -- int ideal_mini_size); -- - void _wnck_get_fallback_icons (GdkPixbuf **iconp, - int ideal_size, - GdkPixbuf **mini_iconp, -@@ -213,6 +194,9 @@ void _wnck_set_desktop_layout (Screen *xscreen, - int rows, - int columns); - -+cairo_surface_t *_wnck_cairo_surface_get_from_pixmap (Screen *screen, -+ Pixmap xpixmap); -+ - GdkPixbuf* _wnck_gdk_pixbuf_get_from_pixmap (Screen *screen, - Pixmap xpixmap); - --- -2.31.1 - diff --git a/libwnck_0002-icons-Use-cairo-surfaces-to-render-icons.patch b/libwnck_0002-icons-Use-cairo-surfaces-to-render-icons_43.patch similarity index 89% rename from libwnck_0002-icons-Use-cairo-surfaces-to-render-icons.patch rename to libwnck_0002-icons-Use-cairo-surfaces-to-render-icons_43.patch index 35aee44..41465d4 100644 --- a/libwnck_0002-icons-Use-cairo-surfaces-to-render-icons.patch +++ b/libwnck_0002-icons-Use-cairo-surfaces-to-render-icons_43.patch @@ -1,4 +1,4 @@ -From 421809299f8d4bf20422c8300717eadb0ddc8ada Mon Sep 17 00:00:00 2001 +From 882fab71ee0260b1b70cb53edbc2bd2e9d35ebd3 Mon Sep 17 00:00:00 2001 From: Victor Kareh Date: Fri, 27 Nov 2020 11:25:08 -0500 Subject: [PATCH 2/5] icons: Use cairo surfaces to render icons @@ -6,25 +6,24 @@ Subject: [PATCH 2/5] icons: Use cairo surfaces to render icons This replaces GdkPixbuf manipulation with the cairo_surface equivalents. As a result, icons can now render sharply in HiDPI displays. --- - libwnck/application.c | 151 +++++++++++++++++++--- + libwnck/application.c | 151 ++++++++++++++++++--- libwnck/application.h | 3 + - libwnck/class-group.c | 172 ++++++++++++++++++++----- + libwnck/class-group.c | 172 +++++++++++++++++++----- libwnck/class-group.h | 3 + libwnck/pager.c | 20 +-- libwnck/selector.c | 103 +++++++-------- - libwnck/tasklist.c | 169 ++++++++++++------------ - libwnck/util.c | 4 +- + libwnck/tasklist.c | 173 ++++++++++++------------- libwnck/window.c | 139 +++++++++++++++++--- libwnck/window.h | 3 + libwnck/wnck-image-menu-item-private.h | 3 + libwnck/wnck-image-menu-item.c | 8 ++ - 12 files changed, 556 insertions(+), 222 deletions(-) + 11 files changed, 556 insertions(+), 222 deletions(-) diff --git a/libwnck/application.c b/libwnck/application.c -index 8d78209..66f1502 100644 +index 9ab7f48..d8283cc 100644 --- a/libwnck/application.c +++ b/libwnck/application.c -@@ -63,8 +63,8 @@ struct _WnckApplicationPrivate +@@ -62,8 +62,8 @@ struct _WnckApplicationPrivate WnckWindow *name_window; /* window we are using name of */ @@ -35,7 +34,7 @@ index 8d78209..66f1502 100644 WnckIconCache *icon_cache; -@@ -171,13 +171,8 @@ wnck_application_finalize (GObject *object) +@@ -159,13 +159,8 @@ wnck_application_finalize (GObject *object) g_free (application->priv->name); application->priv->name = NULL; @@ -51,9 +50,9 @@ index 8d78209..66f1502 100644 _wnck_icon_cache_free (application->priv->icon_cache); application->priv->icon_cache = NULL; -@@ -349,14 +344,20 @@ get_icons (WnckApplication *app) +@@ -336,14 +331,20 @@ get_icons (WnckApplication *app) + { app->priv->need_emit_icon_changed = TRUE; - app->priv->icon_from_leader = TRUE; - if (app->priv->icon) - g_object_unref (G_OBJECT (app->priv->icon)); @@ -78,7 +77,7 @@ index 8d78209..66f1502 100644 } /* FIXME we should really fall back to using the icon -@@ -417,12 +418,39 @@ find_icon_window (WnckApplication *app) +@@ -404,12 +405,39 @@ find_icon_window (WnckApplication *app) GdkPixbuf* wnck_application_get_icon (WnckApplication *app) { @@ -119,7 +118,7 @@ index 8d78209..66f1502 100644 else { WnckWindow *w = find_icon_window (app); -@@ -448,12 +476,39 @@ wnck_application_get_icon (WnckApplication *app) +@@ -435,12 +463,39 @@ wnck_application_get_icon (WnckApplication *app) GdkPixbuf* wnck_application_get_mini_icon (WnckApplication *app) { @@ -160,7 +159,7 @@ index 8d78209..66f1502 100644 else { WnckWindow *w = find_icon_window (app); -@@ -464,6 +519,68 @@ wnck_application_get_mini_icon (WnckApplication *app) +@@ -451,6 +506,68 @@ wnck_application_get_mini_icon (WnckApplication *app) } } @@ -230,7 +229,7 @@ index 8d78209..66f1502 100644 * wnck_application_get_icon_is_fallback: * @app: a #WnckApplication diff --git a/libwnck/application.h b/libwnck/application.h -index 7966a81..e8893f5 100644 +index 40fe4c6..f3ea970 100644 --- a/libwnck/application.h +++ b/libwnck/application.h @@ -29,6 +29,7 @@ @@ -241,7 +240,7 @@ index 7966a81..e8893f5 100644 G_BEGIN_DECLS -@@ -91,6 +92,8 @@ const char* wnck_application_get_icon_name (WnckApplication *app); +@@ -92,6 +93,8 @@ const char* wnck_application_get_icon_name (WnckApplication *app); int wnck_application_get_pid (WnckApplication *app); GdkPixbuf* wnck_application_get_icon (WnckApplication *app); GdkPixbuf* wnck_application_get_mini_icon (WnckApplication *app); @@ -251,10 +250,10 @@ index 7966a81..e8893f5 100644 const char* wnck_application_get_startup_id (WnckApplication *app); diff --git a/libwnck/class-group.c b/libwnck/class-group.c -index f4afc31..b0d4fee 100644 +index 46d1f24..e6c45d6 100644 --- a/libwnck/class-group.c +++ b/libwnck/class-group.c -@@ -58,8 +58,8 @@ struct _WnckClassGroupPrivate { +@@ -59,8 +59,8 @@ struct _WnckClassGroupPrivate { GHashTable *window_icon_handlers; GHashTable *window_name_handlers; @@ -265,7 +264,7 @@ index f4afc31..b0d4fee 100644 }; G_DEFINE_TYPE_WITH_PRIVATE (WnckClassGroup, wnck_class_group, G_TYPE_OBJECT); -@@ -183,17 +183,8 @@ wnck_class_group_finalize (GObject *object) +@@ -171,17 +171,8 @@ wnck_class_group_finalize (GObject *object) class_group->priv->window_name_handlers = NULL; } @@ -285,7 +284,7 @@ index f4afc31..b0d4fee 100644 G_OBJECT_CLASS (wnck_class_group_parent_class)->finalize (object); } -@@ -381,7 +372,8 @@ set_name (WnckClassGroup *class_group) +@@ -370,7 +361,8 @@ set_name (WnckClassGroup *class_group) /* Walks the list of applications, trying to get an icon from them */ static void @@ -295,7 +294,7 @@ index f4afc31..b0d4fee 100644 { GList *l; -@@ -397,15 +389,15 @@ get_icons_from_applications (WnckClassGroup *class_group, GdkPixbuf **icon, GdkP +@@ -386,15 +378,15 @@ get_icons_from_applications (WnckClassGroup *class_group, GdkPixbuf **icon, GdkP app = wnck_window_get_application (window); if (app) { @@ -315,7 +314,7 @@ index f4afc31..b0d4fee 100644 } } } -@@ -413,7 +405,8 @@ get_icons_from_applications (WnckClassGroup *class_group, GdkPixbuf **icon, GdkP +@@ -402,7 +394,8 @@ get_icons_from_applications (WnckClassGroup *class_group, GdkPixbuf **icon, GdkP /* Walks the list of windows, trying to get an icon from them */ static void @@ -325,7 +324,7 @@ index f4afc31..b0d4fee 100644 { GList *l; -@@ -426,15 +419,15 @@ get_icons_from_windows (WnckClassGroup *class_group, GdkPixbuf **icon, GdkPixbuf +@@ -415,15 +408,15 @@ get_icons_from_windows (WnckClassGroup *class_group, GdkPixbuf **icon, GdkPixbuf window = WNCK_WINDOW (l->data); @@ -345,7 +344,7 @@ index f4afc31..b0d4fee 100644 } } } -@@ -445,7 +438,7 @@ get_icons_from_windows (WnckClassGroup *class_group, GdkPixbuf **icon, GdkPixbuf +@@ -434,7 +427,7 @@ get_icons_from_windows (WnckClassGroup *class_group, GdkPixbuf **icon, GdkPixbuf static void set_icon (WnckClassGroup *class_group) { @@ -354,18 +353,18 @@ index f4afc31..b0d4fee 100644 gboolean icons_reffed = FALSE; get_icons_from_applications (class_group, &icon, &mini_icon); -@@ -455,28 +448,39 @@ set_icon (WnckClassGroup *class_group) +@@ -448,28 +441,39 @@ set_icon (WnckClassGroup *class_group) + + handle = wnck_screen_get_handle (class_group->priv->screen); - if (!icon || !mini_icon) - { - _wnck_get_fallback_icons (&icon, + GdkPixbuf *icon_pixbuf, *mini_icon_pixbuf; + + _wnck_get_fallback_icons (&icon_pixbuf, - _wnck_get_default_icon_size (), + _wnck_handle_get_default_icon_size (handle), - &mini_icon, + &mini_icon_pixbuf, - _wnck_get_default_mini_icon_size ()); + _wnck_handle_get_default_mini_icon_size (handle)); + if (icon_pixbuf) + { + icon = gdk_cairo_surface_create_from_pixbuf (icon_pixbuf, 0, NULL); @@ -403,7 +402,7 @@ index f4afc31..b0d4fee 100644 } g_signal_emit (G_OBJECT (class_group), signals[ICON_CHANGED], 0); -@@ -709,9 +713,39 @@ wnck_class_group_get_name (WnckClassGroup *class_group) +@@ -702,9 +706,39 @@ wnck_class_group_get_name (WnckClassGroup *class_group) GdkPixbuf * wnck_class_group_get_icon (WnckClassGroup *class_group) { @@ -444,7 +443,7 @@ index f4afc31..b0d4fee 100644 } /** -@@ -730,8 +764,76 @@ wnck_class_group_get_icon (WnckClassGroup *class_group) +@@ -723,8 +757,76 @@ wnck_class_group_get_icon (WnckClassGroup *class_group) **/ GdkPixbuf * wnck_class_group_get_mini_icon (WnckClassGroup *class_group) @@ -523,7 +522,7 @@ index f4afc31..b0d4fee 100644 + return cairo_surface_reference (class_group->priv->mini_icon); } diff --git a/libwnck/class-group.h b/libwnck/class-group.h -index ce084c3..5a9e07c 100644 +index 581cd22..122e0ed 100644 --- a/libwnck/class-group.h +++ b/libwnck/class-group.h @@ -30,6 +30,7 @@ @@ -534,7 +533,7 @@ index ce084c3..5a9e07c 100644 G_BEGIN_DECLS -@@ -81,6 +82,8 @@ const char * wnck_class_group_get_name (WnckClassGroup *class_group); +@@ -82,6 +83,8 @@ const char * wnck_class_group_get_name (WnckClassGroup *class_group); GdkPixbuf *wnck_class_group_get_icon (WnckClassGroup *class_group); GdkPixbuf *wnck_class_group_get_mini_icon (WnckClassGroup *class_group); @@ -544,10 +543,10 @@ index ce084c3..5a9e07c 100644 #ifndef WNCK_DISABLE_DEPRECATED G_DEPRECATED_FOR(wnck_class_group_get_id) diff --git a/libwnck/pager.c b/libwnck/pager.c -index c769d62..6a49585 100644 +index 4df766c..9b09928 100644 --- a/libwnck/pager.c +++ b/libwnck/pager.c -@@ -900,8 +900,9 @@ draw_window (cairo_t *cr, +@@ -984,8 +984,9 @@ draw_window (cairo_t *cr, gboolean translucent) { GtkStyleContext *context; @@ -558,7 +557,7 @@ index c769d62..6a49585 100644 gboolean is_active; GdkRGBA fg; gdouble translucency; -@@ -931,14 +932,15 @@ draw_window (cairo_t *cr, +@@ -1015,14 +1016,15 @@ draw_window (cairo_t *cr, cairo_pop_group_to_source (cr); cairo_paint_with_alpha (cr, translucency); @@ -577,7 +576,7 @@ index c769d62..6a49585 100644 /* If the icon is too big, fall back to mini icon. * We don't arbitrarily scale the icon, because it's -@@ -947,11 +949,12 @@ draw_window (cairo_t *cr, +@@ -1031,11 +1033,12 @@ draw_window (cairo_t *cr, if (icon_w > (winrect->width - 2) || icon_h > (winrect->height - 2)) { @@ -593,7 +592,7 @@ index c769d62..6a49585 100644 /* Give up. */ if (icon_w > (winrect->width - 2) || -@@ -967,7 +970,7 @@ draw_window (cairo_t *cr, +@@ -1051,7 +1054,7 @@ draw_window (cairo_t *cr, icon_y = winrect->y + (winrect->height - icon_h) / 2; cairo_push_group (cr); @@ -602,7 +601,7 @@ index c769d62..6a49585 100644 cairo_pop_group_to_source (cr); cairo_paint_with_alpha (cr, translucency); } -@@ -988,6 +991,7 @@ draw_window (cairo_t *cr, +@@ -1072,6 +1075,7 @@ draw_window (cairo_t *cr, cairo_stroke (cr); gtk_style_context_restore (context); @@ -611,11 +610,11 @@ index c769d62..6a49585 100644 static WnckWindow * diff --git a/libwnck/selector.c b/libwnck/selector.c -index b975b27..6d85273 100644 +index 4cf6189..fcc3322 100644 --- a/libwnck/selector.c +++ b/libwnck/selector.c -@@ -121,103 +121,96 @@ wnck_selector_get_screen (WnckSelector *selector) - return wnck_screen_get (gdk_x11_screen_get_screen_number (screen)); +@@ -135,103 +135,96 @@ wnck_selector_get_screen (WnckSelector *selector) + gdk_x11_screen_get_screen_number (screen)); } -static GdkPixbuf * @@ -767,10 +766,10 @@ index b975b27..6d85273 100644 static void diff --git a/libwnck/tasklist.c b/libwnck/tasklist.c -index 8791b10..9cb8f0b 100644 +index b773247..10c6cc8 100644 --- a/libwnck/tasklist.c +++ b/libwnck/tasklist.c -@@ -270,11 +270,11 @@ static WnckTask *wnck_task_new_from_startup_sequence (WnckTasklist *tasklis +@@ -289,11 +289,11 @@ static WnckTask *wnck_task_new_from_startup_sequence (WnckTasklist *tasklis #endif static gboolean wnck_task_get_needs_attention (WnckTask *task); @@ -783,7 +782,7 @@ index 8791b10..9cb8f0b 100644 static gint wnck_task_compare_alphabetically (gconstpointer a, gconstpointer b); static gint wnck_task_compare (gconstpointer a, -@@ -611,10 +611,10 @@ wnck_button_new (void) +@@ -637,10 +637,10 @@ wnck_button_set_handle (WnckButton *self, } static void @@ -797,7 +796,7 @@ index 8791b10..9cb8f0b 100644 } static void -@@ -3338,7 +3338,7 @@ wnck_task_popup_menu (WnckTask *task, +@@ -3533,7 +3533,7 @@ wnck_task_popup_menu (WnckTask *task, GtkWidget *menu; WnckTask *win_task; char *text; @@ -806,7 +805,7 @@ index 8791b10..9cb8f0b 100644 GtkWidget *menu_item; GList *l, *list; -@@ -3382,15 +3382,15 @@ wnck_task_popup_menu (WnckTask *task, +@@ -3577,15 +3577,15 @@ wnck_task_popup_menu (WnckTask *task, gtk_widget_set_tooltip_text (menu_item, text); g_free (text); @@ -826,7 +825,7 @@ index 8791b10..9cb8f0b 100644 } gtk_widget_show (menu_item); -@@ -3576,111 +3576,91 @@ wnck_task_get_text (WnckTask *task, +@@ -3771,102 +3771,78 @@ wnck_task_get_text (WnckTask *task, } static void @@ -881,9 +880,11 @@ index 8791b10..9cb8f0b 100644 } -static GdkPixbuf * --wnck_task_scale_icon (GdkPixbuf *orig, gboolean minimized) +static cairo_surface_t * -+wnck_task_scale_icon (cairo_surface_t *orig, gboolean minimized) + wnck_task_scale_icon (gsize mini_icon_size, +- GdkPixbuf *orig, ++ cairo_surface_t *orig, + gboolean minimized) { - int w, h; - GdkPixbuf *pixbuf; @@ -901,7 +902,7 @@ index 8791b10..9cb8f0b 100644 + cairo_image_surface_get_width (orig), + cairo_image_surface_get_height (orig)); -- if (h != (int) MINI_ICON_SIZE || +- if (h != (int) mini_icon_size || - !gdk_pixbuf_get_has_alpha (orig)) - { - double scale; @@ -909,10 +910,10 @@ index 8791b10..9cb8f0b 100644 - pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, - TRUE, - 8, -- MINI_ICON_SIZE * w / (double) h, -- MINI_ICON_SIZE); +- mini_icon_size * w / (double) h, +- mini_icon_size); - -- scale = MINI_ICON_SIZE / (double) gdk_pixbuf_get_height (orig); +- scale = mini_icon_size / (double) gdk_pixbuf_get_height (orig); - - gdk_pixbuf_scale (orig, - pixbuf, @@ -957,19 +958,25 @@ index 8791b10..9cb8f0b 100644 { WnckWindowState state; - GdkPixbuf *pixbuf; + WnckHandle *handle; + gsize mini_icon_size; + cairo_surface_t *surface; + cairo_surface_t *mini_icon; - pixbuf = NULL; + surface = NULL; + handle = task->tasklist->priv->handle; + mini_icon_size = _wnck_handle_get_default_mini_icon_size (handle); +@@ -3874,17 +3850,21 @@ wnck_task_get_icon (WnckTask *task) switch (task->type) { case WNCK_TASK_CLASS_GROUP: -- pixbuf = wnck_task_scale_icon (wnck_class_group_get_mini_icon (task->class_group), -- FALSE); +- pixbuf = wnck_task_scale_icon (mini_icon_size, +- wnck_class_group_get_mini_icon (task->class_group), +- FALSE); + mini_icon = wnck_class_group_get_mini_icon_surface (task->class_group); -+ surface = wnck_task_scale_icon (mini_icon, FALSE); ++ surface = wnck_task_scale_icon (mini_icon_size, mini_icon, FALSE); + + cairo_surface_destroy (mini_icon); break; @@ -977,24 +984,27 @@ index 8791b10..9cb8f0b 100644 case WNCK_TASK_WINDOW: state = wnck_window_get_state (task->window); -- pixbuf = wnck_task_scale_icon (wnck_window_get_mini_icon (task->window), -- state & WNCK_WINDOW_STATE_MINIMIZED); +- pixbuf = wnck_task_scale_icon (mini_icon_size, +- wnck_window_get_mini_icon (task->window), +- state & WNCK_WINDOW_STATE_MINIMIZED); + mini_icon = wnck_window_get_mini_icon_surface (task->window); -+ surface = wnck_task_scale_icon (mini_icon, state & WNCK_WINDOW_STATE_MINIMIZED); ++ surface = wnck_task_scale_icon (mini_icon_size, ++ mini_icon, ++ state & WNCK_WINDOW_STATE_MINIMIZED); + + cairo_surface_destroy (mini_icon); break; case WNCK_TASK_STARTUP_SEQUENCE: -@@ -3701,16 +3681,28 @@ wnck_task_get_icon (WnckTask *task) +@@ -3905,16 +3885,28 @@ wnck_task_get_icon (WnckTask *task) if (loaded != NULL) { -- pixbuf = wnck_task_scale_icon (loaded, FALSE); +- pixbuf = wnck_task_scale_icon (mini_icon_size, loaded, FALSE); + cairo_surface_t *temp; + + temp = gdk_cairo_surface_create_from_pixbuf (loaded, 0, NULL); -+ surface = wnck_task_scale_icon (temp, FALSE); ++ surface = wnck_task_scale_icon (mini_icon_size, temp, FALSE); + + cairo_surface_destroy (temp); g_object_unref (G_OBJECT (loaded)); @@ -1007,7 +1017,7 @@ index 8791b10..9cb8f0b 100644 { + GdkPixbuf *pixbuf; _wnck_get_fallback_icons (NULL, 0, - &pixbuf, MINI_ICON_SIZE); + &pixbuf, mini_icon_size); + + if (pixbuf != NULL) + { @@ -1017,7 +1027,7 @@ index 8791b10..9cb8f0b 100644 } #endif break; -@@ -3719,7 +3711,7 @@ wnck_task_get_icon (WnckTask *task) +@@ -3923,7 +3915,7 @@ wnck_task_get_icon (WnckTask *task) break; } @@ -1026,7 +1036,7 @@ index 8791b10..9cb8f0b 100644 } static gboolean -@@ -3768,12 +3760,13 @@ wnck_task_get_needs_attention (WnckTask *task) +@@ -3972,12 +3964,13 @@ wnck_task_get_needs_attention (WnckTask *task) static void wnck_task_update_visible_state (WnckTask *task) { @@ -1044,7 +1054,7 @@ index 8791b10..9cb8f0b 100644 text = wnck_task_get_text (task, TRUE, TRUE); if (text != NULL) -@@ -4244,7 +4237,7 @@ wnck_task_draw (GtkWidget *widget, +@@ -4448,7 +4441,7 @@ wnck_task_draw (GtkWidget *widget, static void wnck_task_create_widgets (WnckTask *task, GtkReliefStyle relief) { @@ -1053,7 +1063,7 @@ index 8791b10..9cb8f0b 100644 char *text; static const GtkTargetEntry targets[] = { { (gchar *) "application/x-wnck-window-id", 0, 0 } -@@ -4271,9 +4264,9 @@ wnck_task_create_widgets (WnckTask *task, GtkReliefStyle relief) +@@ -4477,9 +4470,9 @@ wnck_task_create_widgets (WnckTask *task, GtkReliefStyle relief) gtk_drag_dest_set (GTK_WIDGET (task->button), 0, NULL, 0, GDK_ACTION_DEFAULT); @@ -1066,33 +1076,11 @@ index 8791b10..9cb8f0b 100644 text = wnck_task_get_text (task, TRUE, TRUE); wnck_button_set_text (WNCK_BUTTON (task->button), text); -diff --git a/libwnck/util.c b/libwnck/util.c -index d51ee05..8ccce16 100644 ---- a/libwnck/util.c -+++ b/libwnck/util.c -@@ -721,7 +721,7 @@ wnck_set_default_icon_size (gsize size) - gsize - _wnck_get_default_icon_size (void) - { -- return default_icon_size; -+ return default_icon_size * _wnck_get_window_scaling_factor (); - } - - static gsize default_mini_icon_size = WNCK_DEFAULT_MINI_ICON_SIZE; -@@ -766,7 +766,7 @@ wnck_set_default_mini_icon_size (gsize size) - gsize - _wnck_get_default_mini_icon_size (void) - { -- return default_mini_icon_size; -+ return default_mini_icon_size * _wnck_get_window_scaling_factor (); - } - - /** diff --git a/libwnck/window.c b/libwnck/window.c -index 25c56a5..bd8ac31 100644 +index 35bb37c..f01b4c2 100644 --- a/libwnck/window.c +++ b/libwnck/window.c -@@ -89,8 +89,8 @@ struct _WnckWindowPrivate +@@ -87,8 +87,8 @@ struct _WnckWindowPrivate WnckWindowType wintype; @@ -1103,7 +1091,7 @@ index 25c56a5..bd8ac31 100644 WnckIconCache *icon_cache; -@@ -423,13 +423,8 @@ wnck_window_finalize (GObject *object) +@@ -411,13 +411,8 @@ wnck_window_finalize (GObject *object) g_free (window->priv->session_id_utf8); window->priv->session_id_utf8 = NULL; @@ -1119,7 +1107,7 @@ index 25c56a5..bd8ac31 100644 _wnck_icon_cache_free (window->priv->icon_cache); window->priv->icon_cache = NULL; -@@ -2136,14 +2131,20 @@ get_icons (WnckWindow *window) +@@ -2132,14 +2127,20 @@ get_icons (WnckWindow *window) { window->priv->need_emit_icon_changed = TRUE; @@ -1146,7 +1134,7 @@ index 25c56a5..bd8ac31 100644 } g_assert ((window->priv->icon && window->priv->mini_icon) || -@@ -2177,11 +2178,41 @@ _wnck_window_load_icons (WnckWindow *window) +@@ -2173,11 +2174,41 @@ _wnck_window_load_icons (WnckWindow *window) GdkPixbuf* wnck_window_get_icon (WnckWindow *window) { @@ -1189,7 +1177,7 @@ index 25c56a5..bd8ac31 100644 } /** -@@ -2198,12 +2229,86 @@ wnck_window_get_icon (WnckWindow *window) +@@ -2194,12 +2225,86 @@ wnck_window_get_icon (WnckWindow *window) **/ GdkPixbuf* wnck_window_get_mini_icon (WnckWindow *window) @@ -1278,7 +1266,7 @@ index 25c56a5..bd8ac31 100644 /** diff --git a/libwnck/window.h b/libwnck/window.h -index 72545aa..fb3ce51 100644 +index 47c6543..2bec086 100644 --- a/libwnck/window.h +++ b/libwnck/window.h @@ -33,6 +33,7 @@ @@ -1289,7 +1277,7 @@ index 72545aa..fb3ce51 100644 G_BEGIN_DECLS -@@ -381,6 +382,8 @@ gboolean wnck_window_transient_is_most_recently_activated (WnckWindow *window); +@@ -382,6 +383,8 @@ gboolean wnck_window_transient_is_most_recently_activated (WnckWindow *window); GdkPixbuf* wnck_window_get_icon (WnckWindow *window); GdkPixbuf* wnck_window_get_mini_icon (WnckWindow *window); @@ -1332,5 +1320,5 @@ index e8e6d87..7f5efdc 100644 wnck_image_menu_item_set_image_from_window (WnckImageMenuItem *item, WnckWindow *window) -- -2.31.1 +2.37.2 diff --git a/libwnck_0003-xutils-Change-icons-to-being-cairo-surfaces.patch b/libwnck_0003-xutils-Change-icons-to-being-cairo-surfaces_43.patch similarity index 84% rename from libwnck_0003-xutils-Change-icons-to-being-cairo-surfaces.patch rename to libwnck_0003-xutils-Change-icons-to-being-cairo-surfaces_43.patch index 70f4874..f0f1396 100644 --- a/libwnck_0003-xutils-Change-icons-to-being-cairo-surfaces.patch +++ b/libwnck_0003-xutils-Change-icons-to-being-cairo-surfaces_43.patch @@ -1,4 +1,4 @@ -From b5db0c72ffcb702f7c277bf46ce0c6585b079b25 Mon Sep 17 00:00:00 2001 +From 53d505622e90805684260873d0fbadaec9e2d3ed Mon Sep 17 00:00:00 2001 From: Victor Kareh Date: Mon, 20 Jan 2020 13:38:59 -0500 Subject: [PATCH 3/5] xutils: Change icons to being cairo surfaces @@ -13,22 +13,21 @@ adapted from https://gitlab.gnome.org/GNOME/mutter/commit/af7f51b9 libwnck/application.c | 22 +-- libwnck/class-group.c | 17 +- libwnck/tasklist.c | 9 +- - libwnck/util.c | 4 +- libwnck/window.c | 22 +-- libwnck/wnck-icon-cache-private.h | 15 +- - libwnck/wnck-icon-cache.c | 305 +++++++++++++----------------- - libwnck/xutils.c | 42 ++-- + libwnck/wnck-icon-cache.c | 299 +++++++++++++----------------- + libwnck/xutils.c | 42 ++--- libwnck/xutils.h | 11 +- - 9 files changed, 186 insertions(+), 261 deletions(-) + 8 files changed, 179 insertions(+), 258 deletions(-) diff --git a/libwnck/application.c b/libwnck/application.c -index 66f1502..8d9d034 100644 +index d8283cc..b441eb6 100644 --- a/libwnck/application.c +++ b/libwnck/application.c -@@ -323,15 +323,17 @@ wnck_application_get_pid (WnckApplication *app) - static void +@@ -309,10 +309,11 @@ static void get_icons (WnckApplication *app) { + WnckHandle *handle; - GdkPixbuf *icon; - GdkPixbuf *mini_icon; + cairo_surface_t *icon; @@ -37,15 +36,17 @@ index 66f1502..8d9d034 100644 gsize mini_size; + int scaling_factor; - icon = NULL; + handle = wnck_screen_get_handle (app->priv->screen); + +@@ -320,6 +321,7 @@ get_icons (WnckApplication *app) mini_icon = NULL; - normal_size = _wnck_get_default_icon_size (); - mini_size = _wnck_get_default_mini_icon_size (); + normal_size = _wnck_handle_get_default_icon_size (handle); + mini_size = _wnck_handle_get_default_mini_icon_size (handle); + scaling_factor = _wnck_get_window_scaling_factor (); if (_wnck_read_icons (app->priv->screen, app->priv->xwindow, -@@ -339,7 +341,8 @@ get_icons (WnckApplication *app) +@@ -327,24 +329,16 @@ get_icons (WnckApplication *app) &icon, normal_size, &mini_icon, @@ -54,8 +55,7 @@ index 66f1502..8d9d034 100644 + scaling_factor)) { app->priv->need_emit_icon_changed = TRUE; - app->priv->icon_from_leader = TRUE; -@@ -347,17 +350,8 @@ get_icons (WnckApplication *app) + g_clear_pointer (&app->priv->icon, cairo_surface_destroy); g_clear_pointer (&app->priv->mini_icon, cairo_surface_destroy); @@ -76,21 +76,21 @@ index 66f1502..8d9d034 100644 /* FIXME we should really fall back to using the icon diff --git a/libwnck/class-group.c b/libwnck/class-group.c -index b0d4fee..dbf5e1d 100644 +index e6c45d6..7899497 100644 --- a/libwnck/class-group.c +++ b/libwnck/class-group.c -@@ -448,23 +448,10 @@ set_icon (WnckClassGroup *class_group) +@@ -441,23 +441,10 @@ set_icon (WnckClassGroup *class_group) + + handle = wnck_screen_get_handle (class_group->priv->screen); - if (!icon || !mini_icon) - { - GdkPixbuf *icon_pixbuf, *mini_icon_pixbuf; - - _wnck_get_fallback_icons (&icon_pixbuf, + _wnck_get_fallback_icons (&icon, - _wnck_get_default_icon_size (), + _wnck_handle_get_default_icon_size (handle), - &mini_icon_pixbuf, + &mini_icon, - _wnck_get_default_mini_icon_size ()); + _wnck_handle_get_default_mini_icon_size (handle)); - if (icon_pixbuf) - { - icon = gdk_cairo_surface_create_from_pixbuf (icon_pixbuf, 0, NULL); @@ -106,56 +106,34 @@ index b0d4fee..dbf5e1d 100644 icons_reffed = TRUE; } diff --git a/libwnck/tasklist.c b/libwnck/tasklist.c -index 9cb8f0b..b10ef8c 100644 +index 10c6cc8..3e7b789 100644 --- a/libwnck/tasklist.c +++ b/libwnck/tasklist.c -@@ -3694,15 +3694,8 @@ wnck_task_get_icon (WnckTask *task) +@@ -3898,15 +3898,8 @@ wnck_task_get_icon (WnckTask *task) if (surface == NULL) { - GdkPixbuf *pixbuf; _wnck_get_fallback_icons (NULL, 0, -- &pixbuf, MINI_ICON_SIZE); +- &pixbuf, mini_icon_size); - - if (pixbuf != NULL) - { - surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, 0, NULL); - g_object_unref (pixbuf); - } -+ &surface, MINI_ICON_SIZE); ++ &surface, mini_icon_size); } #endif break; -diff --git a/libwnck/util.c b/libwnck/util.c -index 8ccce16..d51ee05 100644 ---- a/libwnck/util.c -+++ b/libwnck/util.c -@@ -721,7 +721,7 @@ wnck_set_default_icon_size (gsize size) - gsize - _wnck_get_default_icon_size (void) - { -- return default_icon_size * _wnck_get_window_scaling_factor (); -+ return default_icon_size; - } - - static gsize default_mini_icon_size = WNCK_DEFAULT_MINI_ICON_SIZE; -@@ -766,7 +766,7 @@ wnck_set_default_mini_icon_size (gsize size) - gsize - _wnck_get_default_mini_icon_size (void) - { -- return default_mini_icon_size * _wnck_get_window_scaling_factor (); -+ return default_mini_icon_size; - } - - /** diff --git a/libwnck/window.c b/libwnck/window.c -index bd8ac31..92f3c08 100644 +index f01b4c2..5c97675 100644 --- a/libwnck/window.c +++ b/libwnck/window.c -@@ -2111,15 +2111,17 @@ wnck_window_transient_is_most_recently_activated (WnckWindow *window) - static void +@@ -2105,10 +2105,11 @@ static void get_icons (WnckWindow *window) { + WnckHandle *handle; - GdkPixbuf *icon; - GdkPixbuf *mini_icon; + cairo_surface_t *icon; @@ -164,15 +142,17 @@ index bd8ac31..92f3c08 100644 gsize mini_size; + int scaling_factor; - icon = NULL; + handle = wnck_screen_get_handle (window->priv->screen); + +@@ -2116,6 +2117,7 @@ get_icons (WnckWindow *window) mini_icon = NULL; - normal_size = _wnck_get_default_icon_size (); - mini_size = _wnck_get_default_mini_icon_size (); + normal_size = _wnck_handle_get_default_icon_size (handle); + mini_size = _wnck_handle_get_default_mini_icon_size (handle); + scaling_factor = _wnck_get_window_scaling_factor (); if (_wnck_read_icons (window->priv->screen, window->priv->xwindow, -@@ -2127,24 +2129,16 @@ get_icons (WnckWindow *window) +@@ -2123,24 +2125,16 @@ get_icons (WnckWindow *window) &icon, normal_size, &mini_icon, @@ -228,10 +208,10 @@ index 6a3d5ec..d3c39e2 100644 G_END_DECLS diff --git a/libwnck/wnck-icon-cache.c b/libwnck/wnck-icon-cache.c -index 1749585..38131d8 100644 +index 9ff8d15..d9e67e8 100644 --- a/libwnck/wnck-icon-cache.c +++ b/libwnck/wnck-icon-cache.c -@@ -45,8 +45,8 @@ struct _WnckIconCache +@@ -44,8 +44,8 @@ struct _WnckIconCache IconOrigin origin; Pixmap prev_pixmap; Pixmap prev_mask; @@ -242,7 +222,7 @@ index 1749585..38131d8 100644 int ideal_size; int ideal_mini_size; guint want_fallback : 1; -@@ -141,49 +141,65 @@ find_best_size (gulong *data, +@@ -139,49 +139,65 @@ find_best_size (gulong *data, return FALSE; } @@ -342,7 +322,7 @@ index 1749585..38131d8 100644 { Display *display; Atom type; -@@ -221,7 +237,9 @@ read_rgb_icon (Screen *screen, +@@ -219,7 +235,9 @@ read_rgb_icon (Screen *screen, return FALSE; } @@ -353,7 +333,7 @@ index 1749585..38131d8 100644 { XFree (data); return FALSE; -@@ -235,14 +253,8 @@ read_rgb_icon (Screen *screen, +@@ -233,14 +251,8 @@ read_rgb_icon (Screen *screen, return FALSE; } @@ -370,7 +350,7 @@ index 1749585..38131d8 100644 XFree (data); -@@ -250,27 +262,27 @@ read_rgb_icon (Screen *screen, +@@ -248,27 +260,27 @@ read_rgb_icon (Screen *screen, } static gboolean @@ -408,7 +388,7 @@ index 1749585..38131d8 100644 else mask_surface = NULL; -@@ -326,26 +338,41 @@ try_pixmap_and_mask (Screen *screen, +@@ -324,26 +336,41 @@ try_pixmap_and_mask (Screen *screen, return FALSE; } @@ -468,7 +448,7 @@ index 1749585..38131d8 100644 return TRUE; } else -@@ -404,13 +431,8 @@ static void +@@ -354,13 +381,8 @@ static void clear_icon_cache (WnckIconCache *icon_cache, gboolean dirty_all) { @@ -484,7 +464,7 @@ index 1749585..38131d8 100644 icon_cache->origin = USING_NO_ICON; -@@ -423,89 +445,26 @@ clear_icon_cache (WnckIconCache *icon_cache, +@@ -372,89 +394,26 @@ clear_icon_cache (WnckIconCache *icon_cache, } static void @@ -580,7 +560,7 @@ index 1749585..38131d8 100644 WnckIconCache* _wnck_icon_cache_new (void) { -@@ -585,22 +544,17 @@ _wnck_icon_cache_get_is_fallback (WnckIconCache *icon_cache) +@@ -528,22 +487,17 @@ _wnck_icon_cache_get_is_fallback (WnckIconCache *icon_cache) } gboolean @@ -611,7 +591,7 @@ index 1749585..38131d8 100644 XWMHints *hints; /* Return value is whether the icon changed */ -@@ -613,6 +567,9 @@ _wnck_read_icons (WnckScreen *screen, +@@ -556,6 +510,9 @@ _wnck_read_icons (WnckScreen *screen, *iconp = NULL; *mini_iconp = NULL; @@ -621,7 +601,7 @@ index 1749585..38131d8 100644 if (ideal_size != icon_cache->ideal_size || ideal_mini_size != icon_cache->ideal_mini_size) clear_icon_cache (icon_cache, TRUE); -@@ -623,8 +580,6 @@ _wnck_read_icons (WnckScreen *screen, +@@ -566,8 +523,6 @@ _wnck_read_icons (WnckScreen *screen, if (!_wnck_icon_cache_get_icon_invalidated (icon_cache)) return FALSE; /* we have no new info to use */ @@ -630,7 +610,7 @@ index 1749585..38131d8 100644 /* Our algorithm here assumes that we can't have for example origin * < USING_NET_WM_ICON and icon_cache->net_wm_icon_dirty == FALSE * unless we have tried to read NET_WM_ICON. -@@ -636,21 +591,15 @@ _wnck_read_icons (WnckScreen *screen, +@@ -579,21 +534,15 @@ _wnck_read_icons (WnckScreen *screen, if (icon_cache->origin <= USING_NET_WM_ICON && icon_cache->net_wm_icon_dirty) @@ -654,7 +634,7 @@ index 1749585..38131d8 100644 replace_cache (icon_cache, USING_NET_WM_ICON, *iconp, *mini_iconp); -@@ -661,6 +610,9 @@ _wnck_read_icons (WnckScreen *screen, +@@ -604,6 +553,9 @@ _wnck_read_icons (WnckScreen *screen, if (icon_cache->origin <= USING_WM_HINTS && icon_cache->wm_hints_dirty) { @@ -664,27 +644,7 @@ index 1749585..38131d8 100644 icon_cache->wm_hints_dirty = FALSE; _wnck_error_trap_push (display); -@@ -689,7 +641,8 @@ _wnck_read_icons (WnckScreen *screen, - { - if (try_pixmap_and_mask (xscreen, pixmap, mask, - iconp, ideal_size, -- mini_iconp, ideal_mini_size)) -+ mini_iconp, ideal_mini_size, -+ scaling_factor)) - { - icon_cache->prev_pixmap = pixmap; - icon_cache->prev_mask = mask; -@@ -705,6 +658,9 @@ _wnck_read_icons (WnckScreen *screen, - if (icon_cache->origin <= USING_KWM_WIN_ICON && - icon_cache->kwm_win_icon_dirty) - { -+ Pixmap pixmap; -+ Pixmap mask; -+ - icon_cache->kwm_win_icon_dirty = FALSE; - - get_kwm_win_icon (xscreen, xwindow, &pixmap, &mask); -@@ -715,7 +671,8 @@ _wnck_read_icons (WnckScreen *screen, +@@ -632,7 +584,8 @@ _wnck_read_icons (WnckScreen *screen, { if (try_pixmap_and_mask (xscreen, pixmap, mask, iconp, ideal_size, @@ -695,10 +655,10 @@ index 1749585..38131d8 100644 icon_cache->prev_pixmap = pixmap; icon_cache->prev_mask = mask; diff --git a/libwnck/xutils.c b/libwnck/xutils.c -index 58873dc..cd9036a 100644 +index 60ae7b2..476f027 100644 --- a/libwnck/xutils.c +++ b/libwnck/xutils.c -@@ -1453,7 +1453,8 @@ _wnck_select_input (Screen *screen, +@@ -1389,7 +1389,8 @@ _wnck_select_input (Screen *screen, cairo_surface_t * _wnck_cairo_surface_get_from_pixmap (Screen *screen, @@ -708,7 +668,7 @@ index 58873dc..cd9036a 100644 { cairo_surface_t *surface; Display *display; -@@ -1471,6 +1472,9 @@ _wnck_cairo_surface_get_from_pixmap (Screen *screen, +@@ -1407,6 +1408,9 @@ _wnck_cairo_surface_get_from_pixmap (Screen *screen, &x_ret, &y_ret, &w_ret, &h_ret, &bw_ret, &depth_ret)) goto TRAP_POP; @@ -718,7 +678,7 @@ index 58873dc..cd9036a 100644 if (depth_ret == 1) { surface = cairo_xlib_surface_create_for_bitmap (display, -@@ -1527,7 +1531,7 @@ _wnck_gdk_pixbuf_get_from_pixmap (Screen *screen, +@@ -1463,7 +1467,7 @@ _wnck_gdk_pixbuf_get_from_pixmap (Screen *screen, cairo_surface_t *surface; GdkPixbuf *retval; @@ -727,7 +687,7 @@ index 58873dc..cd9036a 100644 if (surface == NULL) return NULL; -@@ -1542,36 +1546,30 @@ _wnck_gdk_pixbuf_get_from_pixmap (Screen *screen, +@@ -1478,36 +1482,30 @@ _wnck_gdk_pixbuf_get_from_pixmap (Screen *screen, return retval; } @@ -779,10 +739,10 @@ index 58873dc..cd9036a 100644 if (iconp) *iconp = default_icon_at_size (ideal_size); diff --git a/libwnck/xutils.h b/libwnck/xutils.h -index 2af255d..8146cda 100644 +index 4e5c620..51e8e55 100644 --- a/libwnck/xutils.h +++ b/libwnck/xutils.h -@@ -159,10 +159,10 @@ void _wnck_keyboard_size (WnckScreen *screen, +@@ -156,10 +156,10 @@ void _wnck_keyboard_size (WnckScreen *screen, void _wnck_toggle_showing_desktop (Screen *screen, gboolean show); @@ -797,7 +757,7 @@ index 2af255d..8146cda 100644 void _wnck_get_window_geometry (Screen *screen, Window xwindow, -@@ -195,7 +195,8 @@ void _wnck_set_desktop_layout (Screen *xscreen, +@@ -192,7 +192,8 @@ void _wnck_set_desktop_layout (Screen *xscreen, int columns); cairo_surface_t *_wnck_cairo_surface_get_from_pixmap (Screen *screen, @@ -808,5 +768,5 @@ index 2af255d..8146cda 100644 GdkPixbuf* _wnck_gdk_pixbuf_get_from_pixmap (Screen *screen, Pixmap xpixmap); -- -2.31.1 +2.37.2 diff --git a/libwnck_0004-icons-Mark-GdkPixbuf-icons-as-deprecated.patch b/libwnck_0004-icons-Mark-GdkPixbuf-icons-as-deprecated_43.patch similarity index 84% rename from libwnck_0004-icons-Mark-GdkPixbuf-icons-as-deprecated.patch rename to libwnck_0004-icons-Mark-GdkPixbuf-icons-as-deprecated_43.patch index 9b227c5..cc3940c 100644 --- a/libwnck_0004-icons-Mark-GdkPixbuf-icons-as-deprecated.patch +++ b/libwnck_0004-icons-Mark-GdkPixbuf-icons-as-deprecated_43.patch @@ -1,4 +1,4 @@ -From af4bab0581f164a0cfb0396591940b26584281c1 Mon Sep 17 00:00:00 2001 +From d8316f3e2745fde9039f03a1e619f13132f21bf4 Mon Sep 17 00:00:00 2001 From: Victor Kareh Date: Tue, 11 Feb 2020 07:40:47 -0500 Subject: [PATCH 4/5] icons: Mark GdkPixbuf icons as deprecated @@ -16,10 +16,10 @@ GdkPixbuf icons as deprecated without having to break the API. 7 files changed, 33 insertions(+), 1 deletion(-) diff --git a/libwnck/application.c b/libwnck/application.c -index 8d9d034..90eee73 100644 +index b441eb6..9096ddb 100644 --- a/libwnck/application.c +++ b/libwnck/application.c -@@ -408,6 +408,8 @@ find_icon_window (WnckApplication *app) +@@ -395,6 +395,8 @@ find_icon_window (WnckApplication *app) * Return value: (transfer none): the icon for @app. The caller should * reference the returned GdkPixbuf if it needs to keep * the icon around. @@ -28,7 +28,7 @@ index 8d9d034..90eee73 100644 **/ GdkPixbuf* wnck_application_get_icon (WnckApplication *app) -@@ -447,10 +449,12 @@ wnck_application_get_icon (WnckApplication *app) +@@ -434,10 +436,12 @@ wnck_application_get_icon (WnckApplication *app) } else { @@ -41,7 +41,7 @@ index 8d9d034..90eee73 100644 return NULL; } } -@@ -466,6 +470,8 @@ wnck_application_get_icon (WnckApplication *app) +@@ -453,6 +457,8 @@ wnck_application_get_icon (WnckApplication *app) * Return value: (transfer none): the mini-icon for @app. The caller should * reference the returned GdkPixbuf if it needs to keep * the mini-icon around. @@ -50,7 +50,7 @@ index 8d9d034..90eee73 100644 **/ GdkPixbuf* wnck_application_get_mini_icon (WnckApplication *app) -@@ -505,10 +511,12 @@ wnck_application_get_mini_icon (WnckApplication *app) +@@ -492,10 +498,12 @@ wnck_application_get_mini_icon (WnckApplication *app) } else { @@ -64,10 +64,10 @@ index 8d9d034..90eee73 100644 } } diff --git a/libwnck/application.h b/libwnck/application.h -index e8893f5..fbb2442 100644 +index f3ea970..4d9078e 100644 --- a/libwnck/application.h +++ b/libwnck/application.h -@@ -90,10 +90,16 @@ int wnck_application_get_n_windows (WnckApplication *app); +@@ -91,10 +91,16 @@ int wnck_application_get_n_windows (WnckApplication *app); const char* wnck_application_get_name (WnckApplication *app); const char* wnck_application_get_icon_name (WnckApplication *app); int wnck_application_get_pid (WnckApplication *app); @@ -85,10 +85,10 @@ index e8893f5..fbb2442 100644 const char* wnck_application_get_startup_id (WnckApplication *app); diff --git a/libwnck/class-group.c b/libwnck/class-group.c -index dbf5e1d..9ec6ea6 100644 +index 7899497..026e995 100644 --- a/libwnck/class-group.c +++ b/libwnck/class-group.c -@@ -696,6 +696,8 @@ wnck_class_group_get_name (WnckClassGroup *class_group) +@@ -689,6 +689,8 @@ wnck_class_group_get_name (WnckClassGroup *class_group) * the icon around. * * Since: 2.2 @@ -97,7 +97,7 @@ index dbf5e1d..9ec6ea6 100644 **/ GdkPixbuf * wnck_class_group_get_icon (WnckClassGroup *class_group) -@@ -748,6 +750,8 @@ wnck_class_group_get_icon (WnckClassGroup *class_group) +@@ -741,6 +743,8 @@ wnck_class_group_get_icon (WnckClassGroup *class_group) * to keep the mini-icon around. * * Since: 2.2 @@ -107,10 +107,10 @@ index dbf5e1d..9ec6ea6 100644 GdkPixbuf * wnck_class_group_get_mini_icon (WnckClassGroup *class_group) diff --git a/libwnck/class-group.h b/libwnck/class-group.h -index 5a9e07c..1370ca6 100644 +index 122e0ed..dee0e7c 100644 --- a/libwnck/class-group.h +++ b/libwnck/class-group.h -@@ -80,8 +80,12 @@ const char * wnck_class_group_get_id (WnckClassGroup *class_group); +@@ -81,8 +81,12 @@ const char * wnck_class_group_get_id (WnckClassGroup *class_group); const char * wnck_class_group_get_name (WnckClassGroup *class_group); @@ -124,10 +124,10 @@ index 5a9e07c..1370ca6 100644 cairo_surface_t *wnck_class_group_get_mini_icon_surface (WnckClassGroup *class_group); diff --git a/libwnck/test-wnck.c b/libwnck/test-wnck.c -index ffaad59..05ddd7e 100644 +index 77085cd..649c2e6 100644 --- a/libwnck/test-wnck.c +++ b/libwnck/test-wnck.c -@@ -520,7 +520,7 @@ icon_set_func (GtkTreeViewColumn *tree_column, +@@ -523,7 +523,7 @@ icon_set_func (GtkTreeViewColumn *tree_column, return; g_object_set (GTK_CELL_RENDERER (cell), @@ -137,7 +137,7 @@ index ffaad59..05ddd7e 100644 } diff --git a/libwnck/window.c b/libwnck/window.c -index 92f3c08..021dea8 100644 +index 5c97675..3cd800d 100644 --- a/libwnck/window.c +++ b/libwnck/window.c @@ -21,6 +21,8 @@ @@ -149,7 +149,7 @@ index 92f3c08..021dea8 100644 #include #include -@@ -2168,6 +2170,8 @@ _wnck_window_load_icons (WnckWindow *window) +@@ -2164,6 +2166,8 @@ _wnck_window_load_icons (WnckWindow *window) * Return value: (transfer none): the icon for @window. The caller should * reference the returned GdkPixbuf if it needs to keep * the icon around. @@ -158,7 +158,7 @@ index 92f3c08..021dea8 100644 **/ GdkPixbuf* wnck_window_get_icon (WnckWindow *window) -@@ -2220,6 +2224,8 @@ wnck_window_get_icon (WnckWindow *window) +@@ -2216,6 +2220,8 @@ wnck_window_get_icon (WnckWindow *window) * Return value: (transfer none): the mini-icon for @window. The caller should * reference the returned GdkPixbuf if it needs to keep * the icon around. @@ -168,10 +168,10 @@ index 92f3c08..021dea8 100644 GdkPixbuf* wnck_window_get_mini_icon (WnckWindow *window) diff --git a/libwnck/window.h b/libwnck/window.h -index fb3ce51..831024c 100644 +index 2bec086..d7e52f1 100644 --- a/libwnck/window.h +++ b/libwnck/window.h -@@ -380,8 +380,12 @@ void wnck_window_activate_transient (WnckWindow *window, +@@ -381,8 +381,12 @@ void wnck_window_activate_transient (WnckWindow *window, guint32 timestamp); gboolean wnck_window_transient_is_most_recently_activated (WnckWindow *window); @@ -185,5 +185,5 @@ index fb3ce51..831024c 100644 cairo_surface_t* wnck_window_get_mini_icon_surface (WnckWindow *window); -- -2.31.1 +2.37.2 diff --git a/libwnck_0005-tasklist-Add-surface-loader-function.patch b/libwnck_0005-tasklist-Add-surface-loader-function_43.patch similarity index 88% rename from libwnck_0005-tasklist-Add-surface-loader-function.patch rename to libwnck_0005-tasklist-Add-surface-loader-function_43.patch index 8ffc4cf..b93d5cb 100644 --- a/libwnck_0005-tasklist-Add-surface-loader-function.patch +++ b/libwnck_0005-tasklist-Add-surface-loader-function_43.patch @@ -1,4 +1,4 @@ -From 4bc5ffe67b88fe47b283cf1b59b3bcd4f18eb105 Mon Sep 17 00:00:00 2001 +From 6cdfd1fe219c207bcc3355fde21b58979cdbf633 Mon Sep 17 00:00:00 2001 From: Victor Kareh Date: Thu, 3 Jun 2021 14:04:06 -0400 Subject: [PATCH 5/5] tasklist: Add surface loader function @@ -11,10 +11,10 @@ a similar icon loader function that takes surface icons. 2 files changed, 75 insertions(+), 1 deletion(-) diff --git a/libwnck/tasklist.c b/libwnck/tasklist.c -index b10ef8c..9c921b0 100644 +index 3e7b789..225f62e 100644 --- a/libwnck/tasklist.c +++ b/libwnck/tasklist.c -@@ -228,6 +228,10 @@ struct _WnckTasklistPrivate +@@ -235,6 +235,10 @@ struct _WnckTasklistPrivate void *icon_loader_data; GDestroyNotify free_icon_loader_data; @@ -23,9 +23,9 @@ index b10ef8c..9c921b0 100644 + GDestroyNotify free_surface_loader_data; + #ifdef HAVE_STARTUP_NOTIFICATION + SnDisplay *sn_display; SnMonitorContext *sn_context; - guint startup_sequence_timeout; -@@ -1077,6 +1081,11 @@ wnck_tasklist_finalize (GObject *object) +@@ -1215,6 +1219,11 @@ wnck_tasklist_finalize (GObject *object) tasklist->priv->free_icon_loader_data = NULL; tasklist->priv->icon_loader_data = NULL; @@ -34,10 +34,10 @@ index b10ef8c..9c921b0 100644 + tasklist->priv->free_surface_loader_data = NULL; + tasklist->priv->surface_loader_data = NULL; + - G_OBJECT_CLASS (wnck_tasklist_parent_class)->finalize (object); - } + g_clear_object (&tasklist->priv->handle); -@@ -1315,6 +1324,31 @@ wnck_tasklist_set_icon_loader (WnckTasklist *tasklist, + G_OBJECT_CLASS (wnck_tasklist_parent_class)->finalize (object); +@@ -1455,6 +1464,31 @@ wnck_tasklist_set_icon_loader (WnckTasklist *tasklist, tasklist->priv->free_icon_loader_data = free_data_func; } @@ -69,7 +69,7 @@ index b10ef8c..9c921b0 100644 static void get_layout (GtkOrientation orientation, int for_size, -@@ -3665,7 +3699,21 @@ wnck_task_get_icon (WnckTask *task) +@@ -3869,7 +3903,21 @@ wnck_task_get_icon (WnckTask *task) case WNCK_TASK_STARTUP_SEQUENCE: #ifdef HAVE_STARTUP_NOTIFICATION @@ -82,9 +82,9 @@ index b10ef8c..9c921b0 100644 + if (icon != NULL) + { + surface = (* task->tasklist->priv->surface_loader) (icon, -+ MINI_ICON_SIZE, -+ 0, -+ task->tasklist->priv->surface_loader_data); ++ mini_icon_size, ++ 0, ++ task->tasklist->priv->surface_loader_data); + + } + } @@ -93,10 +93,10 @@ index b10ef8c..9c921b0 100644 const char *icon; diff --git a/libwnck/tasklist.h b/libwnck/tasklist.h -index 0659f9d..0af8df5 100644 +index 5407d34..373eaaa 100644 --- a/libwnck/tasklist.h +++ b/libwnck/tasklist.h -@@ -138,6 +138,32 @@ void wnck_tasklist_set_icon_loader (WnckTasklist *tasklist, +@@ -141,6 +141,32 @@ void wnck_tasklist_set_icon_loader (WnckTasklist *tasklist, void *data, GDestroyNotify free_data_func); @@ -130,5 +130,5 @@ index 0659f9d..0af8df5 100644 #endif /* WNCK_TASKLIST_H */ -- -2.31.1 +2.37.2 diff --git a/sources b/sources index 41553b7..f8c52da 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libwnck-40.1.tar.xz) = 50ba20547e95280d10f1f66f36eea6c649b59d385da7a9217c295150520099585a5ff43c08a552afb8b0db3ee7305bbb2c38d0baed84cc6dc0942f3ca1e43e29 +SHA512 (libwnck-43.0.tar.xz) = f6c14b0a650c6d5ab4d4013e6add3972a0f0bcdedfb9785f64199c9a65713d11c9d936e8b04d0f04707c3d165dd345bfa806f654bf82eabb765546b8914d68d2