Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!bbn.com!news From: news@bbn.com (News system owner ID) Newsgroups: comp.windows.x Subject: Re: "Close" window operation under mwm (Motif Window Manager)... Keywords: mwm, error, close, window manager Message-ID: <64235@bbn.BBN.COM> Date: 17 May 91 04:37:46 GMT References: <1991May5.070402.2985@cs.ucla.edu> Reply-To: rnewman@bbn.com (Ron Newman) Organization: Bolt Beranek and Newman Inc., Cambridge MA Lines: 63 william@oahu.cs.ucla.edu (William Cheng) writes: |> Under mwm (Motif Window Manager), if an application is CLOSED by |> selecting the "Close" entry in the popup menu which is generated |> by clicking the button on the left top portion of the window, |> an XIO error often occures with the following messages: |> |> XIO: fatal IO error 32 (Broken pipe) on X server "rye:0.0" |> after 445 requests (89 known processed) with 0 events remaining. |> The connection was probably broken by a server shutdown or KillClient. |> |> This happens with many applications (bitmap, xdvi, idraw, xfd, xlogo...) |> but not with xloadimage, xclock, xload. Apparently, any application that |> has more than one window will get the error message. The "Close" item in the Motif Window Manager menu invokes mwm's "f.kill" function, which does one of two things: 1) Sends a ClientMessage event to the window, with message_type = WM_PROTOCOLS atom format = 32 data.l[0] = WM_DELETE_WINDOW atom or 2) calls XKillClient on the window, which rudely breaks its application's connection to the X server. If the application has registered for the WM_DELETE_WINDOW protocol, mwm (or any other ICCCM-compliant window manager) will do the first, giving the application a chance to shut down gracefully (or, for that matter, to refuse to shut down). xclock, for example, contains this code to register for the protocol wm_delete_window = XInternAtom (XtDisplay(toplevel), "WM_DELETE_WINDOW", False); (void) XSetWMProtocols (XtDisplay(toplevel), XtWindow(toplevel), &wm_delete_window, 1); and this code to handle the resulting ClientMessage event: XtOverrideTranslations(toplevel, XtParseTranslationTable ("WM_PROTOCOLS: quit()")); along with a quit() action procedure that calls XCloseDisplay() and exit(). If the application hasn't registered for WM_DELETE_WINDOW, mwm does the second action (XKillClient). The application will die with an XIOError the next time it tries to read from the (now closed) X socket. That's what you're seeing. Many of MIT's officially distributed X clients don't register for WM_DELETE_WINDOW. For more information, look at sections 4.1.2.7, 4.2.8, and (especially) 5.2.2 of the Inter-Client Communication Conventions Manual (ICCCM). Also section 14.3.4 ("MWM Functions") of the OSF/Motif Programmer's Guide, which describes the "f.kill" function. Note that the Open Look window manager calls this same function "Quit" (their "Close" is more like Motif's "Minimize"). /Ron Newman rnewman@bbn.com Ron Newman rnewman@bbn.com