Mercurial > dwm-meillo
comparison client.c @ 52:d18f6dd0cf23
fixed several things, nearly feature complete
author | Anselm R. Garbe <garbeam@wmii.de> |
---|---|
date | Thu, 13 Jul 2006 20:28:19 +0200 |
parents | 035617ee18d1 |
children | 529901e6a227 |
comparison
equal
deleted
inserted
replaced
51:035617ee18d1 | 52:d18f6dd0cf23 |
---|---|
50 sel->x = sx; | 50 sel->x = sx; |
51 sel->y = sy; | 51 sel->y = sy; |
52 sel->w = sw - 2 * sel->border; | 52 sel->w = sw - 2 * sel->border; |
53 sel->h = sh - 2 * sel->border; | 53 sel->h = sh - 2 * sel->border; |
54 craise(sel); | 54 craise(sel); |
55 resize(sel); | 55 resize(sel, False); |
56 discard_events(EnterWindowMask); | 56 discard_events(EnterWindowMask); |
57 } | 57 } |
58 | 58 |
59 void | 59 void |
60 view(Arg *arg) | 60 view(Arg *arg) |
98 Client *c; | 98 Client *c; |
99 | 99 |
100 arrange = floating; | 100 arrange = floating; |
101 for(c = clients; c; c = c->next) { | 101 for(c = clients; c; c = c->next) { |
102 if(c->tags[tsel]) | 102 if(c->tags[tsel]) |
103 resize(c); | 103 resize(c, True); |
104 else | 104 else |
105 ban_client(c); | 105 ban_client(c); |
106 } | 106 } |
107 if(sel && !sel->tags[tsel]) { | 107 if(sel && !sel->tags[tsel]) { |
108 if((sel = next(clients))) { | 108 if((sel = next(clients))) { |
123 arrange = tiling; | 123 arrange = tiling; |
124 for(n = 0, c = clients; c; c = c->next) | 124 for(n = 0, c = clients; c; c = c->next) |
125 if(c->tags[tsel]) | 125 if(c->tags[tsel]) |
126 n++; | 126 n++; |
127 | 127 |
128 h = (n > 2) ? sh / (n - 2) : sh; | 128 h = (n > 1) ? sh / (n - 1) : sh; |
129 | 129 |
130 for(i = 0, c = clients; c; c = c->next) { | 130 for(i = 0, c = clients; c; c = c->next) { |
131 if(c->tags[tsel]) { | 131 if(c->tags[tsel]) { |
132 if(n == 1) { | 132 if(n == 1) { |
133 c->x = sx; | 133 c->x = sx; |
134 c->y = sy; | 134 c->y = sy; |
135 c->w = sw; | 135 c->w = sw - 2 * c->border; |
136 c->h = sh; | 136 c->h = sh - 2 * c->border; |
137 } | 137 } |
138 else if(i == 1) { | 138 else if(i == 0) { |
139 c->x = sx; | 139 c->x = sx; |
140 c->y = sy; | 140 c->y = sy; |
141 c->w = mw; | 141 c->w = mw - 2 * c->border; |
142 c->h = sh; | 142 c->h = sh - 2 * c->border; |
143 } | 143 } |
144 else { | 144 else { |
145 c->x = sx + mw; | 145 c->x = sx + mw; |
146 c->y = sy + (i - 2) * h; | 146 c->y = sy + (i - 1) * h; |
147 c->w = w; | 147 c->w = w - 2 * c->border; |
148 c->h = h; | 148 c->h = h - 2 * c->border; |
149 } | 149 } |
150 resize(c); | 150 resize(c, False); |
151 i++; | 151 i++; |
152 } | 152 } |
153 else | 153 else |
154 ban_client(c); | 154 ban_client(c); |
155 } | 155 } |
302 } | 302 } |
303 | 303 |
304 void | 304 void |
305 focus(Client *c) | 305 focus(Client *c) |
306 { | 306 { |
307 if(sel && sel != c) { | 307 Client *old = sel; |
308 XSetWindowBorder(dpy, sel->win, dc.bg); | 308 |
309 XMapWindow(dpy, sel->title); | |
310 draw_client(sel); | |
311 } | |
312 sel = c; | 309 sel = c; |
313 XUnmapWindow(dpy, c->title); | 310 if(old && old != c) |
314 XSetWindowBorder(dpy, c->win, dc.fg); | 311 draw_client(old); |
315 draw_client(c); | 312 draw_client(c); |
316 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); | 313 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); |
317 XFlush(dpy); | 314 XFlush(dpy); |
318 discard_events(EnterWindowMask); | 315 discard_events(EnterWindowMask); |
319 } | 316 } |
461 c->y += dy; | 458 c->y += dy; |
462 } | 459 } |
463 | 460 |
464 | 461 |
465 void | 462 void |
466 resize(Client *c) | 463 resize(Client *c, Bool inc) |
467 { | 464 { |
468 XConfigureEvent e; | 465 XConfigureEvent e; |
469 | 466 |
470 if(c->incw) | 467 if(inc) { |
471 c->w -= (c->w - c->basew) % c->incw; | 468 if(c->incw) |
472 if(c->inch) | 469 c->w -= (c->w - c->basew) % c->incw; |
473 c->h -= (c->h - c->baseh) % c->inch; | 470 if(c->inch) |
471 c->h -= (c->h - c->baseh) % c->inch; | |
472 } | |
474 if(c->minw && c->w < c->minw) | 473 if(c->minw && c->w < c->minw) |
475 c->w = c->minw; | 474 c->w = c->minw; |
476 if(c->minh && c->h < c->minh) | 475 if(c->minh && c->h < c->minh) |
477 c->h = c->minh; | 476 c->h = c->minh; |
478 if(c->maxw && c->w > c->maxw) | 477 if(c->maxw && c->w > c->maxw) |
552 | 551 |
553 void | 552 void |
554 draw_client(Client *c) | 553 draw_client(Client *c) |
555 { | 554 { |
556 int i; | 555 int i; |
557 if(c == sel) | 556 if(c == sel) { |
558 return; | 557 XUnmapWindow(dpy, c->title); |
558 XSetWindowBorder(dpy, c->win, dc.fg); | |
559 return; | |
560 } | |
561 | |
562 XSetWindowBorder(dpy, c->win, dc.bg); | |
563 XMapWindow(dpy, c->title); | |
559 | 564 |
560 dc.x = dc.y = 0; | 565 dc.x = dc.y = 0; |
561 dc.h = c->th; | 566 dc.h = c->th; |
562 | 567 |
563 dc.w = 0; | 568 dc.w = 0; |