Jayidaks / softkeyboard

Automatically exported from code.google.com/p/softkeyboard
1 stars 1 forks source link

Sequence translation for physical keyboard with shift+alt+key not implemented #1119

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I was making Russian/Spanish language pack for HTC ChaCha phone (with hardware 
qwerty keyboard that already has both Russian and Spanish letters). The Russian 
layout was not an issue, but Spanish became one.

Two of the letters (ñ and ç) are drawn to be used with "Fn" ("Alt") key. For 
the lower case translation I had used this:
<!-- Fn + keycode_n - ñ -->
<SequenceMapping keySequence="42" altModifier="true" targetChar="ñ"/>
<!-- Fn + keycode_m - ç -->
<SequenceMapping keySequence="41" altModifier="true" targetChar="ç"/>

But for the upper case when both Alt+Shift should be pressed translations won't 
work:
<SequenceMapping keySequence="42" altModifier="true" shiftModifier="true" 
targetChar="Ñ"/>
<SequenceMapping keySequence="41" altModifier="true" shiftModifier="true" 
targetChar="Ç"/>

I have looked up the source code (in keyboards/ExtarnelAnyKeyboard.java) and 
noticed that there are no option for Alt+Shift in the code (when both Alt and 
Shift pressed the sequence is being translated as if only Alt is pressed):

 if (!isAlt && !isShift) {
                                // if
                                // (AnySoftKeyboardConfiguration.getInstance().getDEBUG())
                                // Log.d(TAG,
                                // "Physical translation details: keys:"+printInts(keyCodes)+" target:"+target);
                                translator.addSequence(keyCodes,
                                        target.intValue());
                                // http://code.google.com/p/softkeyboard/issues/detail?id=734
                                translator.addShiftSequence(keyCodes, Character
                                        .toUpperCase(target.intValue()));
                            } else if (isAlt) {
                                // if
                                // (AnySoftKeyboardConfiguration.getInstance().getDEBUG())
                                // Log.d(TAG,
                                // "Physical translation details: ALT+key:"+keyCode+" target:"+target);
                                translator.addAltSequence(keyCodes,
                                        target.intValue());
                            } else if (isShift) {
                                // if
                                // (AnySoftKeyboardConfiguration.getInstance().getDEBUG())
                                // Log.d(TAG,
                                // "Physical translation details: ALT+key:"+keyCode+" target:"+target);
                                translator.addShiftSequence(keyCodes,
                                        target.intValue());
                            }

It looks like probably nobody needed these kind of translations for hardware 
keyboards yet, but I would be grateful if it was fixed in the future.

Original issue reported on code.google.com by stsvet...@gmail.com on 10 Aug 2013 at 9:35