Implement multi-shift for illume-keyboard and change Default.kbd to use it.

Works well on my end and nobody complained about the patch in almost a week so if it's a problem, feel free to revert, but please explain me how to improve it.


SVN revision: 57810
This commit is contained in:
Rui Seabra 2011-03-16 22:43:55 +00:00
parent 5b6527fbc6
commit d5f998a4a4
3 changed files with 54 additions and 3 deletions

View File

@ -174,6 +174,7 @@ _e_kbd_int_layout_state_update(E_Kbd_Int *ki)
if ((ki->layout.state & CTRL) && (ky->is_ctrl)) selected = 1; if ((ki->layout.state & CTRL) && (ky->is_ctrl)) selected = 1;
if ((ki->layout.state & ALT) && (ky->is_alt)) selected = 1; if ((ki->layout.state & ALT) && (ky->is_alt)) selected = 1;
if ((ki->layout.state & CAPSLOCK) && (ky->is_capslock)) selected = 1; if ((ki->layout.state & CAPSLOCK) && (ky->is_capslock)) selected = 1;
if ((ki->layout.state & (SHIFT | CAPSLOCK)) && (ky->is_multi_shift)) selected = 1;
if (selected) if (selected)
{ {
if (!ky->selected) if (!ky->selected)
@ -351,6 +352,24 @@ _e_kbd_int_key_press_handle(E_Kbd_Int *ki, E_Kbd_Int_Key *ky)
_e_kbd_int_layout_state_update(ki); _e_kbd_int_layout_state_update(ki);
return; return;
} }
if (ky->is_multi_shift)
{
if (ki->layout.state & SHIFT)
{
ki->layout.state &= (~(SHIFT));
ki->layout.state |= CAPSLOCK;
}
else if (ki->layout.state & CAPSLOCK)
{
ki->layout.state &= (~(CAPSLOCK));
}
else
{
ki->layout.state |= SHIFT;
}
_e_kbd_int_layout_state_update(ki);
return;
}
if (ky->is_ctrl) if (ky->is_ctrl)
{ {
if (ki->layout.state & CTRL) ki->layout.state &= (~(CTRL)); if (ki->layout.state & CTRL) ki->layout.state &= (~(CTRL));
@ -426,7 +445,7 @@ _e_kbd_int_key_press_handle(E_Kbd_Int *ki, E_Kbd_Int_Key *ky)
} }
if (ki->layout.state & (SHIFT | CTRL | ALT)) if (ki->layout.state & (SHIFT | CTRL | ALT))
{ {
ki->layout.state &= (~(SHIFT | CTRL | ALT)); if( !(ky->is_multi_shift) ) ki->layout.state &= (~(SHIFT | CTRL | ALT));
_e_kbd_int_layout_state_update(ki); _e_kbd_int_layout_state_update(ki);
} }
} }
@ -574,6 +593,7 @@ _e_kbd_int_zoomkey_up(E_Kbd_Int *ki)
if ((ki->layout.state & CTRL) && (ky->is_ctrl)) selected = 1; if ((ki->layout.state & CTRL) && (ky->is_ctrl)) selected = 1;
if ((ki->layout.state & ALT) && (ky->is_alt)) selected = 1; if ((ki->layout.state & ALT) && (ky->is_alt)) selected = 1;
if ((ki->layout.state & CAPSLOCK) && (ky->is_capslock)) selected = 1; if ((ki->layout.state & CAPSLOCK) && (ky->is_capslock)) selected = 1;
if ((ki->layout.state & (SHIFT|CAPSLOCK)) && (ky->is_multi_shift)) selected = 1;
if (selected) if (selected)
edje_object_signal_emit(o, "e,state,selected", "e"); edje_object_signal_emit(o, "e,state,selected", "e");
if (!selected) if (!selected)
@ -997,6 +1017,7 @@ _e_kbd_int_layout_parse(E_Kbd_Int *ki, const char *layout)
st->out = eina_stringshare_add(str); st->out = eina_stringshare_add(str);
} }
if (!strcmp(str, "is_shift")) ky->is_shift = 1; if (!strcmp(str, "is_shift")) ky->is_shift = 1;
if (!strcmp(str, "is_multi_shift")) ky->is_multi_shift = 1;
if (!strcmp(str, "is_ctrl")) ky->is_ctrl = 1; if (!strcmp(str, "is_ctrl")) ky->is_ctrl = 1;
if (!strcmp(str, "is_alt")) ky->is_alt = 1; if (!strcmp(str, "is_alt")) ky->is_alt = 1;
if (!strcmp(str, "is_capslock")) ky->is_capslock = 1; if (!strcmp(str, "is_capslock")) ky->is_capslock = 1;

