On Thu, Nov 1, 2018 at 10:15 PM Diogo Galvao <diog...@gmail.com> wrote:
>
> When the "br" keyboard layout is chosen during install, keys like  รง~"
> work correctly on the console but X tries to load the "fr" variant along
> with it, which is invalid for this layout, so it falls back to the
> default keymap. This can be observed in the first Xorg.0.log below.
>
> The variant seems to be configured in xenocara/xserver/config/wscons.c:
>
> for (i = 0; kbdvar[i].val; i++)
>     if ((wsenc & kbdvar[i].val) == kbdvar[i].val) {
>         LogMessageVerb(X_INFO, 3, "wskbd: using variant %s\n",
>                        kbdvar[i].name);
>         input_options = input_option_new(input_options,
>                                          "xkb_variant", kbdvar[i].name);
>         break;
>     }
>
>
> That kbdvar array starts like this:
>
> struct nameint kbdvar[] = {
>     {KB_NODEAD | KB_SG, "de_nodeadkeys"},
>     {KB_NODEAD | KB_SF, "fr_nodeadkeys"},
>     {KB_SF, "fr"},
>
>
> And in sys/dev/wscons/wsksymdef.h there is:
>
> #define KB_SF 0x1000
> ...
> #define KB_BR 0x1500
>
>
> So the condition ((wsenc & kbdvar[i].val) == kbdvar[i].val) ends up
> being true for KB_BR & KB_SF, therefore "fr" variant gets configured.
> That bitmasking was introduced in revision 1.15 along with a bitmask for
> choosing keyboard options:
>
> https://cvsweb.openbsd.org/cgi-bin/cvsweb/xenocara/xserver/config/wscons.c#rev1.15
>
> I used this small patch to get back part of the old behavior:


I've just tested it on a recent snapshot and it still applies clearly:


Index: xserver/config/wscons.c
===================================================================
RCS file: /cvs/xenocara/xserver/config/wscons.c,v
retrieving revision 1.22
diff -u -p -u -r1.22 wscons.c
--- xserver/config/wscons.c 30 Jul 2018 16:00:39 -0000 1.22
+++ xserver/config/wscons.c 1 Nov 2018 23:06:14 -0000
@@ -139,7 +139,7 @@ wscons_add_keyboard(void)
             break;
         }
     for (i = 0; kbdvar[i].val; i++)
-        if ((wsenc & kbdvar[i].val) == kbdvar[i].val) {
+        if (wsenc == kbdvar[i].val || KB_VARIANT(wsenc) == kbdvar[i].val) {
             LogMessageVerb(X_INFO, 3, "wskbd: using variant %s\n",
                            kbdvar[i].name);
             input_options = input_option_new(input_options,


Could somebody please take a look?

This reverts part of the 1.15 revision and now the "fr" variant is no
longer chosen by mistake for the "br" layout. However I'm not sure if it
brings back any problem or introduce new ones on different setups.

If there's a better approach I could try to submit another patch.

Here's a link to the original message with logs included; I'm omitting
them now for brevity:
https://marc.info/?l=openbsd-bugs&m=154115135800355&w=2

Thank you,
Diogo

Reply via email to