| 153 | #include <cstring> |
| 154 | |
| 155 | void Keyboard_Class::updateKeysState() |
| 156 | { |
| 157 | _keys_state_buffer.reset(); |
| 158 | _key_pos_print_keys.clear(); |
| 159 | _key_pos_hid_keys.clear(); |
| 160 | _key_pos_modifier_keys.clear(); |
| 161 | |
| 162 | // Get special keys |
| 163 | for (auto &i : _key_list_buffer) |
| 164 | { |
| 165 | // modifier |
| 166 | if (getKeyValue(i).value_first == KEY_FN) |
| 167 | { |
| 168 | _keys_state_buffer.fn = true; |
| 169 | continue; |
| 170 | } |
| 171 | if (getKeyValue(i).value_first == KEY_OPT) |
| 172 | { |
| 173 | _keys_state_buffer.opt = true; |
| 174 | continue; |
| 175 | } |
| 176 | |
| 177 | if (getKeyValue(i).value_first == KEY_LEFT_CTRL) |
| 178 | { |
| 179 | _keys_state_buffer.ctrl = true; |
| 180 | _key_pos_modifier_keys.push_back(i); |
| 181 | continue; |
| 182 | } |
| 183 | |
| 184 | if (getKeyValue(i).value_first == KEY_LEFT_SHIFT) |
| 185 | { |
| 186 | _keys_state_buffer.shift = true; |
| 187 | _key_pos_modifier_keys.push_back(i); |
| 188 | continue; |
| 189 | } |
| 190 | |
| 191 | if (getKeyValue(i).value_first == KEY_LEFT_ALT) |
| 192 | { |
| 193 | _keys_state_buffer.alt = true; |
| 194 | _key_pos_modifier_keys.push_back(i); |
| 195 | continue; |
| 196 | } |
| 197 | |
| 198 | // function |
| 199 | if (getKeyValue(i).value_first == KEY_TAB) |
| 200 | { |
| 201 | _keys_state_buffer.tab = true; |
| 202 | _key_pos_hid_keys.push_back(i); |
| 203 | continue; |
| 204 | } |
| 205 | |
| 206 | if (getKeyValue(i).value_first == KEY_BACKSPACE) |
| 207 | { |
| 208 | _keys_state_buffer.del = true; |
| 209 | _key_pos_hid_keys.push_back(i); |
| 210 | continue; |
| 211 | } |
| 212 | |