archrelease: copy trunk to extra-x86_64
[arch-packages.git] / libwnck3 / trunk / 0003-xutils-move-XRes-code-to-separate-function.patch
blobc1e6cf612863a3069eb0892bbeac54defae81d4e
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Alberts=20Muktup=C4=81vels?= <alberts.muktupavels@gmail.com>
3 Date: Fri, 30 Sep 2022 18:07:55 +0300
4 Subject: [PATCH] xutils: move XRes code to separate function
6 ---
7 libwnck/xutils.c | 28 ++++++++++++++++++++--------
8 1 file changed, 20 insertions(+), 8 deletions(-)
10 diff --git a/libwnck/xutils.c b/libwnck/xutils.c
11 index 60ae7b253228..d120ff16c0da 100644
12 --- a/libwnck/xutils.c
13 +++ b/libwnck/xutils.c
14 @@ -1145,37 +1145,49 @@ _wnck_get_session_id (Screen *screen,
15 _wnck_atom_get ("SM_CLIENT_ID"));
18 -int
19 -_wnck_get_pid (Screen *screen,
20 - Window xwindow)
21 +#ifdef HAVE_XRES
22 +static int
23 +xres_get_pid (Screen *screen,
24 + Window xwindow)
26 int pid = -1;
28 -#ifdef HAVE_XRES
29 XResClientIdSpec client_spec;
30 long client_id_count = 0;
31 XResClientIdValue *client_ids = NULL;
33 client_spec.client = xwindow;
34 client_spec.mask = XRES_CLIENT_ID_PID_MASK;
36 if (XResQueryClientIds (DisplayOfScreen (screen), 1, &client_spec,
37 &client_id_count, &client_ids) == Success)
39 long i;
41 for (i = 0; i < client_id_count; i++)
43 pid = XResGetClientPid (&client_ids[i]);
44 if (pid != -1)
45 break;
48 XResClientIdsDestroy (client_id_count, client_ids);
50 - if (pid != -1)
51 - return pid;
54 + return pid;
56 +#endif
58 +int
59 +_wnck_get_pid (Screen *screen,
60 + Window xwindow)
62 + int pid = -1;
64 +#ifdef HAVE_XRES
65 + pid = xres_get_pid (screen, xwindow);
67 + if (pid != -1)
68 + return pid;
69 #endif
71 if (!_wnck_get_cardinal (screen, xwindow,