More on capturing the mouse pointer in X...

Subject: More on capturing the mouse pointer in X...
From: David Truman <dave -at- KLG -dot- COM>
Date: Tue, 28 Jun 1994 08:35:18 -0400

Glen Accardo writes:

> This is a bit of extra information on capturing screens in X. Specifically
> it is a reply to David Warren's (?) question about capturing the mouse
> cursor. (Sorry David, my desk ate the Post It with your phone number.)

> As I understand it, the mouse cursor is NOT part of X screen memory. It is
> a sprite which is superimposed over the screen. This makes mouse cursor
> updating a good bit faster -- a nice feature except that most screen
> capture programs DON'T do the extra work of adding the mouse to a screen
> image. My solution for creating such a screen shot would be to draw the
> mouse cursor manually.

> Granted, this isn't a good solution because it involves faking output, and
> we all know where that leads. Unless someone knows of a specific program
> which does capture the mouse (I haven't tried 'em all yet), it's the best
> I can come up with.

I have a slightly better solution, better in that it doesn't involve
"faking" the pointer by drawing it manually. The mouse pointers are
stored in an X font called "cursor". So what I do is capture an image
of the "cursor" I need, and place that over the screen capture of the

So for example, if I want to show the mouse cursor pulling down a menu
I would:
* use xwd with a sleep to get the window with the menu pulled
down (not an easy task either)
* display the "cursor" font (I'll say how later) and capture
* the mouse pointer I need
* import both graphics into my page layout program with the
mouse pointer image *on top of* the other graphic

To display the cursor font, I use the following unix/x command:
xfd -fn cursor &
This runs a program called "xfd" (should be available on all X
distributions) specifying this "cursor" font. And of course, "&"
tells it to run in the background so I can type other commands...
Once font is displayed, any bitmap program like XV, HiJaak, PaintShop Pro,
etc., can be used to capture the window and crop just the pointer you want.

I've got an XWD graphic of this "cursor" mouse pointer font that I'd be
happy to compress/uuencode and email to anyone who isn't able to display the
pointers themselves. There's lots of silly cursors in there too, like
Gumby, the starship Enterprise, etc. I considered posting it along with
this message, since it's only 20K, but I didn't think people wanted to
read "uuencoding" in TECHWR-L. Hardly scintillating English prose:
begin 664 xfd.xwd.Z
M'YV0 *N"0C@ $$!!!$$'& HH (!",&2$AP8D 0% $,0$1P0,2/(!4"L#BR
M8T, #PFB4!D1SQTR==K ?G18$5 @"+:=! -at- 09\"=&G'Z+!B10$2<0 L,11K1
(it continues ad nauseum)

The only problem I've found (any suggestions, TECHWhiRLers?!) is that
my cropped mouse pointer saves the background color around the pointer
(since I can only crop in a square). I have to ensure that it's the
same color as the background of the application I'm capturing. I'd
love to make this background "transparent", or somehow be able to
tightly crop around the irregular shape of the mouse pointer. I'm not
a graphics whiz, so I'm sure there's a way to do it, but I just haven't
found it yet...

Dave Truman -- Senior Technical Writer, XRT Products
KL Group Inc. | Phone: (416) 594-1026 Ext. 732
260 King Street East, Third Floor | Fax: (416) 594-1919
Toronto, Ontario, M5A 1K3 CANADA | Email: drt -at- klg -dot- com

Previous by Author: Updating multiple docs
Next by Author: Re: Introducing FTP-ing for Anna & Others
Previous by Thread: Re: Book on the Internet?
Next by Thread: Compuserve vs. AOL - I choose neither

What this post helpful? Share it with friends and colleagues:

Sponsored Ads