Compare commits
No commits in common. "c8" and "c10s" have entirely different histories.
31
.gitignore
vendored
31
.gitignore
vendored
@ -1 +1,30 @@
|
||||
SOURCES/libwnck-3.24.1.tar.xz
|
||||
libwnck-2.30.0.tar.bz2
|
||||
libwnck-2.30.3.tar.bz2
|
||||
/libwnck-2.30.4.tar.bz2
|
||||
/libwnck-2.91.6.tar.bz2
|
||||
/libwnck-3.0.2.tar.bz2
|
||||
/libwnck-3.1.90.tar.xz
|
||||
/libwnck-3.1.92.tar.xz
|
||||
/libwnck-3.2.0.tar.xz
|
||||
/libwnck-3.2.1.tar.xz
|
||||
/libwnck-3.3.5.tar.xz
|
||||
/libwnck-3.4.0.tar.xz
|
||||
/libwnck-3.4.2.tar.xz
|
||||
/libwnck-3.4.3.tar.xz
|
||||
/libwnck-3.4.4.tar.xz
|
||||
/libwnck-3.4.5.tar.xz
|
||||
/libwnck-3.4.7.tar.xz
|
||||
/libwnck-3.4.9.tar.xz
|
||||
/libwnck-3.14.0.tar.xz
|
||||
/libwnck-3.14.1.tar.xz
|
||||
/libwnck-3.20.0.tar.xz
|
||||
/libwnck-3.20.1.tar.xz
|
||||
/libwnck-3.24.0.tar.xz
|
||||
/libwnck-3.24.1.tar.xz
|
||||
/libwnck-3.31.4.tar.xz
|
||||
/libwnck-3.32.0.tar.xz
|
||||
/sources
|
||||
/libwnck-3.36.0.tar.xz
|
||||
/libwnck-40.0.tar.xz
|
||||
/libwnck-40.1.tar.xz
|
||||
/libwnck-43.0.tar.xz
|
||||
|
@ -1 +0,0 @@
|
||||
5c16cd0c63022cfa7cf2f824d037482cfbd9068b SOURCES/libwnck-3.24.1.tar.xz
|
6
gating.yaml
Normal file
6
gating.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
--- !Policy
|
||||
product_versions:
|
||||
- rhel-10
|
||||
decision_context: osci_compose_gate
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: desktop-qe.desktop-ci.tier1-gating.functional}
|
@ -2,23 +2,35 @@
|
||||
|
||||
Summary: Window Navigator Construction Kit
|
||||
Name: libwnck3
|
||||
Version: 3.24.1
|
||||
Release: 2%{?dist}
|
||||
Version: 43.0
|
||||
Release: 10%{?dist}
|
||||
URL: http://download.gnome.org/sources/%{source_name}/
|
||||
Source0: http://download.gnome.org/sources/%{source_name}/3.24/%{source_name}-%{version}.tar.xz
|
||||
License: LGPLv2+
|
||||
Group: System Environment/Libraries
|
||||
Source0: http://download.gnome.org/sources/%{source_name}/40/%{source_name}-%{version}.tar.xz
|
||||
License: LGPL-2.0-or-later
|
||||
|
||||
# https://gitlab.gnome.org/GNOME/libwnck/-/merge_requests/10
|
||||
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
|
||||
# fix https://gitlab.gnome.org/GNOME/libwnck/-/issues/154#note_1562760
|
||||
# https://gitlab.gnome.org/GNOME/libwnck/-/commit/07694559cc0c65ce1cca9ac33b165cef84c34d5e
|
||||
Patch7: libwnck_0001-Revert-xutils-Get-the-correct-PID-for-clients-inside.patch
|
||||
# https://bugs.launchpad.net/ubuntu/+source/libwnck3/+bug/1990263
|
||||
# https://gitlab.gnome.org/GNOME/libwnck/-/merge_requests/46
|
||||
Patch8: libwnck3_handle_avoid_segfault_in_invalidate_icons.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: meson
|
||||
BuildRequires: gettext
|
||||
BuildRequires: glib2-devel
|
||||
BuildRequires: gobject-introspection-devel
|
||||
BuildRequires: gtk3-devel
|
||||
BuildRequires: gtk-doc
|
||||
BuildRequires: libXres-devel
|
||||
BuildRequires: pango-devel
|
||||
BuildRequires: startup-notification-devel
|
||||
BuildRequires: gobject-introspection-devel
|
||||
BuildRequires: libXres-devel
|
||||
BuildRequires: gettext
|
||||
BuildRequires: intltool
|
||||
BuildRequires: libtool, automake, autoconf
|
||||
BuildRequires: gnome-common
|
||||
|
||||
Requires: startup-notification
|
||||
|
||||
@ -29,7 +41,6 @@ about open windows, workspaces, their names/icons, and so forth.
|
||||
|
||||
%package devel
|
||||
Summary: Libraries and headers for libwnck
|
||||
Group: Development/Libraries
|
||||
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||
|
||||
%description devel
|
||||
@ -38,33 +49,27 @@ developing applications that use %{name}.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q -n %{source_name}-%{version}
|
||||
%autosetup -n %{source_name}-%{version} -p1
|
||||
|
||||
|
||||
%build
|
||||
%configure \
|
||||
--disable-static \
|
||||
--enable-introspection=yes \
|
||||
--enable-startup-notification
|
||||
%meson -Dgtk_doc=true
|
||||
%meson_build
|
||||
|
||||
%{make_build}
|
||||
|
||||
%install
|
||||
%{make_install}
|
||||
|
||||
find %{buildroot} -name '*.la' -exec rm -f {} ';'
|
||||
%meson_install
|
||||
|
||||
%find_lang %{source_name}-3.0 --with-gnome --all-name
|
||||
|
||||
|
||||
%post -p /sbin/ldconfig
|
||||
|
||||
%postun -p /sbin/ldconfig
|
||||
%ldconfig_scriptlets
|
||||
|
||||
|
||||
%files -f %{source_name}-3.0.lang
|
||||
%license COPYING
|
||||
%doc AUTHORS README NEWS
|
||||
%{_libdir}/%{source_name}-3.so.*
|
||||
%{_libdir}/%{source_name}-3.so.0*
|
||||
%{_bindir}/wnck-urgency-monitor
|
||||
%{_libdir}/girepository-1.0/Wnck-3.0.typelib
|
||||
|
||||
@ -78,6 +83,91 @@ find %{buildroot} -name '*.la' -exec rm -f {} ';'
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 43.0-10
|
||||
- Bump release for October 2024 mass rebuild:
|
||||
Resolves: RHEL-64018
|
||||
|
||||
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 43.0-9
|
||||
- Bump release for June 2024 mass rebuild
|
||||
|
||||
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 43.0-8
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 43.0-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Tue Nov 21 2023 Wolfgang Ulbrich <fedora@raveit.de> - 43.0-6
|
||||
- fix rhbz (#2242944)
|
||||
- disable Revert-pager-do-not-change-workspace-size-from-size patch
|
||||
|
||||
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 43.0-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 43.0-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
* Fri Oct 07 2022 Wolfgang Ulbrich <fedora@raveit.de> - 43.0-3
|
||||
- fix https://bugs.launchpad.net/ubuntu/+source/libwnck3/+bug/1990263
|
||||
|
||||
* Thu Sep 29 2022 Wolfgang Ulbrich <fedora@raveit.de> - 43.0-2
|
||||
- fix https://gitlab.gnome.org/GNOME/libwnck/-/issues/154
|
||||
|
||||
* Mon Sep 19 2022 Wolfgang Ulbrich <fedora@raveit.de> - 43.0-1
|
||||
- update to 43.0
|
||||
|
||||
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 40.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||
|
||||
* Sat Feb 19 2022 Wolfgang Ulbrich <fedora@raveit.de> - 40.1-1
|
||||
- update to 40.1
|
||||
|
||||
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 40.0-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||
|
||||
* Sun Dec 12 2021 Wolfgang Ulbrich <fedora@raveit.de> - 40.0-4
|
||||
- use https://gitlab.gnome.org/GNOME/libwnck/-/commit/bd8ab37
|
||||
- Scale tasklist icons
|
||||
|
||||
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 40.0-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||
|
||||
* Fri Jun 11 2021 Wolfgang Ulbrich <fedora@raveit.de> - 40.0-2
|
||||
- revert https://gitlab.gnome.org/GNOME/libwnck/-/commit/3456b74
|
||||
- fixes rhbz #1971048
|
||||
- and https://github.com/mate-desktop/mate-panel/issues/1230
|
||||
|
||||
* Wed May 26 2021 Kalev Lember <klember@redhat.com> - 40.0-1
|
||||
- Update to 40.0
|
||||
- Tighten soname globs
|
||||
|
||||
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.36.0-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.36.0-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Sat Mar 28 2020 Wolfgang Ulbrich <fedora@raveit.de> - 3.36.0-1
|
||||
- update to 3.36.0
|
||||
|
||||
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.32.0-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.32.0-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Wed May 01 2019 Phil Wyett <philwyett@kathenas.org> - 3.32.0-1
|
||||
- Update to 3.32.0
|
||||
|
||||
* Fri Feb 01 2019 Kalev Lember <klember@redhat.com> - 3.31.4-1
|
||||
- Update to 3.31.4
|
||||
- Switch to the meson build system
|
||||
|
||||
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.24.1-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.24.1-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
|
||||
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.24.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||
|
29
libwnck3_handle_avoid_segfault_in_invalidate_icons.patch
Normal file
29
libwnck3_handle_avoid_segfault_in_invalidate_icons.patch
Normal file
@ -0,0 +1,29 @@
|
||||
From 6ceb684442eb26e3bdb8a38bf52264ad55f96a7b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Alberts=20Muktup=C4=81vels?= <alberts.muktupavels@gmail.com>
|
||||
Date: Tue, 20 Sep 2022 15:40:22 +0300
|
||||
Subject: [PATCH] handle: avoid segfault in invalidate_icons
|
||||
|
||||
Screens variable won't be initialized if default icon sizes are
|
||||
set/changed before using wnck_screen_get_default.
|
||||
|
||||
https://bugs.launchpad.net/ubuntu/+source/libwnck3/+bug/1990263
|
||||
---
|
||||
libwnck/wnck-handle.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/libwnck/wnck-handle.c b/libwnck/wnck-handle.c
|
||||
index e12ff882..8d5da45c 100644
|
||||
--- a/libwnck/wnck-handle.c
|
||||
+++ b/libwnck/wnck-handle.c
|
||||
@@ -70,6 +70,9 @@ invalidate_icons (WnckHandle *self)
|
||||
Display *xdisplay;
|
||||
int i;
|
||||
|
||||
+ if (self->screens == NULL)
|
||||
+ return;
|
||||
+
|
||||
xdisplay = _wnck_get_default_display ();
|
||||
|
||||
for (i = 0; i < ScreenCount (xdisplay); ++i)
|
||||
--
|
||||
|
58
libwnck_0001-Expose-window-scaling-factor_43.patch
Normal file
58
libwnck_0001-Expose-window-scaling-factor_43.patch
Normal file
@ -0,0 +1,58 @@
|
||||
From 27b7ebb8092a36f0fb32e3277577ff9f09d309e6 Mon Sep 17 00:00:00 2001
|
||||
From: Victor Kareh <vkareh@redhat.com>
|
||||
Date: Tue, 6 Aug 2019 09:59:59 -0400
|
||||
Subject: [PATCH 1/5] Expose window scaling factor
|
||||
|
||||
---
|
||||
libwnck/private.h | 2 ++
|
||||
libwnck/util.c | 21 +++++++++++++++++++++
|
||||
2 files changed, 23 insertions(+)
|
||||
|
||||
diff --git a/libwnck/private.h b/libwnck/private.h
|
||||
index d5e48d9..6741e1e 100644
|
||||
--- a/libwnck/private.h
|
||||
+++ b/libwnck/private.h
|
||||
@@ -37,6 +37,8 @@ G_BEGIN_DECLS
|
||||
|
||||
WnckHandle *_wnck_get_handle (void);
|
||||
|
||||
+int _wnck_get_window_scaling_factor (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 83659dc..a58a99e 100644
|
||||
--- a/libwnck/util.c
|
||||
+++ b/libwnck/util.c
|
||||
@@ -164,6 +164,27 @@ _wnck_get_handle (void)
|
||||
return wnck_handle;
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * _wnck_get_window_scaling_factor:
|
||||
+ *
|
||||
+ * Retrieves the internal scale factor that maps from window coordinates to the
|
||||
+ * actual device pixels. On traditional systems this is 1, on high density
|
||||
+ * outputs, it can be a higher value (typically 2).
|
||||
+ */
|
||||
+int
|
||||
+_wnck_get_window_scaling_factor (void)
|
||||
+{
|
||||
+ GdkScreen *screen;
|
||||
+ GValue value = G_VALUE_INIT;
|
||||
+
|
||||
+ g_value_init (&value, G_TYPE_INT);
|
||||
+
|
||||
+ screen = gdk_screen_get_default ();
|
||||
+ if (gdk_screen_get_setting (screen, "gdk-window-scaling-factor", &value))
|
||||
+ return g_value_get_int (&value);
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* wnck_set_default_icon_size:
|
||||
* @size: the default size for windows and application standard icons.
|
||||
--
|
||||
2.37.2
|
||||
|
@ -0,0 +1,98 @@
|
||||
From 89a5825eb20bfa91b91055e5a3dfe6445e6b9bd2 Mon Sep 17 00:00:00 2001
|
||||
From: raveit65 <mate@raveit.de>
|
||||
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
|
||||
|
@ -0,0 +1,75 @@
|
||||
From 9c4551c67d6fe854f7d37970398f5d5c9d17c28e Mon Sep 17 00:00:00 2001
|
||||
From: raveit65 <mate@raveit.de>
|
||||
Date: Thu, 29 Sep 2022 10:31:16 +0200
|
||||
Subject: [PATCH] Revert "xutils: Get the correct PID for clients inside PID
|
||||
namespaces"
|
||||
|
||||
This reverts commit 07694559cc0c65ce1cca9ac33b165cef84c34d5e.
|
||||
|
||||
- fixing https://gitlab.gnome.org/GNOME/libwnck/-/issues/154#note_1562760
|
||||
---
|
||||
libwnck/xutils.c | 36 +++---------------------------------
|
||||
1 file changed, 3 insertions(+), 33 deletions(-)
|
||||
|
||||
diff --git a/libwnck/xutils.c b/libwnck/xutils.c
|
||||
index 60ae7b2..f2a2d3c 100644
|
||||
--- a/libwnck/xutils.c
|
||||
+++ b/libwnck/xutils.c
|
||||
@@ -27,9 +27,6 @@
|
||||
#if HAVE_CAIRO_XLIB_XRENDER
|
||||
#include <cairo-xlib-xrender.h>
|
||||
#endif
|
||||
-#ifdef HAVE_XRES
|
||||
-#include <X11/extensions/XRes.h>
|
||||
-#endif
|
||||
#include "screen.h"
|
||||
#include "window.h"
|
||||
#include "private.h"
|
||||
@@ -1149,41 +1146,14 @@ int
|
||||
_wnck_get_pid (Screen *screen,
|
||||
Window xwindow)
|
||||
{
|
||||
- int pid = -1;
|
||||
-
|
||||
-#ifdef HAVE_XRES
|
||||
- XResClientIdSpec client_spec;
|
||||
- long client_id_count = 0;
|
||||
- XResClientIdValue *client_ids = NULL;
|
||||
-
|
||||
- client_spec.client = xwindow;
|
||||
- client_spec.mask = XRES_CLIENT_ID_PID_MASK;
|
||||
-
|
||||
- if (XResQueryClientIds (DisplayOfScreen (screen), 1, &client_spec,
|
||||
- &client_id_count, &client_ids) == Success)
|
||||
- {
|
||||
- long i;
|
||||
-
|
||||
- for (i = 0; i < client_id_count; i++)
|
||||
- {
|
||||
- pid = XResGetClientPid (&client_ids[i]);
|
||||
- if (pid != -1)
|
||||
- break;
|
||||
- }
|
||||
-
|
||||
- XResClientIdsDestroy (client_id_count, client_ids);
|
||||
-
|
||||
- if (pid != -1)
|
||||
- return pid;
|
||||
- }
|
||||
-#endif
|
||||
+ int val;
|
||||
|
||||
if (!_wnck_get_cardinal (screen, xwindow,
|
||||
_wnck_atom_get ("_NET_WM_PID"),
|
||||
- &pid))
|
||||
+ &val))
|
||||
return 0;
|
||||
else
|
||||
- return pid;
|
||||
+ return val;
|
||||
}
|
||||
|
||||
char*
|
||||
--
|
||||
2.37.3
|
||||
|
1324
libwnck_0002-icons-Use-cairo-surfaces-to-render-icons_43.patch
Normal file
1324
libwnck_0002-icons-Use-cairo-surfaces-to-render-icons_43.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,772 @@
|
||||
From 53d505622e90805684260873d0fbadaec9e2d3ed Mon Sep 17 00:00:00 2001
|
||||
From: Victor Kareh <vkareh@redhat.com>
|
||||
Date: Mon, 20 Jan 2020 13:38:59 -0500
|
||||
Subject: [PATCH 3/5] xutils: Change icons to being cairo surfaces
|
||||
|
||||
Since all icons are stored internally as cairo surfaces, we should be
|
||||
returning icons as cairo surfaces from the private functions in xutils.
|
||||
This simplifies the drawing codepath and makes us able to delete a bunch
|
||||
of GdkPixbuf manipulation.
|
||||
|
||||
adapted from https://gitlab.gnome.org/GNOME/mutter/commit/af7f51b9
|
||||
---
|
||||
libwnck/application.c | 22 +--
|
||||
libwnck/class-group.c | 17 +-
|
||||
libwnck/tasklist.c | 9 +-
|
||||
libwnck/window.c | 22 +--
|
||||
libwnck/wnck-icon-cache-private.h | 15 +-
|
||||
libwnck/wnck-icon-cache.c | 299 +++++++++++++-----------------
|
||||
libwnck/xutils.c | 42 ++---
|
||||
libwnck/xutils.h | 11 +-
|
||||
8 files changed, 179 insertions(+), 258 deletions(-)
|
||||
|
||||
diff --git a/libwnck/application.c b/libwnck/application.c
|
||||
index d8283cc..b441eb6 100644
|
||||
--- a/libwnck/application.c
|
||||
+++ b/libwnck/application.c
|
||||
@@ -309,10 +309,11 @@ static void
|
||||
get_icons (WnckApplication *app)
|
||||
{
|
||||
WnckHandle *handle;
|
||||
- GdkPixbuf *icon;
|
||||
- GdkPixbuf *mini_icon;
|
||||
+ cairo_surface_t *icon;
|
||||
+ cairo_surface_t *mini_icon;
|
||||
gsize normal_size;
|
||||
gsize mini_size;
|
||||
+ int scaling_factor;
|
||||
|
||||
handle = wnck_screen_get_handle (app->priv->screen);
|
||||
|
||||
@@ -320,6 +321,7 @@ get_icons (WnckApplication *app)
|
||||
mini_icon = NULL;
|
||||
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,
|
||||
@@ -327,24 +329,16 @@ get_icons (WnckApplication *app)
|
||||
&icon,
|
||||
normal_size,
|
||||
&mini_icon,
|
||||
- mini_size))
|
||||
+ mini_size,
|
||||
+ scaling_factor))
|
||||
{
|
||||
app->priv->need_emit_icon_changed = TRUE;
|
||||
|
||||
g_clear_pointer (&app->priv->icon, cairo_surface_destroy);
|
||||
g_clear_pointer (&app->priv->mini_icon, cairo_surface_destroy);
|
||||
|
||||
- if (icon)
|
||||
- {
|
||||
- app->priv->icon = gdk_cairo_surface_create_from_pixbuf (icon, 0, NULL);
|
||||
- g_clear_object (&icon);
|
||||
- }
|
||||
-
|
||||
- if (mini_icon)
|
||||
- {
|
||||
- app->priv->mini_icon = gdk_cairo_surface_create_from_pixbuf (mini_icon, 0, NULL);
|
||||
- g_clear_object (&mini_icon);
|
||||
- }
|
||||
+ app->priv->icon = icon;
|
||||
+ app->priv->mini_icon = mini_icon;
|
||||
}
|
||||
|
||||
/* FIXME we should really fall back to using the icon
|
||||
diff --git a/libwnck/class-group.c b/libwnck/class-group.c
|
||||
index e6c45d6..7899497 100644
|
||||
--- a/libwnck/class-group.c
|
||||
+++ b/libwnck/class-group.c
|
||||
@@ -441,23 +441,10 @@ set_icon (WnckClassGroup *class_group)
|
||||
|
||||
handle = wnck_screen_get_handle (class_group->priv->screen);
|
||||
|
||||
- GdkPixbuf *icon_pixbuf, *mini_icon_pixbuf;
|
||||
-
|
||||
- _wnck_get_fallback_icons (&icon_pixbuf,
|
||||
+ _wnck_get_fallback_icons (&icon,
|
||||
_wnck_handle_get_default_icon_size (handle),
|
||||
- &mini_icon_pixbuf,
|
||||
+ &mini_icon,
|
||||
_wnck_handle_get_default_mini_icon_size (handle));
|
||||
- if (icon_pixbuf)
|
||||
- {
|
||||
- icon = gdk_cairo_surface_create_from_pixbuf (icon_pixbuf, 0, NULL);
|
||||
- g_clear_object (&icon_pixbuf);
|
||||
- }
|
||||
-
|
||||
- if (mini_icon_pixbuf)
|
||||
- {
|
||||
- mini_icon = gdk_cairo_surface_create_from_pixbuf (mini_icon_pixbuf, 0, NULL);
|
||||
- g_clear_object (&mini_icon_pixbuf);
|
||||
- }
|
||||
|
||||
icons_reffed = TRUE;
|
||||
}
|
||||
diff --git a/libwnck/tasklist.c b/libwnck/tasklist.c
|
||||
index 10c6cc8..3e7b789 100644
|
||||
--- a/libwnck/tasklist.c
|
||||
+++ b/libwnck/tasklist.c
|
||||
@@ -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);
|
||||
-
|
||||
- if (pixbuf != NULL)
|
||||
- {
|
||||
- surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, 0, NULL);
|
||||
- g_object_unref (pixbuf);
|
||||
- }
|
||||
+ &surface, mini_icon_size);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
diff --git a/libwnck/window.c b/libwnck/window.c
|
||||
index f01b4c2..5c97675 100644
|
||||
--- a/libwnck/window.c
|
||||
+++ b/libwnck/window.c
|
||||
@@ -2105,10 +2105,11 @@ static void
|
||||
get_icons (WnckWindow *window)
|
||||
{
|
||||
WnckHandle *handle;
|
||||
- GdkPixbuf *icon;
|
||||
- GdkPixbuf *mini_icon;
|
||||
+ cairo_surface_t *icon;
|
||||
+ cairo_surface_t *mini_icon;
|
||||
gsize normal_size;
|
||||
gsize mini_size;
|
||||
+ int scaling_factor;
|
||||
|
||||
handle = wnck_screen_get_handle (window->priv->screen);
|
||||
|
||||
@@ -2116,6 +2117,7 @@ get_icons (WnckWindow *window)
|
||||
mini_icon = NULL;
|
||||
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,
|
||||
@@ -2123,24 +2125,16 @@ get_icons (WnckWindow *window)
|
||||
&icon,
|
||||
normal_size,
|
||||
&mini_icon,
|
||||
- mini_size))
|
||||
+ mini_size,
|
||||
+ scaling_factor))
|
||||
{
|
||||
window->priv->need_emit_icon_changed = TRUE;
|
||||
|
||||
g_clear_pointer (&window->priv->icon, cairo_surface_destroy);
|
||||
g_clear_pointer (&window->priv->mini_icon, cairo_surface_destroy);
|
||||
|
||||
- if (icon)
|
||||
- {
|
||||
- window->priv->icon = gdk_cairo_surface_create_from_pixbuf (icon, 0, NULL);
|
||||
- g_clear_object (&icon);
|
||||
- }
|
||||
-
|
||||
- if (mini_icon)
|
||||
- {
|
||||
- window->priv->mini_icon = gdk_cairo_surface_create_from_pixbuf (mini_icon, 0, NULL);
|
||||
- g_clear_object (&mini_icon);
|
||||
- }
|
||||
+ window->priv->icon = icon;
|
||||
+ window->priv->mini_icon = mini_icon;
|
||||
}
|
||||
|
||||
g_assert ((window->priv->icon && window->priv->mini_icon) ||
|
||||
diff --git a/libwnck/wnck-icon-cache-private.h b/libwnck/wnck-icon-cache-private.h
|
||||
index 6a3d5ec..d3c39e2 100644
|
||||
--- a/libwnck/wnck-icon-cache-private.h
|
||||
+++ b/libwnck/wnck-icon-cache-private.h
|
||||
@@ -38,13 +38,14 @@ 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);
|
||||
+gboolean _wnck_read_icons (WnckScreen *screen,
|
||||
+ Window xwindow,
|
||||
+ WnckIconCache *icon_cache,
|
||||
+ cairo_surface_t **iconp,
|
||||
+ int ideal_size,
|
||||
+ cairo_surface_t **mini_iconp,
|
||||
+ int ideal_mini_size,
|
||||
+ int scaling_factor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
diff --git a/libwnck/wnck-icon-cache.c b/libwnck/wnck-icon-cache.c
|
||||
index 9ff8d15..d9e67e8 100644
|
||||
--- a/libwnck/wnck-icon-cache.c
|
||||
+++ b/libwnck/wnck-icon-cache.c
|
||||
@@ -44,8 +44,8 @@ struct _WnckIconCache
|
||||
IconOrigin origin;
|
||||
Pixmap prev_pixmap;
|
||||
Pixmap prev_mask;
|
||||
- GdkPixbuf *icon;
|
||||
- GdkPixbuf *mini_icon;
|
||||
+ cairo_surface_t *icon;
|
||||
+ cairo_surface_t *mini_icon;
|
||||
int ideal_size;
|
||||
int ideal_mini_size;
|
||||
guint want_fallback : 1;
|
||||
@@ -139,49 +139,65 @@ find_best_size (gulong *data,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
-static void
|
||||
-argbdata_to_pixdata (gulong *argb_data, int len, guchar **pixdata)
|
||||
+static cairo_surface_t *
|
||||
+argbdata_to_surface (gulong *argb_data,
|
||||
+ int w,
|
||||
+ int h,
|
||||
+ int ideal_w,
|
||||
+ int ideal_h,
|
||||
+ int scaling_factor)
|
||||
{
|
||||
- guchar *p;
|
||||
- int i;
|
||||
+ cairo_surface_t *surface, *icon;
|
||||
+ cairo_t *cr;
|
||||
+ int y, x, stride;
|
||||
+ uint32_t *data;
|
||||
|
||||
- *pixdata = g_new (guchar, len * 4);
|
||||
- p = *pixdata;
|
||||
+ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, w, h);
|
||||
+ cairo_surface_set_device_scale (surface, (double)scaling_factor, (double)scaling_factor);
|
||||
+ stride = cairo_image_surface_get_stride (surface) / sizeof (uint32_t);
|
||||
+ data = (uint32_t *) cairo_image_surface_get_data (surface);
|
||||
|
||||
/* One could speed this up a lot. */
|
||||
- i = 0;
|
||||
- while (i < len)
|
||||
+ for (y = 0; y < h; y++)
|
||||
{
|
||||
- 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;
|
||||
+ for (x = 0; x < w; x++)
|
||||
+ {
|
||||
+ uint32_t *p = &data[y * stride + x];
|
||||
+ gulong *d = &argb_data[y * w + x];
|
||||
+ *p = *d;
|
||||
+ }
|
||||
}
|
||||
+
|
||||
+ cairo_surface_mark_dirty (surface);
|
||||
+
|
||||
+ icon = cairo_surface_create_similar_image (surface,
|
||||
+ cairo_image_surface_get_format (surface),
|
||||
+ ideal_w, ideal_h);
|
||||
+
|
||||
+ cairo_surface_set_device_scale (icon, (double)scaling_factor, (double)scaling_factor);
|
||||
+
|
||||
+ cr = cairo_create (icon);
|
||||
+ cairo_scale (cr, ideal_w / (double)w, ideal_h / (double)h);
|
||||
+ cairo_set_source_surface (cr, surface, 0, 0);
|
||||
+ cairo_paint (cr);
|
||||
+
|
||||
+ cairo_set_operator (cr, CAIRO_OPERATOR_IN);
|
||||
+ cairo_paint (cr);
|
||||
+
|
||||
+ cairo_destroy (cr);
|
||||
+ cairo_surface_destroy (surface);
|
||||
+
|
||||
+ return icon;
|
||||
}
|
||||
|
||||
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)
|
||||
+read_rgb_icon (Screen *screen,
|
||||
+ Window xwindow,
|
||||
+ int ideal_size,
|
||||
+ int ideal_mini_size,
|
||||
+ cairo_surface_t **iconp,
|
||||
+ cairo_surface_t **mini_iconp,
|
||||
+ int scaling_factor)
|
||||
{
|
||||
Display *display;
|
||||
Atom type;
|
||||
@@ -219,7 +235,9 @@ read_rgb_icon (Screen *screen,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
- if (!find_best_size (data, nitems, ideal_size, &w, &h, &best))
|
||||
+ if (!find_best_size (data, nitems,
|
||||
+ ideal_size,
|
||||
+ &w, &h, &best))
|
||||
{
|
||||
XFree (data);
|
||||
return FALSE;
|
||||
@@ -233,14 +251,8 @@ read_rgb_icon (Screen *screen,
|
||||
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);
|
||||
+ *iconp = argbdata_to_surface (best, w, h, ideal_size, ideal_size, scaling_factor);
|
||||
+ *mini_iconp = argbdata_to_surface (best_mini, mini_w, mini_h, ideal_mini_size, ideal_mini_size, scaling_factor);
|
||||
|
||||
XFree (data);
|
||||
|
||||
@@ -248,27 +260,27 @@ read_rgb_icon (Screen *screen,
|
||||
}
|
||||
|
||||
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)
|
||||
+try_pixmap_and_mask (Screen *screen,
|
||||
+ Pixmap src_pixmap,
|
||||
+ Pixmap src_mask,
|
||||
+ cairo_surface_t **iconp,
|
||||
+ int ideal_size,
|
||||
+ cairo_surface_t **mini_iconp,
|
||||
+ int ideal_mini_size,
|
||||
+ int scaling_factor)
|
||||
{
|
||||
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);
|
||||
+ surface = _wnck_cairo_surface_get_from_pixmap (screen, src_pixmap, scaling_factor);
|
||||
|
||||
if (surface && src_mask != None)
|
||||
- mask_surface = _wnck_cairo_surface_get_from_pixmap (screen, src_mask);
|
||||
+ mask_surface = _wnck_cairo_surface_get_from_pixmap (screen, src_mask, scaling_factor);
|
||||
else
|
||||
mask_surface = NULL;
|
||||
|
||||
@@ -324,26 +336,41 @@ try_pixmap_and_mask (Screen *screen,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
- unscaled = gdk_pixbuf_get_from_surface (image,
|
||||
- 0, 0,
|
||||
- width, height);
|
||||
+ if (image)
|
||||
+ {
|
||||
+ int image_w, image_h;
|
||||
|
||||
- cairo_surface_destroy (image);
|
||||
+ image_w = cairo_image_surface_get_width (image);
|
||||
+ image_h = cairo_image_surface_get_height (image);
|
||||
+
|
||||
+ *iconp = cairo_surface_create_similar (image,
|
||||
+ cairo_surface_get_content (image),
|
||||
+ ideal_size,
|
||||
+ ideal_size);
|
||||
+
|
||||
+ cairo_surface_set_device_scale (*iconp, (double)scaling_factor, (double)scaling_factor);
|
||||
+
|
||||
+ cr = cairo_create (*iconp);
|
||||
+ cairo_scale (cr, ideal_size / (double)image_w, ideal_size / (double)image_h);
|
||||
+ cairo_set_source_surface (cr, image, 0, 0);
|
||||
+ cairo_paint (cr);
|
||||
+ cairo_destroy (cr);
|
||||
+
|
||||
+ *mini_iconp = cairo_surface_create_similar (image,
|
||||
+ cairo_surface_get_content (image),
|
||||
+ ideal_mini_size,
|
||||
+ ideal_mini_size);
|
||||
+
|
||||
+ cairo_surface_set_device_scale (*mini_iconp, (double)scaling_factor, (double)scaling_factor);
|
||||
+
|
||||
+ cr = cairo_create (*mini_iconp);
|
||||
+ cairo_scale (cr, ideal_mini_size / (double)image_w, ideal_mini_size / (double)image_h);
|
||||
+ cairo_set_source_surface (cr, image, 0, 0);
|
||||
+ cairo_paint (cr);
|
||||
+ cairo_destroy (cr);
|
||||
+
|
||||
+ 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
|
||||
@@ -354,13 +381,8 @@ 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;
|
||||
+ g_clear_pointer (&icon_cache->icon, cairo_surface_destroy);
|
||||
+ g_clear_pointer (&icon_cache->mini_icon, cairo_surface_destroy);
|
||||
|
||||
icon_cache->origin = USING_NO_ICON;
|
||||
|
||||
@@ -372,89 +394,26 @@ clear_icon_cache (WnckIconCache *icon_cache,
|
||||
}
|
||||
|
||||
static void
|
||||
-replace_cache (WnckIconCache *icon_cache,
|
||||
- IconOrigin origin,
|
||||
- GdkPixbuf *new_icon,
|
||||
- GdkPixbuf *new_mini_icon)
|
||||
+replace_cache (WnckIconCache *icon_cache,
|
||||
+ IconOrigin origin,
|
||||
+ cairo_surface_t *new_icon,
|
||||
+ cairo_surface_t *new_mini_icon)
|
||||
{
|
||||
clear_icon_cache (icon_cache, FALSE);
|
||||
|
||||
icon_cache->origin = origin;
|
||||
|
||||
if (new_icon)
|
||||
- g_object_ref (G_OBJECT (new_icon));
|
||||
+ cairo_surface_reference (new_icon);
|
||||
|
||||
icon_cache->icon = new_icon;
|
||||
|
||||
if (new_mini_icon)
|
||||
- g_object_ref (G_OBJECT (new_mini_icon));
|
||||
+ cairo_surface_reference (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)
|
||||
{
|
||||
@@ -528,22 +487,17 @@ _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)
|
||||
+_wnck_read_icons (WnckScreen *screen,
|
||||
+ Window xwindow,
|
||||
+ WnckIconCache *icon_cache,
|
||||
+ cairo_surface_t **iconp,
|
||||
+ int ideal_size,
|
||||
+ cairo_surface_t **mini_iconp,
|
||||
+ int ideal_mini_size,
|
||||
+ int scaling_factor)
|
||||
{
|
||||
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 */
|
||||
@@ -556,6 +510,9 @@ _wnck_read_icons (WnckScreen *screen,
|
||||
*iconp = NULL;
|
||||
*mini_iconp = NULL;
|
||||
|
||||
+ ideal_size *= scaling_factor;
|
||||
+ ideal_mini_size *= scaling_factor;
|
||||
+
|
||||
if (ideal_size != icon_cache->ideal_size ||
|
||||
ideal_mini_size != icon_cache->ideal_mini_size)
|
||||
clear_icon_cache (icon_cache, TRUE);
|
||||
@@ -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 */
|
||||
|
||||
- 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.
|
||||
@@ -579,21 +534,15 @@ _wnck_read_icons (WnckScreen *screen,
|
||||
|
||||
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, mini_iconp,
|
||||
+ scaling_factor))
|
||||
{
|
||||
- *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);
|
||||
|
||||
@@ -604,6 +553,9 @@ _wnck_read_icons (WnckScreen *screen,
|
||||
if (icon_cache->origin <= USING_WM_HINTS &&
|
||||
icon_cache->wm_hints_dirty)
|
||||
{
|
||||
+ Pixmap pixmap;
|
||||
+ Pixmap mask;
|
||||
+
|
||||
icon_cache->wm_hints_dirty = FALSE;
|
||||
|
||||
_wnck_error_trap_push (display);
|
||||
@@ -632,7 +584,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;
|
||||
diff --git a/libwnck/xutils.c b/libwnck/xutils.c
|
||||
index 60ae7b2..476f027 100644
|
||||
--- a/libwnck/xutils.c
|
||||
+++ b/libwnck/xutils.c
|
||||
@@ -1389,7 +1389,8 @@ _wnck_select_input (Screen *screen,
|
||||
|
||||
cairo_surface_t *
|
||||
_wnck_cairo_surface_get_from_pixmap (Screen *screen,
|
||||
- Pixmap xpixmap)
|
||||
+ Pixmap xpixmap,
|
||||
+ int scaling_factor)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
Display *display;
|
||||
@@ -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;
|
||||
|
||||
+ w_ret *= scaling_factor;
|
||||
+ h_ret *= scaling_factor;
|
||||
+
|
||||
if (depth_ret == 1)
|
||||
{
|
||||
surface = cairo_xlib_surface_create_for_bitmap (display,
|
||||
@@ -1463,7 +1467,7 @@ _wnck_gdk_pixbuf_get_from_pixmap (Screen *screen,
|
||||
cairo_surface_t *surface;
|
||||
GdkPixbuf *retval;
|
||||
|
||||
- surface = _wnck_cairo_surface_get_from_pixmap (screen, xpixmap);
|
||||
+ surface = _wnck_cairo_surface_get_from_pixmap (screen, xpixmap, 1);
|
||||
|
||||
if (surface == NULL)
|
||||
return NULL;
|
||||
@@ -1478,36 +1482,30 @@ _wnck_gdk_pixbuf_get_from_pixmap (Screen *screen,
|
||||
return retval;
|
||||
}
|
||||
|
||||
-static GdkPixbuf*
|
||||
+static cairo_surface_t*
|
||||
default_icon_at_size (int size)
|
||||
{
|
||||
- GdkPixbuf *base;
|
||||
+ GdkPixbuf *pixbuf;
|
||||
+ cairo_surface_t *surface;
|
||||
|
||||
- base = gdk_pixbuf_new_from_resource ("/org/gnome/libwnck/default_icon.png", NULL);
|
||||
+ pixbuf = gdk_pixbuf_new_from_resource_at_scale ("/org/gnome/libwnck/default_icon.png",
|
||||
+ size, size,
|
||||
+ TRUE, NULL);
|
||||
|
||||
- g_assert (base);
|
||||
+ g_assert (pixbuf);
|
||||
|
||||
- if (gdk_pixbuf_get_width (base) == size &&
|
||||
- gdk_pixbuf_get_height (base) == size)
|
||||
- {
|
||||
- return base;
|
||||
- }
|
||||
- else
|
||||
- {
|
||||
- GdkPixbuf *scaled;
|
||||
+ surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, 0, NULL);
|
||||
|
||||
- scaled = gdk_pixbuf_scale_simple (base, size, size, GDK_INTERP_BILINEAR);
|
||||
- g_object_unref (G_OBJECT (base));
|
||||
+ g_clear_object (&pixbuf);
|
||||
|
||||
- return scaled;
|
||||
- }
|
||||
+ return surface;
|
||||
}
|
||||
|
||||
void
|
||||
-_wnck_get_fallback_icons (GdkPixbuf **iconp,
|
||||
- int ideal_size,
|
||||
- GdkPixbuf **mini_iconp,
|
||||
- int ideal_mini_size)
|
||||
+_wnck_get_fallback_icons (cairo_surface_t **iconp,
|
||||
+ int ideal_size,
|
||||
+ cairo_surface_t **mini_iconp,
|
||||
+ int ideal_mini_size)
|
||||
{
|
||||
if (iconp)
|
||||
*iconp = default_icon_at_size (ideal_size);
|
||||
diff --git a/libwnck/xutils.h b/libwnck/xutils.h
|
||||
index 4e5c620..51e8e55 100644
|
||||
--- a/libwnck/xutils.h
|
||||
+++ b/libwnck/xutils.h
|
||||
@@ -156,10 +156,10 @@ void _wnck_keyboard_size (WnckScreen *screen,
|
||||
void _wnck_toggle_showing_desktop (Screen *screen,
|
||||
gboolean show);
|
||||
|
||||
-void _wnck_get_fallback_icons (GdkPixbuf **iconp,
|
||||
- int ideal_size,
|
||||
- GdkPixbuf **mini_iconp,
|
||||
- int ideal_mini_size);
|
||||
+void _wnck_get_fallback_icons (cairo_surface_t **iconp,
|
||||
+ int ideal_size,
|
||||
+ cairo_surface_t **mini_iconp,
|
||||
+ int ideal_mini_size);
|
||||
|
||||
void _wnck_get_window_geometry (Screen *screen,
|
||||
Window xwindow,
|
||||
@@ -192,7 +192,8 @@ void _wnck_set_desktop_layout (Screen *xscreen,
|
||||
int columns);
|
||||
|
||||
cairo_surface_t *_wnck_cairo_surface_get_from_pixmap (Screen *screen,
|
||||
- Pixmap xpixmap);
|
||||
+ Pixmap xpixmap,
|
||||
+ int scaling_factor);
|
||||
|
||||
GdkPixbuf* _wnck_gdk_pixbuf_get_from_pixmap (Screen *screen,
|
||||
Pixmap xpixmap);
|
||||
--
|
||||
2.37.2
|
||||
|
189
libwnck_0004-icons-Mark-GdkPixbuf-icons-as-deprecated_43.patch
Normal file
189
libwnck_0004-icons-Mark-GdkPixbuf-icons-as-deprecated_43.patch
Normal file
@ -0,0 +1,189 @@
|
||||
From d8316f3e2745fde9039f03a1e619f13132f21bf4 Mon Sep 17 00:00:00 2001
|
||||
From: Victor Kareh <vkareh@redhat.com>
|
||||
Date: Tue, 11 Feb 2020 07:40:47 -0500
|
||||
Subject: [PATCH 4/5] icons: Mark GdkPixbuf icons as deprecated
|
||||
|
||||
Since we have migrated icons to render as cairo surfaces we can now mark
|
||||
GdkPixbuf icons as deprecated without having to break the API.
|
||||
---
|
||||
libwnck/application.c | 8 ++++++++
|
||||
libwnck/application.h | 6 ++++++
|
||||
libwnck/class-group.c | 4 ++++
|
||||
libwnck/class-group.h | 4 ++++
|
||||
libwnck/test-wnck.c | 2 +-
|
||||
libwnck/window.c | 6 ++++++
|
||||
libwnck/window.h | 4 ++++
|
||||
7 files changed, 33 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libwnck/application.c b/libwnck/application.c
|
||||
index b441eb6..9096ddb 100644
|
||||
--- a/libwnck/application.c
|
||||
+++ b/libwnck/application.c
|
||||
@@ -395,6 +395,8 @@ find_icon_window (WnckApplication *app)
|
||||
* Return value: (transfer none): the icon for @app. The caller should
|
||||
* reference the returned <classname>GdkPixbuf</classname> if it needs to keep
|
||||
* the icon around.
|
||||
+ *
|
||||
+ * Deprecated:41.0: Use wnck_application_get_icon_surface() instead.
|
||||
**/
|
||||
GdkPixbuf*
|
||||
wnck_application_get_icon (WnckApplication *app)
|
||||
@@ -434,10 +436,12 @@ wnck_application_get_icon (WnckApplication *app)
|
||||
}
|
||||
else
|
||||
{
|
||||
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
WnckWindow *w = find_icon_window (app);
|
||||
if (w)
|
||||
return wnck_window_get_icon (w);
|
||||
else
|
||||
+G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -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 <classname>GdkPixbuf</classname> if it needs to keep
|
||||
* the mini-icon around.
|
||||
+ *
|
||||
+ * Deprecated:41.0: Use wnck_application_get_mini_icon_surface() instead.
|
||||
**/
|
||||
GdkPixbuf*
|
||||
wnck_application_get_mini_icon (WnckApplication *app)
|
||||
@@ -492,10 +498,12 @@ wnck_application_get_mini_icon (WnckApplication *app)
|
||||
}
|
||||
else
|
||||
{
|
||||
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
WnckWindow *w = find_icon_window (app);
|
||||
if (w)
|
||||
return wnck_window_get_mini_icon (w);
|
||||
else
|
||||
+G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
diff --git a/libwnck/application.h b/libwnck/application.h
|
||||
index f3ea970..4d9078e 100644
|
||||
--- a/libwnck/application.h
|
||||
+++ b/libwnck/application.h
|
||||
@@ -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);
|
||||
+
|
||||
+G_DEPRECATED_FOR(wnck_application_get_icon_surface)
|
||||
GdkPixbuf* wnck_application_get_icon (WnckApplication *app);
|
||||
+
|
||||
+G_DEPRECATED_FOR(wnck_application_get_mini_icon_surface)
|
||||
GdkPixbuf* wnck_application_get_mini_icon (WnckApplication *app);
|
||||
+
|
||||
cairo_surface_t* wnck_application_get_icon_surface (WnckApplication *app);
|
||||
cairo_surface_t* wnck_application_get_mini_icon_surface (WnckApplication *app);
|
||||
+
|
||||
gboolean wnck_application_get_icon_is_fallback (WnckApplication *app);
|
||||
const char* wnck_application_get_startup_id (WnckApplication *app);
|
||||
|
||||
diff --git a/libwnck/class-group.c b/libwnck/class-group.c
|
||||
index 7899497..026e995 100644
|
||||
--- a/libwnck/class-group.c
|
||||
+++ b/libwnck/class-group.c
|
||||
@@ -689,6 +689,8 @@ wnck_class_group_get_name (WnckClassGroup *class_group)
|
||||
* the icon around.
|
||||
*
|
||||
* Since: 2.2
|
||||
+ *
|
||||
+ * Deprecated:41.0: Use wnck_class_group_get_icon_surface() instead.
|
||||
**/
|
||||
GdkPixbuf *
|
||||
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
|
||||
+ *
|
||||
+ * Deprecated:41.0: Use wnck_class_group_get_mini_icon_surface() instead.
|
||||
**/
|
||||
GdkPixbuf *
|
||||
wnck_class_group_get_mini_icon (WnckClassGroup *class_group)
|
||||
diff --git a/libwnck/class-group.h b/libwnck/class-group.h
|
||||
index 122e0ed..dee0e7c 100644
|
||||
--- a/libwnck/class-group.h
|
||||
+++ b/libwnck/class-group.h
|
||||
@@ -81,8 +81,12 @@ const char * wnck_class_group_get_id (WnckClassGroup *class_group);
|
||||
|
||||
const char * wnck_class_group_get_name (WnckClassGroup *class_group);
|
||||
|
||||
+G_DEPRECATED_FOR(wnck_class_group_get_icon_surface)
|
||||
GdkPixbuf *wnck_class_group_get_icon (WnckClassGroup *class_group);
|
||||
+
|
||||
+G_DEPRECATED_FOR(wnck_class_group_get_mini_icon_surface)
|
||||
GdkPixbuf *wnck_class_group_get_mini_icon (WnckClassGroup *class_group);
|
||||
+
|
||||
cairo_surface_t *wnck_class_group_get_icon_surface (WnckClassGroup *class_group);
|
||||
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 77085cd..649c2e6 100644
|
||||
--- a/libwnck/test-wnck.c
|
||||
+++ b/libwnck/test-wnck.c
|
||||
@@ -523,7 +523,7 @@ icon_set_func (GtkTreeViewColumn *tree_column,
|
||||
return;
|
||||
|
||||
g_object_set (GTK_CELL_RENDERER (cell),
|
||||
- "pixbuf", wnck_window_get_mini_icon (window),
|
||||
+ "surface", wnck_window_get_mini_icon_surface (window),
|
||||
NULL);
|
||||
}
|
||||
|
||||
diff --git a/libwnck/window.c b/libwnck/window.c
|
||||
index 5c97675..3cd800d 100644
|
||||
--- a/libwnck/window.c
|
||||
+++ b/libwnck/window.c
|
||||
@@ -21,6 +21,8 @@
|
||||
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
+#undef WNCK_DISABLE_DEPRECATED
|
||||
+
|
||||
#include <config.h>
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
@@ -2164,6 +2166,8 @@ _wnck_window_load_icons (WnckWindow *window)
|
||||
* Return value: (transfer none): the icon for @window. The caller should
|
||||
* reference the returned <classname>GdkPixbuf</classname> if it needs to keep
|
||||
* the icon around.
|
||||
+ *
|
||||
+ * Deprecated:41.0: Use wnck_window_get_icon_surface() instead.
|
||||
**/
|
||||
GdkPixbuf*
|
||||
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 <classname>GdkPixbuf</classname> if it needs to keep
|
||||
* the icon around.
|
||||
+ *
|
||||
+ * Deprecated:41.0: Use wnck_window_get_mini_icon_surface() instead.
|
||||
**/
|
||||
GdkPixbuf*
|
||||
wnck_window_get_mini_icon (WnckWindow *window)
|
||||
diff --git a/libwnck/window.h b/libwnck/window.h
|
||||
index 2bec086..d7e52f1 100644
|
||||
--- a/libwnck/window.h
|
||||
+++ b/libwnck/window.h
|
||||
@@ -381,8 +381,12 @@ void wnck_window_activate_transient (WnckWindow *window,
|
||||
guint32 timestamp);
|
||||
gboolean wnck_window_transient_is_most_recently_activated (WnckWindow *window);
|
||||
|
||||
+G_DEPRECATED_FOR(wnck_window_get_icon_surface)
|
||||
GdkPixbuf* wnck_window_get_icon (WnckWindow *window);
|
||||
+
|
||||
+G_DEPRECATED_FOR(wnck_window_get_mini_icon_surface)
|
||||
GdkPixbuf* wnck_window_get_mini_icon (WnckWindow *window);
|
||||
+
|
||||
cairo_surface_t* wnck_window_get_icon_surface (WnckWindow *window);
|
||||
cairo_surface_t* wnck_window_get_mini_icon_surface (WnckWindow *window);
|
||||
|
||||
--
|
||||
2.37.2
|
||||
|
134
libwnck_0005-tasklist-Add-surface-loader-function_43.patch
Normal file
134
libwnck_0005-tasklist-Add-surface-loader-function_43.patch
Normal file
@ -0,0 +1,134 @@
|
||||
From 6cdfd1fe219c207bcc3355fde21b58979cdbf633 Mon Sep 17 00:00:00 2001
|
||||
From: Victor Kareh <vkareh@redhat.com>
|
||||
Date: Thu, 3 Jun 2021 14:04:06 -0400
|
||||
Subject: [PATCH 5/5] tasklist: Add surface loader function
|
||||
|
||||
Since the tasklist now supports cairo_surface_t icons, we provide
|
||||
a similar icon loader function that takes surface icons.
|
||||
---
|
||||
libwnck/tasklist.c | 50 +++++++++++++++++++++++++++++++++++++++++++++-
|
||||
libwnck/tasklist.h | 26 ++++++++++++++++++++++++
|
||||
2 files changed, 75 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libwnck/tasklist.c b/libwnck/tasklist.c
|
||||
index 3e7b789..225f62e 100644
|
||||
--- a/libwnck/tasklist.c
|
||||
+++ b/libwnck/tasklist.c
|
||||
@@ -235,6 +235,10 @@ struct _WnckTasklistPrivate
|
||||
void *icon_loader_data;
|
||||
GDestroyNotify free_icon_loader_data;
|
||||
|
||||
+ WnckLoadSurfaceFunction surface_loader;
|
||||
+ void *surface_loader_data;
|
||||
+ GDestroyNotify free_surface_loader_data;
|
||||
+
|
||||
#ifdef HAVE_STARTUP_NOTIFICATION
|
||||
SnDisplay *sn_display;
|
||||
SnMonitorContext *sn_context;
|
||||
@@ -1215,6 +1219,11 @@ wnck_tasklist_finalize (GObject *object)
|
||||
tasklist->priv->free_icon_loader_data = NULL;
|
||||
tasklist->priv->icon_loader_data = NULL;
|
||||
|
||||
+ if (tasklist->priv->free_surface_loader_data != NULL)
|
||||
+ (* tasklist->priv->free_surface_loader_data) (tasklist->priv->surface_loader_data);
|
||||
+ tasklist->priv->free_surface_loader_data = NULL;
|
||||
+ tasklist->priv->surface_loader_data = NULL;
|
||||
+
|
||||
g_clear_object (&tasklist->priv->handle);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * wnck_tasklist_set_surface_loader:
|
||||
+ * @tasklist: a #WnckTasklist
|
||||
+ * @load_surface_func: icon loader function
|
||||
+ * @data: data for icon loader function
|
||||
+ * @free_data_func: function to free the data
|
||||
+ *
|
||||
+ * Sets a function to be used for loading cairo surface icons.
|
||||
+ **/
|
||||
+void
|
||||
+wnck_tasklist_set_surface_loader (WnckTasklist *tasklist,
|
||||
+ WnckLoadSurfaceFunction load_surface_func,
|
||||
+ void *data,
|
||||
+ GDestroyNotify free_data_func)
|
||||
+{
|
||||
+ g_return_if_fail (WNCK_IS_TASKLIST (tasklist));
|
||||
+
|
||||
+ if (tasklist->priv->free_surface_loader_data != NULL)
|
||||
+ (* tasklist->priv->free_surface_loader_data) (tasklist->priv->surface_loader_data);
|
||||
+
|
||||
+ tasklist->priv->surface_loader = load_surface_func;
|
||||
+ tasklist->priv->surface_loader_data = data;
|
||||
+ tasklist->priv->free_surface_loader_data = free_data_func;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
get_layout (GtkOrientation orientation,
|
||||
int for_size,
|
||||
@@ -3869,7 +3903,21 @@ wnck_task_get_icon (WnckTask *task)
|
||||
|
||||
case WNCK_TASK_STARTUP_SEQUENCE:
|
||||
#ifdef HAVE_STARTUP_NOTIFICATION
|
||||
- if (task->tasklist->priv->icon_loader != NULL)
|
||||
+ if (task->tasklist->priv->surface_loader != NULL)
|
||||
+ {
|
||||
+ const char *icon;
|
||||
+
|
||||
+ icon = sn_startup_sequence_get_icon_name (task->startup_sequence);
|
||||
+ if (icon != NULL)
|
||||
+ {
|
||||
+ surface = (* task->tasklist->priv->surface_loader) (icon,
|
||||
+ mini_icon_size,
|
||||
+ 0,
|
||||
+ task->tasklist->priv->surface_loader_data);
|
||||
+
|
||||
+ }
|
||||
+ }
|
||||
+ else if (task->tasklist->priv->icon_loader != NULL)
|
||||
{
|
||||
const char *icon;
|
||||
|
||||
diff --git a/libwnck/tasklist.h b/libwnck/tasklist.h
|
||||
index 5407d34..373eaaa 100644
|
||||
--- a/libwnck/tasklist.h
|
||||
+++ b/libwnck/tasklist.h
|
||||
@@ -141,6 +141,32 @@ void wnck_tasklist_set_icon_loader (WnckTasklist *tasklist,
|
||||
void *data,
|
||||
GDestroyNotify free_data_func);
|
||||
|
||||
+/**
|
||||
+ * WnckLoadSurfaceFunction:
|
||||
+ * @icon_name: an icon name as in the Icon field in a .desktop file for the
|
||||
+ * icon to load.
|
||||
+ * @size: the desired icon size.
|
||||
+ * @flags: not defined to do anything yet.
|
||||
+ * @data: data passed to the function, set when the #WnckLoadSurfaceFunction has
|
||||
+ * been set for the #WnckTasklist.
|
||||
+ *
|
||||
+ * Specifies the type of function passed to wnck_tasklist_set_icon_loader().
|
||||
+ *
|
||||
+ * Returns: it should return a <classname>cairo_surface_t</classname> of @icon_name
|
||||
+ * at size @size, or %NULL if no icon for @icon_name at size @size could be
|
||||
+ * loaded.
|
||||
+ *
|
||||
+ */
|
||||
+typedef cairo_surface_t* (*WnckLoadSurfaceFunction) (const char *icon_name,
|
||||
+ int size,
|
||||
+ unsigned int flags,
|
||||
+ void *data);
|
||||
+
|
||||
+void wnck_tasklist_set_surface_loader (WnckTasklist *tasklist,
|
||||
+ WnckLoadSurfaceFunction load_surface_func,
|
||||
+ void *data,
|
||||
+ GDestroyNotify free_data_func);
|
||||
+
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* WNCK_TASKLIST_H */
|
||||
--
|
||||
2.37.2
|
||||
|
Loading…
Reference in New Issue
Block a user