[comp.windows.x.motif] pointers

dolanmic@nic.cerf.net (Michael A. Dolan) (06/11/91)

 was hoping that someone reading this group could help with with the 
following problem:

I need to change the pointer image during the execution of a motif app.
From within a callback, I am calling the standard Xlib stuff to put
up an hourglass, using the following code:

change_cursor( w )
widget	w;
{
	XDefineCursor( XtDisplay( w ), XtWindow( w ),
		XcreateFontCursor( XtDisplay( w ), XC_gumby ) );
}

and I am tearing it down with:

unchange_cursor( w )
{
	XUndefineCursor( XtDisplay( w ), XtWindow( w ) );
}

Nothing appears to happen, however. Is there something special, or 
a special circumstance, under which I can change the cursor shape?

Any help would be appreciated.

Please reply back at age!syd@ucsd.com if you can help.

My worry here is that Motif won't allow me to do this.

Syd Logan
Software Engineer,
AGE Logic, Inc.
age!syd@ucsd.com
(619)455-8600

janzen@mprgate.mpr.ca (Martin Janzen) (06/18/91)

In article <447@nic.cerf.net>, dolanmic@nic.cerf.net (Michael A. Dolan) writes:
>[...]
>I need to change the pointer image during the execution of a motif app.
>From within a callback, I am calling the standard Xlib stuff to put
>up an hourglass, using the following code:
>
>change_cursor( w )
>widget	w;
>{
>	XDefineCursor( XtDisplay( w ), XtWindow( w ),
>		XcreateFontCursor( XtDisplay( w ), XC_gumby ) );
>}

This looks like a memory leak to me; you'd probably be better off calling
XCreateFontCursor only once and storing the resulting Cursor in a global
variable.

>and I am tearing it down with:
>
>unchange_cursor( w )
>{
>	XUndefineCursor( XtDisplay( w ), XtWindow( w ) );
>}
>
>Nothing appears to happen, however.

You need to let the X server know about your cursor change.  In Motif, all
you have to do is to call XmUpdateDisplay(w) after changing the cursor.

>[...]
>Please reply back at age!syd@ucsd.com if you can help.

My mail bounced, so here it is.

-- 
Martin Janzen                     janzen@mprgate.mpr.ca (134.87.131.13)
MPR Teltech Ltd.                  Phone: (604) 293-5309
8999 Nelson Way                   Fax: (604) 293-6100
Burnaby, BC, CANADA  V5A 4B5