mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2025-12-31 06:30:52 +00:00
handle WM_DELETE_WINDOW better
This commit is contained in:
@@ -29,6 +29,7 @@ struct _MwLLX11 {
|
||||
GC gc;
|
||||
Colormap colormap;
|
||||
Atom wm_delete;
|
||||
Atom wm_protocols;
|
||||
XIM xim;
|
||||
XIC xic;
|
||||
|
||||
|
||||
@@ -211,6 +211,7 @@ static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) {
|
||||
|
||||
r->x11.colormap = DefaultColormap(r->x11.display, XDefaultScreen(r->x11.display));
|
||||
r->x11.wm_delete = XInternAtom(r->x11.display, "WM_DELETE_WINDOW", False);
|
||||
r->x11.wm_protocols = XInternAtom(r->x11.display, "WM_PROTOCOLS", False);
|
||||
XSetWMProtocols(r->x11.display, r->x11.window, &r->x11.wm_delete, 1);
|
||||
|
||||
r->x11.gc = XCreateGC(r->x11.display, r->x11.window, 0, NULL);
|
||||
@@ -471,7 +472,7 @@ static void MwLLNextEventImpl(MwLL handle) {
|
||||
handle->x11.width = ev.xconfigure.width;
|
||||
handle->x11.height = ev.xconfigure.height;
|
||||
} else if(ev.type == ClientMessage) {
|
||||
if(ev.xclient.data.l[0] == (long)handle->x11.wm_delete) {
|
||||
if(ev.xclient.message_type == handle->x11.wm_protocols && ev.xclient.data.l[0] == (long)handle->x11.wm_delete) {
|
||||
MwLLDispatch(handle, close, NULL);
|
||||
}
|
||||
} else if(ev.type == FocusIn) {
|
||||
|
||||
Reference in New Issue
Block a user