summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnselm R Garbe <anselm@garbe.us>2011-04-15 08:12:20 +0000
committerAnselm R Garbe <anselm@garbe.us>2011-04-15 08:12:20 +0000
commitd24837f1adb40b3ecdb6d20e0a5102b1bf3774a3 (patch)
tree731e99781c1f03926eb09325385d0b4b7697efa5
parentapplied Peter/Andreas NetActiveWindow patch in a slightly modified version (diff)
downloaddwm-d24837f1adb40b3ecdb6d20e0a5102b1bf3774a3.tar.gz
dwm-d24837f1adb40b3ecdb6d20e0a5102b1bf3774a3.zip
minor fix of the NetActiveWindow multi-monitor flaw, slight rearrangement
-rw-r--r--dwm.c107
1 files changed, 54 insertions, 53 deletions
diff --git a/dwm.c b/dwm.c
index a3d83fb..5cafe12 100644
--- a/dwm.c
+++ b/dwm.c
@@ -521,6 +521,46 @@ clearurgent(Client *c) {
521} 521}
522 522
523void 523void
524clientmessage(XEvent *e) {
525 XClientMessageEvent *cme = &e->xclient;
526 Client *c = wintoclient(cme->window);
527
528 if(!c)
529 return;
530 if(cme->message_type == netatom[NetWMState] && cme->data.l[1] == netatom[NetWMFullscreen]) {
531 if(cme->data.l[0]) {
532 XChangeProperty(dpy, cme->window, netatom[NetWMState], XA_ATOM, 32,
533 PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
534 c->oldstate = c->isfloating;
535 c->oldbw = c->bw;
536 c->bw = 0;
537 c->isfloating = True;
538 resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
539 XRaiseWindow(dpy, c->win);
540 }
541 else {
542 XChangeProperty(dpy, cme->window, netatom[NetWMState], XA_ATOM, 32,
543 PropModeReplace, (unsigned char*)0, 0);
544 c->isfloating = c->oldstate;
545 c->bw = c->oldbw;
546 c->x = c->oldx;
547 c->y = c->oldy;
548 c->w = c->oldw;
549 c->h = c->oldh;
550 resizeclient(c, c->x, c->y, c->w, c->h);
551 arrange(c->mon);
552 }
553 }
554 else if(cme->message_type == netatom[NetActiveWindow]) {
555 if(!ISVISIBLE(c)) {
556 c->mon->seltags ^= 1;
557 c->mon->tagset[c->mon->seltags] = c->tags;
558 }
559 pop(c);
560 }
561}
562
563void
524configure(Client *c) { 564configure(Client *c) {
525 XConfigureEvent ce; 565 XConfigureEvent ce;
526 566
@@ -1212,14 +1252,12 @@ nexttiled(Client *c) {
1212 return c; 1252 return c;
1213} 1253}
1214 1254
1215Monitor * 1255void
1216ptrtomon(int x, int y) { 1256pop(Client *c) {
1217 Monitor *m; 1257 detach(c);
1218 1258 attach(c);
1219 for(m = mons; m; m = m->next) 1259 focus(c);
1220 if(INRECT(x, y, m->wx, m->wy, m->ww, m->wh)) 1260 arrange(c->mon);
1221 return m;
1222 return selmon;
1223} 1261}
1224 1262
1225void 1263void
@@ -1256,49 +1294,15 @@ propertynotify(XEvent *e) {
1256 } 1294 }
1257} 1295}
1258 1296
1259void 1297Monitor *
1260clientmessage(XEvent *e) { 1298ptrtomon(int x, int y) {
1261 XClientMessageEvent *cme = &e->xclient; 1299 Monitor *m;
1262 Client *c = wintoclient(cme->window);
1263 1300
1264 if(!c) 1301 for(m = mons; m; m = m->next)
1265 return; 1302 if(INRECT(x, y, m->wx, m->wy, m->ww, m->wh))
1266 if(cme->message_type == netatom[NetWMState] && cme->data.l[1] == netatom[NetWMFullscreen]) { 1303 return m;
1267 if(cme->data.l[0]) { 1304 return selmon;
1268 XChangeProperty(dpy, cme->window, netatom[NetWMState], XA_ATOM, 32,
1269 PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
1270 c->oldstate = c->isfloating;
1271 c->oldbw = c->bw;
1272 c->bw = 0;
1273 c->isfloating = True;
1274 resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
1275 XRaiseWindow(dpy, c->win);
1276 }
1277 else {
1278 XChangeProperty(dpy, cme->window, netatom[NetWMState], XA_ATOM, 32,
1279 PropModeReplace, (unsigned char*)0, 0);
1280 c->isfloating = c->oldstate;
1281 c->bw = c->oldbw;
1282 c->x = c->oldx;
1283 c->y = c->oldy;
1284 c->w = c->oldw;
1285 c->h = c->oldh;
1286 resizeclient(c, c->x, c->y, c->w, c->h);
1287 arrange(c->mon);
1288 }
1289 }
1290 else if(cme->message_type == netatom[NetActiveWindow]) {
1291 if(!ISVISIBLE(c)) {
1292 Arg a = { .ui = c->tags };
1293 view(&a);
1294 }
1295 detach(c);
1296 attach(c);
1297 focus(c);
1298 arrange(c->mon);
1299 }
1300} 1305}
1301
1302void 1306void
1303quit(const Arg *arg) { 1307quit(const Arg *arg) {
1304 running = False; 1308 running = False;
@@ -2043,10 +2047,7 @@ zoom(const Arg *arg) {
2043 if(c == nexttiled(selmon->clients)) 2047 if(c == nexttiled(selmon->clients))
2044 if(!c || !(c = nexttiled(c->next))) 2048 if(!c || !(c = nexttiled(c->next)))
2045 return; 2049 return;
2046 detach(c); 2050 pop(c);
2047 attach(c);
2048 focus(c);
2049 arrange(c->mon);
2050} 2051}
2051 2052
2052int 2053int