I want the mouse pointer to change from my default left_ptr to
a different shape when in front of xeyes only.
How can I do that?
Here's what I've tried unsuccessfully:
1) setting the pointer with xsetroot (unsurprisingly it only sets
the pointer for the root window, not others)
2) Several variations on:
$ echo "xeyes*pointerShape: dot" >> ~/.Xdefaults
$ xrdb -merge ~/.Xdefaults
xterms respond xterm*pointerShape, but not xeyes.
3) An Xcursors theme:
$ mkdir ~/.xeyes ~/.xeyes/default ~/.xeyes/default/cursors
$ cd ~/.xeyes/default
$ cat > index.theme
[Icon Theme]
Name=Xeyes
Comment=Xeyes specific theme
$ cd default
$ for f in $(ls /usr/share/icons/default/cursors/) ; do
ln -s /usr/share/icons/default/cursors/dotbox $f
done
$ XCURSOR_PATH=$HOME/.xeyes/ XCURSOR_THEME=default xeyes
Nothing changed. I also tried an strace of xeyes, and never saw it
open any file in $HOME/.xeyes/
What else should I try? The goal, once I can figure out how to do it,
is to have an invisible pointer in front of a full screen xeyes window.
Elijah
------
resorting to recompiling xeyes is cheating
> I want the mouse pointer to change from my default left_ptr to
> a different shape when in front of xeyes only.
Normally I would recommend trying to play with it using editres, but when
I try to do that on my machine, I do not get any resource tree from the
application. My only other thought is to read through the source and find
out what is actually going on. Is it using Xt or something else?
Aaron W. Hsu
--
Programming is just another word for the lost art of thinking.
Yes, it would seem so:
int
main(int argc, char **argv)
{
XtAppContext app_context;
Widget toplevel;
Arg arg[2];
Cardinal i;
XtSetLanguageProc(NULL, (XtLanguageProc) NULL, NULL);
toplevel = XtAppInitialize(&app_context, "XEyes",
options, XtNumber(options), &argc, argv,
NULL, arg, (Cardinal) 0);
/* ... */
XtAppMainLoop(app_context);
return 0;
}
I haven't written an X11 app in at least a decade, and I never did
much X11 programming at all. What should I look for in the code?
Elijah
------
using old xeyes source, but expects it has not changed much
I don't know anything about Xt.
But the Xlib Programming Manual gives this example for changing
the cursor. p.182:
#include <X11/cursorfont.h>
int cursor_shape = XC_arrow;
Window window;
Cursor cursor;
cursor = XCreateFontCursor(display, cursor_shape);
XDefineCursor(display, window, cursor);
/* Now cursor will appear when pointer is in window */
Xt must have some way to get the Window out of an XtAppContext.
So if you can find that, then this should help.
Oh, and on page 891 of the Xlib Reference Manual it gives
all the names for the cursor font.
I'm too lazy to type them all, but XC_crosshair might look cool.
or XC_gumby or XC_center_ptr.
I notice you use different names, but the same email address in
different groups. Curious.
Problem statement:
[I want the mouse pointer to change from my default left_ptr to]
[a different shape when in front of xeyes only.]
> I don't know anything about Xt.
> But the Xlib Programming Manual gives this example for changing
> the cursor. p.182:
Ah, but the hope was to find a way that doesn't involve changing
xeyes, so it will work in any install, not just my custom build.
It seems that hope has been dashed.
Elijah
------
also reads comp.lang.postscript
> It seems that hope has been dashed.
I guess that depends. I still don't have time to check the source for
XEyes, but surely this isn't the first time someone has wanted to do this.
Yes, the "pointerShape" resource is not part of Xt. It works in xterm because
xterm has code to support it. Xt handles the parsing of the cursor name
strings, but that's all.
In the Athena widget set (libXaw), most widgets have a "cursor" resource.
Without looking it up, I'd guess that Motif (libXm) is similar. So
"AppName*cursor: dot" would work with a lot of the traditional X11
applications. But xeyes doesn't use Xaw or Xm, just bare Xt with a custom
widget class that doesn't have any cursor-changing ability.
--
Alan Curry