mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-08 10:23:27 +00:00
handle WM_DELETE_WINDOW better
This commit is contained in:
@@ -29,6 +29,7 @@ struct _MwLLX11 {
|
|||||||
GC gc;
|
GC gc;
|
||||||
Colormap colormap;
|
Colormap colormap;
|
||||||
Atom wm_delete;
|
Atom wm_delete;
|
||||||
|
Atom wm_protocols;
|
||||||
XIM xim;
|
XIM xim;
|
||||||
XIC xic;
|
XIC xic;
|
||||||
|
|
||||||
|
|||||||
@@ -209,8 +209,9 @@ static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) {
|
|||||||
r->x11.grabbed = 0;
|
r->x11.grabbed = 0;
|
||||||
r->x11.force_render = 0;
|
r->x11.force_render = 0;
|
||||||
|
|
||||||
r->x11.colormap = DefaultColormap(r->x11.display, XDefaultScreen(r->x11.display));
|
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_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);
|
XSetWMProtocols(r->x11.display, r->x11.window, &r->x11.wm_delete, 1);
|
||||||
|
|
||||||
r->x11.gc = XCreateGC(r->x11.display, r->x11.window, 0, NULL);
|
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.width = ev.xconfigure.width;
|
||||||
handle->x11.height = ev.xconfigure.height;
|
handle->x11.height = ev.xconfigure.height;
|
||||||
} else if(ev.type == ClientMessage) {
|
} 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);
|
MwLLDispatch(handle, close, NULL);
|
||||||
}
|
}
|
||||||
} else if(ev.type == FocusIn) {
|
} else if(ev.type == FocusIn) {
|
||||||
|
|||||||
Reference in New Issue
Block a user