proportional panning

Matthias Hopf mhopf at suse.de
Tue Jun 30 08:04:02 PDT 2009


On Jun 28, 09 04:41:54 +0100, David De La Harpe Golden wrote:
> 2009/6/8 Matthias Hopf <mhopf at suse.de>:
> > Yes, you're right - I forgot how it was on the Amiga. Shame on me.
> > You're more than welcome to add this to the panning code.
> 
> Turns out doing the panning itself is the easy bit, there's extending the randr
> protocol to include a panning mode field and xrandr command line tool to
> grok it too to worry about...

Yes, there is no flags field or something similar so far. Either means
that there should be an additional call, or this could be implemented
with a (to be standardized) property for the moment. In the end this
probably should be part of the protocol.

> Attached please find an initial patch anyway, though only settable
> from xorg.conf
> as it stands owing to the above, just adds another field to the end of
> the lengthy
> "Panning" option string:
>    /b (or nothing - default) for border push,
>    /l for the proportional panning.

Reasonable enough for the beginning.

> Note that the border values are still used and relevant in the proportional
> code path:
> 1. as you get close to the edge of the crtc it can be nice to
> have unpanned zones to facilitate window placement, it made
> sense to reuse the border fields, use positive
> border values to have such zones, as in the first example below.

Agreed.

> 2. it turns out negative border values also allow a potentially quite
> useful effect with the proportional panning mode:
> Say you had two 1024x768 monitors, one above the other.  You want
> a larger virtual desktop, say 2048x3072.   Well, you can e.g. do the
> following, and as you pan around the edges will line up on
> both heads at all times, which is neat:

Interesting. Wouldn't have thought of that :-)
Might be interesting to add this to the manual as an example (if it
isn't already).

> +	    switch (pm) {
> +            case 'l':
> +	        output->initialPanningMode = XF86CrtcPanningModeLinear;
> +    	        break;
> +            case 'b':
> +            default:
> +		output->initialPanningMode = XF86CrtcPanningModeBorderPush;

You should consider printing a warning or even error if the mode is wrong.
Other modes might be added in the future.

> +     * panningMode: e.g. push against border or proportional to pointer position.
> +     * Added in ABI version ???

Please change XF86_CRTC_VERSION if you change the struct.
Also only add entries to the end of the struct. This might look ugly,
but is backward compatible. Otherwise we would have to change the server
ABI for just that.

> @@ -605,6 +614,7 @@ struct _xf86Output {
>      BoxRec          initialTotalArea;
>      BoxRec          initialTrackingArea;
>      INT16           initialBorder[4];
> +    xf86CrtcPanningMode initialPanningMode;

Similar, change XF86_OUTPUT_VERSION.

> +		    propx = crtc->panningBorder[0] +
> +                            (((x - crtc->panningTotalArea.x1) *
> +                              (width - crtc->panningBorder[0] - crtc->panningBorder[2])) /
> +                             (crtc->panningTotalArea.x2 - crtc->panningTotalArea.x1));

This *looks* like it could require some rounding - but I could be
totally wrong.

Thanks

Matthias

-- 
Matthias Hopf <mhopf at suse.de>      __        __   __
Maxfeldstr. 5 / 90409 Nuernberg   (_   | |  (_   |__          mat at mshopf.de
Phone +49-911-74053-715           __)  |_|  __)  |__  R & D   www.mshopf.de



More information about the xorg mailing list