XWorkstation.st
branchjv
changeset 6916 2a4ce6c4d0b5
parent 6915 7f3a3fe5b871
child 6925 4d77a816de2c
--- a/XWorkstation.st	Wed Sep 09 12:44:40 2015 +0100
+++ b/XWorkstation.st	Wed Sep 09 07:15:37 2015 +0100
@@ -32,7 +32,8 @@
 		xlibTimeoutForWindowCreation hasConnectionBroken uniqueDeviceID
 		stxDeviceAtom uuidAtom primaryBuffer windowGroupWindow
 		maxOperationsUntilFlush operationsUntilFlush lastError hostname 
-		wmClientLeaderAtom wmClientMachineAtom wmClassName wmClassClass'
+		wmClientLeaderAtom wmClientMachineAtom wmClassName wmClassClass
+		pid netWmPidAtom'
 	classVariableNames:'RawKeySymTranslation ConservativeSync MaxStringLength
 		DefaultXLibTimeout DefaultXLibTimeoutForWindowCreation
 		ErrorDBCache'
@@ -1885,6 +1886,7 @@
     Atom WmQuitAppAtom, MotifWMHintsAtom;
     Atom WmClientLeaderAtom;
     Atom WmClientMachineAtom;
+    Atom NetWmPidAtom;
     Atom STXDeviceAtom, UUIDAtom;
     Atom atoms[3];
     int atomCount = 0;
@@ -2085,6 +2087,9 @@
 	    WmClientMachineAtom = XInternAtom(dpy, "WM_CLIENT_MACHINE", False);
 	    __INST(wmClientMachineAtom) = __MKATOMOBJ(WmClientMachineAtom);
 
+	    NetWmPidAtom = XInternAtom(dpy, "_NET_WM_PID", False);
+	    __INST(netWmPidAtom) = __MKATOMOBJ(NetWmPidAtom);
+
 	    UUIDAtom = XInternAtom(dpy, "UUID", False);
 	    __INST(uuidAtom) = __MKATOMOBJ(UUIDAtom);
 	    STXDeviceAtom = XInternAtom(dpy, "STX_DEVICE_ID", False);
@@ -2106,6 +2111,8 @@
 #endif
 	    WmClientLeaderAtom = __AtomVal(__INST(wmClientLeaderAtom));
 	    WmClientMachineAtom = __AtomVal(__INST(wmClientMachineAtom));
+	    NetWmPidAtom = __AtomVal(__INST(netWmPidAtom));
+
 	    UUIDAtom = __AtomVal(__INST(uuidAtom));;
 	    STXDeviceAtom = __AtomVal(__INST(stxDeviceAtom));;
 	}
@@ -2146,7 +2153,7 @@
 
 	ENTER_XLIB();
 	/* 
-	 * Required by ICCCM (https://tronche.com/gui/x/icccm/sec-5.html)
+	 * Defined by ICCCM (https://tronche.com/gui/x/icccm/sec-5.html)
 	 * Section 5.1. Client Support for Session Management,         
          */
 	XChangeProperty (dpy, newWindow, WmClientLeaderAtom, XA_WINDOW, 32, 
@@ -2171,6 +2178,15 @@
 	    classhint.res_name = (char *) __stringVal(__INST(wmClassName));
 	}	
 	XSetClassHint(myDpy, newWindow, &classhint);
+        /*
+	 * Defined by EWMH, http://standards.freedesktop.org/wm-spec/1.3
+	 * Section Application Window Properties
+	 */
+	if (__isInteger(__INST(pid))) {
+	int pid = __intVal(__INST(pid));
+	XChangeProperty (dpy, newWindow, NetWmPidAtom, XA_CARDINAL, 32, 
+	                 PropModeReplace, (unsigned char *)&pid, 1);
+	}	
 	LEAVE_XLIB();
 
 #ifdef SUPPORT_MOTIF_WM_HINTS
@@ -8914,8 +8930,12 @@
 	wmClassClass := 'SmalltalkX'.
     ] ifFalse:[
 	wmClassClass := wmClassName asUppercaseFirst.
-    ]
-
+    ].
+    "
+    Cache pid in order to set _NET_WM_PID properu
+    (defined by EWMH, Section Application Window Properties
+    "
+    pid := OperatingSystem getProcessId.
 
     "Modified (comment): / 17-04-2012 / 21:18:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !