@@ -807,65 +807,6 @@ impl crate::Keystroke {
key_char,
}
}
-
- /**
- * Returns which symbol the dead key represents
- * <https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values#dead_keycodes_for_linux>
- */
- pub fn underlying_dead_key(keysym: Keysym) -> Option<String> {
- match keysym {
- Keysym::dead_grave => Some("`".to_owned()),
- Keysym::dead_acute => Some("´".to_owned()),
- Keysym::dead_circumflex => Some("^".to_owned()),
- Keysym::dead_tilde => Some("~".to_owned()),
- Keysym::dead_macron => Some("¯".to_owned()),
- Keysym::dead_breve => Some("˘".to_owned()),
- Keysym::dead_abovedot => Some("˙".to_owned()),
- Keysym::dead_diaeresis => Some("¨".to_owned()),
- Keysym::dead_abovering => Some("˚".to_owned()),
- Keysym::dead_doubleacute => Some("˝".to_owned()),
- Keysym::dead_caron => Some("ˇ".to_owned()),
- Keysym::dead_cedilla => Some("¸".to_owned()),
- Keysym::dead_ogonek => Some("˛".to_owned()),
- Keysym::dead_iota => Some("ͅ".to_owned()),
- Keysym::dead_voiced_sound => Some("゙".to_owned()),
- Keysym::dead_semivoiced_sound => Some("゚".to_owned()),
- Keysym::dead_belowdot => Some("̣̣".to_owned()),
- Keysym::dead_hook => Some("̡".to_owned()),
- Keysym::dead_horn => Some("̛".to_owned()),
- Keysym::dead_stroke => Some("̶̶".to_owned()),
- Keysym::dead_abovecomma => Some("̓̓".to_owned()),
- Keysym::dead_abovereversedcomma => Some("ʽ".to_owned()),
- Keysym::dead_doublegrave => Some("̏".to_owned()),
- Keysym::dead_belowring => Some("˳".to_owned()),
- Keysym::dead_belowmacron => Some("̱".to_owned()),
- Keysym::dead_belowcircumflex => Some("ꞈ".to_owned()),
- Keysym::dead_belowtilde => Some("̰".to_owned()),
- Keysym::dead_belowbreve => Some("̮".to_owned()),
- Keysym::dead_belowdiaeresis => Some("̤".to_owned()),
- Keysym::dead_invertedbreve => Some("̯".to_owned()),
- Keysym::dead_belowcomma => Some("̦".to_owned()),
- Keysym::dead_currency => None,
- Keysym::dead_lowline => None,
- Keysym::dead_aboveverticalline => None,
- Keysym::dead_belowverticalline => None,
- Keysym::dead_longsolidusoverlay => None,
- Keysym::dead_a => None,
- Keysym::dead_A => None,
- Keysym::dead_e => None,
- Keysym::dead_E => None,
- Keysym::dead_i => None,
- Keysym::dead_I => None,
- Keysym::dead_o => None,
- Keysym::dead_O => None,
- Keysym::dead_u => None,
- Keysym::dead_U => None,
- Keysym::dead_small_schwa => Some("ə".to_owned()),
- Keysym::dead_capital_schwa => Some("Ə".to_owned()),
- Keysym::dead_greek => None,
- _ => None,
- }
- }
}
#[cfg(any(feature = "wayland", feature = "x11"))]
@@ -69,7 +69,6 @@ use super::{
window::{ImeInput, WaylandWindowStatePtr},
};
-use crate::platform::{PlatformWindow, blade::BladeContext};
use crate::{
AnyWindowHandle, Bounds, Capslock, CursorStyle, DOUBLE_CLICK_INTERVAL, DevicePixels, DisplayId,
FileDropEvent, ForegroundExecutor, KeyDownEvent, KeyUpEvent, Keystroke, LinuxCommon,
@@ -92,6 +91,10 @@ use crate::{
xdg_desktop_portal::{Event as XDPEvent, XDPEventSource},
},
};
+use crate::{
+ platform::{PlatformWindow, blade::BladeContext},
+ underlying_dead_key,
+};
/// Used to convert evdev scancode to xkb scancode
const MIN_KEYCODE: u32 = 8;
@@ -1310,7 +1313,7 @@ impl Dispatch<wl_keyboard::WlKeyboard, ()> for WaylandClientStatePtr {
xkb::Status::Composing => {
keystroke.key_char = None;
state.pre_edit_text =
- compose.utf8().or(Keystroke::underlying_dead_key(keysym));
+ compose.utf8().or(underlying_dead_key(keysym));
let pre_edit =
state.pre_edit_text.clone().unwrap_or(String::default());
drop(state);
@@ -1327,7 +1330,7 @@ impl Dispatch<wl_keyboard::WlKeyboard, ()> for WaylandClientStatePtr {
}
xkb::Status::Cancelled => {
let pre_edit = state.pre_edit_text.take();
- let new_pre_edit = Keystroke::underlying_dead_key(keysym);
+ let new_pre_edit = underlying_dead_key(keysym);
state.pre_edit_text = new_pre_edit.clone();
drop(state);
if let Some(pre_edit) = pre_edit {
@@ -2,6 +2,7 @@ use crate::{
linux::KeyboardState,
platform::{xcb_flush, Capslock},
scap_screen_capture::scap_screen_sources,
+ underlying_dead_key,
};
use core::str;
use std::{
@@ -1066,9 +1067,8 @@ impl X11Client {
}
xkbc::Status::Composing => {
keystroke.key_char = None;
- state.pre_edit_text = compose_state
- .utf8()
- .or(crate::Keystroke::underlying_dead_key(keysym));
+ state.pre_edit_text =
+ compose_state.utf8().or(underlying_dead_key(keysym));
let pre_edit =
state.pre_edit_text.clone().unwrap_or(String::default());
drop(state);
@@ -1083,7 +1083,7 @@ impl X11Client {
if let Some(pre_edit) = pre_edit {
window.handle_ime_commit(pre_edit);
}
- if let Some(current_key) = Keystroke::underlying_dead_key(keysym) {
+ if let Some(current_key) = underlying_dead_key(keysym) {
window.handle_ime_preedit(current_key);
}
state = self.0.borrow_mut();