[E-devel] Adding support for a ternary state shift in illume keyboard
Hi, I'm completely unsure of this patch and haven't had the change of testing it. The desired behavior is to have a shit key that will alternate between shift, capslock and then normal state. This would allow a caps lock in the Default.kbd without adding another virtual key. I'm thinking of adding other special kinds of keys which will do things like "change layout to keyboard type fubar" (rather than just sliding up on the keyboard). Specially to dh, am I going in the right direction with this patch? Rui Index: e_kbd_int.c === --- e_kbd_int.c (revision 57681) +++ e_kbd_int.c (working copy) @@ -174,6 +174,8 @@ if ((ki->layout.state & CTRL) && (ky->is_ctrl)) 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 & SHIFT) && (ky->tern_shift)) selected = 1; + if ((ki->layout.state & CAPSLOCK) && (ky->tern_capslock)) selected = 1; if (selected) { if (!ky->selected) @@ -351,6 +353,20 @@ _e_kbd_int_layout_state_update(ki); return; } + if (ky->tern_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 (ki->layout.state & CTRL) ki->layout.state &= (~(CTRL)); @@ -574,6 +590,8 @@ if ((ki->layout.state & CTRL) && (ky->is_ctrl)) 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 & SHIFT) && (ky->tern_shift)) selected = 1; + if ((ki->layout.state & CAPSLOCK) && (ky->tern_capslock)) selected = 1; if (selected) edje_object_signal_emit(o, "e,state,selected", "e"); if (!selected) @@ -997,6 +1015,7 @@ st->out = eina_stringshare_add(str); } if (!strcmp(str, "is_shift")) ky->is_shift = 1; + if (!strcmp(str, "tern_shift")) ky->tern_shift = 1; if (!strcmp(str, "is_ctrl")) ky->is_ctrl = 1; if (!strcmp(str, "is_alt")) ky->is_alt = 1; if (!strcmp(str, "is_capslock")) ky->is_capslock = 1; Index: e_kbd_int.h === --- e_kbd_int.h (revision 57681) +++ e_kbd_int.h (working copy) @@ -96,6 +96,7 @@ unsigned char selected : 1; unsigned char is_shift : 1; + unsigned char tern_shift : 1; unsigned char is_ctrl : 1; unsigned char is_alt : 1; unsigned char is_capslock : 1; -- Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d___ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
Re: [E-devel] Adding support for a ternary state shift in illume keyboard
Em 10-03-2011 23:49, Rui Miguel Silva Seabra escreveu: > Hi, > > I'm completely unsure of this patch and haven't had the change of > testing it. > > The desired behavior is to have a shit key that will alternate between > shift, capslock and then normal state. > > This would allow a caps lock in the Default.kbd without adding another > virtual key. > > I'm thinking of adding other special kinds of keys which will do things > like "change layout to keyboard type fubar" (rather than just sliding up > on the keyboard). > > Specially to dh, am I going in the right direction with this patch? Please, nobody bug me about that stupid logic operation bug in the state change from SHIFT to CAPSLOCK, I already spotted it :) Rui -- Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d ___ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
Re: [E-devel] Adding support for a ternary state shift in illume keyboard
On 03/10/2011 06:49 PM, Rui Miguel Silva Seabra wrote: > Hi, > > I'm completely unsure of this patch and haven't had the change of > testing it. > > The desired behavior is to have a shit key that will alternate between > shift, capslock and then normal state. > > This would allow a caps lock in the Default.kbd without adding another > virtual key. > > I'm thinking of adding other special kinds of keys which will do things > like "change layout to keyboard type fubar" (rather than just sliding up > on the keyboard). > > Specially to dh, am I going in the right direction with this patch? > > Rui > 1) Thanks for the patch :) 2) I'm currently away from home with very limited 'net access (if any @ all sometimes) and don't have my comp with me, so I can't apply this and test it (yet). I should be back 'online' (hopefully) Saturday night/Sunday (monday @ the latest). I'll have a look @ this patch then. Thanks, dh > > tern_shift.patch > > > Index: e_kbd_int.c > === > --- e_kbd_int.c (revision 57681) > +++ e_kbd_int.c (working copy) > @@ -174,6 +174,8 @@ > if ((ki->layout.state& CTRL)&& (ky->is_ctrl)) 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& SHIFT)&& (ky->tern_shift)) selected = 1; > + if ((ki->layout.state& CAPSLOCK)&& (ky->tern_capslock)) selected = 1; > if (selected) > { >if (!ky->selected) > @@ -351,6 +353,20 @@ > _e_kbd_int_layout_state_update(ki); > return; >} > + if (ky->tern_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 (ki->layout.state& CTRL) ki->layout.state&= (~(CTRL)); > @@ -574,6 +590,8 @@ > if ((ki->layout.state& CTRL)&& (ky->is_ctrl)) 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& SHIFT)&& (ky->tern_shift)) selected = 1; > + if ((ki->layout.state& CAPSLOCK)&& (ky->tern_capslock)) selected = 1; > if (selected) > edje_object_signal_emit(o, "e,state,selected", "e"); > if (!selected) > @@ -997,6 +1015,7 @@ >st->out = eina_stringshare_add(str); > } > if (!strcmp(str, "is_shift")) ky->is_shift = 1; > + if (!strcmp(str, "tern_shift")) ky->tern_shift = 1; > if (!strcmp(str, "is_ctrl")) ky->is_ctrl = 1; > if (!strcmp(str, "is_alt")) ky->is_alt = 1; > if (!strcmp(str, "is_capslock")) ky->is_capslock = 1; > Index: e_kbd_int.h > === > --- e_kbd_int.h (revision 57681) > +++ e_kbd_int.h (working copy) > @@ -96,6 +96,7 @@ > unsigned char selected : 1; > > unsigned char is_shift : 1; > + unsigned char tern_shift : 1; > unsigned char is_ctrl : 1; > unsigned char is_alt : 1; > unsigned char is_capslock : 1; > > > -- Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d ___ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
Re: [E-devel] Adding support for a ternary state shift in illume keyboard
Em 11-03-2011 04:02, Christopher Michael escreveu: On 03/10/2011 06:49 PM, Rui Miguel Silva Seabra wrote: Hi, I'm completely unsure of this patch and haven't had the change of testing it. The desired behavior is to have a shit key that will alternate between shift, capslock and then normal state. This would allow a caps lock in the Default.kbd without adding another virtual key. I'm thinking of adding other special kinds of keys which will do things like "change layout to keyboard type fubar" (rather than just sliding up on the keyboard). Specially to dh, am I going in the right direction with this patch? Rui 1) Thanks for the patch :) 2) I'm currently away from home with very limited 'net access (if any @ all sometimes) and don't have my comp with me, so I can't apply this and test it (yet). I should be back 'online' (hopefully) Saturday night/Sunday (monday @ the latest). I'll have a look @ this patch then. Thanks, Please look at this patch instead, as it has a bit operation bug (in my changes) fixed. Rui Index: e_kbd_int.c === --- e_kbd_int.c (revision 57681) +++ e_kbd_int.c (working copy) @@ -174,6 +174,8 @@ if ((ki->layout.state & CTRL) && (ky->is_ctrl)) 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 & SHIFT) && (ky->tern_shift)) selected = 1; + if ((ki->layout.state & CAPSLOCK) && (ky->tern_capslock)) selected = 1; if (selected) { if (!ky->selected) @@ -351,6 +353,20 @@ _e_kbd_int_layout_state_update(ki); return; } + if (ky->tern_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 (ki->layout.state & CTRL) ki->layout.state &= (~(CTRL)); @@ -574,6 +590,8 @@ if ((ki->layout.state & CTRL) && (ky->is_ctrl)) 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 & SHIFT) && (ky->tern_shift)) selected = 1; + if ((ki->layout.state & CAPSLOCK) && (ky->tern_capslock)) selected = 1; if (selected) edje_object_signal_emit(o, "e,state,selected", "e"); if (!selected) @@ -997,6 +1015,7 @@ st->out = eina_stringshare_add(str); } if (!strcmp(str, "is_shift")) ky->is_shift = 1; + if (!strcmp(str, "tern_shift")) ky->tern_shift = 1; if (!strcmp(str, "is_ctrl")) ky->is_ctrl = 1; if (!strcmp(str, "is_alt")) ky->is_alt = 1; if (!strcmp(str, "is_capslock")) ky->is_capslock = 1; Index: e_kbd_int.h === --- e_kbd_int.h (revision 57681) +++ e_kbd_int.h (working copy) @@ -96,6 +96,7 @@ unsigned char selected : 1; unsigned char is_shift : 1; + unsigned char tern_shift : 1; unsigned char is_ctrl : 1; unsigned char is_alt : 1; unsigned char is_capslock : 1; -- Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d___ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
Re: [E-devel] Adding support for a ternary state shift in illume keyboard
Em 11-03-2011 09:47, Rui Miguel Silva Seabra escreveu: Em 11-03-2011 04:02, Christopher Michael escreveu: On 03/10/2011 06:49 PM, Rui Miguel Silva Seabra wrote: Hi, I'm completely unsure of this patch and haven't had the change of testing it. The desired behavior is to have a shit key that will alternate between shift, capslock and then normal state. This would allow a caps lock in the Default.kbd without adding another virtual key. I'm thinking of adding other special kinds of keys which will do things like "change layout to keyboard type fubar" (rather than just sliding up on the keyboard). Specially to dh, am I going in the right direction with this patch? Rui 1) Thanks for the patch :) 2) I'm currently away from home with very limited 'net access (if any @ all sometimes) and don't have my comp with me, so I can't apply this and test it (yet). I should be back 'online' (hopefully) Saturday night/Sunday (monday @ the latest). I'll have a look @ this patch then. Thanks, Please look at this patch instead, as it has a bit operation bug (in my changes) fixed. Rui My lil'bernie gave a few minutes to test at least compilation, THIS attached version at least compiles. Rui Index: src/modules/illume-keyboard/e_kbd_int.c === --- src/modules/illume-keyboard/e_kbd_int.c (revision 57681) +++ src/modules/illume-keyboard/e_kbd_int.c (working copy) @@ -174,6 +174,8 @@ if ((ki->layout.state & CTRL) && (ky->is_ctrl)) 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 & SHIFT) && (ky->tern_shift)) selected = 1; + if ((ki->layout.state & CAPSLOCK) && (ky->tern_shift)) selected = 1; if (selected) { if (!ky->selected) @@ -351,6 +353,20 @@ _e_kbd_int_layout_state_update(ki); return; } + if (ky->tern_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 (ki->layout.state & CTRL) ki->layout.state &= (~(CTRL)); @@ -574,6 +590,8 @@ if ((ki->layout.state & CTRL) && (ky->is_ctrl)) 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 & SHIFT) && (ky->tern_shift)) selected = 1; + if ((ki->layout.state & CAPSLOCK) && (ky->tern_shift)) selected = 1; if (selected) edje_object_signal_emit(o, "e,state,selected", "e"); if (!selected) @@ -997,6 +1015,7 @@ st->out = eina_stringshare_add(str); } if (!strcmp(str, "is_shift")) ky->is_shift = 1; + if (!strcmp(str, "tern_shift")) ky->tern_shift = 1; if (!strcmp(str, "is_ctrl")) ky->is_ctrl = 1; if (!strcmp(str, "is_alt")) ky->is_alt = 1; if (!strcmp(str, "is_capslock")) ky->is_capslock = 1; -- Colocation vs. Managed Hosting A question and answer guide to determining the best fit for your organization - today and in the future. http://p.sf.net/sfu/internap-sfd2d___ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
Re: [E-devel] Adding support for a ternary state shift in illume keyboard
Em 11-03-2011 10:24, Rui Miguel Silva Seabra escreveu: Em 11-03-2011 09:47, Rui Miguel Silva Seabra escreveu: Em 11-03-2011 04:02, Christopher Michael escreveu: On 03/10/2011 06:49 PM, Rui Miguel Silva Seabra wrote: Hi, I'm completely unsure of this patch and haven't had the change of testing it. The desired behavior is to have a shit key that will alternate between shift, capslock and then normal state. This would allow a caps lock in the Default.kbd without adding another virtual key. I'm thinking of adding other special kinds of keys which will do things like "change layout to keyboard type fubar" (rather than just sliding up on the keyboard). Specially to dh, am I going in the right direction with this patch? Rui 1) Thanks for the patch :) 2) I'm currently away from home with very limited 'net access (if any @ all sometimes) and don't have my comp with me, so I can't apply this and test it (yet). I should be back 'online' (hopefully) Saturday night/Sunday (monday @ the latest). I'll have a look @ this patch then. Thanks, Please look at this patch instead, as it has a bit operation bug (in my changes) fixed. Rui My lil'bernie gave a few minutes to test at least compilation, THIS attached version at least compiles. Rui Ok, the attached patch definitely works. I alter Default.kbd because it's an optimal case where you want a multi shift. For it, you need capslock key definitions. In the is_multi_shift key, I used some UTF-8 arrows to indicate what the next state will be, if pressed. How it works: Only want one character in uppercase? Press once, type it, and go back to normal. Want to use uppercase? Press twice, go on writing. Wnat to go back to lowercase? Press it again and there you go. For now it only supports the standard states, but it should be possible to extend into something like CaMeLcAsE or whatever, but I don't think that's really an effort worth my time right now :) May I commit or does anyone see any significant issue? Rui Index: e_kbd_int.c === --- e_kbd_int.c (revision 57681) +++ e_kbd_int.c (working copy) @@ -174,6 +174,7 @@ if ((ki->layout.state & CTRL) && (ky->is_ctrl)) 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 & (SHIFT | CAPSLOCK)) && (ky->is_multi_shift)) selected = 1; if (selected) { if (!ky->selected) @@ -351,6 +352,24 @@ _e_kbd_int_layout_state_update(ki); 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 (ki->layout.state & CTRL) ki->layout.state &= (~(CTRL)); @@ -426,7 +445,7 @@ } 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); } } @@ -574,6 +593,7 @@ if ((ki->layout.state & CTRL) && (ky->is_ctrl)) 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 & (SHIFT|CAPSLOCK)) && (ky->is_multi_shift)) selected = 1; if (selected) edje_object_signal_emit(o, "e,state,selected", "e"); if (!selected) @@ -997,6 +1017,7 @@ st->out = eina_stringshare_add(str); } 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_alt")) ky->is_alt = 1; if (!strcmp(str, "is_capslock")) ky->is_capslock = 1; Index: e_kbd_int.h === --- e_kbd_int.h (revision 57681) +++ e_kbd_int.h (working copy) @@ -96,6 +96,7 @@ unsigned char selected : 1; unsigned char is_shift : 1; + unsigned char is_multi_shift : 1; unsigned char is_ctrl : 1; unsigned char is_alt : 1; unsigned char is_capslock : 1; Index: keyboards/Default.kbd === --- keyboards/Default.kbd (revision 57681) +++ keyboards/Default.kbd (working copy) @@ -14,86 +14,115 @@ key 5 5 10 10 normal q "q" shiftQ "Q" + capslockQ "Q" key 15 5 10