View File

@ -96,6 +96,7 @@ struct _E_Kbd_Int_Key
unsigned char selected : 1; unsigned char selected : 1;
unsigned char is_shift : 1; unsigned char is_shift : 1;
unsigned char is_multi_shift : 1;
unsigned char is_ctrl : 1; unsigned char is_ctrl : 1;
unsigned char is_alt : 1; unsigned char is_alt : 1;
unsigned char is_capslock : 1; unsigned char is_capslock : 1;

View File

@ -14,86 +14,115 @@ icon alpha.png
key 5 5 10 10 key 5 5 10 10
normal q "q" normal q "q"
shift Q "Q" shift Q "Q"
capslock Q "Q"
key 15 5 10 10 key 15 5 10 10
normal w "w" normal w "w"
shift W "W" shift W "W"
capslock W "W"
key 25 5 10 10 key 25 5 10 10
normal e "e" normal e "e"
shift E "E" shift E "E"
capslock E "E"
key 35 5 10 10 key 35 5 10 10
normal r "r" normal r "r"
shift R "R" shift R "R"
capslock R "R"
key 45 5 10 10 key 45 5 10 10
normal t "t" normal t "t"
shift T "T" shift T "T"
capslock T "T"
key 55 5 10 10 key 55 5 10 10
normal y "y" normal y "y"
shift Y "Y" shift Y "Y"
capslock Y "Y"
key 65 5 10 10 key 65 5 10 10
normal u "u" normal u "u"
shift U "U" shift U "U"
capslock U "U"
key 75 5 10 10 key 75 5 10 10
normal i "i" normal i "i"
shift I "I" shift I "I"
capslock I "I"
key 85 5 10 10 key 85 5 10 10
normal o "o" normal o "o"
shift O "O" shift O "O"
capslock O "O"
key 95 5 10 10 key 95 5 10 10
normal p "p" normal p "p"
shift P "P" shift P "P"
capslock P "P"
key 10 15 10 10 key 10 15 10 10
normal a "a" normal a "a"
shift A "A" shift A "A"
capslock A "A"
key 20 15 10 10 key 20 15 10 10
normal s "s" normal s "s"
shift S "S" shift S "S"
capslock S "S"
key 30 15 10 10 key 30 15 10 10
normal d "d" normal d "d"
shift D "D" shift D "D"
capslock D "D"
key 40 15 10 10 key 40 15 10 10
normal f "f" normal f "f"
shift F "F" shift F "F"
capslock F "F"
key 50 15 10 10 key 50 15 10 10
normal g "g" normal g "g"
shift G "G" shift G "G"
capslock G "G"
key 60 15 10 10 key 60 15 10 10
normal h "h" normal h "h"
shift H "H" shift H "H"
capslock H "H"
key 70 15 10 10 key 70 15 10 10
normal j "j" normal j "j"
shift J "J" shift J "J"
capslock J "J"
key 80 15 10 10 key 80 15 10 10
normal k "k" normal k "k"
shift K "K" shift K "K"
capslock K "K"
key 90 15 10 10 key 90 15 10 10
normal l "l" normal l "l"
shift L "L" shift L "L"
capslock L "L"
key 15 25 10 10 key 15 25 10 10
normal z "z" normal z "z"
shift Z "Z" shift Z "Z"
capslock Z "Z"
key 25 25 10 10 key 25 25 10 10
normal x "x" normal x "x"
shift X "X" shift X "X"
capslock X "X"
key 35 25 10 10 key 35 25 10 10
normal c "c" normal c "c"
shift C "C" shift C "C"
capslock C "C"
key 45 25 10 10 key 45 25 10 10
normal v "v" normal v "v"
shift V "V" shift V "V"
capslock V "V"
key 55 25 10 10 key 55 25 10 10
normal b "b" normal b "b"
shift B "B" shift B "B"
capslock B "B"
key 65 25 10 10 key 65 25 10 10
normal n "n" normal n "n"
shift N "N" shift N "N"
capslock N "N"
key 75 25 10 10 key 75 25 10 10
normal m "m" normal m "m"
shift M "M" shift M "M"
capslock M "M"
key 105 25 10 10 key 105 25 10 10
normal shift.png # normal shift.png
is_shift normal ↑
shift ⇈
capslock ⇊
is_multi_shift
key 115 5 10 10 key 115 5 10 10
normal . period normal . period