1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 06:40:06 -04:00

egui-winit: fix AltGr characters on windows/linux (#790)

Closes https://github.com/emilk/egui/issues/351
Closes https://github.com/emilk/egui/pull/785
This commit is contained in:
Emil Ernerfeldt
2021-10-13 08:55:00 +02:00
committed by GitHub
parent fe2094af14
commit e43cfeac17

View File

@@ -225,10 +225,12 @@ impl State {
} }
} }
WindowEvent::ReceivedCharacter(ch) => { WindowEvent::ReceivedCharacter(ch) => {
if is_printable_char(*ch) // On Mac we get here when the user presses Cmd-C (copy), ctrl-W, etc.
&& !self.egui_input.modifiers.ctrl // We need to ignore these characters that are side-effects of commands.
&& !self.egui_input.modifiers.mac_cmd let is_mac_cmd = cfg!(target_os = "macos")
{ && (self.egui_input.modifiers.ctrl || self.egui_input.modifiers.mac_cmd);
if is_printable_char(*ch) && !is_mac_cmd {
self.egui_input self.egui_input
.events .events
.push(egui::Event::Text(ch.to_string())); .push(egui::Event::Text(ch.to_string()));