Set Lock key event in event-handler 60/167960/1
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Tue, 23 Jan 2018 05:46:32 +0000 (14:46 +0900)
committerSeoyeon Kim <seoyeon2.kim@samsung.com>
Tue, 23 Jan 2018 05:53:17 +0000 (14:53 +0900)
 - Added Num Lock, Caps Lock, and Scroll Lock ecore key event

Change-Id: I2ad9073c1a090ed08b3d91cf5e3488e86d3a2bbe
Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
dali/internal/window-system/tizen-wayland/event-handler-ecore-wl.cpp
dali/internal/window-system/ubuntu-x11/event-handler-ecore-x.cpp

index 05e4d36..3c28e56 100644 (file)
@@ -94,6 +94,33 @@ const unsigned int PRIMARY_TOUCH_BUTTON_ID( 1 );
 const unsigned int BYTES_PER_CHARACTER_FOR_ATTRIBUTES = 3;
 
 /**
+ * EcoreInputModifierToEcoreIMFLock function converts from Ecore_Event_Modifier to Ecore_IMF_Keyboard_Locks enums.
+ * @param[in] modifier the Ecore_Event_Modifier input.
+ * @return the Ecore_IMF_Keyboard_Locks output.
+ */
+Ecore_IMF_Keyboard_Locks EcoreInputModifierToEcoreIMFLock( unsigned int modifier )
+{
+    unsigned int lock( ECORE_IMF_KEYBOARD_LOCK_NONE ); // If no other matches, returns NONE.
+
+    if( modifier & ECORE_EVENT_LOCK_NUM )
+    {
+      lock |= ECORE_IMF_KEYBOARD_LOCK_NUM; // Num lock is active.
+    }
+
+    if( modifier & ECORE_EVENT_LOCK_CAPS )
+    {
+      lock |= ECORE_IMF_KEYBOARD_LOCK_CAPS; // Caps lock is active.
+    }
+
+    if( modifier & ECORE_EVENT_LOCK_SCROLL )
+    {
+      lock |= ECORE_IMF_KEYBOARD_LOCK_SCROLL; // Scroll lock is active.
+    }
+
+    return static_cast<Ecore_IMF_Keyboard_Locks>( lock );
+}
+
+/**
  * Ecore_Event_Modifier enums in Ecore_Input.h do not match Ecore_IMF_Keyboard_Modifiers in Ecore_IMF.h.
  * This function converts from Ecore_Event_Modifier to Ecore_IMF_Keyboard_Modifiers enums.
  * @param[in] ecoreModifier the Ecore_Event_Modifier input.
@@ -101,7 +128,7 @@ const unsigned int BYTES_PER_CHARACTER_FOR_ATTRIBUTES = 3;
  */
 Ecore_IMF_Keyboard_Modifiers EcoreInputModifierToEcoreIMFModifier(unsigned int ecoreModifier)
 {
-   int modifier( ECORE_IMF_KEYBOARD_MODIFIER_NONE );  // If no other matches returns NONE.
+   unsigned int modifier( ECORE_IMF_KEYBOARD_MODIFIER_NONE );  // If no other matches returns NONE.
 
 
    if ( ecoreModifier & ECORE_EVENT_MODIFIER_SHIFT )  // enums from ecore_input/Ecore_Input.h
@@ -590,7 +617,7 @@ struct EventHandler::Impl
         ecoreKeyDownEvent.compose   = keyEvent->compose;
         ecoreKeyDownEvent.timestamp = keyEvent->timestamp;
         ecoreKeyDownEvent.modifiers = EcoreInputModifierToEcoreIMFModifier ( keyEvent->modifiers );
-        ecoreKeyDownEvent.locks     = (Ecore_IMF_Keyboard_Locks) ECORE_IMF_KEYBOARD_LOCK_NONE;
+        ecoreKeyDownEvent.locks     = EcoreInputModifierToEcoreIMFLock( keyEvent->modifiers );
         ecoreKeyDownEvent.dev_name  = ecore_device_name_get( keyEvent->dev );
         ecoreKeyDownEvent.dev_class = static_cast<Ecore_IMF_Device_Class>( ecore_device_class_get( keyEvent->dev ) );
         ecoreKeyDownEvent.dev_subclass = static_cast<Ecore_IMF_Device_Subclass>( ecore_device_subclass_get( keyEvent->dev ) );
@@ -695,7 +722,7 @@ struct EventHandler::Impl
         ecoreKeyUpEvent.compose   = keyEvent->compose;
         ecoreKeyUpEvent.timestamp = keyEvent->timestamp;
         ecoreKeyUpEvent.modifiers = EcoreInputModifierToEcoreIMFModifier ( keyEvent->modifiers );
-        ecoreKeyUpEvent.locks     = (Ecore_IMF_Keyboard_Locks) ECORE_IMF_KEYBOARD_LOCK_NONE;
+        ecoreKeyUpEvent.locks     = EcoreInputModifierToEcoreIMFLock( keyEvent->modifiers );
         ecoreKeyUpEvent.dev_name  = ecore_device_name_get( keyEvent->dev );
         ecoreKeyUpEvent.dev_class = static_cast<Ecore_IMF_Device_Class>( ecore_device_class_get( keyEvent->dev ) );
         ecoreKeyUpEvent.dev_subclass = static_cast<Ecore_IMF_Device_Subclass>( ecore_device_subclass_get( keyEvent->dev ) );
index e05e847..4d93e06 100644 (file)
@@ -207,6 +207,33 @@ const unsigned int DirectionStringsTotal = sizeof( ElDBusAccessibilityDirectionS
 #endif // DALI_ELDBUS_AVAILABLE
 
 /**
+ * EcoreInputModifierToEcoreIMFLock function converts from Ecore_Event_Modifier to Ecore_IMF_Keyboard_Locks enums.
+ * @param[in] modifier the Ecore_Event_Modifier input.
+ * @return the Ecore_IMF_Keyboard_Locks output.
+ */
+Ecore_IMF_Keyboard_Locks EcoreInputModifierToEcoreIMFLock( unsigned int modifier )
+{
+    unsigned int lock( ECORE_IMF_KEYBOARD_LOCK_NONE ); // If no other matches, returns NONE.
+
+    if( modifier & ECORE_EVENT_LOCK_NUM )
+    {
+      lock |= ECORE_IMF_KEYBOARD_LOCK_NUM; // Num lock is active.
+    }
+
+    if( modifier & ECORE_EVENT_LOCK_CAPS )
+    {
+      lock |= ECORE_IMF_KEYBOARD_LOCK_CAPS; // Caps lock is active.
+    }
+
+    if( modifier & ECORE_EVENT_LOCK_SCROLL )
+    {
+      lock |= ECORE_IMF_KEYBOARD_LOCK_SCROLL; // Scroll lock is active.
+    }
+
+    return static_cast<Ecore_IMF_Keyboard_Locks>( lock );
+}
+
+/**
  * Ecore_Event_Modifier enums in Ecore_Input.h do not match Ecore_IMF_Keyboard_Modifiers in Ecore_IMF.h.
  * This function converts from Ecore_Event_Modifier to Ecore_IMF_Keyboard_Modifiers enums.
  * @param[in] ecoreModifier the Ecore_Event_Modifier input.
@@ -214,7 +241,7 @@ const unsigned int DirectionStringsTotal = sizeof( ElDBusAccessibilityDirectionS
  */
 Ecore_IMF_Keyboard_Modifiers EcoreInputModifierToEcoreIMFModifier(unsigned int ecoreModifier)
 {
-   int modifier( ECORE_IMF_KEYBOARD_MODIFIER_NONE );  // If no other matches returns NONE.
+   unsigned int modifier( ECORE_IMF_KEYBOARD_MODIFIER_NONE );  // If no other matches returns NONE.
 
 
    if ( ecoreModifier & ECORE_EVENT_MODIFIER_SHIFT )  // enums from ecore_input/Ecore_Input.h
@@ -672,7 +699,7 @@ struct EventHandler::Impl
         ecoreKeyDownEvent.compose   = keyEvent->compose;
         ecoreKeyDownEvent.timestamp = keyEvent->timestamp;
         ecoreKeyDownEvent.modifiers = EcoreInputModifierToEcoreIMFModifier ( keyEvent->modifiers );
-        ecoreKeyDownEvent.locks     = (Ecore_IMF_Keyboard_Locks) ECORE_IMF_KEYBOARD_LOCK_NONE;
+        ecoreKeyDownEvent.locks     = EcoreInputModifierToEcoreIMFLock( keyEvent->modifiers );
 #ifdef ECORE_IMF_1_13
         ecoreKeyDownEvent.dev_name  = "";
         ecoreKeyDownEvent.dev_class = ECORE_IMF_DEVICE_CLASS_KEYBOARD;
@@ -752,7 +779,7 @@ struct EventHandler::Impl
         ecoreKeyUpEvent.compose   = keyEvent->compose;
         ecoreKeyUpEvent.timestamp = keyEvent->timestamp;
         ecoreKeyUpEvent.modifiers = EcoreInputModifierToEcoreIMFModifier ( keyEvent->modifiers );
-        ecoreKeyUpEvent.locks     = (Ecore_IMF_Keyboard_Locks) ECORE_IMF_KEYBOARD_LOCK_NONE;
+        ecoreKeyUpEvent.locks     = EcoreInputModifierToEcoreIMFLock( keyEvent->modifiers );
 #ifdef ECORE_IMF_1_13
         ecoreKeyUpEvent.dev_name  = "";
 #endif // ECORE_IMF_1_13