diff -Naur -Naur yae-0.7/x_window.c yae-0.7.patched/x_window.c --- yae-0.7/x_window.c 2007-04-03 17:47:59.000000000 -0400 +++ yae-0.7.patched/x_window.c 2021-10-12 00:23:48.765550342 -0400 @@ -57,6 +57,8 @@ static Cursor InvisibleCursor; +static Atom delete_atom; + Visual *getVisual( Display *dpy, int screen, int depth, int class ) { XVisualInfo vinfo, *vinfoList; @@ -219,6 +221,9 @@ XFlush( dc->display ); #endif + delete_atom = XInternAtom(dc->display, "WM_DELETE_WINDOW", False); + XSetWMProtocols(dc->display, dc->window, &delete_atom, 1); + /* * startup micro job for X window */ @@ -313,6 +318,10 @@ #endif refreshScreen(); break; + case ClientMessage: + if(event.xclient.data.l[0] == delete_atom) + shutdown_6502(); + break; case DestroyNotify: Signal6502( SIG_6502_SHUTDOWN ); break;