From dc6c22372b0a7fa8c9bbbedd1fe67abf97e75d06 Mon Sep 17 00:00:00 2001 From: Jonathan Johnson Date: Thu, 19 Oct 2023 15:03:47 -0700 Subject: [PATCH] Refreshing after ime input --- src/dynamic.rs | 8 ++++++-- src/widgets/input.rs | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/dynamic.rs b/src/dynamic.rs index 68fb8f7..9d1f934 100644 --- a/src/dynamic.rs +++ b/src/dynamic.rs @@ -1,4 +1,5 @@ use std::fmt::Debug; +use std::panic::AssertUnwindSafe; use std::sync::{Arc, Condvar, Mutex, MutexGuard, PoisonError}; use kludgine::app::WindowHandle; @@ -20,7 +21,7 @@ impl Dynamic { windows: Vec::new(), readers: 0, }), - sync: Condvar::new(), + sync: AssertUnwindSafe(Condvar::new()), })) } @@ -122,7 +123,10 @@ impl From> for DynamicRefReader { #[derive(Debug)] struct DynamicData { state: Mutex>, - sync: Condvar, + + // The AssertUnwindSafe is only needed on Mac. For some reason on + // Mac OS, Condvar isn't RefUnwindSafe. + sync: AssertUnwindSafe, } impl DynamicData { diff --git a/src/widgets/input.rs b/src/widgets/input.rs index cae02f5..ac6b406 100644 --- a/src/widgets/input.rs +++ b/src/widgets/input.rs @@ -367,6 +367,7 @@ impl Widget for Input { Ime::Commit(text) => { self.editor_mut(context.kludgine, &Self::styles(&context.widget)) .insert_string(&text, None); + context.set_needs_redraw(); } }