[client] x11: handle window deletion properly

This commit is contained in:
Geoffrey McRae 2021-01-31 21:43:54 +11:00
parent 5ac53362a3
commit 17d423db06

View File

@ -76,6 +76,7 @@ struct X11DSState
Atom aNetWMStateFullscreen; Atom aNetWMStateFullscreen;
Atom aNetWMWindowType; Atom aNetWMWindowType;
Atom aNetWMWindowTypeNormal; Atom aNetWMWindowTypeNormal;
Atom aWMDeleteWindow;
// clipboard members // clipboard members
Atom aSelection; Atom aSelection;
@ -209,6 +210,10 @@ static bool x11Init(const LG_DSInitParams params)
XInternAtom(x11.display, "_NET_WM_WINDOW_TYPE", True); XInternAtom(x11.display, "_NET_WM_WINDOW_TYPE", True);
x11.aNetWMWindowTypeNormal = x11.aNetWMWindowTypeNormal =
XInternAtom(x11.display, "_NET_WM_WINDOW_TYPE_NORMAL", True); XInternAtom(x11.display, "_NET_WM_WINDOW_TYPE_NORMAL", True);
x11.aWMDeleteWindow =
XInternAtom(x11.display, "WM_DELETE_WINDOW", True);
XSetWMProtocols(x11.display, x11.window, &x11.aWMDeleteWindow, 1);
XChangeProperty( XChangeProperty(
x11.display, x11.display,
@ -510,13 +515,9 @@ static int x11EventThread(void * unused)
switch(xe.type) switch(xe.type)
{ {
case DestroyNotify: case ClientMessage:
if (xe.xdestroywindow.display == x11.display && if (xe.xclient.data.l[0] == x11.aWMDeleteWindow)
xe.xdestroywindow.window == x11.window)
{
x11.window = 0;
app_handleCloseEvent(); app_handleCloseEvent();
}
break; break;
case ConfigureNotify: case ConfigureNotify: