summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2007-06-12 19:13:23 -0700
committerAlan Coopersmith <alan.coopersmith@sun.com>2007-06-12 19:13:23 -0700
commit300afc5784cec539a1a9d2babb9f73056aee52cd (patch)
treea360625a73a1f8b94f4119542c55113feb35e843
parent861edc2009b8224d9acf77b9703a9fdb7d4903cc (diff)
X.Org Bug 10775: xclock does not set _NET_WM_PID
X.Org Bugzilla #10775: <https://bugs.freedesktop.org/show_bug.cgi?id=10775>
-rw-r--r--configure.ac2
-rw-r--r--xclock.c15
2 files changed, 16 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 6f8a7d0..a23ec02 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,7 +31,7 @@ AM_CONFIG_HEADER(config.h)
AC_PROG_CC
AC_PROG_INSTALL
-AC_CHECK_FUNCS([strlcpy])
+AC_CHECK_FUNCS([strlcpy getpid])
AC_SEARCH_LIBS([iconv], [iconv],
[AC_DEFINE(HAVE_ICONV, 1, [Define to 1 if iconv() is available.])])
diff --git a/xclock.c b/xclock.c
index 18e6c16..7b8b287 100644
--- a/xclock.c
+++ b/xclock.c
@@ -57,6 +57,10 @@ in this Software without prior written authorization from The Open Group.
Boolean no_locale = True; /* if True, use old behavior */
#endif
+#ifdef HAVE_GETPID
+# include <unistd.h>
+#endif
+
/* Command line options table. Only resources are entered here...there is a
pass over the remaining options after XtParseCommand is let loose. */
@@ -208,6 +212,17 @@ main(int argc, char *argv[])
False);
(void) XSetWMProtocols (XtDisplay(toplevel), XtWindow(toplevel),
&wm_delete_window, 1);
+
+#ifdef HAVE_GETPID
+ {
+ pid_t pid = getpid();
+ XChangeProperty(XtDisplay(toplevel), XtWindow(toplevel),
+ XInternAtom(XtDisplay(toplevel), "_NET_WM_PID", False),
+ XA_CARDINAL, 32, PropModeReplace,
+ (unsigned char *) &pid, 1);
+ }
+#endif
+
XtAppMainLoop (app_con);
exit(0);
}