[hackers] [dwm] added ban() which takes care than a banned window is not banned again... (this reduces the overall ConfigureNotify's to clients)

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Wed Feb 14 14:03:49 2007

changeset: 760:8ed842c35e8d
tag: tip
user: Anselm R. Garbe <arg_AT_suckless.org>
date: Wed Feb 14 14:01:12 2007 +0100
summary: added ban() which takes care than a banned window is not banned again... (this reduces the overall ConfigureNotify's to clients)

diff -r 6365c9425b48 -r 8ed842c35e8d client.c
--- a/client.c Wed Feb 14 09:35:48 2007 +0100
+++ b/client.c Wed Feb 14 14:01:12 2007 +0100
@@ -66,6 +66,14 @@ xerrordummy(Display *dsply, XErrorEvent
 }
 
 /* extern */
+
+void
+ban(Client *c) {
+ if(!c || c->isbanned)
+ return;
+ c->isbanned = True;
+ XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
+}
 
 void
 configure(Client *c) {
@@ -190,7 +198,7 @@ manage(Window w, XWindowAttributes *wa)
         c->next = clients;
         c->snext = stack;
         stack = clients = c;
- XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
+ ban(c);
         XMapWindow(dpy, c->win);
         setclientstate(c, NormalState);
         if(isvisible(c))
diff -r 6365c9425b48 -r 8ed842c35e8d config.mk
--- a/config.mk Wed Feb 14 09:35:48 2007 +0100
+++ b/config.mk Wed Feb 14 14:01:12 2007 +0100
@@ -1,5 +1,5 @@
 # dwm version
-VERSION = 3.5
+VERSION = 3.6
 
 # Customize below to fit your system
 
diff -r 6365c9425b48 -r 8ed842c35e8d dwm.h
--- a/dwm.h Wed Feb 14 09:35:48 2007 +0100
+++ b/dwm.h Wed Feb 14 14:01:12 2007 +0100
@@ -73,7 +73,7 @@ struct Client {
         int minax, minay, maxax, maxay;
         long flags;
         unsigned int border;
- Bool isfixed, isfloat, ismax;
+ Bool isbanned, isfixed, isfloat, ismax;
         Bool *tags;
         Client *next;
         Client *prev;
@@ -99,6 +99,7 @@ extern Window root, barwin;
 extern Window root, barwin;
 
 /* client.c */
+extern void ban(Client *c); /* ban c */
 extern void configure(Client *c); /* send synthetic configure event */
 extern void focus(Client *c); /* focus c, c may be NULL */
 extern Client *getclient(Window w); /* return client of w */
diff -r 6365c9425b48 -r 8ed842c35e8d event.c
--- a/event.c Wed Feb 14 09:35:48 2007 +0100
+++ b/event.c Wed Feb 14 14:01:12 2007 +0100
@@ -189,7 +189,7 @@ configurerequest(XEvent *e) {
                                 configure(c);
                         resize(c, False);
                         if(!isvisible(c))
- XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
+ ban(c);
                 }
                 else
                         configure(c);
diff -r 6365c9425b48 -r 8ed842c35e8d view.c
--- a/view.c Wed Feb 14 09:35:48 2007 +0100
+++ b/view.c Wed Feb 14 14:01:12 2007 +0100
@@ -55,10 +55,12 @@ dofloat(void) {
         Client *c;
 
         for(c = clients; c; c = c->next) {
- if(isvisible(c))
+ if(isvisible(c)) {
+ c->isbanned = False;
                         resize(c, True);
+ }
                 else
- XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
+ ban(c);
         }
         if(!sel || !isvisible(sel)) {
                 for(c = stack; c && !isvisible(c); c = c->snext);
@@ -82,6 +84,7 @@ dotile(void) {
 
         for(i = 0, c = clients; c; c = c->next)
                 if(isvisible(c)) {
+ c->isbanned = False;
                         if(c->isfloat) {
                                 resize(c, True);
                                 continue;
@@ -108,7 +111,7 @@ dotile(void) {
                         i++;
                 }
                 else
- XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
+ ban(c);
         if(!sel || !isvisible(sel)) {
                 for(c = stack; c && !isvisible(c); c = c->snext);
                 focus(c);
Received on Wed Feb 14 2007 - 14:03:49 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:55:19 UTC