mirror of
https://github.com/danbulant/cushy
synced 2026-05-27 05:42:43 +00:00
Refreshing after ime input
This commit is contained in:
parent
983b6a97ad
commit
dc6c22372b
2 changed files with 7 additions and 2 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
use std::panic::AssertUnwindSafe;
|
||||||
use std::sync::{Arc, Condvar, Mutex, MutexGuard, PoisonError};
|
use std::sync::{Arc, Condvar, Mutex, MutexGuard, PoisonError};
|
||||||
|
|
||||||
use kludgine::app::WindowHandle;
|
use kludgine::app::WindowHandle;
|
||||||
|
|
@ -20,7 +21,7 @@ impl<T> Dynamic<T> {
|
||||||
windows: Vec::new(),
|
windows: Vec::new(),
|
||||||
readers: 0,
|
readers: 0,
|
||||||
}),
|
}),
|
||||||
sync: Condvar::new(),
|
sync: AssertUnwindSafe(Condvar::new()),
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -122,7 +123,10 @@ impl<T> From<Dynamic<T>> for DynamicRefReader<T> {
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct DynamicData<T> {
|
struct DynamicData<T> {
|
||||||
state: Mutex<State<T>>,
|
state: Mutex<State<T>>,
|
||||||
sync: Condvar,
|
|
||||||
|
// The AssertUnwindSafe is only needed on Mac. For some reason on
|
||||||
|
// Mac OS, Condvar isn't RefUnwindSafe.
|
||||||
|
sync: AssertUnwindSafe<Condvar>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> DynamicData<T> {
|
impl<T> DynamicData<T> {
|
||||||
|
|
|
||||||
|
|
@ -367,6 +367,7 @@ impl Widget for Input {
|
||||||
Ime::Commit(text) => {
|
Ime::Commit(text) => {
|
||||||
self.editor_mut(context.kludgine, &Self::styles(&context.widget))
|
self.editor_mut(context.kludgine, &Self::styles(&context.widget))
|
||||||
.insert_string(&text, None);
|
.insert_string(&text, None);
|
||||||
|
context.set_needs_redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue