30
30
*/
31
31
typedef struct {
32
32
keyboard_mode_t mode ;
33
- slider_location_t location ;
34
33
bool active ; // Marker is 'active', i.e., touched
35
34
// if true, the special chars keyboard mode is available.
36
35
bool special_chars ;
@@ -90,18 +89,19 @@ static void _render(component_t* component)
90
89
static void _on_event (const event_t * event , component_t * component )
91
90
{
92
91
keyboard_switch_data_t * ks_data = (keyboard_switch_data_t * )component -> data ;
92
+ if (event -> data .source != top_slider ) {
93
+ return ;
94
+ }
93
95
switch (event -> id ) {
94
96
case EVENT_CONTINUOUS_TAP :
95
- if (event -> data .source == top_slider && ks_data -> location == top_slider &&
96
- event -> data .position > SLIDER_POSITION_ONE_THIRD &&
97
+ if (event -> data .position > SLIDER_POSITION_ONE_THIRD &&
97
98
event -> data .position <= SLIDER_POSITION_TWO_THIRD ) {
98
99
ks_data -> active = true;
99
100
break ;
100
101
}
101
102
/* FALLTHROUGH */
102
103
case EVENT_SHORT_TAP :
103
- if (event -> data .source == top_slider && ks_data -> location == top_slider &&
104
- event -> data .position > SLIDER_POSITION_ONE_THIRD &&
104
+ if (event -> data .position > SLIDER_POSITION_ONE_THIRD &&
105
105
event -> data .position <= SLIDER_POSITION_TWO_THIRD ) {
106
106
ks_data -> active = false;
107
107
switch (ks_data -> mode ) {
@@ -145,7 +145,6 @@ static component_functions_t _component_functions = {
145
145
/********************************** Create Instance **********************************/
146
146
147
147
component_t * keyboard_switch_create (
148
- slider_location_t location ,
149
148
bool special_chars ,
150
149
bool default_to_digits ,
151
150
component_t * parent ,
@@ -164,7 +163,6 @@ component_t* keyboard_switch_create(
164
163
}
165
164
memset (ks_data , 0 , sizeof (keyboard_switch_data_t ));
166
165
167
- ks_data -> location = location ;
168
166
ks_data -> mode = default_to_digits ? DIGITS : LOWER_CASE ;
169
167
ks_data -> active = false;
170
168
ks_data -> special_chars = special_chars ;
0 commit comments