Re: Does exist a method to....

Steve Lamont (spl@szechuan.ucsd.edu)
Mon, 2 Dec 96 07:10:32 PST

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

> > 1) turn off the hardware cursor, alternately you can change the cursor
> > to something different.
>
> I cannot understand what do you mean about "hardware cursor". Maybe does
> it mean that i have to eliminate the default drawing of the pointer on
> my windows, and do this by myself ?

Yes. Actually, what you do is to create an invisible cursor.

> If it is, where i can find informations on what can i do this ?

You can look at the source of the freely available program
'unclutter,' from which I have "borrowed" the following:

/*
* Lifted from unclutter
* Mark M Martin. cetia 1991 mmm@cetia.fr
* Version 4 changes by Charles Hannum <mycroft@ai.mit.edu>
*/

static Cursor create_blank_cursor( void )

{

Display *display = fl_get_display();
Window root = RootWindow( display,
DefaultScreen( display ) );
Pixmap cursormask = XCreatePixmap( display, root, 1, 1, 1 /*depth*/ );
XGCValues xgc;
GC gc;
XColor dummycolour;
Cursor cursor;

xgc.function = GXclear;
gc = XCreateGC(display, cursormask, GCFunction, &xgc);

XFillRectangle(display, cursormask, gc, 0, 0, 1, 1);

dummycolour.pixel = 0;
dummycolour.red = 0;
dummycolour.flags = 04;

cursor = XCreatePixmapCursor( display, cursormask, cursormask,
&dummycolour, &dummycolour, 0, 0 );

XFreePixmap( display, cursormask );
XFreeGC( display, gc );

return cursor;

}

[You can tell I stole it almost word for word because 'dummycolour' is
spelled oddly :-)]

To hide the cursor, just issue:

XDefineCursor( display, window, display_blank_cursor );

and to restore the cursor

XUndefineCursor( display, window );

I suppose that you could integrate this into the XForms cursor
management tools somehow, but I have never bothered to try.

In the application where this bit of code is used I create my own
large box cursor using the Xor drawing functions to undraw and draw.
Doing a 'save under' to a server side Pixmap would probably also work
for fancier cursors.

This reminds me of a minor peeve I have with X. There's no way that
I've ever found to query a Window's current cursor. You can set it
but you can't query it. That missing query and the inability to query
a Window's background Pixmap have always mystified me. I mean,
clearly the X server knows what the cursor is -- why it's unable to
tell the application is beyond me.

spl

To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html