ref: 3a300145dedef2e2cad9be0bf4ba2166770bc943
parent: 836f7f458e83e630f8554032cc7731c62edde5dd
author: cinap_lenrek <[email protected]>
date: Sat Apr 18 00:23:01 EDT 2020
x11: add _NET_WM_PID property to main window (thanks joe9)
--- a/gui-x11/x11.c
+++ b/gui-x11/x11.c
@@ -115,6 +115,7 @@
static Atom targets;
static Atom text;
static Atom compoundtext;
+static Atom wmpid;
static Drawable xdrawable;
static void xexpose(XEvent*);
@@ -201,6 +202,7 @@
XSetWindowAttributes attrs;
XPixmapFormatValues *pfmt;
Pixmap icon_pixmap;
+ unsigned long pid;
memimageinit();
@@ -344,6 +346,16 @@
&normalhints, /* XA_WM_NORMAL_HINTS */
&hints, /* XA_WM_HINTS */
&classhints); /* XA_WM_CLASS */
+ if ((wmpid = XInternAtom(xdisplay, "_NET_WM_PID", False)) != None) {
+ pid = (unsigned long) getpid();
+ XChangeProperty(xdisplay, xdrawable,
+ wmpid, /* Atom property */
+ XA_CARDINAL, /* Atom type */
+ 32, /* int format, 32 really is "long" */
+ PropModeReplace, /* int mode */
+ (uchar *)&pid, /* unsigned char * data */
+ 1); /* int nelements */
+ }
XFlush(xdisplay);
/*