@ -233,47 +233,60 @@ hopefully. I have not yet read the implementation in XWayland though…</p>
<h3>Understanding Wayland</h3>
<h3>Understanding Wayland</h3>
<p>This part is supposed to also be simple: the core Wayland protocol will send us
<p>This part is supposed to also be simple: the core Wayland protocol will send us
<aclass="reference external"href="TODO">wl_keyboard::keymap</a>, <aclass="reference external"href="TODO">wl_keyboard::key</a> and
<aclass="reference external"href="TODO">wl_keyboard::keymap</a>, <aclass="reference external"href="TODO">wl_keyboard::key</a> and
<aclass="reference external"href="TODO">wl_keyboard::modifiers</a> events containing the required data.</p>
<aclass="reference external"href="TODO">wl_keyboard::modifiers</a> events containing the required data. To prove
our hypotheses we can use <ttclass="docutils literal">wev</tt> which does very little post-processing as
with <ttclass="docutils literal">xev</tt>.</p>
<p>The client does not seem to have a say in what kind of keymap it will get, it
<p>The client does not seem to have a say in what kind of keymap it will get, it
is up to the compositor. This means that even XWayland cannot say it wants raw
is up to the compositor. This means that even XWayland cannot say it wants raw
data, but <ttclass="docutils literal">xkb_v1</tt>-style keycodes are probably close.</p>
data, but <ttclass="docutils literal">xkb_v1</tt>-style keycodes are probably close (they are off by 8,
<p>While exploring what happens I found a bug in <ttclass="docutils literal">wev</tt> (as of version 1.0.0-13
which is kind of expected).</p>
in Arch): for wl_keyboard::modifiers the group is reported as the serial
<p>While exploring what happens I found out there is a bug in the stable version
number:</p>
1.0.0 of <ttclass="docutils literal">wev</tt>, where it forgets to include the serial number for
<preclass="literal-block">
wl_keyboard::modifiers. It has already <aclass="reference external"href="https://git.sr.ht/~sircmpwn/wev/commit/83de8e931ab04ce3322a58b359d8effa7901b21c">been patched</a>
<p>But I am also interested in what is exchanged between the compositor and
<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
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:
<!-- TO-MENTION:
- nested compositor issues
- nested compositor issues
- the IM resolves compose? (I could bisect it, but too lazy)
- the IM resolves compose? (I could bisect it, but too lazy)
- copy my issue comment in case link rots.
- copy my issue comment in case link rots.
- list of all the packages I had downloaded and compiled -->
- list of all the packages I had downloaded and compiled -->