Close when the embedding window is destroyed
153aaf88
2 file(s) · +7 −2
| 9 | 9 | © 2009 Evan Gates <evan.gates@gmail.com> |
|
| 10 | 10 | © 2010-2012 Connor Lane Smith <cls@lubutu.com> |
|
| 11 | 11 | © 2014-2019 Hiltjo Posthuma <hiltjo@codemadness.org> |
|
| 12 | - | © 2015-2018 Quentin Rameau <quinq@fifth.space> |
|
| 12 | + | © 2015-2019 Quentin Rameau <quinq@fifth.space> |
|
| 13 | 13 | ||
| 14 | 14 | Permission is hereby granted, free of charge, to any person obtaining a |
|
| 15 | 15 | copy of this software and associated documentation files (the "Software"), |
| 556 | 556 | if (XFilterEvent(&ev, None)) |
|
| 557 | 557 | continue; |
|
| 558 | 558 | switch(ev.type) { |
|
| 559 | + | case DestroyNotify: |
|
| 560 | + | if (ev.xdestroywindow.window != win) |
|
| 561 | + | break; |
|
| 562 | + | cleanup(); |
|
| 563 | + | exit(1); |
|
| 559 | 564 | case Expose: |
|
| 560 | 565 | if (ev.xexpose.count == 0) |
|
| 561 | 566 | drw_map(drw, win, 0, 0, mw, mh); |
|
| 667 | 672 | XMapRaised(dpy, win); |
|
| 668 | 673 | XSetInputFocus(dpy, win, RevertToParent, CurrentTime); |
|
| 669 | 674 | if (embed) { |
|
| 670 | - | XSelectInput(dpy, parentwin, FocusChangeMask); |
|
| 675 | + | XSelectInput(dpy, parentwin, FocusChangeMask | SubstructureNotifyMask); |
|
| 671 | 676 | if (XQueryTree(dpy, parentwin, &dw, &w, &dws, &du) && dws) { |
|
| 672 | 677 | for (i = 0; i < du && dws[i] != win; ++i) |
|
| 673 | 678 | XSelectInput(dpy, dws[i], FocusChangeMask); |
|