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:
parent
fe2094af14
commit
e43cfeac17
1 changed files with 6 additions and 4 deletions
|
@ -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()));
|
||||||
|
|
Loading…
Reference in a new issue