home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / windows / x / 20603 < prev    next >
Encoding:
Internet Message Format  |  1992-12-29  |  2.6 KB

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