Skip to content

Commit 832db73

Browse files
committed
Change all occurances of Event::Text to Event::Key.text
1 parent 4f0ae20 commit 832db73

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

crates/eframe/src/web/events.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ fn install_keydown(runner_ref: &WebRunner, target: &EventTarget) -> Result<(), J
137137
&& !runner.text_agent.has_focus()
138138
{
139139
if let Some(text) = text_from_keyboard_event(&event) {
140-
let egui_event = egui::Event::Text(text);
140+
let egui_event = egui::Event::from_text(text);
141141
let should_stop_propagation =
142142
(runner.web_options.should_stop_propagation)(&egui_event);
143143
let should_prevent_default =

crates/eframe/src/web/text_agent.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl TextAgent {
6767
// and we need to ignore the `input` event.
6868
if !text.is_empty() && !event.is_composing() {
6969
input.set_value("");
70-
let event = egui::Event::Text(text);
70+
let event = egui::Event::from_text(text);
7171
runner.input.raw.events.push(event);
7272
runner.needs_repaint.repaint_asap();
7373
}

crates/egui_kittest/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ impl<'a, State> Harness<'a, State> {
535535
modifiers,
536536
repeat: false,
537537
physical_key: None,
538+
text: None,
538539
});
539540
}
540541
}

crates/egui_kittest/src/node.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ impl Node<'_> {
134134
modifiers: Modifiers::default(),
135135
repeat: false,
136136
physical_key: None,
137+
text: None,
137138
});
138139
}
139140

@@ -145,11 +146,12 @@ impl Node<'_> {
145146
modifiers: Modifiers::default(),
146147
repeat: false,
147148
physical_key: None,
149+
text: None,
148150
});
149151
}
150152

151153
pub fn type_text(&self, text: &str) {
152-
self.event(egui::Event::Text(text.to_owned()));
154+
self.event(egui::Event::from_text(text.to_owned()));
153155
}
154156

155157
pub fn value(&self) -> Option<String> {

examples/custom_keypad/src/keypad.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@ impl State {
3232

3333
fn queue_char(&mut self, c: char) {
3434
let events = self.events.get_or_insert(vec![]);
35+
let text = Some(c.to_string());
3536
if let Some(key) = egui::Key::from_name(&c.to_string()) {
3637
events.push(egui::Event::Key {
3738
key,
3839
physical_key: Some(key),
3940
pressed: true,
4041
repeat: false,
4142
modifiers: Default::default(),
42-
text: None,
43+
text,
4344
});
4445
}
45-
events.push(egui::Event::Text(c.to_string()));
4646
}
4747

4848
fn queue_key(&mut self, key: egui::Key) {

0 commit comments

Comments
 (0)