+
+bool GrabKeyList( Window window, const Dali::Vector<Dali::KEY>& daliKeyVector, const Dali::Vector<KeyGrabMode>& grabModeVector, Dali::Vector<bool>& returnVector)
+{
+ const Dali::Vector<bool>::SizeType returnCount = returnVector.Count();
+ const Dali::Vector<Dali::KEY>::SizeType keyCount = daliKeyVector.Count();
+ const Dali::Vector<KeyGrabMode>::SizeType keyGrabModeCount = grabModeVector.Count();
+
+ if( keyCount != keyGrabModeCount || keyCount != returnCount || keyCount == 0 )
+ {
+ return false;
+ }
+
+ eina_init();
+
+ Eina_List* keyList = NULL;
+ {
+ for( Dali::Vector<float>::SizeType index = 0; index < keyCount; ++index )
+ {
+ Ecore_Wl_Window_Keygrab_Info info;
+ info.key = const_cast<char*>(Dali::Internal::Adaptor::KeyLookup::GetKeyName( daliKeyVector[index] ));
+
+ switch( grabModeVector[index] )
+ {
+ case TOPMOST:
+ {
+ info.mode = ECORE_WL_WINDOW_KEYGRAB_TOPMOST;
+ break;
+ }
+ case SHARED:
+ {
+ info.mode = ECORE_WL_WINDOW_KEYGRAB_SHARED;
+ break;
+ }
+ case OVERRIDE_EXCLUSIVE:
+ {
+ info.mode = ECORE_WL_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
+ break;
+ }
+ case EXCLUSIVE:
+ {
+ info.mode = ECORE_WL_WINDOW_KEYGRAB_EXCLUSIVE;
+ break;
+ }
+ default:
+ {
+ info.mode = ECORE_WL_WINDOW_KEYGRAB_UNKNOWN;
+ break;
+ }
+ }
+
+ keyList = eina_list_append( keyList, &info );
+ }
+ }
+
+ Eina_List* grabList = ecore_wl_window_keygrab_list_set( AnyCast<Ecore_Wl_Window*>( window.GetNativeHandle() ), keyList );
+
+ returnVector.Resize( keyCount, true );
+
+ Eina_List* l = NULL;
+ Eina_List* m = NULL;
+ void *listData = NULL;
+ void *data = NULL;
+ if( grabList != NULL )
+ {
+ EINA_LIST_FOREACH( grabList, m, data )
+ {
+ Dali::Vector<float>::SizeType index = 0;
+ EINA_LIST_FOREACH( keyList, l, listData )
+ {
+ if((static_cast<Ecore_Wl_Window_Keygrab_Info*>(listData))->key == NULL)
+ {
+ DALI_LOG_ERROR("input key list has null data!");
+ break;
+ }
+
+ if( strcmp( static_cast<char*>(data), static_cast<Ecore_Wl_Window_Keygrab_Info*>(listData)->key ) == 0 )
+ {
+ returnVector[index] = false;
+ }
+ ++index;
+ }
+ }
+ }
+
+ eina_list_free( keyList );
+ eina_list_free( grabList );
+ eina_shutdown();
+
+ return true;
+}
+
+bool UngrabKeyList( Window window, const Dali::Vector<Dali::KEY>& daliKeyVector, Dali::Vector<bool>& returnVector)
+{
+ const Dali::Vector<bool>::SizeType returnCount = returnVector.Count();
+ const Dali::Vector<Dali::KEY>::SizeType keyCount = daliKeyVector.Count();
+
+ if( keyCount != returnCount ||keyCount == 0 )
+ {
+ return false;
+ }
+
+ eina_init();
+
+ Eina_List* keyList = NULL;
+ {
+ for( Dali::Vector<float>::SizeType index = 0; index < keyCount; ++index )
+ {
+ Ecore_Wl_Window_Keygrab_Info info;
+ info.key = const_cast<char*>(Dali::Internal::Adaptor::KeyLookup::GetKeyName( daliKeyVector[index] ));
+ keyList = eina_list_append( keyList, &info );
+ }
+ }
+
+ Eina_List* ungrabList = ecore_wl_window_keygrab_list_unset( AnyCast<Ecore_Wl_Window*>( window.GetNativeHandle() ), keyList );
+
+ returnVector.Resize( keyCount, true );
+
+ Eina_List* l = NULL;
+ Eina_List* m = NULL;
+ void *listData = NULL;
+ void *data = NULL;
+
+ if( ungrabList != NULL )
+ {
+ EINA_LIST_FOREACH( ungrabList, m, data )
+ {
+ Dali::Vector<float>::SizeType index = 0;
+ EINA_LIST_FOREACH( keyList, l, listData )
+ {
+ if( strcmp( static_cast<char*>(data), static_cast<Ecore_Wl_Window_Keygrab_Info*>(listData)->key ) == 0 )
+ {
+ returnVector[index] = false;
+ }
+ ++index;
+ }
+ }
+ }
+
+ eina_list_free( keyList );
+ eina_list_free( ungrabList );
+ eina_shutdown();
+
+ return true;
+}
+