MPX updated

Peter Hutterer mailinglists at
Thu Dec 7 17:22:53 PST 2006

Hey guys,

I've been working on getting MPX [1] up-to-date with the current  
server for the last few weeks. (MPX is a patch against to get  
multiple mouse cursors). Thanks to Daniel Stone's changes [2], MPX  
fits now snugly into the event generation.

MPX now
- is integrated rather than bolted on top
- has it's own extension protocol
- does proper mouse cursor rendering
- has a lot of still-unused stuff under the hood

This is the first set of patches I can offer for people to play with.  
It's not overly stable or mature yet. More features will be added but  
you can get a grip on what it does.

The short version:

The long version:
I had a different approach with this version than with the first,  
initial MPX.
The previous MPX was built on two assumptions
1) I did not have a clue what the code did
2) I did not want to modify the code base
Which resulted in MPX being rather bolted on and not very scaleable.  
It did prove the point though.

This time, I didn't care about  2) and well, I do have a bit of a  
clue what is going on now.

One of the main rules I tried to follow though was that the behaviour  
of X should not change if there is only one pointer. So the core  
pointer has been neither removed nor does it behave different.  
Everything in the core protocol tends to fall back on the core  
pointer, unless there is some intelligent solution to apply it to  
all. This is still work in progress.

API changes
I had to break a few APIs, resulting in miPointer, miSprite and miDC  
having DeviceIntPtr arguments now. This allows for some nifty things  
(see below). Wherever no device is given, the core pointer is used.  
Big parts of dix events have device arguments now as well.

The result of this is that, although the number of changes seems very  
high, it isn't actually that bad. The actual functionality changes  
are only little, most of the benefits come from passing the devices  

MPX extension
There is a bit of an MPX extension already. A few requests and  
events, with more to come. MPX does not change the input extension  
any more, it has it's own events (so far MPXMotionNotify,  
MPXButtonPress and MPXButtonRelease).
Currently, there is a XCB frontend for a client that wants to use MPX.

The MPX extension borrows heavily from Xi. To be more precise, it  
uses some of Xi's function and takes a piggyback
ride on the XI event delivery. Again, this keeps the number of  
changes down.

Current procol provides the following calls:
- query extension version
- list MPX devices
- get event base
- register for events
- query for a particular pointer's coordinates

more to come.

The whole client-side part is currently XCB and I intend to maintain  
it that way for the near future. Providing an XCB frontend is much  
quicker than providing an Xlib frontend.

Cursor rendering
Each cursor is it's own entity now, instead of sharing with the core  
pointer's cursor. That means that as you move one mouse into a  
textfield, only this one cursor changes to a caret. The API should  
cope with commands to change/warp etc. only one cursor but the  
protocol is not there yet. There are a few glitches left.

A lot of stuff under the hood
Passing the devices around from everywhere gives us quite a few  
The ability to query a particular pointer's position is already  
there, but some of the possibilities include grabbing only a single  
pointer, warping a certain cursor, getting pointer-specific enter/ 
leave events, etc.
So far, there is none of the floor control I had in the old MPX but  
I'll add it to the protocol ASAP. Which means a client can then  
decide which window can receive events from pointers.

whot at hyena:~/X11R7/xserver$> git diff origin | diffstat | tail -n 1
62 files changed, 3902 insertions(+), 1134 deletions(-)

Download & patching
There's five parts to it:
	to be applied with patch -p1 in xserver
	against commit f9f7d7f3be53c808abb5eaceb7a1abc55744a210
	to be applied with patch -p0 in proto/ (will create mpxproto)
	to be applied with patch -p1 in xcb/libxcb
	against commit f486075fa093846c3f32b3e4b9624c039ea26ba4
	to be applied with patch -p1 in xcb/proto
	against commit 701dec025966bd19dcd1a6ae6f277abf3f1abd16
	to be applied with patch -p1 in util/modular
	against commit 3fd2a827e19ff31f6efd73bc94724cb1fbd135f7

The last should adjust the script that you can just use it  
to rebuild the server (disable dmx and xnest though).
So far I only tried the nv driver. I don't know whether the others  
build or work.

Unfortunately, I can't provide a public git repository to clone from,  
the patches have to do until I can provide binaries. The patches  
probably only work against the commits I have merged in my git  
repository and not against later versions.
The list of compatible commits is 
A little script to patch and build: 
It's a pain. I know.

Thanks to Ben Close, Daniel Stone, Jamey Sharp, and all others who  
gave me input, feedback and provided help.



Multi-Pointer X Server

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the xorg mailing list