[Y-devel] keyboard layouts (continued)

Maurice van der Pot griffon26 at kfk4ever.com
Sun Feb 29 19:48:57 GMT 2004


On Sun, Feb 29, 2004 at 08:00:34PM +0200, Alexey Boyko wrote:
> 
> > What do you think is the best approach? Sending modifier events separately
> > or sending a modifier state along with normal keys that are pressed?
> 
> For character entering better sending modifier state with keys. But some 
> programs may want to react on modifiers key pressing.

I can imagine that for some modifiers it would be useful to send an event
to applications. If I press shift, the application may want to display 
something indicating that anything I type will be capitalised.
The problem is that if we allow any key to be a modifier and any modifier
to have any impact on the traversal of the character tree, then what sense
do modifiers still make to applications?

Maybe in addition to Actions, we should also define some standard modifier
functions. If a modifier with such a standard function is pressed, the application
is notified. If some other modifier is pressed, it wouldn't make sense to the
application anyway, so we don't generate an event.

This way the application still doesn't need to know anything about virtual key codes.

> > Let's call the physical location of the q key on a qwerty and the a on an
> > azerty VK_TOPLEFTLETTER. Let's also assume the location of the q on azerty
> > generates VK_LEFTCENTERLETTER.
> 
> if virtual keys will have names like VK_TOPLEFTLETTER, how applications will 
> parse strings like "Ctrl+C DoCopy"? where they find, that 'C' have virtual 
> key VK_SOMEWHEREINBOTTOM? ;)

If you press Ctrl+C on qwerty, a VK_BOTTOMTHIRDLETTERFROMLEFT ;) will be 
sent by layer 1 to the character tree (layer 2) along with the modifier state. 
The modifier state will have no effect on the handling of the 
VK_BOTTOMTHIRDLETTERFROMLEFT in the character tree for qwerty and it will
be sent up to layer 3 along with the modifier state. Layer 3 will see that
a ctrl+c corresponds to the action called Copy and will send a Copy action
to the application.

Now some other scenarios: 

1) Keyboard with 'c' on top right key, user wants ctrl+'c' to be Copy, user presses ctrl + top right key

  - Layer 1 sends VK_TOPRIGHT (with modifier state)
  - Layer 2 walks the tree and finds 'c' character, and sends it up together with modifier state
  - Layer 3 looks up the ctrl+'c' combo, finds associated Copy action and sends it to the application

2) Keyboard with 'c' on top right key, user wants ctrl+'c' to be Copy, user presses ctrl + bottom third letter key

  - Layer 1 sends VK_BOTTOMTHIRDLETTERFROMLEFT (with modifier state)
  - Layer 2 walks the tree and finds some character, let's call it 'bla', and sends it up with modifier state
  - Layer 3 looks up the ctrl+'bla' combo and sees that it is not associated with the Copy action

3) Keyboard with 'c' on top right key, user wants ctrl+'bottom third letter key' to be Copy, user presses ctrl + top right key

  - Layer 1 sends VK_TOPRIGHT (with modifier state)
  - Layer 2 walks the tree and finds 'c' character, and sends it up together with modifier state
  - Layer 3 looks up the ctrl+'c' combo and sees that it is not associated with the Copy action

4) Keyboard with 'c' on top right key, user wants ctrl+'bottom third letter key' to be Copy, user presses ctrl + bottom third letter key

  - Layer 1 sends VK_BOTTOMTHIRDLETTERFROMLEFT (with modifier state)
  - Layer 2 walks the tree and finds some character, let's call it 'bla', and sends it up with modifier state
  - Layer 3 looks up the ctrl+'bla' combo and sees that it is associated with the Copy action, sends the action to the application

> May be I badly explains, but I have two convertion maps. First in keyboard 
> driver (keymap), second in character module (charmap).
> 
> key layout (qwerty/azerty) is described as keymap in keyboard driver, so 
> topleft key on qwerty keyboard will be converted to VK_q (with code 113), and 
> on azerty it will be VK_a (code 97).

This is where our opinion differs. In my opinion the only conversion that is
done in the keyboard driver should be done to get to values that correspond
to key positions. 

If you want to do the translation in the keyboard driver in such a way that 
the q of qwerty and q of azerty generate the same key code, then answer me
this:

If you have a US keyboard with qwerty keycaps and you want to type with dvorak, 
then the conversion has to be done at the level of what you call the charmap.
But if you have a US keyboard with dvorak keycaps, no conversion is done anywhere.

If you ask me, that is about as logical as taking your US keyboard with qwerty
keycaps, rearrange the keycaps to a dvorak layout and just expecting to be able 
to type with the new layout.

> Naturally, I looks on that from my own belltower. May be this two maps must be 
> in one file, because they probably changed synchronously. May be we must have 
> another data flow model.

And that is exactly the problem with your approach. You need multiple dvorak
charmaps for keyboards with different key caps. Unless you want users to take 
their azerty, tell their computer it's a qwerty and then use a dvorak layout
for qwerty keyboards.

> > 2) You express shortcuts in the characters that are output, which is keymap
> >    dependent, so you would have a set of shortcuts for each keymap you use.
> >    Result: You can switch between Cyrillic and QWERTY as long as you have
> >            two shortcuts (ctrl + arch with slash = quit) and (ctrl + q =
> > quit).
> 
> What is "arch with slash"? ;) On 'q' key I have cyrillic_short_i letter: '??';

I looked at this page: https://www.york.ac.uk/inst/ltc/lfa/russkeybd.htm
and it looked like a small arch with a forward slash through it ;)

> > Didn't someone mention 1 keymap per focus? I think there should be 1 keymap
> > and 1 input tree state per focusable object.
> 
> Agreed. Under widget I means focusable object.

Better hope that buttons and other widgets within one window aren't separately
focusable with that definition.

> I used two cyrillic letters in this mail. Mail is in utf-8 encoding.
Now if only my client could handle it =]

Regards,
Maurice.




More information about the Y-devel mailing list









2026 © www.Y-Windows.Org - All Rights Reserved