[comp.windows.x] using 1 mouse for >1 screen

pmoore@hemel.bull.co.uk (Paul Moore) (11/09/90)

Any ideas on how to control more than one screen with one mouse? I mean
that the user can effectively slave one screen of the one he is using.

I can see that I could grab the mouse (and kbd) on server 1 and push
the events onto the application running on another server. But how
can I make the mouse pointer move on the "slaved" server?
Or is there another way entirely?

(Plan B: a black box with a big knob on it marked "screen a" and "screen b"
that connects the mouse/kbd to either server)

mouse@LARRY.MCRCIM.MCGILL.EDU (11/12/90)

> Any ideas on how to control more than one screen with one mouse?  I
> mean that the user can effectively slave one screen of the one he is
> using.

> I can see that I could grab the mouse (and kbd) on server 1 and push
> the events onto the application running on another server.  But how
> can I make the mouse pointer move on the "slaved" server?  Or is
> there another way entirely?

Pointer motion is fairly easy, at least when the displays are using
screens of matching sizes.  Simply loop doing XQueryPointer calls on
the "master" server, and when the pointer position changes, do
XWarpPointer calls on the "slave" servers.

Unfortunately I see no way to avoid the polling type of loop.  You
would need to select for PointerMotionMask on all viewable windows, and
then watch for new windows to ensure that you select for input on them
too....  In order to handle button and key events, you pretty much have
to do that anyway.

The reason you don't want to grab the pointer (and/or keyboard) is that
if you do, you break many things.  You break the changing of pointer
cursors as the pointer moves across windows on the master server; you
break the mechanisms for distributing events to the windows they should
be sent to; and you completely break applications that try to grab the
pointer (or keyboard) themselves.

Without extensions, there really is no good way to do this.  I recall
hearing of an "input synthesis" extension; if it lives up to its name,
that sounds like a good way.  I have not looked at it myself.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu