Mercurial > aewl
comparison client.c @ 270:dacd3f3c5823
implemented restack behavior (floats are on top in tiled mode)
author | Anselm R.Garbe <arg@10ksloc.org> |
---|---|
date | Mon, 14 Aug 2006 10:18:24 +0200 |
parents | d6fd632d861c |
children | be40a56df248 |
comparison
equal
deleted
inserted
replaced
269:bf6792e3e700 | 270:dacd3f3c5823 |
---|---|
57 sel = c; | 57 sel = c; |
58 if(old && old != c) | 58 if(old && old != c) |
59 drawtitle(old); | 59 drawtitle(old); |
60 drawtitle(c); | 60 drawtitle(c); |
61 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); | 61 XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); |
62 XSync(dpy, False); | |
63 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); | |
64 } | 62 } |
65 | 63 |
66 void | 64 void |
67 focusnext(Arg *arg) | 65 focusnext(Arg *arg) |
68 { | 66 { |
75 togglemax(NULL); | 73 togglemax(NULL); |
76 | 74 |
77 if(!(c = getnext(sel->next))) | 75 if(!(c = getnext(sel->next))) |
78 c = getnext(clients); | 76 c = getnext(clients); |
79 if(c) { | 77 if(c) { |
80 higher(c); | |
81 focus(c); | 78 focus(c); |
79 restack(); | |
82 } | 80 } |
83 } | 81 } |
84 | 82 |
85 void | 83 void |
86 focusprev(Arg *arg) | 84 focusprev(Arg *arg) |
96 if(!(c = getprev(sel->prev))) { | 94 if(!(c = getprev(sel->prev))) { |
97 for(c = clients; c && c->next; c = c->next); | 95 for(c = clients; c && c->next; c = c->next); |
98 c = getprev(c); | 96 c = getprev(c); |
99 } | 97 } |
100 if(c) { | 98 if(c) { |
101 higher(c); | |
102 focus(c); | 99 focus(c); |
100 restack(); | |
103 } | 101 } |
104 } | 102 } |
105 | 103 |
106 Client * | 104 Client * |
107 getclient(Window w) | 105 getclient(Window w) |
176 dx = -dx; | 174 dx = -dx; |
177 dy = -dy; | 175 dy = -dy; |
178 } | 176 } |
179 c->x += dx; | 177 c->x += dx; |
180 c->y += dy; | 178 c->y += dy; |
181 } | |
182 | |
183 void | |
184 higher(Client *c) | |
185 { | |
186 XRaiseWindow(dpy, c->win); | |
187 XRaiseWindow(dpy, c->title); | |
188 } | 179 } |
189 | 180 |
190 void | 181 void |
191 killclient(Arg *arg) | 182 killclient(Arg *arg) |
192 { | 183 { |
269 if(!c->isfloat) | 260 if(!c->isfloat) |
270 c->isfloat = trans | 261 c->isfloat = trans |
271 || (c->maxw && c->minw && | 262 || (c->maxw && c->minw && |
272 c->maxw == c->minw && c->maxh == c->minh); | 263 c->maxw == c->minw && c->maxh == c->minh); |
273 settitle(c); | 264 settitle(c); |
274 arrange(NULL); | 265 |
275 | 266 XMapWindow(dpy, c->win); |
276 /* mapping the window now prevents flicker */ | 267 XMapWindow(dpy, c->title); |
277 XMapRaised(dpy, c->win); | |
278 XMapRaised(dpy, c->title); | |
279 if(isvisible(c)) | 268 if(isvisible(c)) |
280 focus(c); | 269 focus(c); |
270 arrange(NULL); | |
281 } | 271 } |
282 | 272 |
283 void | 273 void |
284 resize(Client *c, Bool sizehints, Corner sticky) | 274 resize(Client *c, Bool sizehints, Corner sticky) |
285 { | 275 { |
408 sel->x = sx; | 398 sel->x = sx; |
409 sel->y = sy + bh; | 399 sel->y = sy + bh; |
410 sel->w = sw - 2; | 400 sel->w = sw - 2; |
411 sel->h = sh - 2 - bh; | 401 sel->h = sh - 2 - bh; |
412 | 402 |
413 higher(sel); | 403 restack(); |
414 resize(sel, arrange == dofloat, TopLeft); | 404 resize(sel, arrange == dofloat, TopLeft); |
415 | 405 |
416 sel->x = ox; | 406 sel->x = ox; |
417 sel->y = oy; | 407 sel->y = oy; |
418 sel->w = ow; | 408 sel->w = ow; |
444 free(c); | 434 free(c); |
445 | 435 |
446 XSync(dpy, False); | 436 XSync(dpy, False); |
447 XSetErrorHandler(xerror); | 437 XSetErrorHandler(xerror); |
448 XUngrabServer(dpy); | 438 XUngrabServer(dpy); |
449 arrange(NULL); | |
450 if(sel) | 439 if(sel) |
451 focus(sel); | 440 focus(sel); |
441 arrange(NULL); | |
452 } | 442 } |
453 | 443 |
454 void | 444 void |
455 zoom(Arg *arg) | 445 zoom(Arg *arg) |
456 { | 446 { |
472 sel->next->prev = sel->prev; | 462 sel->next->prev = sel->prev; |
473 sel->prev = NULL; | 463 sel->prev = NULL; |
474 clients->prev = sel; | 464 clients->prev = sel; |
475 sel->next = clients; | 465 sel->next = clients; |
476 clients = sel; | 466 clients = sel; |
467 focus(sel); | |
477 arrange(NULL); | 468 arrange(NULL); |
478 focus(sel); | 469 } |
479 } |