浏览代码

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

Anselm R. Garbe 18 年之前
父节点
当前提交
3ce8c9f338
共有 5 个文件被更改,包括 19 次插入7 次删除
  1. 9 1
      client.c
  2. 1 1
      config.mk
  3. 2 1
      dwm.h
  4. 1 1
      event.c
  5. 6 3
      view.c

+ 9 - 1
client.c

@@ -67,6 +67,14 @@ xerrordummy(Display *dsply, XErrorEvent *ee) {
 
 /* 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) {
 	XConfigureEvent ce;
@@ -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))

+ 1 - 1
config.mk

@@ -1,5 +1,5 @@
 # dwm version
-VERSION = 3.5
+VERSION = 3.6
 
 # Customize below to fit your system
 

+ 2 - 1
dwm.h

@@ -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 Display *dpy;
 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 */

+ 1 - 1
event.c

@@ -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);

+ 6 - 3
view.c

@@ -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);