home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / windows / x / 15345 < prev    next >
Encoding:
Internet Message Format  |  1992-08-17  |  1.7 KB

  1. Path: sparky!uunet!usc!sol.ctr.columbia.edu!destroyer!ncar!noao!arizona!azhao
  2. From: azhao@cs.arizona.edu (Qiang Alex Zhao)
  3. Newsgroups: comp.windows.x
  4. Subject: Help -- set/get WM_DELETE_WINDOW
  5. Keywords: WM_DELETE_WINDOW
  6. Message-ID: <20689@optima.cs.arizona.edu>
  7. Date: 18 Aug 92 07:09:56 GMT
  8. Sender: news@cs.arizona.edu
  9. Followup-To: comp.windows.x
  10. Organization: Computer Science Dept, Univ of Arizona, Tucson
  11. Lines: 49
  12.  
  13.  
  14. Hi,
  15.  
  16. I tried to use WM_DELETE_WINDOW, hoping to let my program know when a
  17. window is going to be killed. But my code didn't work with twm (Sun,
  18. X11R5), mwm, 4Dwm (SGI/Iris, X11R4).
  19.  
  20. Here's my code:
  21.  
  22.     ....
  23.     Atom delw;
  24.     ....
  25.     delw = XInternAtom(display, "WM_DELETE_WINDOW", False);
  26.     XSetWMProtocols(display, window, &delw, 1);
  27.     ....
  28.     /* event-handling loop ... get event in variable ev */
  29.     switch (ev.type) {
  30.     ....
  31.     case ClientMessage:
  32.         printf("Got it!\n");
  33.         /* free/destroy everything and close display */
  34.         break;
  35.     ....
  36.     }
  37.     ....
  38.  
  39. My program just opened a window, "xprop" showed:
  40.  
  41.     WM_STATE(WM_STATE):
  42.             window state: Normal
  43.             icon window: 0x0
  44.     WM_ICON_NAME(STRING) = "Test"
  45.     WM_NAME(STRING) = "Test"
  46.     WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW
  47.     ....
  48.  
  49. Then I selected window menu (mwm) "Quit" or "Exit" -- nothing happened
  50. to that window, and the program still ran happily.
  51.  
  52. What should I do? I saw some articles on this issue posted some weeks
  53. ago -- could anybody send me copies of those articles, or even better,
  54. a summery?
  55.  
  56. Thanks a lot.
  57.  
  58. ________________________________________________________________
  59. = Qiang Alex Zhao           Computer Science Department
  60.   azhao@cs.arizona.edu             University of Arizona
  61.   (602) 621-2759                   Tucson, AZ 85721
  62.