Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!spool.mu.edu!uunet!tut.cis.ohio-state.edu!ucbvax!is.Morgan.COM!jerryl From: jerryl@is.Morgan.COM (Jerry Liebelson) Newsgroups: comp.windows.x.motif Subject: WM_DELETE_WINDOW: How to tell mwm not to delete Message-ID: <9105071903.AA14199@14199> Date: 7 May 91 19:03:35 GMT Article-I.D.: 14199.9105071903.AA14199 Sender: daemon@ucbvax.BERKELEY.EDU Distribution: inet Organization: The Internet Lines: 69 Reply-To: jerryl@is.morgan.com ------------------------------------------------------------------------------ Hi - When I use a callback for the WM_DELETE_WINDOW protocol, the routine gets invoked ok. But how can I tell the window manager not to actually delete the window. Say I wanted to throw up a dialog box asking the user if he really wanted to quit? The ICCCM manual (section 5.2.2 seems to imply such optional behavior). Shown below is the code that I use (Motif 1.1/X11R4 patchlevel 18/SunOS 4.11). |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| | Jerry Liebelson | EMAIL: jerryl@is.morgan.com | | Information Systems | uunet!is.morgan.com!jerryl | | Morgan Stanley, Inc. | VOICE: (212) 703-2409 | | 1633 Broadway 36th Floor | FAX: (212) 703-2371 | | New York, NY 10019 | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #include #ifndef XA_WM_PROTOCOLS #define XA_WM_PROTOCOLS "WM_PROTOCOLS" #endif #ifndef XA_WM_DELETE_WINDOW #define XA_WM_DELETE_WINDOW "WM_DELETE_WINDOW" #endif #endif void Quit(); static Atom WmDeleteWindowAtom, WmProtocolsAtom; /* GLOBAL */ Widget AppShell; /* ... */ main() { XtAppContext appContext; /* ... */ AppShell = XtAppInitialize ( &appContext, appClass, NULL, 0, &argc, argv, NULL, NULL, 0 ); /* ... */ WmDeleteWindowAtom = XInternAtom (XtDisplay(AppShell), XA_WM_DELETE_WINDOW, False); WmProtocolsAtom = XInternAtom (XtDisplay(AppShell), XA_WM_PROTOCOLS, False); XmAddProtocolCallback(AppShell, WmProtocolsAtom, WmDeleteWindowAtom, Quit, NULL); /* ... */ } void Quit(widget, clientData, event) Widget widget; XtPointer *clientData; XEvent *event; { fprintf(stderr, "In Quit()\n"); }