[hackers] [wmii] Don't call getpid() for every window creation. || Kris Maglione

From: <hg_AT_suckless.org>
Date: Thu, 27 May 2010 21:38:32 +0000 (UTC)

changeset: 2654:15595804e7a9
user: Kris Maglione <kris_AT_suckless.org>
date: Thu May 27 17:37:50 2010 -0400
files: lib/libstuff/x11/windows/createwindow_visual.c
description:
Don't call getpid() for every window creation.

diff -r 85ce73328c49 -r 15595804e7a9 lib/libstuff/x11/windows/createwindow_visual.c
--- a/lib/libstuff/x11/windows/createwindow_visual.c Thu May 27 17:37:09 2010 -0400
+++ b/lib/libstuff/x11/windows/createwindow_visual.c Thu May 27 17:37:50 2010 -0400
@@ -6,6 +6,7 @@
 #include <unistd.h>
 
 static char hostname[HOST_NAME_MAX + 1];
+static long pid;
 
 Window*
 createwindow_visual(Window *parent, Rectangle r,
@@ -37,7 +38,10 @@
         if(class != InputOnly)
                 w->gc = XCreateGC(display, w->xid, 0, nil);
 
- changeprop_ulong(w, "_NET_WM_PID", "CARDINAL", (ulong[1]){ getpid() }, 1);
+ if(pid == 0)
+ pid = getpid();
+ changeprop_long(w, "_NET_WM_PID", "CARDINAL", &pid, 1);
+
         if(!hostname[0])
                 gethostname(hostname, sizeof(hostname) - 1);
         if(hostname[0])
Received on Thu May 27 2010 - 21:38:32 UTC

This archive was generated by hypermail 2.2.0 : Thu May 27 2010 - 21:48:03 UTC