summaryrefslogtreecommitdiffstats
path: root/core/src/shell.rs
diff options
context:
space:
mode:
authorLibravatar KENZ <KENZ.gelsoft@gmail.com>2025-01-10 07:12:31 +0900
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2025-02-02 17:44:13 +0100
commit7db5256b720c3ecbe7c1cce7a1b47fd03151e03a (patch)
treeccf08e3f76e27d0871185b786ece83f970dddc77 /core/src/shell.rs
parent599d8b560bec8036c5ddda62a7bf0a540bdec396 (diff)
downloadiced-7db5256b720c3ecbe7c1cce7a1b47fd03151e03a.tar.gz
iced-7db5256b720c3ecbe7c1cce7a1b47fd03151e03a.tar.bz2
iced-7db5256b720c3ecbe7c1cce7a1b47fd03151e03a.zip
Draft `input_method` support
Diffstat (limited to 'core/src/shell.rs')
-rw-r--r--core/src/shell.rs25
1 files changed, 24 insertions, 1 deletions
diff --git a/core/src/shell.rs b/core/src/shell.rs
index 12ebbaa8..d2c1b9ec 100644
--- a/core/src/shell.rs
+++ b/core/src/shell.rs
@@ -1,6 +1,15 @@
-use crate::event;
use crate::time::Instant;
use crate::window;
+use crate::{event, Point};
+
+/// TODO
+#[derive(Clone, Copy, Debug)]
+pub struct CaretInfo {
+ /// TODO
+ pub position: Point,
+ /// TODO
+ pub input_method_allowed: bool,
+}
/// A connection to the state of a shell.
///
@@ -15,6 +24,7 @@ pub struct Shell<'a, Message> {
redraw_request: Option<window::RedrawRequest>,
is_layout_invalid: bool,
are_widgets_invalid: bool,
+ caret_info: Option<CaretInfo>,
}
impl<'a, Message> Shell<'a, Message> {
@@ -26,6 +36,7 @@ impl<'a, Message> Shell<'a, Message> {
redraw_request: None,
is_layout_invalid: false,
are_widgets_invalid: false,
+ caret_info: None,
}
}
@@ -80,6 +91,16 @@ impl<'a, Message> Shell<'a, Message> {
self.redraw_request
}
+ /// TODO
+ pub fn update_caret_info(&mut self, caret_info: Option<CaretInfo>) {
+ self.caret_info = caret_info.or(self.caret_info);
+ }
+
+ /// TODO
+ pub fn caret_info(&self) -> Option<CaretInfo> {
+ self.caret_info
+ }
+
/// Returns whether the current layout is invalid or not.
pub fn is_layout_invalid(&self) -> bool {
self.is_layout_invalid
@@ -130,6 +151,8 @@ impl<'a, Message> Shell<'a, Message> {
);
}
+ self.update_caret_info(other.caret_info());
+
self.is_layout_invalid =
self.is_layout_invalid || other.is_layout_invalid;