summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
}