[haiku-development] Re: Bug #2499 Shortcuts based on default keymap

  • From: John Scipione <jscipione@xxxxxxxxx>
  • To: "haiku-development@xxxxxxxxxxxxx" <haiku-development@xxxxxxxxxxxxx>
  • Date: Wed, 23 Oct 2013 18:51:58 -0400

On Wed, Oct 23, 2013 at 3:57 AM, Siarzhuk Zharski <zharik@xxxxxx> wrote:
> John Scipione писал 23.10.2013 03:10:
>> We detect if you have a non-latin keymap, and if so, map these
>> shortcuts to letters that appear in the same positions on the default
>> US-International keymap rather than mapping them to the letters in the
>> current keymap.
>
> KeymapSwitcher does such remapping (filtering and substituting) for years
> and I have no complains about this workaround. So this idea is looking good
> for me too. ;)

I've checked out the SwitchFilter class in KeymapSwitcher and perhaps
instead of changing the shortcuts it would be better a better idea to
do input server substitution like is done there. I don't see that
KeymapSwitcher detects if you're on a Latin keyboard or not, but I
suppose that could be added. I guess you don't need to detect Latin or
not because you can choose to turn the base keymap filter on or off
per keymap, right?

>> There is an additional problem of the mapping changing when you switch
>> keymaps as well, that would need to be handled, actually, it's already
>> a problem.
>
> Even if you solve the problem on keymap's level - those Russians™ will
> continue using KeymapSwitcher. Just because proposition to switch keymaps
> with the Keymap Preflet makes them ROFL-ing. ;-) In my opinion the problem
> should be solved as part of the native keymap switching implementation.

I'm not sure what a theoretical native keymap switching implementation
entails that KeymapSwitcher can't already do. We just need a message
constants so that apps (and BWindow) can update themselves when the
keymap changes, whether the change happens from KeymapSwitcher or from
Keymap preflet, both should set off the same trigger.

> Let me explain once more as it is implemented in the KeymapSwitcher. The KS
> maintains the list of user-defined keymaps with the possibility to define
> some keymap as the "base" one to remap shortcuts characters into it. So if
> the keymap_switcher filter detects that modifier keys are pressed at the
> moment of the character filtering the character will be substituted with one
> from the "base" keymap and the system will receive Cmd-Q instead of Cmd-Й
> for example. The "base" keymap remapping can be naturally switched off or
> configured for any keymap in the list.

I follow you here, this sounds good.

> So my draft proposal is the following: app_server maintains the
> user-configurable list of keymap tables instead of the single keymap table
> as it does currently. Every BWindow or even BView instance in the system
> should "know" the keymap used to remap the characters that typed in. The
> shortcuts remapping and configuration is implemented as described in
> previous paragraph of this message. The [meta]shortcuts used to change the
> current keymap can be driven by already existing input server filter from
> Shortcuts Preflet.

It doesn't seem like app_server needs to be modified unless the base
keymap needs to be configured by the user. If we can assume
US-International is the base keymap that we do the remapping to the
current solution in KeymapSwitcher seems pretty good.

> By the way, there are no latin characters in Belarusian - the only latin
> looking character "і" is <U+0456> but not latin "i" <U+0069> ;-)

Excuse my ignorance, I saw a few characters that looked decidedly
Latin to my eye in the Keymap app, my mistake.

Other related posts: