From 47041b0fac4a6d37ed557c651a7d7f0fb28dc113 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 10 Jul 2019 23:33:45 +0000 Subject: [PATCH] Implement basic keyboard views Use existing concepts of levels and modifier latches and locks to implement the three view design of issue #38. The use of a lock to switch from letter to numbers and a latch to handle upper and lower case has side effects, but these can be addressed in a future commit. --- data/keyboards/symbols/us.xml | 6 ++++++ eek/eek-keyboard.c | 16 ++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/data/keyboards/symbols/us.xml b/data/keyboards/symbols/us.xml index b55f6e77..4c1ed959 100644 --- a/data/keyboards/symbols/us.xml +++ b/data/keyboards/symbols/us.xml @@ -167,6 +167,9 @@ ISO_Level3_Shift + ISO_Level3_Shift + ISO_Level3_Shift + ISO_Level3_Shift a @@ -235,6 +238,9 @@ Shift_L + Shift_L + Shift_L + Shift_L z diff --git a/eek/eek-keyboard.c b/eek/eek-keyboard.c index d67a13da..313f5c38 100644 --- a/eek/eek-keyboard.c +++ b/eek/eek-keyboard.c @@ -208,10 +208,22 @@ set_level_from_modifiers (EekKeyboard *self) EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(self); gint level = 0; - if (priv->modifiers & priv->alt_gr_mask) + if (priv->modifiers & priv->alt_gr_mask) { + /* Alt-Gr is the 123 and ABC keys */ + priv->modifier_behavior = EEK_MODIFIER_BEHAVIOR_LOCK; level |= 2; - if (priv->modifiers & EEK_SHIFT_MASK) + } + + if (priv->modifiers & EEK_SHIFT_MASK) { + /* Left Shift is the Shift and =/+ keys */ level |= 1; + + if (level == 1) + priv->modifier_behavior = EEK_MODIFIER_BEHAVIOR_LATCH; + else + priv->modifier_behavior = EEK_MODIFIER_BEHAVIOR_LOCK; + } + eek_element_set_level (EEK_ELEMENT(self), level); }