From 0fa318ca7eaa3439b96b23dae68489b0c5f50a25 Mon Sep 17 00:00:00 2001 From: Richard Acayan Date: Mon, 30 Sep 2024 22:02:58 -0400 Subject: [PATCH] core: layout: use built-in uppercase function for shift modifier There are uppercase symbols outside the Latin alphabet. Use the built-in uppercase function for displaying uppercase text due to the shift key. --- src/core/layout.rs | 72 +++++++--------------------------------------- 1 file changed, 10 insertions(+), 62 deletions(-) diff --git a/src/core/layout.rs b/src/core/layout.rs index ff6a354..8691970 100644 --- a/src/core/layout.rs +++ b/src/core/layout.rs @@ -120,68 +120,11 @@ impl Part { fn modify_shift_label(orig_sym: &KeyValue) -> KeyValue { - match orig_sym { - KeyValue(Keysym::a, _) - => KeyValue::from(Keysym::a, "A"), - KeyValue(Keysym::b, _) - => KeyValue::from(Keysym::b, "B"), - KeyValue(Keysym::c, _) - => KeyValue::from(Keysym::c, "C"), - KeyValue(Keysym::d, _) - => KeyValue::from(Keysym::d, "D"), - KeyValue(Keysym::e, _) - => KeyValue::from(Keysym::e, "E"), - KeyValue(Keysym::f, _) - => KeyValue::from(Keysym::f, "F"), - KeyValue(Keysym::g, _) - => KeyValue::from(Keysym::g, "G"), - KeyValue(Keysym::h, _) - => KeyValue::from(Keysym::h, "H"), - KeyValue(Keysym::i, _) - => KeyValue::from(Keysym::i, "I"), - KeyValue(Keysym::j, _) - => KeyValue::from(Keysym::j, "J"), - KeyValue(Keysym::k, _) - => KeyValue::from(Keysym::k, "K"), - KeyValue(Keysym::l, _) - => KeyValue::from(Keysym::l, "L"), - KeyValue(Keysym::m, _) - => KeyValue::from(Keysym::m, "M"), - KeyValue(Keysym::n, _) - => KeyValue::from(Keysym::n, "N"), - KeyValue(Keysym::o, _) - => KeyValue::from(Keysym::o, "O"), - KeyValue(Keysym::p, _) - => KeyValue::from(Keysym::p, "P"), - KeyValue(Keysym::q, _) - => KeyValue::from(Keysym::q, "Q"), - KeyValue(Keysym::r, _) - => KeyValue::from(Keysym::r, "R"), - KeyValue(Keysym::s, _) - => KeyValue::from(Keysym::s, "S"), - KeyValue(Keysym::t, _) - => KeyValue::from(Keysym::t, "T"), - KeyValue(Keysym::u, _) - => KeyValue::from(Keysym::u, "U"), - KeyValue(Keysym::v, _) - => KeyValue::from(Keysym::v, "V"), - KeyValue(Keysym::w, _) - => KeyValue::from(Keysym::w, "W"), - KeyValue(Keysym::x, _) - => KeyValue::from(Keysym::x, "X"), - KeyValue(Keysym::y, _) - => KeyValue::from(Keysym::y, "Y"), - KeyValue(Keysym::z, _) - => KeyValue::from(Keysym::z, "Z"), - - KeyValue(Keysym::ae, _) - => KeyValue::from(Keysym::ae, "Æ"), - KeyValue(Keysym::oe, _) - => KeyValue::from(Keysym::oe, "Œ"), - KeyValue(Keysym::mu, _) - => KeyValue::from(Keysym::mu, "Μ"), - - _ => orig_sym.clone(), + if Self::keyvalue_has_text(orig_sym) { + let upper = orig_sym.1.to_uppercase(); + KeyValue(orig_sym.0, upper) + } else { + orig_sym.clone() } } @@ -334,6 +277,11 @@ impl Part { KeyValue(Keysym::F12, _) => false, KeyValue(Keysym::Delete, _) => false, + KeyValue(Keysym::Alt_L, _) => false, + KeyValue(Keysym::Control_L, _) => false, + KeyValue(Keysym::Meta_L, _) => false, + KeyValue(Keysym::XF86_Fn, _) => false, + KeyValue(_, l) => l != "", } }