input: Make it possible to deactivate a modifier with any button for it

Before this change,
one could only deactivate a modifier with the same button that was
used to activate it.
Pressing another button for the same modifier did not work.

Part-of: <https://gitlab.gnome.org/World/Phosh/squeekboard/-/merge_requests/706>
This commit is contained in:
MoonlightWave-12
2024-11-18 13:41:48 +01:00
parent 716fa62e8b
commit 053faf2598
2 changed files with 4 additions and 3 deletions

View File

@ -1186,7 +1186,7 @@ mod seat {
key_id,
modifier, time,
),
false => submission.handle_drop_modifier(key_id, time),
false => submission.handle_drop_modifier(key_id, modifier, time),
}
}
// only show when UI is present

View File

@ -229,10 +229,11 @@ impl Submission {
pub fn handle_drop_modifier(
&mut self,
key_id: KeyStateId,
_key_id: KeyStateId,
modifier: Modifier,
_time: Timestamp,
) {
vec_remove(&mut self.modifiers_active, |(id, _)| *id == key_id);
vec_remove(&mut self.modifiers_active, |(_, m)| *m == modifier);
self.update_modifiers();
}