title: Need Help Understanding X11 Protocol Errors
body: <p>I've just started building a minimal X server for Windows from scratch.  As I work through it I'm sure I'll run into all kinds of errors and glitches as I work the bugs out and learn more about the protocol.</p>
  
  <p>Here's an example of an error I have seen printed by a client:</p>
  
  <pre><code>X Error of failed request:  0
    Major opcode of failed request:  0 ()
    Serial number of failed request:  0
    Current serial number in output stream:  3
  </code></pre>
  
  <p>The major opcode meaning seems pretty obvious, but where are the "X Error" codes defined?</p>
  
  <p>What are the serial numbers of the failed request and output stream?  Are these supposed to match each other?  By output stream, does that mean what was sent to the xserver or what was sent to the xclient?  Is this related to sequence numbers?</p>