data, but <ttclass="docutils literal">xkb_v1</tt>-style keycodes are probably close (they are off by 8,
which is kind of expected).</p>
<p>While exploring what happens I found out there is a bug in the stable version
1.0.0 of <ttclass="docutils literal">wev</tt>, where it forgets to include the serial number for
wl_keyboard::modifiers. It has already <aclass="reference external"href="https://git.sr.ht/~sircmpwn/wev/commit/83de8e931ab04ce3322a58b359d8effa7901b21c">been patched</a>
15 months ago, but the patch is not included in a release yet.</p>
<p>But I am also interested in what is exchanged between the compositor and
XWayland server. And there does not seem to be any kind of sniffer yet, so <aclass="reference external"href="https://gitea.ledoian.cz/LEdoian/sopass/">I
started writing one</a></p>
started writing one</a>
<aclass="footnote-reference"href="#wiresharkify"id="footnote-reference-1">[1]</a>. Only then I learned that I can set the environment variable
<ttclass="docutils literal">WAYLAND_DEBUG=1</tt> to get dumps of all the calls that are happening. (To my
defense, this does not seem to be very documented. I only found a small note in
the <aclass="reference external"href="TODO">building guide</a>. Even the <aclass="reference external"href="TODO">debugging extras page</a> does
not mention this.)</p>
<!-- should fix the wl docs instead of ranting, though… -->
<p>By running <ttclass="docutils literal">WAYLAND_DEBUG=1 Xwayland :15</tt> and <ttclass="docutils literal"><spanclass="pre">DISPLAY=:15</span> xev</tt>, we do
learn what we thought was happening:</p>
<ulclass="simple">
<li>XWayland gets XKB v1 keymap (I trust sway to supply the same map as to
<li>XWayland gets the correct (Wayland core) events from the compositor</li>
<li>XWayland sends a wrong (X11 with XKB) events to <ttclass="docutils literal">xev</tt>.</li>
</ul>
<p>This confirms that XWayland is really the culprit here.</p>
</div>
</div>
<divclass="section"id="digging-into-xwayland">
<h2>Digging into XWayland</h2>
<p>At this point, we have all the tools, references to documentation and knowledge
we could possibly have, so now we get our hands dirty. A simple <ttclass="docutils literal">grep <spanclass="pre">-r</span>
wl_keyboard src/</tt> tells us that the keyboard handling occurs in the file
<ttclass="docutils literal"><spanclass="pre">hw/xwayland/xwayland-input.c</span></tt> in functions <ttclass="docutils literal">keyboard_handle_*</tt>, which look
like the libwayland-client handlers we have seen in <ttclass="docutils literal">wev</tt>.</p>
<!-- TO-MENTION:
- nested compositor issues
- the IM resolves compose? (I could bisect it, but too lazy)
- copy my issue comment in case link rots.
- list of all the packages I had downloaded and compiled -->