Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

change the mouse pointer for window of one app

35 views
Skip to first unread message

Eli the Bearded

unread,
May 13, 2011, 6:17:37 PM5/13/11
to
[posted with no response to comp.os.linux.x a couple of days ago]

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

Aaron W. Hsu

unread,
May 13, 2011, 11:03:26 PM5/13/11
to
On Fri, 13 May 2011 18:17:37 -0400, Eli the Bearded
<*@eli.users.panix.com> wrote:

> 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.

Eli the Bearded

unread,
May 16, 2011, 7:13:56 PM5/16/11
to
In comp.windows.x, Aaron W. Hsu <arc...@sacrideo.us> wrote:
> Eli the Bearded <*@eli.users.panix.com> wrote:
>> 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?

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

luserXtrog

unread,
May 23, 2011, 2:07:48 AM5/23/11
to
On May 16, 6:13 pm, Eli the Bearded <*...@eli.users.panix.com> wrote:
> In comp.windows.x, Aaron W. Hsu <arcf...@sacrideo.us> wrote:

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.

Eli the Bearded

unread,
May 30, 2011, 2:13:48 AM5/30/11
to
In comp.windows.x, luserXtrog <mij...@yahoo.com> wrote:

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

Aaron W. Hsu

unread,
May 30, 2011, 5:50:36 PM5/30/11
to
On Mon, 30 May 2011 02:13:48 -0400, Eli the Bearded
<*@eli.users.panix.com> wrote:

> 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.

Alan Curry

unread,
May 30, 2011, 8:56:01 PM5/30/11
to
In article <eli$11053...@qz.little-neck.ny.us>,

Eli the Bearded <*@eli.users.panix.com> wrote:

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

0 new messages