Date: Tuesday, November 15, 2022 @ 22:35:41 Author: heftig Revision: 461856
43.0-3: FS#76564 more patches Added: libwnck3/trunk/0002-handle-init-XRes-extension.patch libwnck3/trunk/0003-xutils-move-XRes-code-to-separate-function.patch libwnck3/trunk/0004-xutils-use-WnckScreen-in-_wnck_get_pid.patch libwnck3/trunk/0005-xutils-check-if-XRes-is-available-before-using-XResQ.patch Modified: libwnck3/trunk/PKGBUILD -----------------------------------------------------------------+ 0002-handle-init-XRes-extension.patch | 132 +++++++ 0003-xutils-move-XRes-code-to-separate-function.patch | 71 ++++ 0004-xutils-use-WnckScreen-in-_wnck_get_pid.patch | 173 ++++++++++ 0005-xutils-check-if-XRes-is-available-before-using-XResQ.patch | 25 + PKGBUILD | 20 - 5 files changed, 418 insertions(+), 3 deletions(-) Added: 0002-handle-init-XRes-extension.patch =================================================================== --- 0002-handle-init-XRes-extension.patch (rev 0) +++ 0002-handle-init-XRes-extension.patch 2022-11-15 22:35:41 UTC (rev 461856) @@ -0,0 +1,132 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Alberts=20Muktup=C4=81vels?= <alberts.muktupav...@gmail.com> +Date: Fri, 30 Sep 2022 17:32:09 +0300 +Subject: [PATCH] handle: init XRes extension + +XResQueryClientIds needs XRes 1.2 or newer. +--- + libwnck/wnck-handle-private.h | 2 ++ + libwnck/wnck-handle.c | 48 +++++++++++++++++++++++++++++++++++ + meson.build | 2 +- + 3 files changed, 51 insertions(+), 1 deletion(-) + +diff --git a/libwnck/wnck-handle-private.h b/libwnck/wnck-handle-private.h +index c4217cefd277..063310400934 100644 +--- a/libwnck/wnck-handle-private.h ++++ b/libwnck/wnck-handle-private.h +@@ -26,6 +26,8 @@ G_BEGIN_DECLS + + WnckClientType _wnck_handle_get_client_type (WnckHandle *self); + ++gboolean _wnck_handle_has_xres (WnckHandle *self); ++ + gsize _wnck_handle_get_default_icon_size (WnckHandle *self); + + gsize _wnck_handle_get_default_mini_icon_size (WnckHandle *self); +diff --git a/libwnck/wnck-handle.c b/libwnck/wnck-handle.c +index 8d5da45c8787..fa11d3d16cd1 100644 +--- a/libwnck/wnck-handle.c ++++ b/libwnck/wnck-handle.c +@@ -29,20 +29,27 @@ + #include "config.h" + #include "wnck-handle-private.h" + ++#include <X11/Xlib.h> ++#ifdef HAVE_XRES ++#include <X11/extensions/XRes.h> ++#endif ++ + #include "private.h" + #include "screen.h" + #include "window.h" + #include "wnck-enum-types.h" + #include "xutils.h" + + struct _WnckHandle + { + GObject parent; + + WnckScreen **screens; + + WnckClientType client_type; + ++ gboolean have_xres; ++ + gsize default_icon_size; + gsize default_mini_icon_size; + +@@ -167,6 +174,40 @@ filter_func (GdkXEvent *gdkxevent, + return GDK_FILTER_CONTINUE; + } + ++static void ++init_xres (WnckHandle *self) ++{ ++#ifdef HAVE_XRES ++ Display *xdisplay; ++ int event_base; ++ int error_base; ++ int major; ++ int minor; ++ ++ xdisplay = _wnck_get_default_display (); ++ event_base = error_base = major = minor = 0; ++ ++ if (XResQueryExtension (xdisplay, &event_base, &error_base) && ++ XResQueryVersion (xdisplay, &major, &minor) == 1) ++ { ++ if (major > 1 || (major == 1 && minor >= 2)) ++ self->have_xres = TRUE; ++ } ++#endif ++} ++ ++static void ++wnck_handle_constructed (GObject *object) ++{ ++ WnckHandle *self; ++ ++ self = WNCK_HANDLE (object); ++ ++ G_OBJECT_CLASS (wnck_handle_parent_class)->constructed (object); ++ ++ init_xres (self); ++} ++ + static void + wnck_handle_finalize (GObject *object) + { +@@ -293,6 +334,7 @@ wnck_handle_class_init (WnckHandleClass *self_class) + + object_class = G_OBJECT_CLASS (self_class); + ++ object_class->constructed = wnck_handle_constructed; + object_class->finalize = wnck_handle_finalize; + object_class->get_property = wnck_handle_get_property; + object_class->set_property = wnck_handle_set_property; +@@ -346,6 +388,12 @@ _wnck_handle_get_client_type (WnckHandle *self) + return self->client_type; + } + ++gboolean ++_wnck_handle_has_xres (WnckHandle *self) ++{ ++ return self->have_xres; ++} ++ + /** + * wnck_handle_get_default_screen: + * @self: a #WnckHandle +diff --git a/meson.build b/meson.build +index 6b0eea97af5b..907fdf269e7e 100644 +--- a/meson.build ++++ b/meson.build +@@ -45,7 +45,7 @@ pkg_deps = [ + {'name': 'gtk+-3.0', 'version': '>= 3.22.0' }, + {'name': STARTUP_NOTIFICATION_PACKAGE, 'version': '>= 0.4', 'required': get_option('startup_notification')}, + {'name': X11_PACKAGE }, +- {'name': XRES_PACKAGE, 'required': false}, ++ {'name': XRES_PACKAGE, 'version': '>= 1.2', 'required': false}, + ] + + foreach p: pkg_deps Added: 0003-xutils-move-XRes-code-to-separate-function.patch =================================================================== --- 0003-xutils-move-XRes-code-to-separate-function.patch (rev 0) +++ 0003-xutils-move-XRes-code-to-separate-function.patch 2022-11-15 22:35:41 UTC (rev 461856) @@ -0,0 +1,71 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Alberts=20Muktup=C4=81vels?= <alberts.muktupav...@gmail.com> +Date: Fri, 30 Sep 2022 18:07:55 +0300 +Subject: [PATCH] xutils: move XRes code to separate function + +--- + libwnck/xutils.c | 28 ++++++++++++++++++++-------- + 1 file changed, 20 insertions(+), 8 deletions(-) + +diff --git a/libwnck/xutils.c b/libwnck/xutils.c +index 60ae7b253228..d120ff16c0da 100644 +--- a/libwnck/xutils.c ++++ b/libwnck/xutils.c +@@ -1145,37 +1145,49 @@ _wnck_get_session_id (Screen *screen, + _wnck_atom_get ("SM_CLIENT_ID")); + } + +-int +-_wnck_get_pid (Screen *screen, +- Window xwindow) ++#ifdef HAVE_XRES ++static int ++xres_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; + } ++ ++ return pid; ++} ++#endif ++ ++int ++_wnck_get_pid (Screen *screen, ++ Window xwindow) ++{ ++ int pid = -1; ++ ++#ifdef HAVE_XRES ++ pid = xres_get_pid (screen, xwindow); ++ ++ if (pid != -1) ++ return pid; + #endif + + if (!_wnck_get_cardinal (screen, xwindow, Added: 0004-xutils-use-WnckScreen-in-_wnck_get_pid.patch =================================================================== --- 0004-xutils-use-WnckScreen-in-_wnck_get_pid.patch (rev 0) +++ 0004-xutils-use-WnckScreen-in-_wnck_get_pid.patch 2022-11-15 22:35:41 UTC (rev 461856) @@ -0,0 +1,173 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Alberts=20Muktup=C4=81vels?= <alberts.muktupav...@gmail.com> +Date: Fri, 30 Sep 2022 18:39:00 +0300 +Subject: [PATCH] xutils: use WnckScreen in _wnck_get_pid + +--- + libwnck/application.c | 2 +- + libwnck/window.c | 2 +- + libwnck/wnck-resource-usage.c | 26 +++++++++++++------------- + libwnck/xutils.c | 16 ++++++++++------ + libwnck/xutils.h | 4 ++-- + 5 files changed, 27 insertions(+), 23 deletions(-) + +diff --git a/libwnck/application.c b/libwnck/application.c +index 9ab7f4892fbf..31005ba40dfc 100644 +--- a/libwnck/application.c ++++ b/libwnck/application.c +@@ -524,7 +524,7 @@ _wnck_application_create (Window xwindow, + if (application->priv->name) + application->priv->name_from_leader = TRUE; + +- application->priv->pid = _wnck_get_pid (xscreen, ++ application->priv->pid = _wnck_get_pid (screen, + application->priv->xwindow); + + application->priv->startup_id = _wnck_get_utf8_property (xscreen, +diff --git a/libwnck/window.c b/libwnck/window.c +index 35bb37c1adaa..229b4cb1debc 100644 +--- a/libwnck/window.c ++++ b/libwnck/window.c +@@ -510,7 +510,7 @@ _wnck_window_create (Window xwindow, + _wnck_get_session_id (xscreen, window->priv->xwindow); + + window->priv->pid = +- _wnck_get_pid (xscreen, window->priv->xwindow); ++ _wnck_get_pid (screen, window->priv->xwindow); + + window->priv->x = 0; + window->priv->y = 0; +diff --git a/libwnck/wnck-resource-usage.c b/libwnck/wnck-resource-usage.c +index a845d82bc99e..1d81c283a5ae 100644 +--- a/libwnck/wnck-resource-usage.c ++++ b/libwnck/wnck-resource-usage.c +@@ -126,25 +126,25 @@ wnck_gulong_equal (gconstpointer a, + } + + static gulong +-wnck_check_window_for_pid (Screen *screen, +- Window win, +- XID match_xid, +- XID mask) ++wnck_check_window_for_pid (WnckScreen *screen, ++ Window win, ++ XID match_xid, ++ XID mask) + { + if ((win & ~mask) == match_xid) + return _wnck_get_pid (screen, win); + + return 0; + } + + static void +-wnck_find_pid_for_resource_r (Display *xdisplay, +- Screen *screen, +- Window win_top, +- XID match_xid, +- XID mask, +- gulong *xid, +- gulong *pid) ++wnck_find_pid_for_resource_r (Display *xdisplay, ++ WnckScreen *screen, ++ Window win_top, ++ XID match_xid, ++ XID mask, ++ gulong *xid, ++ gulong *pid) + { + Status qtres; + int err; +@@ -250,10 +250,10 @@ wnck_pid_read_resource_usage_fill_cache (struct xresclient_state *state) + + for (i = 0; i < ScreenCount (state->xdisplay); i++) + { +- Screen *screen; ++ WnckScreen *screen; + Window root; + +- screen = ScreenOfDisplay (state->xdisplay, i); ++ screen = wnck_handle_get_screen (_wnck_get_handle (), i); + root = RootWindow (state->xdisplay, i); + + if (root == None) +diff --git a/libwnck/xutils.c b/libwnck/xutils.c +index d120ff16c0da..08be8aa96f1a 100644 +--- a/libwnck/xutils.c ++++ b/libwnck/xutils.c +@@ -1147,50 +1147,54 @@ _wnck_get_session_id (Screen *screen, + + #ifdef HAVE_XRES + static int +-xres_get_pid (Screen *screen, +- Window xwindow) ++xres_get_pid (WnckScreen *screen, ++ Window xwindow) + { + int pid = -1; ++ Screen *xscreen; + XResClientIdSpec client_spec; + long client_id_count = 0; + XResClientIdValue *client_ids = NULL; + ++ xscreen = _wnck_screen_get_xscreen (screen); ++ + client_spec.client = xwindow; + client_spec.mask = XRES_CLIENT_ID_PID_MASK; + +- if (XResQueryClientIds (DisplayOfScreen (screen), 1, &client_spec, ++ if (XResQueryClientIds (DisplayOfScreen (xscreen), 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); + } + + return pid; + } + #endif + + int +-_wnck_get_pid (Screen *screen, +- Window xwindow) ++_wnck_get_pid (WnckScreen *screen, ++ Window xwindow) + { + int pid = -1; + + #ifdef HAVE_XRES + pid = xres_get_pid (screen, xwindow); + + if (pid != -1) + return pid; + #endif + +- if (!_wnck_get_cardinal (screen, xwindow, ++ if (!_wnck_get_cardinal (_wnck_screen_get_xscreen (screen), ++ xwindow, + _wnck_atom_get ("_NET_WM_PID"), + &pid)) + return 0; +diff --git a/libwnck/xutils.h b/libwnck/xutils.h +index 4e5c62049c1e..700832a4832b 100644 +--- a/libwnck/xutils.h ++++ b/libwnck/xutils.h +@@ -123,8 +123,8 @@ void _wnck_change_viewport (Screen *screen, + + char* _wnck_get_session_id (Screen *screen, + Window xwindow); +-int _wnck_get_pid (Screen *screen, +- Window xwindow); ++int _wnck_get_pid (WnckScreen *screen, ++ Window xwindow); + char* _wnck_get_name (Screen *screen, + Window xwindow); + char* _wnck_get_icon_name (Screen *screen, Added: 0005-xutils-check-if-XRes-is-available-before-using-XResQ.patch =================================================================== --- 0005-xutils-check-if-XRes-is-available-before-using-XResQ.patch (rev 0) +++ 0005-xutils-check-if-XRes-is-available-before-using-XResQ.patch 2022-11-15 22:35:41 UTC (rev 461856) @@ -0,0 +1,25 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Alberts=20Muktup=C4=81vels?= <alberts.muktupav...@gmail.com> +Date: Fri, 30 Sep 2022 18:43:07 +0300 +Subject: [PATCH] xutils: check if XRes is available before using + XResQueryClientIds + +https://gitlab.gnome.org/GNOME/libwnck/-/issues/154 +--- + libwnck/xutils.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/libwnck/xutils.c b/libwnck/xutils.c +index 08be8aa96f1a..91c2d50ee733 100644 +--- a/libwnck/xutils.c ++++ b/libwnck/xutils.c +@@ -1156,6 +1156,9 @@ xres_get_pid (WnckScreen *screen, + long client_id_count = 0; + XResClientIdValue *client_ids = NULL; + ++ if (!_wnck_handle_has_xres (wnck_screen_get_handle (screen))) ++ return -1; ++ + xscreen = _wnck_screen_get_xscreen (screen); + + client_spec.client = xwindow; Modified: PKGBUILD =================================================================== --- PKGBUILD 2022-11-15 22:30:23 UTC (rev 461855) +++ PKGBUILD 2022-11-15 22:35:41 UTC (rev 461856) @@ -3,7 +3,7 @@ pkgname=libwnck3 pkgver=43.0 -pkgrel=2 +pkgrel=3 pkgdesc="Library to manage X windows and workspaces (via pagers, tasklists, etc.)" url="https://gitlab.gnome.org/GNOME/libwnck" arch=(x86_64) @@ -13,9 +13,17 @@ options=(debug) _commit=6147abd0c1fe35b96e1fbb63fa94d23f91fb2934 # tags/43.0^0 source=("git+https://gitlab.gnome.org/GNOME/libwnck.git#commit=$_commit" - 0001-handle-avoid-segfault-in-invalidate_icons.patch) + 0001-handle-avoid-segfault-in-invalidate_icons.patch + 0002-handle-init-XRes-extension.patch + 0003-xutils-move-XRes-code-to-separate-function.patch + 0004-xutils-use-WnckScreen-in-_wnck_get_pid.patch + 0005-xutils-check-if-XRes-is-available-before-using-XResQ.patch) b2sums=('SKIP' - 'f7c2c5261aab62e424cdb84c1a10b831423c82725472adcec8c41b9e6e55f65bf8705451ee7774824d8c05af3332ba6d34a0be7649e389f8942b759f9849fa68') + 'f7c2c5261aab62e424cdb84c1a10b831423c82725472adcec8c41b9e6e55f65bf8705451ee7774824d8c05af3332ba6d34a0be7649e389f8942b759f9849fa68' + 'a186d046e8dc1c8103f9f9a843e0a426d5b11ab3d022a69a9ed7837cf18bc043056ce82f2ca23781d4514996c329f1837a77c6a6d2edf2282b5cac1ec6a03853' + '148b4ecaffadd8b6fc916ad1b744d4588bd4185dd84a1ea476c845db39af45a0e6461d4dd2301d34fba4e386c0f0142cae3f480bfa8076769a303132252c509b' + 'c93d4308e4f60647225f01b75309b2f795ed8d3eb4285948f131ac7b3c60337f7502ba4dd455dddfc9634e177cecca43b4c1e0af428a197df33ea857258e2866' + '02bfef6c46edb6af7ca82500bcb0e23a1838c9e843b6f524d0d570a0a1ae59af00497bf5a2ab1ac7ef9ffdf2b0d2d1a4e74084d8edaa6a39182e909e168bd164') pkgver() { cd libwnck @@ -27,6 +35,12 @@ # https://bugs.archlinux.org/task/76007 git apply -3 ../0001-handle-avoid-segfault-in-invalidate_icons.patch + + # https://bugs.archlinux.org/task/76564 + git apply -3 ../0002-handle-init-XRes-extension.patch + git apply -3 ../0003-xutils-move-XRes-code-to-separate-function.patch + git apply -3 ../0004-xutils-use-WnckScreen-in-_wnck_get_pid.patch + git apply -3 ../0005-xutils-check-if-XRes-is-available-before-using-XResQ.patch } build() {