Re: XForms: setting mouse cursor (angain.. sorry)

Steve Lamont (spl@szechuan.ucsd.edu)
Tue, 30 Sep 97 06:21:38 PDT

To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

ls> I tried to set the mouse cursor in a free object.
> Itried the built in X cursors /cursorfonts.h.../, and above 64th cursor,
> I got a warning message :
> In AddCursor [cursor.c 65] too many cursors

The cursorfont cursors are available using the XForms fl_set_cursor()
routine. How are you "building" the cursors? In a little test
program that simply calls fl_set_cursor() I was able to cycle through
all of the font cursors multiple times with no ill effects.

> I only could create about 25 cursors, and no more.
> I have to use about 60-100 different cursors... :(

Yikes! That's rather a lot, isn't it? I think the first thing that
you need to examine is whether you actually need so many cursors.
If you're in need of animated cursors, XForms supplies an interface
for this with the routine fl_create_animated_cursor().

> Is there an routine which deletes the created bitmap cursor ?
> The XFreeCursor(..) will do ?

There's no correspondence between the id returned by
fl_create_bitmap_cursor() and the Cursor XID -- it's simply an entry
into an internal (and statically allocated, hence your problems)
lookup table. There is an undocumented function
fl_get_cursor_byname() (at least I didn't find it in my 0.87.2
manual's index anywhere that seemed reasonable to look). It will
return the Cursor XID:

Cursor fl_get_cursor_byname( int name )

where `name' is the XForms cursor name retured by
fl_create_bitmap_cursor(). However, there is no way to replace an
entry in the cursor table as far as I can tell, so deleting the cursor
with XFreeCursor() isn't going to buy you anything.

If you really do have need of zillion bitmap cursors, you're going to
have to resort to the raw Xlib calls XCreatePixmapCursor() and
XDefineCursor().

Perhaps if you explained why you have the need for such a large number
of Pixmap cursors, I could help you more.

spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/