home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / fj / maillis / xwindow / 18962 < prev    next >
Encoding:
Internet Message Format  |  1992-12-29  |  2.7 KB

  1. Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!sgiblab!nec-gw!nec-tyo!wnoc-tyo-news!scslwide!wsgw!wsservra!onoe
  2. From: english@alicudi.usc.edu (Joe English)
  3. Newsgroups: fj.mail-lists.x-window
  4. Subject: Re: Help Request for mwm send.msg
  5. Message-ID: <1992Dec29.223440.13014@sm.sony.co.jp>
  6. Date: 29 Dec 92 22:34:40 GMT
  7. Sender: onoe@sm.sony.co.jp (Atsushi Onoe)
  8. Distribution: fj
  9. Organization: Nerds of Action
  10. Lines: 64
  11. Approved: michael@sm.sony.co.jp
  12.  
  13. Date: 29 Dec 1992 11:17:37 -0800
  14. Message-Id: <1hq88hINN3qp@alicudi.usc.edu>
  15. Newsgroups: comp.windows.x,comp.windows.x.motif
  16. References: <1992Dec22.134147.18146@cbnewsj.cb.att.com>
  17. Sender: xpert-request@expo.lcs.mit.edu
  18.  
  19.  
  20. In article <1992Dec22.134147.18146@cbnewsj.cb.att.com>, daver@cbnewsj.cb.att.com (dave.robertson) writes:
  21.  
  22. |> I am having problems trying to use the send_msg function in mwm.
  23. |> I need to add an application specific capability to each window
  24. |> manager menu, and I believe that this can be achieved in this manner.
  25.  
  26. |> Firstly in my mwm configuration file I define the menu as follows : 
  27. |> 
  28. |> Menu DefaultWindowMenu MwmWindowMenu
  29. |> {
  30. |>     MyFunc              f.send_msg 123
  31.  
  32. You probably should *not* put this in the mwm configuration file.
  33. There's no guarantee that 123 will correspond to a valid atom.
  34. (I have no idea why f.send_msg wants the atom number instead of
  35. the atom name as it's argument; it looks like a serious design bug.)
  36.  
  37. What I do instead is something like:
  38.  
  39.     Atom message_atom;
  40.     message_atom = XmInternAtom(dpy, "MY_MESSAGE", False);
  41.     sprintf(buf,"MyFunc       f.send_msg %d\n",(int)message_atom);
  42.     XtVaSetValues(shell, XmNmwmMenu,buf, NULL);
  43.     /* Or: */
  44.     Atom motif_wm_menu = XInternAtom(dpy,"_MOFTIF_WM_MENU", False);
  45.     XChangeProperty(dpy,win, motif_wm_menu, motif_wm_menu, 8, 
  46.         PropModeReplace, buf, strlen(buf));
  47.  
  48. i.e., add the extra menu options from the application itself, not
  49. from the Mwm configuration file.
  50.  
  51.  
  52. |> wm_motif_messages = XInternAtom(dpy, "_MOTIF_WM_MESSAGES", FALSE);
  53. |> static    int    helpmsg = 123;
  54. |> 
  55. |> XChangeProperty(dpy, win, wm_motif_messages, XA_INTEGER, 32,
  56.                                                 ^^^^^^^^^^
  57. |>                 PropModeReplace, (unsigned char *) &helpmsg, 1);
  58.  
  59. This could be the problem; _MOTIF_WM_MESSAGES is supposed to be
  60. of type ATOM.  You also might want to make sure that _MOTIF_WM_MESSAGES
  61. is in the WM_PROTOCOLS list, though I'm not sure if it's necessary.
  62. I think that the VendorShell(?) does this automatically.
  63.  
  64. It's easier just to use:
  65.  
  66.     XmAddProtocolCallback(shell, _motif_wm_messages, message_atom,
  67.         MyCallback, MyCallbacksClosure);
  68.  
  69. but since you're not using the Motif toolkit that's not an
  70. option.
  71.  
  72. Hope this helps,
  73.  
  74. --Joe English
  75.  
  76.   joe@trystero.art.com
  77.