aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calmwm.h5
-rw-r--r--client.c25
-rw-r--r--xutil.c3
3 files changed, 29 insertions, 4 deletions
diff --git a/calmwm.h b/calmwm.h
index b533103..cc9d089 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: calmwm.h,v 1.100 2009/12/07 22:21:59 oga Exp $
+ * $Id: calmwm.h,v 1.101 2009/12/07 22:46:15 oga Exp $
*/
#ifndef _CALMWM_H_
@@ -527,7 +527,8 @@ extern struct conf Conf;
#define _NET_SUPPORTING_WM_CHECK cwm_atoms[8]
#define _NET_WM_NAME cwm_atoms[9]
#define _NET_ACTIVE_WINDOW cwm_atoms[10]
-#define CWM_NO_ATOMS 11
+#define _NET_CLIENT_LIST cwm_atoms[11]
+#define CWM_NO_ATOMS 12
#define CWM_NETWM_START 7
extern Atom cwm_atoms[CWM_NO_ATOMS];
diff --git a/client.c b/client.c
index 16f5fd5..a8eaf06 100644
--- a/client.c
+++ b/client.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: client.c,v 1.67 2009/12/07 22:21:59 oga Exp $
+ * $Id: client.c,v 1.68 2009/12/07 22:46:15 oga Exp $
*/
#include "headers.h"
@@ -114,6 +114,9 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
TAILQ_INSERT_TAIL(&sc->mruq, cc, mru_entry);
TAILQ_INSERT_TAIL(&Clientq, cc, entry);
+ /* append to the client list */
+ XChangeProperty(X_Dpy, sc->rootwin, _NET_CLIENT_LIST, XA_WINDOW, 32,
+ PropModeAppend, (unsigned char *)&cc->win, 1);
client_gethints(cc);
client_update(cc);
@@ -128,7 +131,10 @@ int
client_delete(struct client_ctx *cc)
{
struct screen_ctx *sc = cc->sc;
+ struct client_ctx *tcc;
struct winname *wn;
+ Window *winlist;
+ int i, j;
group_client_delete(cc);
@@ -141,6 +147,23 @@ client_delete(struct client_ctx *cc)
TAILQ_REMOVE(&sc->mruq, cc, mru_entry);
TAILQ_REMOVE(&Clientq, cc, entry);
+ /*
+ * Sadly we can't remove just one entry from a property, so we must
+ * redo the whole thing from scratch. this is the stupid way, the other
+ * way incurs many roundtrips to the server.
+ */
+ i = j = 0;
+ TAILQ_FOREACH(tcc, &Clientq, entry)
+ i++;
+ if (i > 0) {
+ winlist = xmalloc(i * sizeof(*winlist));
+ TAILQ_FOREACH(tcc, &Clientq, entry)
+ winlist[j++] = tcc->win;
+ XChangeProperty(X_Dpy, sc->rootwin, _NET_CLIENT_LIST,
+ XA_WINDOW, 32, PropModeReplace,
+ (unsigned char *)winlist, i);
+ xfree(winlist);
+ }
if (_curcc == cc)
client_none(sc);
diff --git a/xutil.c b/xutil.c
index a2ba9b9..e1577dd 100644
--- a/xutil.c
+++ b/xutil.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: xutil.c,v 1.19 2009/12/07 22:21:59 oga Exp $
+ * $Id: xutil.c,v 1.20 2009/12/07 22:46:15 oga Exp $
*/
#include "headers.h"
@@ -182,6 +182,7 @@ char *atoms[CWM_NO_ATOMS] = {
"_NET_SUPPORTING_WM_CHECK",
"_NET_WM_NAME",
"_NET_ACTIVE_WINDOW",
+ "_NET_CLIENT_LIST",
};
void