home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / sgi / 11166 < prev    next >
Encoding:
Internet Message Format  |  1992-07-22  |  3.3 KB

  1. Path: sparky!uunet!dtix!darwin.sura.net!mips!odin!fido!fangio.asd.sgi.com!rck
  2. From: rck@fangio.asd.sgi.com (Robert Keller)
  3. Newsgroups: comp.sys.sgi
  4. Subject: Re: two cursor questions
  5. Message-ID: <nk7honc@fido.asd.sgi.com>
  6. Date: 22 Jul 92 14:51:29 GMT
  7. References: <14045@borg.cs.unc.edu>
  8. Sender: news@fido.asd.sgi.com (Usenet News Admin)
  9. Organization: Silicon Graphics, Inc., Mountain View, CA
  10. Lines: 61
  11.  
  12. In article <14045@borg.cs.unc.edu> bergman@proline.cs.unc.edu (Larry Bergman) writes:
  13. >  1) I want to use either the "hourglass" or the "watch" cursor
  14. >     in my code.  Are definitions of either available?
  15.  
  16. try typing:
  17.     xsetroot -cursor_name watch 
  18. from the command line. the "watch" cursor is part of the default cursor font.
  19.  
  20.  
  21. >  2) I'm defining a non-default cursor in my program.  For some
  22. >     reason, the new cursor is only displayed in the window that's
  23. >     active when the cursor is defined.  Anywhere outside that
  24. >     window, I get the default cursor (arrow).  This doesn't
  25. >     seem to agree with the documentation.  Has anyone experienced
  26. >     this kind of behavior?  If so, how do I get a non-default
  27. >     cursor definition in other windows (or against the background).
  28.  
  29. using X this can be done as described below (from the X faq).
  30.  
  31. ...robert
  32.  
  33.  
  34.     Subject: 109)  How do I make a "busy cursor" while my application is computing?
  35.     Is it necessary to call XDefineCursor() for every window in my application?
  36.  
  37.         The easiest thing to do is to create a single InputOnly window that is 
  38.     as large as the largest possible screen; make it a child of your toplevel 
  39.     window and it will be clipped to that window, so it won't affect any other 
  40.     application. (It needs to be as big as the largest possible screen in case the 
  41.     user enlarges the window while it is busy or moves elsewhere within a virtual 
  42.     desktop.) Substitute "toplevel" with your top-most widget here (similar code 
  43.     should work for Xlib-only applications; just use your top Window):
  44.  
  45.      unsigned long valuemask;
  46.      XSetWindowAttributes attributes;
  47.  
  48.      /* Ignore device events while the busy cursor is displayed. */
  49.      valuemask = CWDontPropagate | CWCursor;
  50.      attributes.do_not_propagate_mask =  (KeyPressMask | KeyReleaseMask |
  51.          ButtonPressMask | ButtonReleaseMask | PointerMotionMask);
  52.      attributes.cursor = XCreateFontCursor(XtDisplay(toplevel), XC_watch);
  53.  
  54.      /* The window will be as big as the display screen, and clipped by
  55.         its own parent window, so we never have to worry about resizing */
  56.      XCreateWindow(XtDisplay(toplevel), XtWindow(toplevel), 0, 0,
  57.          65535, 65535, (unsigned int) 0, CopyFromParent, InputOnly,
  58.          CopyFromParent, valuemask, &attributes);
  59.  
  60.     When you want to use this busy cursor, map and raise this window; to go back to
  61.     normal, unmap it. This will automatically keep you from getting extra mouse
  62.     events; depending on precisely how the window manager works, it may or may not
  63.     have a similar effect on keystrokes as well.
  64.  
  65.     In addition, note also that most of the Xaw widgets support an XtNcursor 
  66.     resource which can be temporarily reset, should you merely wish to change the
  67.     cursor without blocking pointer events.
  68.  
  69.     [thanks to Andrew Wason (aw@cellar.bae.bellcore.com), Dan Heller 
  70.     (argv@sun.com), and mouse@larry.mcrcim.mcgill.edu; 11/90,5/91]
  71.  
  72.     ----------------------------------------------------------------------
  73.