minor fix of the NetActiveWindow multi-monitor flaw, slight rearrangement
d24837f1
1 file(s) · +54 −53
| 521 | 521 | } |
|
| 522 | 522 | ||
| 523 | 523 | void |
|
| 524 | + | clientmessage(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 | + | ||
| 563 | + | void |
|
| 524 | 564 | configure(Client *c) { |
|
| 525 | 565 | XConfigureEvent ce; |
|
| 526 | 566 | ||
| 1212 | 1252 | return c; |
|
| 1213 | 1253 | } |
|
| 1214 | 1254 | ||
| 1215 | - | Monitor * |
|
| 1216 | - | ptrtomon(int x, int y) { |
|
| 1217 | - | Monitor *m; |
|
| 1218 | - | ||
| 1219 | - | for(m = mons; m; m = m->next) |
|
| 1220 | - | if(INRECT(x, y, m->wx, m->wy, m->ww, m->wh)) |
|
| 1221 | - | return m; |
|
| 1222 | - | return selmon; |
|
| 1255 | + | void |
|
| 1256 | + | pop(Client *c) { |
|
| 1257 | + | detach(c); |
|
| 1258 | + | attach(c); |
|
| 1259 | + | focus(c); |
|
| 1260 | + | arrange(c->mon); |
|
| 1223 | 1261 | } |
|
| 1224 | 1262 | ||
| 1225 | 1263 | void |
|
| 1256 | 1294 | } |
|
| 1257 | 1295 | } |
|
| 1258 | 1296 | ||
| 1259 | - | void |
|
| 1260 | - | clientmessage(XEvent *e) { |
|
| 1261 | - | XClientMessageEvent *cme = &e->xclient; |
|
| 1262 | - | Client *c = wintoclient(cme->window); |
|
| 1297 | + | Monitor * |
|
| 1298 | + | ptrtomon(int x, int y) { |
|
| 1299 | + | Monitor *m; |
|
| 1263 | 1300 | ||
| 1264 | - | if(!c) |
|
| 1265 | - | return; |
|
| 1266 | - | if(cme->message_type == netatom[NetWMState] && cme->data.l[1] == netatom[NetWMFullscreen]) { |
|
| 1267 | - | if(cme->data.l[0]) { |
|
| 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 | - | } |
|
| 1301 | + | for(m = mons; m; m = m->next) |
|
| 1302 | + | if(INRECT(x, y, m->wx, m->wy, m->ww, m->wh)) |
|
| 1303 | + | return m; |
|
| 1304 | + | return selmon; |
|
| 1300 | 1305 | } |
|
| 1301 | - | ||
| 1302 | 1306 | void |
|
| 1303 | 1307 | quit(const Arg *arg) { |
|
| 1304 | 1308 | running = False; |
|
| 2043 | 2047 | if(c == nexttiled(selmon->clients)) |
|
| 2044 | 2048 | if(!c || !(c = nexttiled(c->next))) |
|
| 2045 | 2049 | return; |
|
| 2046 | - | detach(c); |
|
| 2047 | - | attach(c); |
|
| 2048 | - | focus(c); |
|
| 2049 | - | arrange(c->mon); |
|
| 2050 | + | pop(c); |
|
| 2050 | 2051 | } |
|
| 2051 | 2052 | ||
| 2052 | 2053 | int |
|