Fix keyboard

This commit is contained in:
hodasemi 2024-05-18 07:54:06 +02:00
parent 149f58169f
commit 97cb14d4df

View file

@ -8,6 +8,7 @@ use std::{
sync::{Arc, RwLock},
};
#[derive(Debug)]
enum KeyboardMode {
LowerCase,
UpperCase,
@ -379,13 +380,19 @@ impl Visibility for Keyboard {
fn set_visibility(&self, visibility: bool) -> Result<()> {
let mode = self.mode.read().unwrap();
match mode.deref() {
KeyboardMode::LowerCase => self.lower_case.set_visibility(visibility)?,
KeyboardMode::UpperCase => self.upper_case.set_visibility(visibility)?,
KeyboardMode::Specials => self.specials.set_visibility(visibility)?,
}
let gui = match mode.deref() {
KeyboardMode::LowerCase => &self.lower_case,
KeyboardMode::UpperCase => &self.upper_case,
KeyboardMode::Specials => &self.specials,
};
self.text_field_gui.set_visibility(visibility)?;
if visibility {
gui.enable()?;
self.text_field_gui.enable()?;
} else {
gui.disable()?;
self.text_field_gui.disable()?;
}
Ok(())
}