baur@venice.SEDD.TRW.COM (Steven L. Baur) (02/08/90)
I have noticed that certain clients generate output on the console when 'Quit'ing out of them via olwm (broken pipe from server). XView-based clients do not (and certain other well-behaved clients do not). I suspect the error message is due to non-ICCCM compliant clients. What kind of changes should be made to clients who exhibit this problem? If the answer is RTFM, please tell me where. I am a relative X novice, and have just made a pass (or two) through all the distributed X documentation (nearly 2000 pages!); I probably missed something, but I would like to know where for future reference. P.S. X11R4 is wonderful. Anyone who has not upgraded should, now. It made me (a diehard SunView fan) switch to X and enjoy it. -- steve baur@venice.SEDD.TRW.COM
converse@EXPO.LCS.MIT.EDU (Donna Converse) (02/09/90)
> I have noticed that certain clients generate output on the console when > 'Quit'ing out of them via olwm (broken pipe from server). XView-based clients > do not (and certain other well-behaved clients do not). I suspect the error > message is due to non-ICCCM compliant clients. What kind of changes should > be made to clients who exhibit this problem? Although I am not sure what "'Quit'ing out of them via olwm" really means, I can say that well-behaved clients participate in the protocol described in section 5.2.2 of the ICCCM, that is, they delete their own windows when requested. If clients don't participate in the window deletion protocol, the window manager may "kill" them, meaning, disconnect them from the server. The server disconnect results in the console broken pipe message. Donna Converse converse@expo.lcs.mit.edu
jcb@frisbee.Sun.COM (Jim Becker) (02/14/90)
baur@venice.SEDD.TRW.COM (Steven L. Baur) writes: I have noticed that certain clients generate output on the console when 'Quit'ing out of them via olwm (broken pipe from server). XView-based clients do not (and certain other well-behaved clients do not). I suspect the error message is due to non-ICCCM compliant clients. What kind of changes should be made to clients who exhibit this problem? One has to tell the window manager that the application is interested in understanding when olwm wants it to go away. This is done by `interning the atoms' (X-Speak) that are needed for this information to be passed to the application. Once the application has interned the atoms a ClientMessage will be sent when olwm wants to tell you something. There are a number of different things that can be told to you, and I don't know what they all are. However, following is some code that will get you out of the application correctly when the wm_delete_window message comes. I'm not an ICCCM expert, but since there hadn't been a response from one thought that this would help. I assume that an ICCCM expert will correct anything missing. -Jim Becker ~~~ initialization ~~~ #define NUM_ATOMS 3 static short atomic_world_initialized= FALSE; static Atom atom_wm_protocols, atom_wm_delete_window, atom_wm_save_yourself, atom_wm_take_focus; static short debug; initialize_atoms() { Atom atomic_interest[NUM_ATOMS]; atom_wm_protocols = XInternAtom( display, "WM_PROTOCOLS", FALSE ); if( atom_wm_protocols != None ) { atomic_world_initialized= TRUE; atom_wm_delete_window = XInternAtom( display, "WM_DELETE_WINDOW", FALSE ); atom_wm_take_focus = XInternAtom( display, "WM_TAKE_FOCUS", FALSE ); atom_wm_save_yourself = XInternAtom( display, "WM_SAVE_YOURSELF", FALSE ); atomic_interest[0] = atom_wm_delete_window; atomic_interest[1] = atom_wm_take_focus; atomic_interest[2] = atom_wm_save_yourself; XChangeProperty( display, mwindow, atom_wm_protocols, XA_ATOM, 32, PropModeReplace, (unsigned char*)atomic_interest, NUM_ATOMS); } } ~~~ event loop ~~~ main() { initialize_atoms(); while( !done ) { XNextEvent( display, &xevent ); switch( xevent.type ) { . . . case ClientMessage: done = process_client_message( xevent ); break; . . . } } exit(0); } ~~~ de-compose routine ~~~ static int process_client_message( xevent ) XEvent *xevent; { XClientMessageEvent *xclient = xevent->xclient; Atom protocol; char *p; short retval = FALSE; if( atomic_world_initialized && xclient->message_type == atom_wm_protocols ) { protocol = xevent.xclient.data.l[0]; if( protocol == atom_wm_delete_window ) { p = "WM_DELETE_WINDOW"; retval = TRUE; } else if( protocol == atom_wm_save_yourself ) { p = "WM_SAVE_YOURSELF"; } else if( protocol == atom_wm_take_focus ) { p = "WM_TAKE_FOCUS"; XSetInputFocus( display, mwindow, RevertToParent, xevent.xclient.data.l[1] ); } else { p = "*Not Understood Atomically*"; } if( debug ) printf("atom of type %s came by..\n", p); } return retval; } -- Jim Becker / jcb%frisbee@sun.com / Sun Microsystems