Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!europa.asd.contel.com!wlbr!news From: amc@wlv.imsd.contel.com (Allen M. Cohen) Newsgroups: comp.windows.x.motif Subject: Simple routine to toggle cursor between watch and arrow Keywords: cursor, XmUpdateDisplay Message-ID: <1991Jun18.235806.11327@wlbr.imsd.contel.com> Date: 18 Jun 91 23:58:06 GMT Sender: news@wlbr.imsd.contel.com (news) Distribution: na Organization: Autologic, Inc. Lines: 64 Nntp-Posting-Host: wlv.imsd.contel.com Here's a simple rountine to toggle between a watch cursor and an arrow cursor. /* * Change cursor to either a watch or an arrow. * Allen M. Cohen * 06/18/91 */ #include #include extern Widget toplevel; void ToggleCursor(w) Widget w; { static Display *Dsp; /* Main display */ static Cursor WaitCursor; /* Watch cursor for "in-work" */ static Cursor ArrowCursor; /* Arrow cursor for normal mode */ static Bool Tog = 1; if (Dsp == NULL) { /* * Get main display */ Dsp = XtDisplay(toplevel); /* * Create cursors */ WaitCursor = XCreateFontCursor (Dsp, XC_watch); ArrowCursor = XCreateFontCursor (Dsp, XC_arrow); } if ((Tog++) % 2) { /* * Change to "watch" cursor */ XDefineCursor (Dsp, XtWindow(w), WaitCursor); /* * Force expose event before callbacks */ XmUpdateDisplay(toplevel); } else { /* * Revert to "arrow" cursor */ XDefineCursor (Dsp, XtWindow(w), ArrowCursor); } } <> Allen M. Cohen Internet: amc@wlv.imsd.contel.com <> <> 1853 Stonesgate St. UUCP: elroy.Jpl.Nasa.Gov!agi0!allen <> <> Westlake Village, Ca. 91361 Telephone: (805) 498-9611 ext. 195 <> <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>