[Xcb] [PATCH proto 3/3] xkb: Unify events into single event
Ran Benita
ran234 at gmail.com
Sun Aug 18 09:22:13 PDT 2013
On Sun, Aug 18, 2013 at 04:53:59PM +0200, Daniel Martin wrote:
> XKB just knows one event, all the other events are sub events of it.
>
> - Transform all events to structs and remove the xkbType field.
> - Add a union (AnyEvent) covering all sub events.
> - Add one event having the xkbType and xkbAnyEvent fields. The latter is
> of the union type AnyEvent.
>
> This is part 2/2 (!) to fix bug #51295:
> various problems with the xkb protocol bindings
> https://bugs.freedesktop.org/show_bug.cgi?id=51295
>
> (!) This is a workaround. The correct fix would be to use a switch/case,
> which is not supported atm. Introducing the switch/case may break
> API compatibility later.
>
> Signed-off-by: Daniel Martin <consume.noise at gmail.com>
>
All 3 patches in this series are
Tested-By: Ran Benita <ran234 at gmail.com>
I have done something like this on the user side myself.
However I am not sure it is worth breaking every current user (I know at
least a couple) if there's a realistic intention to break it again in
the future. But if you don't see it getting fixed any time soon, then
this is better, so
Reviewed-By: Ran Benita <ran234 at gmail.com>
But please bump the soname for xcb-xkb. Also a couple small
suggestions below you might consider.
> ---
> src/xkb.xml | 79 ++++++++++++++++++++++++++++++++++---------------------------
> 1 file changed, 44 insertions(+), 35 deletions(-)
>
> diff --git a/src/xkb.xml b/src/xkb.xml
> index 4ab8d3e..fd1e703 100644
> --- a/src/xkb.xml
> +++ b/src/xkb.xml
> @@ -2451,8 +2451,7 @@ <request name="SetDebuggingFlags" opcode="101">
>
> <!-- Events -->
>
> - <event name="NewKeyboardNotify" number="0">
> - <field name="xkbType" type="CARD8" />
> + <struct name="NewKeyboardNotify">
> <field name="time" type="TIMESTAMP" />
> <field name="deviceID" type="CARD8" />
> <field name="oldDeviceID" type="CARD8" />
> @@ -2464,10 +2463,9 @@ <event name="NewKeyboardNotify" number="0">
> <field name="requestMinor" type="CARD8" />
> <field name="changed" type="CARD16" mask="NKNDetail" />
> <pad bytes="14" />
> - </event>
> + </struct>
>
> - <event name="MapNotify" number="1">
> - <field name="xkbType" type="CARD8" />
> + <struct name="MapNotify">
> <field name="time" type="TIMESTAMP" />
> <field name="deviceID" type="CARD8" />
> <field name="ptrBtnActions" type="CARD8" />
> @@ -2490,10 +2488,9 @@ <event name="MapNotify" number="1">
> <field name="nVModMapKeys" type="CARD8" />
> <field name="virtualMods" type="CARD16" mask="VMod" />
> <pad bytes="2" />
> - </event>
> + </struct>
>
> - <event name="StateNotify" number="2">
> - <field name="xkbType" type="CARD8" />
> + <struct name="StateNotify">
> <field name="time" type="TIMESTAMP" />
> <field name="deviceID" type="CARD8" />
> <field name="mods" type="CARD8" mask="ModMask" />
> @@ -2515,10 +2512,9 @@ <event name="StateNotify" number="2">
> <field name="eventType" type="CARD8" />
> <field name="requestMajor" type="CARD8" />
> <field name="requestMinor" type="CARD8" />
> - </event>
> + </struct>
>
> - <event name="ControlsNotify" number="3">
> - <field name="xkbType" type="CARD8" />
> + <struct name="ControlsNotify">
> <field name="time" type="TIMESTAMP" />
> <field name="deviceID" type="CARD8" />
> <field name="numGroups" type="CARD8" />
> @@ -2531,30 +2527,27 @@ <event name="ControlsNotify" number="3">
> <field name="requestMajor" type="CARD8" />
> <field name="requestMinor" type="CARD8" />
> <pad bytes="4" />
> - </event>
> + </struct>
>
> - <event name="IndicatorStateNotify" number="4">
> - <field name="xkbType" type="CARD8" />
> + <struct name="IndicatorStateNotify">
> <field name="time" type="TIMESTAMP" />
> <field name="deviceID" type="CARD8" />
> <pad bytes="3" />
> <field name="state" type="CARD32" />
> <field name="stateChanged" type="CARD32" />
> <pad bytes="12" />
> - </event>
> + </struct>
>
> - <event name="IndicatorMapNotify" number="5">
> - <field name="xkbType" type="CARD8" />
> + <struct name="IndicatorMapNotify">
> <field name="time" type="TIMESTAMP" />
> <field name="deviceID" type="CARD8" />
> <pad bytes="3" />
> <field name="state" type="CARD32" />
> <field name="mapChanged" type="CARD32" />
> <pad bytes="12" />
> - </event>
> + </struct>
>
> - <event name="NamesNotify" number="6">
> - <field name="xkbType" type="CARD8" />
> + <struct name="NamesNotify">
> <field name="time" type="TIMESTAMP" />
> <field name="deviceID" type="CARD8" />
> <pad bytes="1" />
> @@ -2572,10 +2565,9 @@ <event name="NamesNotify" number="6">
> <field name="nKeys" type="CARD8" />
> <field name="changedIndicators" type="CARD32" />
> <pad bytes="4" />
> - </event>
> + </struct>
>
> - <event name="CompatMapNotify" number="7">
> - <field name="xkbType" type="CARD8" />
> + <struct name="CompatMapNotify">
> <field name="time" type="TIMESTAMP" />
> <field name="deviceID" type="CARD8" />
> <field name="changedGroups" type="CARD8" mask="SetOfGroup" />
> @@ -2583,10 +2575,9 @@ <event name="CompatMapNotify" number="7">
> <field name="nSI" type="CARD16" />
> <field name="nTotalSI" type="CARD16" />
> <pad bytes="16" />
> - </event>
> + </struct>
>
> - <event name="BellNotify" number="8">
> - <field name="xkbType" type="CARD8" />
> + <struct name="BellNotify">
> <field name="time" type="TIMESTAMP" />
> <field name="deviceID" type="CARD8" />
> <field name="bellClass" type="CARD8" enum="BellClassResult" />
> @@ -2598,10 +2589,9 @@ <event name="BellNotify" number="8">
> <field name="window" type="WINDOW" />
> <field name="eventOnly" type="BOOL" />
> <pad bytes="7" />
> - </event>
> + </struct>
>
> - <event name="ActionMessage" number="9">
> - <field name="xkbType" type="CARD8" />
> + <struct name="ActionMessage">
> <field name="time" type="TIMESTAMP" />
> <field name="deviceID" type="CARD8" />
> <field name="keycode" type="KEYCODE" />
> @@ -2613,10 +2603,9 @@ <event name="ActionMessage" number="9">
> <value>8</value>
> </list>
> <pad bytes="10" />
> - </event>
> + </struct>
>
> - <event name="AccessXNotify" number="10">
> - <field name="xkbType" type="CARD8" />
> + <struct name="AccessXNotify">
> <field name="time" type="TIMESTAMP" />
> <field name="deviceID" type="CARD8" />
> <field name="keycode" type="KEYCODE" />
> @@ -2624,10 +2613,9 @@ <event name="AccessXNotify" number="10">
> <field name="slowKeysDelay" type="CARD16" />
> <field name="debounceDelay" type="CARD16" />
> <pad bytes="16" />
> - </event>
> + </struct>
>
> - <event name="ExtensionDeviceNotify" number="11">
> - <field name="xkbType" type="CARD8" />
> + <struct name="ExtensionDeviceNotify">
> <field name="time" type="TIMESTAMP" />
> <field name="deviceID" type="CARD8" />
> <pad bytes="1" />
> @@ -2641,5 +2629,26 @@ <event name="ExtensionDeviceNotify" number="11">
> <field name="supported" type="CARD16" mask="XIFeature" />
> <field name="unsupported" type="CARD16" mask="XIFeature" />
> <pad bytes="2" />
> + </struct>
> +
> + <union name="AnyEvent">
> + <field name="newKeyboardNotify" type="NewKeyboardNotify" />
> + <field name="mapNotify" type="MapNotify" />
> + <field name="stateNotify" type="StateNotify" />
> + <field name="controlsNotify" type="ControlsNotify" />
> + <field name="indicatorStateNotify" type="IndicatorStateNotify" />
> + <field name="indicatorMapNotify" type="IndicatorMapNotify" />
> + <field name="namesNotify" type="NamesNotify" />
> + <field name="compatMapNotify" type="CompatMapNotify" />
> + <field name="bellNotify" type="BellNotify" />
> + <field name="actionMessage" type="ActionMessage" />
> + <field name="accessXNotify" type="AccessXNotify" />
> + <field name="extensionDeviceNotify" type="ExtensionDeviceNotify" />
> + </union>
> +
> + <event name="Event" number="0">
The generated type is "xcb_xkb_event_event_t". Maybe change the name
here to "Common" or so?
> + <field name="xkbType" type="CARD8" enum="EventType" />
> + <field name="xkbAnyEvent" type="AnyEvent" />
xkbAnyEvent is a mouthful, how about just "any"?
Ran
> </event>
> +
> </xcb>
> --
> 1.8.3.3
>
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb
More information about the Xcb
mailing list