[Xcb] [PATCH 1/3] xinput: Add missing XI2 event enumerations

Ran Benita ran234 at gmail.com
Sat Oct 12 14:52:20 PDT 2013


On Fri, Oct 11, 2013 at 06:18:37PM +0200, Daniel Martin wrote:
> This adds an enumeration 'XIEventMask', which is necessary to select for
> XI2 events via the SelectEvent request.
> 
> And adds an enumeration 'Event' to be able to check the type
> ('event_type' field in the Generic Extension event header) of an XI2
> event.

I'm probably missing some context, but why do we need two copies of the
enum? Merely for the name? (too bad there's not enumcopy).
If the copy is necessary, parhaps move them next to each other with
some comment so if you update one you don't forget about the other.

Other than that the enum is useful of course.

Ran

> 
> Signed-off-by: Daniel Martin <consume.noise at gmail.com>
> ---
>  src/xinput.xml | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 65 insertions(+), 1 deletion(-)
> 
> diff --git a/src/xinput.xml b/src/xinput.xml
> index e62b7cb..ea20c41 100644
> --- a/src/xinput.xml
> +++ b/src/xinput.xml
> @@ -1257,10 +1257,42 @@ <request name="XIGetClientPointer" opcode="45">
>  
>      <!-- XISelectEvents -->
>  
> +    <enum name="XIEventMask">
> +        <item name="DeviceChanged">    <bit>1</bit> </item>
> +        <item name="KeyPress">         <bit>2</bit> </item>
> +        <item name="KeyRelease">       <bit>3</bit> </item>
> +        <item name="ButtonPress">      <bit>4</bit> </item>
> +        <item name="ButtonRelease">    <bit>5</bit> </item>
> +        <item name="Motion">           <bit>6</bit> </item>
> +        <item name="Enter">            <bit>7</bit> </item>
> +        <item name="Leave">            <bit>8</bit> </item>
> +        <item name="FocusIn">          <bit>9</bit> </item>
> +        <item name="FocusOut">         <bit>10</bit> </item>
> +        <item name="Hierarchy">        <bit>11</bit> </item>
> +        <item name="Property">         <bit>12</bit> </item>
> +        <!-- ⋅⋅⋅ Events (v2.1) ⋅⋅⋅ -->
> +        <item name="RawKeyPress">      <bit>13</bit> </item>
> +        <item name="RawKeyRelease">    <bit>14</bit> </item>
> +        <item name="RawButtonPress">   <bit>15</bit> </item>
> +        <item name="RawButtonRelease"> <bit>16</bit> </item>
> +        <item name="RawMotion">        <bit>17</bit> </item>
> +        <!-- ⋅⋅⋅ Events (v2.2) ⋅⋅⋅ -->
> +        <item name="TouchBegin">       <bit>18</bit> </item>
> +        <item name="TouchUpdate">      <bit>19</bit> </item>
> +        <item name="TouchEnd">         <bit>20</bit> </item>
> +        <item name="TouchOwnership">   <bit>21</bit> </item>
> +        <item name="RawTouchBegin">    <bit>22</bit> </item>
> +        <item name="RawTouchUpdate">   <bit>23</bit> </item>
> +        <item name="RawTouchEnd">      <bit>24</bit> </item>
> +        <!-- ⋅⋅⋅ Events (v2.3) ⋅⋅⋅ -->
> +        <item name="BarrierHit">       <bit>25</bit> </item>
> +        <item name="BarrierLeave">     <bit>26</bit> </item>
> +    </enum>
> +
>      <struct name="EventMask">
>          <field type="DeviceId" name="deviceid" altenum="Device" />
>          <field type="CARD16"   name="mask_len" />
> -        <list type="CARD32" name="mask"> <!-- set of EventMaskBit -->
> +        <list type="CARD32" name="mask" mask="XIEventMask">
>              <fieldref>mask_len</fieldref>
>          </list>
>      </struct>
> @@ -1854,6 +1886,38 @@ <event name="DevicePropertyNotify" number="16">
>           - A 'len' field in a v2++ structure is in 4 byte units.
>      -->
>  
> +    <enum name="Event">
> +        <item name="DeviceChanged">    <value>1</value> </item>
> +        <item name="KeyPress">         <value>2</value> </item>
> +        <item name="KeyRelease">       <value>3</value> </item>
> +        <item name="ButtonPress">      <value>4</value> </item>
> +        <item name="ButtonRelease">    <value>5</value> </item>
> +        <item name="Motion">           <value>6</value> </item>
> +        <item name="Enter">            <value>7</value> </item>
> +        <item name="Leave">            <value>8</value> </item>
> +        <item name="FocusIn">          <value>9</value> </item>
> +        <item name="FocusOut">         <value>10</value> </item>
> +        <item name="Hierarchy">        <value>11</value> </item>
> +        <item name="Property">         <value>12</value> </item>
> +        <!-- ⋅⋅⋅ Events (v2.1) ⋅⋅⋅ -->
> +        <item name="RawKeyPress">      <value>13</value> </item>
> +        <item name="RawKeyRelease">    <value>14</value> </item>
> +        <item name="RawButtonPress">   <value>15</value> </item>
> +        <item name="RawButtonRelease"> <value>16</value> </item>
> +        <item name="RawMotion">        <value>17</value> </item>
> +        <!-- ⋅⋅⋅ Events (v2.2) ⋅⋅⋅ -->
> +        <item name="TouchBegin">       <value>18</value> </item>
> +        <item name="TouchUpdate">      <value>19</value> </item>
> +        <item name="TouchEnd">         <value>20</value> </item>
> +        <item name="TouchOwnership">   <value>21</value> </item>
> +        <item name="RawTouchBegin">    <value>22</value> </item>
> +        <item name="RawTouchUpdate">   <value>23</value> </item>
> +        <item name="RawTouchEnd">      <value>24</value> </item>
> +        <!-- ⋅⋅⋅ Events (v2.3) ⋅⋅⋅ -->
> +        <item name="BarrierHit">       <value>25</value> </item>
> +        <item name="BarrierLeave">     <value>26</value> </item>
> +    </enum>
> +
>      <enum name="ChangeReason">
>          <item name="SlaveSwitch">  <value>1</value> </item>
>          <item name="DeviceChange"> <value>2</value> </item>
> -- 
> 1.8.4
> 
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb


More information about the Xcb mailing list