[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PGTK-related misconceptions
From: |
Po Lu |
Subject: |
Re: PGTK-related misconceptions |
Date: |
Wed, 27 Jul 2022 10:48:06 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux) |
Akira Kyle <akira@akirakyle.com> writes:
> This does not appear to work. I can attach the full .xkb file that
> xkbcomp generated if you like, but it's the default which you get from
> the following under the v2.34 xkeyboad-config files.
>
> xkb_keymap "my_dvorak_super" {
> xkb_keycodes { include "evdev" };
> xkb_compatibility { include "complete" };
> xkb_types { include "complete" };
> xkb_symbols { include "us(dvorak)+pc(pc105)" };
> };
>
> Specifically, when I use the same .xkb file under X I get that emacs
> interprets the physical keycode <RWIN> as Super whereas under wayland
> with sway, emacs does not respond to <RWIN>. The relevant lines from
> the xkb_symbols section are
>
> key <RWIN> { [ Super_R ] };
> modifier_map Mod4 { <RWIN> };
>
> Reading through the links that Trey sent in previous emails to the gtk
> source which handles modifier keys in x11 versus wayland, I'm pretty
> convinced his diagnosis is correct.
> Namely gtk behaves differently in stetting GDK_SUPER_MASK on x11
> versus wayland where on the former seeing the "Super_R" symbol will
> set the mask while on the latter, only the virtual modifier "Super"
> will set GDK_SUPER_MASK.
That's because the Wayland compositor isn't sending a keymap that makes
libxkbcommon assign Mod4 to Super. See this bit of gdkkeys-wayland.c:
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Super")))
state |= GDK_SUPER_MASK;
which is called from deliver_key_event and keyboard_handle_modifiers in
gdkdevice-wayland.c:
seat->key_modifiers = gdk_keymap_get_modifier_state (keymap);
and uses an XKB keymap created in _gdk_wayland_keymap_update_from_fd.
It is not a bug in GTK, but a bug in the default configuration of the
Wayland compositor (regardless of what their developers say.)
> Although it seems like in principle, one should be able to get xkb to
> set the "Super" virtual modifier so that GTK correctly picks it up in
> it's wayland code. However thus far I have been unable to make a set
> of xkb rules which will trigger the "Super" virtual modifier for the
> <RWIN> keycode despite much effort. Perhaps this is possible and I
> just don't understand xkb's rules sufficiently, or perhaps there is
> some issue in xkb which is preventing from GTK to picking up the
> "Super" virtual modifier. Thus far I have tried many variations on
Could you please send the entire XKB file generated? Thanks.