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