Skip to content

Commit

Permalink
Fix clipboard pasting into several windows issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mvlabat committed Apr 10, 2021
1 parent c1946be commit d1c8bfd
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions src/systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ pub fn process_input(
}
}

for egui_input in egui_input.values_mut() {
egui_input.raw_input.predicted_dt = time.delta_seconds();
}

let focused_input = egui_input.get_mut(&*focused_window).unwrap();

#[cfg(feature = "manage_clipboard")]
{
let mut copy = false;
Expand All @@ -219,24 +225,21 @@ pub fn process_input(
paste = Some(contents);
}
}
for egui_input in egui_input.values_mut() {
if copy {
egui_input.raw_input.events.push(egui::Event::Copy);
}
if cut {
egui_input.raw_input.events.push(egui::Event::Cut);
}
if let Some(content) = paste.clone() {
egui_input.raw_input.events.push(egui::Event::Text(content))
}

if copy {
focused_input.raw_input.events.push(egui::Event::Copy);
}
if cut {
focused_input.raw_input.events.push(egui::Event::Cut);
}
if let Some(content) = paste.clone() {
focused_input
.raw_input
.events
.push(egui::Event::Text(content))
}
};

for egui_input in egui_input.values_mut() {
egui_input.raw_input.predicted_dt = time.delta_seconds();
}

let focused_input = egui_input.get_mut(&*focused_window).unwrap();
focused_input.raw_input.modifiers = modifiers;
}

Expand Down

0 comments on commit d1c8bfd

Please sign in to comment.