home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / windows / x / 14310 < prev    next >
Encoding:
Internet Message Format  |  1992-07-23  |  3.7 KB

  1. Path: sparky!uunet!zephyr.ens.tek.com!uw-beaver!micro-heart-of-gold.mit.edu!bloom-beacon!INTERNET!dont-send-mail-to-path-lines
  2. From: wls@astro.umd.EDU
  3. Newsgroups: comp.windows.x
  4. Subject: Re: cursor in spring-loaded menu
  5. Message-ID: <199207232056.AA24939@juno.astro.umd.edu>
  6. Date: 23 Jul 92 20:56:20 GMT
  7. Sender: daemon@athena.mit.edu (Mr Background)
  8. Organization: The Internet
  9. Lines: 71
  10.  
  11. > To: wls@astro.umd.edu (William L. Sebok)
  12. > Organization: X Consortium, MIT Laboratory for Computer Science
  13. > From: Donna Converse <converse@expo.lcs.mit.edu>
  14. >>I have a menu widget which I have written intended to be used as a
  15. >>spring-loaded popup when a button is pressed (by means of an XtMenuPopup() in
  16. >>the translations).  While the menu is popped up I would like the cursor to have
  17. >> some special shape.  It seems to be hard to do this.
  18. > In the Athena widget set, the SimpleMenu widget has a cursor resource.
  19. > In this widget's realize method, the cursor for the menu is set as a
  20. > window attribute, and this works fine.
  21. > > Setting the default cursor on the widget does not do anything.
  22. > I don't understand.
  23. ...
  24. > It seems to me that the menu widget should have a cursor resource, and could 
  25. > use the String to Cursor converter supplied by the Intrinsics, so that the
  26. > cursor can be described by the application programmer and/or the user.  Then
  27. > when the widget's window is created, the supplied cursor is used for that
  28. > window.  You should be able to do this and still use XtMenuPopup; you ought
  29. > not have to supply and register the grab action yourself.
  30.  
  31. I guess I didn't make myself clear.  The widget does have a cursor resource.
  32. It is used in the widget's realize method to set the cursor for the widget's
  33. window.  My problem (or complaint?) is that when the widget it is popped up
  34. with the XtMenuPopup action that this resource has no effect.  The cursor
  35. used seems to alway be that of window of the widget making the grab.  I believe
  36. that this is because XtMenuPopup (as far as I can figure out) makes an
  37. XButtonGrab with cursor of None.
  38.  
  39. I know that the resource is properly set because I successfully used it in
  40. the XChangeActivePointerGrab() call.  The Realize routine is:
  41.  
  42. static void
  43. Realize(w, valueMask, attributes)
  44.     Widget w;
  45.     Mask *valueMask;
  46.     XSetWindowAttributes *attributes;
  47. {
  48.     register DSMenuWidget mw = (DSMenuWidget)w;
  49.  
  50.     if ((attributes->cursor = mw->dsmenu.menu_cursor) != None)
  51.         *valueMask |= CWCursor;
  52.     else
  53.         *valueMask &= ~CWCursor;
  54.  
  55.     (*superclass->core_class.realize)(w, valueMask, attributes);
  56. }
  57.  
  58. Which I think is pretty standard.  The widget is a subclass of OverrideShell.
  59. The only thing I could think of that might be preventing the resource from
  60. being set was a conflicting XtNcursor resource in overrideShell, which I
  61. don't think exists.
  62.  
  63. Another reason I think that the cursor is properly set in the window is that
  64. before I inserted the XChangeActivePointerGrab() call I could see the cursor
  65. flicker to the desired cursor before it changed to the cursor of the window
  66. making the grab.  The window making the grab was the parent of and was covered
  67. by the window that the cursor was in.  First the cursor was the cursor of the
  68. covering window.  Then, when the button was pressed,  the cursor briefly became
  69. that of the popup widget. Finally the cursor became that of the window making
  70. the grab until the button was released and the cursor regained its initial
  71. shape.  This seems to me to be the behavior of an XGrabButton() call made with
  72. a cursor of None.  I still don't see how I can get the behavior I want
  73. (the grab done with the menu's cursor rather than with the grabbing window's
  74. cursor) without writing my own version of the XtMenuPopup() action routine or
  75. by the use of XChangeActivePointerGrab().
  76. ---
  77. Bill Sebok      Univ. of Maryland, Astronomy    Internet: wls@astro.umd.edu
  78.