title: Why do I receive key release event when key release is not in event mask. (xcb)
body: <p>I am making a simple xcb application and I noticed that when <code>XCB_EVENT_MASK_KEY_PRESS</code> is in the event mask and <code>XCB_EVENT_MASK_KEY_RELEASE</code> is not in the event mask I still get <code>XCB_KEY_RELEASE</code> events in my event loop if I hold down a key so that it repeats the key press event. Surely if <code>XCB_EVENT_MASK_KEY_RELEASE</code> is not in the event mask I should never get an <code>XCB_KEY_RELEASE</code> event?</p>
  <p>Minimum reproducible example:</p>
  <p>Run and hold down a key for a few seconds so that the keypress event repeats. This causes the key release event despite <code>XCB_EVENT__MASK_KEY_RELEASE</code> not being in the event mask.</p>
  <pre><code>#include &lt;inttypes.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;xcb/xcb.h&gt;
  
  /* notice that the event mask does not conatin XCB_EVENT_MASK_KEY_RLEASE */
  const uint32_t EVENT_MASK
      = XCB_EVENT_MASK_EXPOSURE
      | XCB_EVENT_MASK_KEY_PRESS;
  
  int main()
  {
      int screenNum;
      xcb_connection_t* xcon = xcb_connect(NULL, &amp;screenNum);
  
      const xcb_setup_t* xsetup = xcb_get_setup(xcon);
      xcb_screen_t* screen;
      {
          xcb_screen_iterator_t iter = xcb_setup_roots_iterator(xsetup);
          for (int i = 0; i &lt; screenNum; i++)
              xcb_screen_next(&amp;iter);
          screen = iter.data;
      }
      xcb_window_t window = xcb_generate_id(xcon);
      uint32_t winvals[] = { screen-&gt;white_pixel, EVENT_MASK };
      xcb_create_window(
          xcon,
          XCB_COPY_FROM_PARENT,
          window,
          screen-&gt;root,
          10, 10,
          150, 150,
          10,
          XCB_WINDOW_CLASS_INPUT_OUTPUT,
          screen-&gt;root_visual,
          XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK, winvals);
      xcb_map_window(xcon, window);
      xcb_flush(xcon);
      xcb_generic_event_t* event;
      while ((event = xcb_wait_for_event(xcon))) {
          switch (event-&gt;response_type &amp; ~0x80) {
          case XCB_EXPOSE: {
              // TODO: draw something
              xcb_flush(xcon);
  
              break;
          }
          case XCB_KEY_PRESS: {
              xcb_key_press_event_t* kp = (xcb_key_press_event_t*)event;
              printf(&quot;key pressed: %u\n&quot;, kp-&gt;detail);
              break;
          }
          case XCB_KEY_RELEASE: {
              puts(&quot;KEY RELEASE EVENT?!&quot;);
              break;
          }
          default: {
              printf(&quot;unknown event. type = %u\n&quot;, event-&gt;response_type);
              break;
          }
          }
          free(event);
      }
      xcb_disconnect(xcon);
      return 0;
  }
  </code></pre>