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:39:00 +0300
4 Subject: [PATCH] xutils: use WnckScreen in _wnck_get_pid
7 libwnck/application.c | 2 +-
8 libwnck/window.c | 2 +-
9 libwnck/wnck-resource-usage.c | 26 +++++++++++++-------------
10 libwnck/xutils.c | 16 ++++++++++------
11 libwnck/xutils.h | 4 ++--
12 5 files changed, 27 insertions(+), 23 deletions(-)
14 diff --git a/libwnck/application.c b/libwnck/application.c
15 index 9ab7f4892fbf..31005ba40dfc 100644
16 --- a/libwnck/application.c
17 +++ b/libwnck/application.c
18 @@ -524,7 +524,7 @@ _wnck_application_create (Window xwindow,
19 if (application->priv->name)
20 application->priv->name_from_leader = TRUE;
22 - application->priv->pid = _wnck_get_pid (xscreen,
23 + application->priv->pid = _wnck_get_pid (screen,
24 application->priv->xwindow);
26 application->priv->startup_id = _wnck_get_utf8_property (xscreen,
27 diff --git a/libwnck/window.c b/libwnck/window.c
28 index 35bb37c1adaa..229b4cb1debc 100644
29 --- a/libwnck/window.c
30 +++ b/libwnck/window.c
31 @@ -510,7 +510,7 @@ _wnck_window_create (Window xwindow,
32 _wnck_get_session_id (xscreen, window->priv->xwindow);
35 - _wnck_get_pid (xscreen, window->priv->xwindow);
36 + _wnck_get_pid (screen, window->priv->xwindow);
40 diff --git a/libwnck/wnck-resource-usage.c b/libwnck/wnck-resource-usage.c
41 index a845d82bc99e..1d81c283a5ae 100644
42 --- a/libwnck/wnck-resource-usage.c
43 +++ b/libwnck/wnck-resource-usage.c
44 @@ -126,25 +126,25 @@ wnck_gulong_equal (gconstpointer a,
48 -wnck_check_window_for_pid (Screen *screen,
52 +wnck_check_window_for_pid (WnckScreen *screen,
57 if ((win & ~mask) == match_xid)
58 return _wnck_get_pid (screen, win);
64 -wnck_find_pid_for_resource_r (Display *xdisplay,
71 +wnck_find_pid_for_resource_r (Display *xdisplay,
81 @@ -250,10 +250,10 @@ wnck_pid_read_resource_usage_fill_cache (struct xresclient_state *state)
83 for (i = 0; i < ScreenCount (state->xdisplay); i++)
89 - screen = ScreenOfDisplay (state->xdisplay, i);
90 + screen = wnck_handle_get_screen (_wnck_get_handle (), i);
91 root = RootWindow (state->xdisplay, i);
94 diff --git a/libwnck/xutils.c b/libwnck/xutils.c
95 index d120ff16c0da..08be8aa96f1a 100644
96 --- a/libwnck/xutils.c
97 +++ b/libwnck/xutils.c
98 @@ -1147,50 +1147,54 @@ _wnck_get_session_id (Screen *screen,
102 -xres_get_pid (Screen *screen,
104 +xres_get_pid (WnckScreen *screen,
109 XResClientIdSpec client_spec;
110 long client_id_count = 0;
111 XResClientIdValue *client_ids = NULL;
113 + xscreen = _wnck_screen_get_xscreen (screen);
115 client_spec.client = xwindow;
116 client_spec.mask = XRES_CLIENT_ID_PID_MASK;
118 - if (XResQueryClientIds (DisplayOfScreen (screen), 1, &client_spec,
119 + if (XResQueryClientIds (DisplayOfScreen (xscreen), 1, &client_spec,
120 &client_id_count, &client_ids) == Success)
124 for (i = 0; i < client_id_count; i++)
126 pid = XResGetClientPid (&client_ids[i]);
131 XResClientIdsDestroy (client_id_count, client_ids);
139 -_wnck_get_pid (Screen *screen,
141 +_wnck_get_pid (WnckScreen *screen,
147 pid = xres_get_pid (screen, xwindow);
153 - if (!_wnck_get_cardinal (screen, xwindow,
154 + if (!_wnck_get_cardinal (_wnck_screen_get_xscreen (screen),
156 _wnck_atom_get ("_NET_WM_PID"),
159 diff --git a/libwnck/xutils.h b/libwnck/xutils.h
160 index 4e5c62049c1e..700832a4832b 100644
161 --- a/libwnck/xutils.h
162 +++ b/libwnck/xutils.h
163 @@ -123,8 +123,8 @@ void _wnck_change_viewport (Screen *screen,
165 char* _wnck_get_session_id (Screen *screen,
167 -int _wnck_get_pid (Screen *screen,
169 +int _wnck_get_pid (WnckScreen *screen,
171 char* _wnck_get_name (Screen *screen,
173 char* _wnck_get_icon_name (Screen *screen,