[PATCH xf86-input-keyboard 2/2] Code cleanup, structure initialization.

Peter Hutterer peter.hutterer at who-t.net
Mon Oct 18 15:54:13 PDT 2010


On Mon, Oct 18, 2010 at 01:34:23PM -0400, Trevor Woerner wrote:
> On Mon, Oct 18, 2010 at 1:24 PM, Gaetan Nadon <memsize at videotron.ca> wrote:
> > On Mon, 2010-10-18 at 11:38 -0400, Trevor Woerner wrote:
> >> The InputDriverRec data structure in xserver/hw/xfree86/common/xf86Xinput.h
> >> no longer contains an integer refCount member.
> >
> > Have you taken into account that this driver still builds with server 1.3 or
> > later?
> >
> > PKG_CHECK_MODULES(XORG, [xorg-server >= 1.2.99.0] xproto inputproto)
> >
> > I am not familiar with the details of how that works, but I see lines
> > like this in the code:
> >
> > #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 1
> 
> Unfortunately not; I don't have any understanding of how the
> versioning works with regards to building newer drivers for older
> servers, or visa-versa, or whatever it is this versioning stuff is
> trying to accomplish.
> 
> I'd appreciate a lesson (or a link to a description) so I can clean up
> this code properly.

what it accomplishes is to keep the same code base compiling against a
different set of APIs.

I don't know the input ABI's by heart but essentially whenever we change the
ABI/API, the ABI_XINPUT_VERSION gets bumped. this may happen more than once
during a server release (usually to aid developers building from git).

once you're past the server release, only the last ABI matters though, so to
keep things working, check out the xserver tag for the release, then check
the ABI_XINPUT_VERSION and make sure the ifdef's cater for that.

e.g. the evdev driver has this gem:

    if (!InitValuatorClassDeviceStruct(device, num_axes,
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
                                       atoms,
#endif
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 3
                                       GetMotionHistory,
#endif
                                       GetMotionHistorySize(), Absolute))


so in ABI 7 (i think that was server 1.7), we added axis labels (the "atom"
parameter) and we removed the motion history function with ABI 3 (server
1.5, I think).

Cheers,
  Peter


More information about the xorg-devel mailing list