xkb: Work around alignment problems in GetNames and GetMap replies

The basic situation is this: a list of CARD8/CARD16s followed by a list
of CARD16/CARD32s. In the current code, the second list is aligned to
1/2 bytes according the size of the first list. However, in some cases
the second list needs to be aligned to 4 bytes per the xkbproto spec:
http://www.x.org/releases/current/doc/kbproto/xkbproto.html#appD::Requests

XkbGetMap reply (xkb-opcode 8):
[...]
a     LISTofCARD8          actsRtrn.count
p               unused,p=pad(a)
8A     LISTofKB_ACTION          actsRtrn.acts
4B     LISTofKB_SETBEHAVIOR          behaviorsRtrn
v     LISTofSETofKEYMASK          vmodsRtrn
p               unused, p=pad(v)
2E     LISTofKB_SETEXPLICIT          explicitRtrn
p               unused,p=pad(2E)
2M     LISTofKB_KEYMODMAP          modmapRtrn
p               unused, p=pad(2M)
[...]

XkbGetNames reply (xkb-opcode 17):
[...]
l     LISTofCARD8          nLevelsPerType, sum of all elements=L
p               unused, p=pad(l)
[...]

The server and Xlib handle this with calls to XkbPaddedSize(), which is
a good way to see where the extra padding is needed.

Signed-off-by: Ran Benita <ran234@gmail.com>
xkb: Fix key type map entry field order

In fact, unlike the deleted comment says, both Xlib and the server use
the order as specified in the protocol spec:
http://www.x.org/releases/current/doc/kbproto/xkbproto.html#appD::Requests
(Search for KB_KTMAPENTRY).

Also see struct xkbKTMapEntryWireDesc in
/usr/include/X11/extensions/XKBproto.h

Reviewed-by: Peter Harris <pharris@opentext.com>
Reviewed-by: Daniel Martin <consume.noise@gmail.com>
Signed-off-by: Ran Benita <ran234@gmail.com>
xkb: Change DfltBtnAbsolute to the value used by the server

The spec says:
     #x02     XkbSA_DfltBtnAbsolute
But /usr/include/X11/extensions/XKB.h has:
     #define	XkbSA_DfltBtnAbsolute	(1L << 2)
which is what the server sends.

Note: the XKB spec was changed by Daniel Martin to match the Xlib value.
See kbproto commit db07706cb268d5fe1bc38ef5c0a9f49309068b2c.

Reviewed-by: Daniel Martin <consume.noise@gmail.com>
Signed-off-by: Ran Benita <ran234@gmail.com>
xkb: Unify Overlay1Behavior and Overlay2Behavior

These two structs are used by the server in the exact same way, and are
handled together (see xkb/xkbPrKeyEv.c, XkbKB_Overlay{1,2} handling).
There is no need to use different (and for some reason slightly
different) types for them.

Reviewed-by: Daniel Martin <consume.noise@gmail.com>
Signed-off-by: Ran Benita <ran234@gmail.com>
xkb: Add missing 'supported' field to GetNamedIndicator reply

The protocol encoding has it:
http://www.x.org/releases/current/doc/kbproto/xkbproto.html#appD::Requests

    1     CARD8          opcode
    1     15          xkb-opcode
    [...]

    1     1          Reply
    1     CARD8          deviceID
    2     CARD16          sequence number
    [...]
    4     SETofKB_BOOLCTRL          map.ctrls
    1     BOOL          supported
    3               unused

And xkbGetNamedIndicatorReply in XKBproto.h also.

Finally, the server does send it, though it's always TRUE.

Signed-off-by: Ran Benita <ran234@gmail.com>
xkb: Add missing LedClass and BellClass enum values

The protocol encoding says:
http://www.x.org/releases/current/doc/kbproto/xkbproto.html#appD::Common_Types

    KB_LEDCLASSRESULT
        0     KbdFeedbackClass
        4     LedFeedbackClass

    KB_LEDCLASSSPEC
        Encoding same as KB_LEDCLASSRESULT, with the addition of:
        #x0300     XkbDfltXIClass
        #x0500     XkbAllXIClasses

    KB_BELLCLASSRESULT
        0     KbdFeedbackClass
        5     BellFeedbackClass

    KB_BELLCLASSSPEC
        Encoding same as KB_BELLCLASSRESULT, with the addition of:
        #x0300     XkbDfltXIClass

Note that the spec says something slightly different in another section:
http://www.x.org/releases/current/doc/kbproto/xkbproto.html#Common_Types

    KB_LEDCLASSSPEC { KbdFeedbackClass , LedFeedbackClass , DfltXIClass , AllXIClasses , XINone }
    KB_BELLCLASSSPEC    { KbdFeedbackClass , BellFeedbackClass , DfltXIClass , AllXIClasses  }}

From what I could gather, the encoding is the correct one (but I'm not
sure).

Signed-off-by: Ran Benita <ran234@gmail.com>
xkb: Remove incorrect Control enum comment

The spec says:
http://www.x.org/releases/current/doc/kbproto/xkbproto.html#appD::Common_Types

    SETofKB_CONTROL
        Encodings are the same as for SETofKB_BOOLCTRL, with the addition of:
        #x080000000                  XkbGroupsWrap
        #x100000000                  XkbInternalMods
        #x200000000                  XkbIgnoreLockMods
        #x400000000                  XkbPerKeyRepeat
        #x800000000                  XkbControlsEnabled

And Xlib:
/usr/include/X11/extensions/XKB.h

    #define	XkbGroupsWrapMask	 (1L << 27)
    #define	XkbInternalModsMask	 (1L << 28)
    #define	XkbIgnoreLockModsMask	 (1L << 29)
    #define	XkbPerKeyRepeatMask	 (1L << 30)
    #define	XkbControlsEnabledMask	 (1L << 31)

Which is the same.

Signed-off-by: Ran Benita <ran234@gmail.com>