summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2022-09-30 18:07:55 +0300
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2022-09-30 18:07:55 +0300
commitf6b973b1f15ac1d8b8203972195d9a1765c75ba2 (patch)
tree47028f1d460e2c939f800b1b7bb4457c54882345
parent4ee0ab2b0665da5cb0ad16d6d163ad20549b7ba6 (diff)
downloadlibwnck-f6b973b1f15ac1d8b8203972195d9a1765c75ba2.tar.gz
xutils: move XRes code to separate function
-rw-r--r--libwnck/xutils.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/libwnck/xutils.c b/libwnck/xutils.c
index 60ae7b2..d120ff1 100644
--- a/libwnck/xutils.c
+++ b/libwnck/xutils.c
@@ -1145,13 +1145,12 @@ _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;
@@ -1172,10 +1171,23 @@ _wnck_get_pid (Screen *screen,
}
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,