update wm_client_kill: kill window properly using WM_DELETE_WINDOW event
This commit is contained in:
parent
3702b5be15
commit
6422c54803
17
client.c
17
client.c
@ -19,6 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "client.h"
|
||||
#include "wm.h"
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
// TODO
|
||||
XWindowChanges wm_client_to_xwchanges(Client c)
|
||||
@ -170,12 +172,25 @@ void wm_client_free(Wm *wm, Client *c)
|
||||
|
||||
void wm_client_kill(Wm *wm, Client *c)
|
||||
{
|
||||
DEBUG_PRINT("%s\n", __func__);
|
||||
RETURN_IF_NULL(c);
|
||||
Monitor *m;
|
||||
|
||||
m = c->m;
|
||||
|
||||
XDestroyWindow(wm->display, c->window);
|
||||
XEvent event;
|
||||
Atom delete_atom = XInternAtom(wm->display, "WM_DELETE_WINDOW", False);
|
||||
|
||||
event.type = ClientMessage;
|
||||
event.xclient.window = c->window;
|
||||
event.xclient.display = wm->display;
|
||||
event.xclient.message_type = delete_atom;
|
||||
event.xclient.format = 32;
|
||||
event.xclient.data.l[0] = delete_atom;
|
||||
|
||||
if (XSendEvent(wm->display, c->window, false, NoEventMask, &event) != Success)
|
||||
XKillClient(wm->display, c->window);
|
||||
|
||||
wm_client_free(wm, c);
|
||||
|
||||
wm_layout(wm, m);
|
||||
|
Loading…
x
Reference in New Issue
Block a user