Index: Events.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xnest/Events.c,v retrieving revision 1.10 diff -u -p -r1.10 Events.c --- Events.c 14 Jul 2005 03:36:43 -0000 1.10 +++ Events.c 29 Jul 2005 13:25:43 -0000 @@ -206,8 +206,20 @@ xnestCollectEvents() case DestroyNotify: if (xnestParentWindow != (Window) 0 && - X.xdestroywindow.window == xnestParentWindow) - exit (0); + X.xdestroywindow.window == xnestParentWindow) { + CloseWellKnownConnections(); + OsCleanup(True); + ddxGiveUp(); + exit(0); + } + break; + + case ClientMessage: + if (xnestWMProtocolsAtom != None && + X.xclient.message_type == xnestWMProtocolsAtom && + X.xclient.data.l[0] == xnestWMDeleteWindowAtom && + xnestScreen(X.xclient.window) != NULL) + GiveUp(0); break; case CirculateNotify: Index: Screen.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xnest/Screen.c,v retrieving revision 1.7 diff -u -p -r1.7 Screen.c --- Screen.c 14 Jul 2005 03:36:44 -0000 1.7 +++ Screen.c 29 Jul 2005 13:25:43 -0000 @@ -47,6 +47,9 @@ is" without express or implied warranty. Window xnestDefaultWindows[MAXSCREENS]; Window xnestScreenSaverWindows[MAXSCREENS]; +Atom xnestWMProtocolsAtom = None; +Atom xnestWMDeleteWindowAtom = None; + #ifdef GLXEXT extern void GlxWrapInitVisuals(miInitVisualsProcPtr *); #endif @@ -136,6 +139,22 @@ static miPointerSpriteFuncRec xnestPoint xnestMoveCursor, }; +static void +xnestSetWMProtocols(Window window) +{ + Atom protocols[1]; + + if (xnestWMProtocolsAtom == None) + xnestWMProtocolsAtom = XInternAtom(xnestDisplay, "WM_PROTOCOLS", False); + + if (xnestWMDeleteWindowAtom == None) + xnestWMDeleteWindowAtom = XInternAtom(xnestDisplay, "WM_DELETE_WINDOW", False); + + protocols[0] = xnestWMDeleteWindowAtom; + + XSetWMProtocols(xnestDisplay, window, protocols, 1); +} + Bool xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[]) { @@ -385,7 +404,7 @@ xnestOpenScreen(int index, ScreenPtr pSc xnestDefaultWindows[pScreen->myNum] = xnestParentWindow; XSelectInput (xnestDisplay, xnestDefaultWindows[pScreen->myNum], xnestEventMask); - } else + } else { xnestDefaultWindows[pScreen->myNum] = XCreateWindow(xnestDisplay, DefaultRootWindow(xnestDisplay), @@ -397,6 +416,8 @@ xnestOpenScreen(int index, ScreenPtr pSc InputOutput, xnestDefaultVisual(pScreen), valuemask, &attributes); + xnestSetWMProtocols (xnestDefaultWindows[pScreen->myNum]); + } if (!xnestWindowName) xnestWindowName = argv[0]; Index: Screen.h =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xnest/Screen.h,v retrieving revision 1.2 diff -u -p -r1.2 Screen.h --- Screen.h 23 Apr 2004 19:54:21 -0000 1.2 +++ Screen.h 29 Jul 2005 13:25:43 -0000 @@ -20,6 +20,9 @@ is" without express or implied warranty. extern Window xnestDefaultWindows[MAXSCREENS]; extern Window xnestScreenSaverWindows[MAXSCREENS]; +extern Atom xnestWMProtocolsAtom; +extern Atom xnestWMDeleteWindowAtom; + ScreenPtr xnestScreen(Window window); Bool xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[]); Bool xnestCloseScreen(int index, ScreenPtr pScreen);