ok let me try to explain this very simply.
some time ago i have added armenian and dvorak layouts.
i have noticed that in dvorak and all other layouts uppercase characters work.
while you don't have to do any extra effort for that. let's say:

```
        { 0, 0, XK_a, 1 },
        { 0, 0, XK_o, 1 },
        { 0, 0, XK_e, 1 },
        { 0, 0, XK_u, 1 },
        { 0, 0, XK_i, 1 },
        { 0, 0, XK_d, 1 },
```

notice that layout describes only the lowercase variant, and the uppercase 
works automagically.

same with cyrillic:

```
        { "й", 0, XK_Cyrillic_shorti, 1 },
        { "ц", 0, XK_Cyrillic_tse, 1 },
        { "у", 0, XK_Cyrillic_u, 1 },
        { "к", 0, XK_Cyrillic_ka, 1 },
        { "е", 0, XK_Cyrillic_ie, 1 },
```

one doesn't even have to specify the uppercase variant.
my guess is that the conversion is done by Xorg automatically for some layouts. 
i don't know why and how.

however this approach didn't work with armenian layout (i guess it won't work 
with many other layouts), so i had to specify both uppercase and lowercase 
variants:

```
        { "ճ", "Ճ", XK_Armenian_tche, 1 },
        { "փ", "Փ", XK_Armenian_pyur, 1 },
        { "բ", "Բ", XK_Armenian_ben, 1 },
        { "ս", "Ս", XK_Armenian_se, 1 },
        { "մ", "Մ", XK_Armenian_men, 1 },
        { "ո", "Ո", XK_Armenian_vo, 1 },
        { "ւ", "Ւ", XK_Armenian_vyun, 1 },
```

though i have had specified the uppercase letters, they were painted on the 
keyboard, but didn't work.

now with this patch (see the commit message for more details) uppercase letters 
work.
my guess is this will fix the behaviour not only for armenian, but for many 
other layouts for which Xorg doesn't have a method to get the uppercase symbol 
automatically for some reason.
my guess is that cyrillic and latin are for some reason handled differently by 
xorg than the majority of other character sets.

and one more detail, though this commit fixes almost every letter in armenian 
layout, one thing still don't work. namely,  this line:
        { "՝","՜", XK_Armenian_exclam, 1 },

for some reason only the second character described in this line ("՜") gets 
printed whether the shift is pressed or not. i will try to understand why this 
doesn't work some other day.

but the commit fixes everything.  i have this fix for a year already and i need 
to recompile svkbd every time after update, and restart the device, so if this 
is applied, it will simplify my life a lot.

so to stress it again: this is not only relevant to armenian layout.




On Sun, 3 Dec 2023 21:48:09 +0100
Hiltjo Posthuma <hil...@codemadness.org> wrote:

> On Sun, Dec 03, 2023 at 08:22:04PM +0400, norayr chilingarian wrote:
> > ---
> >  svkbd.c | 11 ++++++++++-
> >  1 file changed, 10 insertions(+), 1 deletion(-)
> > 
> > diff --git a/svkbd.c b/svkbd.c
> > index e4dbd15..cce2463 100644
> > --- a/svkbd.c
> > +++ b/svkbd.c
> > @@ -481,9 +481,18 @@ press(Key *k, KeySym buttonmod)
> >  int
> >  tmp_remap(KeySym keysym)
> >  {
> > -   XChangeKeyboardMapping(dpy, tmp_keycode, 1, &keysym, 1);
> > +   /* map lower and upper case of keysym to the temporary keycode */
> > +   KeySym syms[2];
> > +   XConvertCase(keysym, &syms[0], &syms[1]);
> > +
> > +   /* if keysym is capital letter then swap upper and lower case */
> > +   if (keysym == syms[1])
> > +           syms[1] = syms[0], syms[0] = keysym;
> > +
> > +   XChangeKeyboardMapping(dpy, tmp_keycode, syms[0] == syms[1] ? 1 : 2, 
> > syms, 1);
> >     XSync(dpy, False);
> >  
> > +   printdbg("Temorary map keysym %ld (%ld, %ld) to keycode %d\n", keysym, 
> > syms[0], syms[1], tmp_keycode);
> >     return tmp_keycode;
> >  }
> >  
> > -- 
> > 2.41.0
> > 
> > 
> 
> Thanks for the patch,
> 
> I'm not a svkbd user right now and also not Armenian.
> 
> Can anyone test this and report if it makes sense?
> 
> Thanks,
> 
> -- 
> Kind regards,
> Hiltjo
> 


-- 
There are two ways of constructing a software design.  One way is to make it so 
simple that there are obviously no deficiencies. And the other way is to make 
it so complicated that there are no obvious deficiencies.

-- C.A.R. Hoare

Attachment: pgp_iE9TIQXP0.pgp
Description: PGP signature

Reply via email to