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.
This commit is contained in:
		@ -167,6 +167,9 @@
 | 
				
			|||||||
  </key>
 | 
					  </key>
 | 
				
			||||||
  <key keycode="66" name="ALTGR">
 | 
					  <key keycode="66" name="ALTGR">
 | 
				
			||||||
    <keysym keyval="65027">ISO_Level3_Shift</keysym>
 | 
					    <keysym keyval="65027">ISO_Level3_Shift</keysym>
 | 
				
			||||||
 | 
					    <keysym keyval="65027">ISO_Level3_Shift</keysym>
 | 
				
			||||||
 | 
					    <keysym keyval="65027" label="ABC">ISO_Level3_Shift</keysym>
 | 
				
			||||||
 | 
					    <keysym keyval="65027" label="ABC">ISO_Level3_Shift</keysym>
 | 
				
			||||||
  </key>
 | 
					  </key>
 | 
				
			||||||
  <key keycode="38" name="AC01">
 | 
					  <key keycode="38" name="AC01">
 | 
				
			||||||
    <keysym keyval="97">a</keysym>
 | 
					    <keysym keyval="97">a</keysym>
 | 
				
			||||||
@ -235,6 +238,9 @@
 | 
				
			|||||||
  </key>
 | 
					  </key>
 | 
				
			||||||
  <key keycode="50" name="LFSH">
 | 
					  <key keycode="50" name="LFSH">
 | 
				
			||||||
    <keysym keyval="65505">Shift_L</keysym>
 | 
					    <keysym keyval="65505">Shift_L</keysym>
 | 
				
			||||||
 | 
					    <keysym keyval="65505">Shift_L</keysym>
 | 
				
			||||||
 | 
					    <keysym keyval="65505" label="=/+">Shift_L</keysym>
 | 
				
			||||||
 | 
					    <keysym keyval="65505" label="123">Shift_L</keysym>
 | 
				
			||||||
  </key>
 | 
					  </key>
 | 
				
			||||||
  <key keycode="52" name="AB01">
 | 
					  <key keycode="52" name="AB01">
 | 
				
			||||||
    <keysym keyval="122">z</keysym>
 | 
					    <keysym keyval="122">z</keysym>
 | 
				
			||||||
 | 
				
			|||||||
@ -208,10 +208,22 @@ set_level_from_modifiers (EekKeyboard *self)
 | 
				
			|||||||
    EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(self);
 | 
					    EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(self);
 | 
				
			||||||
    gint level = 0;
 | 
					    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;
 | 
					        level |= 2;
 | 
				
			||||||
    if (priv->modifiers & EEK_SHIFT_MASK)
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (priv->modifiers & EEK_SHIFT_MASK) {
 | 
				
			||||||
 | 
					        /* Left Shift is the Shift and =/+ keys */
 | 
				
			||||||
        level |= 1;
 | 
					        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);
 | 
					    eek_element_set_level (EEK_ELEMENT(self), level);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user