fix macos dead key

after typing dead key, there is also an ime event triggered,so get text_with_all_modifiers is unnecessary
macos-click-through
vzex 3 years ago committed by Keith Simmons
parent 52c93d87af
commit 0fd299d995

@ -1,8 +1,6 @@
use glutin::event::{ElementState, Event, KeyEvent, WindowEvent}; use glutin::event::{ElementState, Event, KeyEvent, WindowEvent};
use glutin::keyboard::Key; use glutin::keyboard::Key;
use glutin::platform::modifier_supplement::KeyEventExtModifierSupplement;
use crate::bridge::{SerialCommand, UiCommand}; use crate::bridge::{SerialCommand, UiCommand};
use crate::event_aggregator::EVENT_AGGREGATOR; use crate::event_aggregator::EVENT_AGGREGATOR;
use crate::settings::SETTINGS; use crate::settings::SETTINGS;
@ -118,13 +116,7 @@ impl KeyboardManager {
if let Some(key_text) = is_control_key(key_event.logical_key) { if let Some(key_text) = is_control_key(key_event.logical_key) {
Some(self.format_keybinding_string(true, true, key_text)) Some(self.format_keybinding_string(true, true, key_text))
} else { } else {
let is_dead_key = let key_text = key_event.text;
key_event.text_with_all_modifiers().is_some() && key_event.text.is_none();
let key_text = if (self.alt || is_dead_key) && cfg!(target_os = "macos") {
key_event.text_with_all_modifiers()
} else {
key_event.text
};
if let Some(key_text) = key_text { if let Some(key_text) = key_text {
// This is not a control key, so we rely upon winit to determine if // This is not a control key, so we rely upon winit to determine if

Loading…
Cancel
Save