comparison aewl.c @ 786:e65be4ffdbdc

Add handling for popup windows
author markus schnalke <meillo@marmaro.de>
date Thu, 14 Jun 2012 00:00:00 +0200
parents f259785bac44
children eecb13b34511
comparison
equal deleted inserted replaced
785:5fa2cf6026e8 786:e65be4ffdbdc
88 int rx, ry, rw, rh; /* revert geometry */ 88 int rx, ry, rw, rh; /* revert geometry */
89 int basew, baseh, incw, inch, maxw, maxh, minw, minh; 89 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
90 int minax, minay, maxax, maxay; 90 int minax, minay, maxax, maxay;
91 long flags; 91 long flags;
92 unsigned int border; 92 unsigned int border;
93 Bool isfixed, isfloat, ismax; 93 Bool isfixed, isfloat, ismax, ispopup;
94 Bool tag; 94 Bool tag;
95 Client *next; 95 Client *next;
96 Client *prev; 96 Client *prev;
97 Client *snext; 97 Client *snext;
98 Window win; 98 Window win;
210 210
211 /* from view.c */ 211 /* from view.c */
212 212
213 Client * 213 Client *
214 nexttiled(Client *c) { 214 nexttiled(Client *c) {
215 for(c = getnext(c); c && c->isfloat; c = getnext(c->next)); 215 for(c = getnext(c); c && (c->isfloat || c->ispopup); c = getnext(c->next));
216 return c; 216 return c;
217 } 217 }
218 218
219 void 219 void
220 togglemax(Client *c) { 220 togglemax(Client *c) {
269 th = (n > nmaster) ? wah / (n - nmaster) : 0; 269 th = (n > nmaster) ? wah / (n - nmaster) : 0;
270 tw = waw - mw; 270 tw = waw - mw;
271 271
272 for(i = 0, c = clients; c; c = c->next) 272 for(i = 0, c = clients; c; c = c->next)
273 if(isvisible(c)) { 273 if(isvisible(c)) {
274 if(c->isfloat) { 274 if(c->isfloat || c->ispopup) {
275 resize(c, True); 275 resize(c, True);
276 continue; 276 continue;
277 } 277 }
278 c->ismax = False; 278 c->ismax = False;
279 c->x = wax; 279 c->x = wax;
309 domax(void) { 309 domax(void) {
310 Client *c; 310 Client *c;
311 311
312 for(c = clients; c; c = c->next) { 312 for(c = clients; c; c = c->next) {
313 if(isvisible(c)) { 313 if(isvisible(c)) {
314 if(c->isfloat) { 314 if(c->isfloat || c->ispopup) {
315 resize(c, True); 315 resize(c, True);
316 continue; 316 continue;
317 } 317 }
318 c->ismax = True; 318 c->ismax = True;
319 c->x = wax; 319 c->x = wax;
378 XEvent ev; 378 XEvent ev;
379 379
380 drawbar(); 380 drawbar();
381 if(!sel) 381 if(!sel)
382 return; 382 return;
383 /*if(sel->isfloat)*/ 383 if(sel->isfloat || sel->ispopup)
384 XRaiseWindow(dpy, sel->win); 384 XRaiseWindow(dpy, sel->win);
385 385 else
386 /*
387 if(!sel->isfloat)
388 XLowerWindow(dpy, sel->win); 386 XLowerWindow(dpy, sel->win);
389 for(c = nexttiled(clients); c; c = nexttiled(c->next)) { 387 for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
390 if(c == sel) 388 if(c == sel)
391 continue; 389 continue;
392 XLowerWindow(dpy, c->win); 390 XLowerWindow(dpy, c->win);
393 } 391 }
394 */
395 392
396 XSync(dpy, False); 393 XSync(dpy, False);
397 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); 394 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
398 } 395 }
399 396
431 } 428 }
432 429
433 void 430 void
434 toggleview() { 431 toggleview() {
435 if (viewfloats) { 432 if (viewfloats) {
433 floattoggle();
436 return; 434 return;
437 } 435 }
438 seltag = !seltag; 436 seltag = !seltag;
439 arrange(); 437 arrange();
440 } 438 }
450 unsigned int n; 448 unsigned int n;
451 Client *c; 449 Client *c;
452 450
453 if(!sel) 451 if(!sel)
454 return; 452 return;
455 if(sel->isfloat) { 453 if(sel->isfloat || sel->ispopup) {
456 togglemax(sel); 454 togglemax(sel);
457 return; 455 return;
458 } 456 }
459 for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) 457 for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
460 n++; 458 n++;
531 unsigned int i; 529 unsigned int i;
532 XClassHint ch = { 0 }; 530 XClassHint ch = { 0 };
533 531
534 if(trans) { 532 if(trans) {
535 c->tag = trans->tag; 533 c->tag = trans->tag;
534 c->isfloat = trans->isfloat;
536 return; 535 return;
537 } 536 }
538 c->tag = seltag; /* default */ 537 c->tag = seltag; /* default */
539 XGetClassHint(dpy, c->win, &ch); 538 XGetClassHint(dpy, c->win, &ch);
540 len = sizeof rule / sizeof rule[0]; 539 len = sizeof rule / sizeof rule[0];
660 } 659 }
661 if((c = getclient(ev->window))) { 660 if((c = getclient(ev->window))) {
662 focus(c); 661 focus(c);
663 if(CLEANMASK(ev->state) != MODKEY) 662 if(CLEANMASK(ev->state) != MODKEY)
664 return; 663 return;
665 if(ev->button == Button1 && c->isfloat) { 664 if(ev->button == Button1 && (c->isfloat || c->ispopup)) {
666 restack(); 665 restack();
667 movemouse(c); 666 movemouse(c);
668 } else if(ev->button == Button3 && c->isfloat && !c->isfixed) { 667 } else if(ev->button == Button3 && (c->isfloat || c->ispopup) && !c->isfixed) {
669 restack(); 668 restack();
670 resizemouse(c); 669 resizemouse(c);
671 } 670 }
672 } 671 }
673 } 672 }
699 if(newmask) 698 if(newmask)
700 XConfigureWindow(dpy, c->win, newmask, &wc); 699 XConfigureWindow(dpy, c->win, newmask, &wc);
701 else 700 else
702 configure(c); 701 configure(c);
703 XSync(dpy, False); 702 XSync(dpy, False);
704 if(c->isfloat) { 703 if(c->isfloat || c->ispopup) {
705 resize(c, False); 704 resize(c, False);
706 if(!isvisible(c)) 705 if(!isvisible(c))
707 XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); 706 XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
708 } 707 }
709 else 708 else
820 else if((c = getclient(ev->window))) { 819 else if((c = getclient(ev->window))) {
821 switch (ev->atom) { 820 switch (ev->atom) {
822 default: break; 821 default: break;
823 case XA_WM_TRANSIENT_FOR: 822 case XA_WM_TRANSIENT_FOR:
824 XGetTransientForHint(dpy, c->win, &trans); 823 XGetTransientForHint(dpy, c->win, &trans);
825 if(!c->isfloat && (c->isfloat = (trans != 0))) 824 if(!c->ispopup && (c->ispopup = (trans != 0)))
826 arrange(); 825 arrange();
827 break; 826 break;
828 case XA_WM_NORMAL_HINTS: 827 case XA_WM_NORMAL_HINTS:
829 updatesizehints(c); 828 updatesizehints(c);
830 break; 829 break;
1214 XGetTransientForHint(dpy, c->win, &trans); 1213 XGetTransientForHint(dpy, c->win, &trans);
1215 grabbuttons(c, False); 1214 grabbuttons(c, False);
1216 XSetWindowBorder(dpy, c->win, dc.norm[ColBG]); 1215 XSetWindowBorder(dpy, c->win, dc.norm[ColBG]);
1217 updatetitle(c); 1216 updatetitle(c);
1218 settag(c, getclient(trans)); 1217 settag(c, getclient(trans));
1219 if(!c->isfloat) 1218 if(!c->ispopup)
1220 c->isfloat = trans || c->isfixed; 1219 c->ispopup = trans || c->isfixed;
1221 if(clients) 1220 if(clients)
1222 clients->prev = c; 1221 clients->prev = c;
1223 c->next = clients; 1222 c->next = clients;
1224 c->snext = stack; 1223 c->snext = stack;
1225 stack = clients = c; 1224 stack = clients = c;