emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PGTK-related misconceptions


From: Akira Kyle
Subject: Re: PGTK-related misconceptions
Date: Tue, 26 Jul 2022 15:36:15 -0600
User-agent: mu4e 1.6.11; emacs 29.0.50


On Tue, Jul 26, 2022 at 10:08 AM, Po Lu <luangruo@yahoo.com> wrote:

It is to prevent errors when Mod4 is _not_ the super key. Very common on X (where Mod4 is commonly Hyper), and in fact it is caused by Mod4 not being part of the Super virtual modifier in the compositor's XKB
configuration.

The conclusion I eventually came to is that the problem lies in the XKB configuration of the Wayland compositor in question (namely, Sway), and not Emacs nor GDK. It works with GNOME Shell and kwin because they set up their keyboards with the correct virtual modifiers by default. So what I'd recommend is to start an X server where the Super key does
work, run:

  xkbcomp $DISPLAY name/of/xkb/file.xkb

and then use that file with Sway.

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.

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 some configuration like the following

default partial modifier_keys xkb_symbols "basic" {
   include "us(dvorak)"
   name[Group1] = "super";
   key <RWIN>  {
       symbols[Group1]= [ Super_R ],
       virtualMods= Super
       };
   key <LWIN>  {
       symbols[Group1]= [ Super_L ],
       virtualMods= Super
       };
};

What is also puzzling to me is that my .xkb file also includes the "misc" xkb_compatibility rules which look like the following

   interpret Super_R+Any {
        virtualModifier= Super;
        action = SetMods(modifiers=modMapMods);
   };

   interpret Super_R {
        action = SetMods(modifiers=Super);
   };



reply via email to

[Prev in Thread] Current Thread [Next in Thread]