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

  • From: Siarzhuk Zharski <zharik@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Thu, 24 Oct 2013 09:42:05 +0200

John Scipione писал 24.10.2013 00:51:
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?

Yes, IMO only user can define which keymap should be used to remap shortcuts. So this way will works regardless of AZERTY, QWERTZ, QWERTY or any other "heretic" Dvorak-like layouts. ;-)

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.

Well, look how KeymapSwitcher drives keymaps:

1) The keymap_switcher input server filter detects Ctrl-Shift press-release combinations;
2) Than the filter looks for the replicant that lives in the Deskbar;
3) After the replicant view is found the message is sent to it;
4) The replicant overwrites the ~/config/settingas/Key_map to the next keymap; 5) The replicant jerks the app_server's "reload_keymap" function to refresh it's keymap remap table by reading it from the keymap file;

Do you know more long and ugly ways to do this work? :-D KS has no future.

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.

app_server maintains currently the keymap remapping and it is natural to do the tables manipulations in it, IMO. Do not forget that every Window/View having text input possibility should be keymap-sensitive.

--
Kind Regards,
   S.Zharski

Other related posts: