--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/public-api/adaptor-framework/key-grab.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/window-system/common/window-impl.h>
+
+namespace Dali
+{
+
+namespace KeyGrab
+{
+
+bool GrabKeyTopmost( Window window, Dali::KEY daliKey )
+{
+ Dali::Internal::Adaptor::Window& windowImpl = Dali::GetImplementation( window );
+ return windowImpl.GrabKey( daliKey, TOPMOST );
+}
+
+bool UngrabKeyTopmost( Window window, Dali::KEY daliKey )
+{
+ Dali::Internal::Adaptor::Window& windowImpl = Dali::GetImplementation( window );
+ return windowImpl.UngrabKey( daliKey );
+}
+
+bool GrabKey( Window window, Dali::KEY daliKey, KeyGrabMode grabMode )
+{
+ Dali::Internal::Adaptor::Window& windowImpl = Dali::GetImplementation( window );
+ return windowImpl.GrabKey( daliKey, grabMode );
+}
+
+
+bool UngrabKey( Window window, Dali::KEY daliKey )
+{
+ Dali::Internal::Adaptor::Window& windowImpl = Dali::GetImplementation( window );
+ return windowImpl.UngrabKey( daliKey );
+}
+
+
+bool GrabKeyList( Window window, const Dali::Vector<Dali::KEY>& daliKeyVector, const Dali::Vector<KeyGrabMode>& grabModeVector, Dali::Vector<bool>& returnVector)
+{
+ Dali::Internal::Adaptor::Window& windowImpl = Dali::GetImplementation( window );
+ return windowImpl.GrabKeyList( daliKeyVector, grabModeVector, returnVector );
+}
+
+bool UngrabKeyList( Window window, const Dali::Vector<Dali::KEY>& daliKeyVector, Dali::Vector<bool>& returnVector)
+{
+ Dali::Internal::Adaptor::Window& windowImpl = Dali::GetImplementation( window );
+ return windowImpl.UngrabKeyList( daliKeyVector, returnVector );
+}
+
+} // namespace KeyGrab
+
+} // namespace Dali
+
${adaptor_input_dir}/common/drag-and-drop-detector-impl.cpp \
${adaptor_input_dir}/common/gesture-manager.cpp \
${adaptor_input_dir}/common/input-method-context-impl.cpp \
+ ${adaptor_input_dir}/common/key-grab.cpp \
${adaptor_input_dir}/common/key-impl.cpp \
${adaptor_input_dir}/common/long-press-gesture-detector.cpp \
${adaptor_input_dir}/common/pan-gesture-detector-base.cpp \
adaptor_input_tizen_wayland_src_files=\
${adaptor_input_dir}/tizen-wayland/input-method-context-factory-ecore-wl.cpp \
${adaptor_input_dir}/tizen-wayland/input-method-context-impl-ecore-wl.cpp \
- ${adaptor_input_dir}/tizen-wayland/key-grab-ecore-wl.cpp \
${adaptor_input_dir}/tizen-wayland/key-mapping-ecore-wl.cpp \
${adaptor_input_dir}/tizen-wayland/virtual-keyboard-impl-ecore-wl.cpp
adaptor_input_ubuntu_x11_src_files=\
${adaptor_input_dir}/ubuntu-x11/input-method-context-factory-x.cpp \
${adaptor_input_dir}/ubuntu-x11/input-method-context-impl-x.cpp \
- ${adaptor_input_dir}/ubuntu-x11/virtual-keyboard-impl-x.cpp
\ No newline at end of file
+ ${adaptor_input_dir}/ubuntu-x11/virtual-keyboard-impl-x.cpp
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/public-api/adaptor-framework/key-grab.h>
-
-// EXTERNAL INCLUDES
-#include <Ecore_Wayland.h>
-#include <dali/integration-api/debug.h>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/adaptor-framework/window.h>
-#include <dali/internal/input/common/key-impl.h>
-
-#include <iostream>
-#include <string.h>
-
-using namespace std;
-
-namespace Dali
-{
-
-namespace KeyGrab
-{
-
-bool GrabKeyTopmost( Window window, Dali::KEY daliKey )
-{
- return GrabKey( window, daliKey, TOPMOST);
-}
-
-
-bool UngrabKeyTopmost( Window window, Dali::KEY daliKey )
-{
- return UngrabKey( window, daliKey );
-}
-
-
-bool GrabKey( Window window, Dali::KEY daliKey, KeyGrabMode grabMode )
-{
- Ecore_Wl_Window_Keygrab_Mode wlGrabMode;
- if( grabMode == TOPMOST )
- {
- wlGrabMode = ECORE_WL_WINDOW_KEYGRAB_TOPMOST;
- }
- else if( grabMode == SHARED )
- {
- wlGrabMode = ECORE_WL_WINDOW_KEYGRAB_SHARED;
- }
- else if( grabMode == OVERRIDE_EXCLUSIVE )
- {
- wlGrabMode = ECORE_WL_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
- }
- else if( grabMode == EXCLUSIVE )
- {
- wlGrabMode = ECORE_WL_WINDOW_KEYGRAB_EXCLUSIVE;
- }
- else
- {
- return false;
- }
-
- return ecore_wl_window_keygrab_set( AnyCast<Ecore_Wl_Window*>( window.GetNativeHandle() ),
- Dali::Internal::Adaptor::KeyLookup::GetKeyName( daliKey ),
- 0, 0, 0, wlGrabMode );
-}
-
-
-bool UngrabKey( Window window, Dali::KEY daliKey )
-{
- return ecore_wl_window_keygrab_unset( AnyCast<Ecore_Wl_Window*>( window.GetNativeHandle() ),
- Dali::Internal::Adaptor::KeyLookup::GetKeyName( daliKey ),
- 0, 0 );
-}
-
-
-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;
-}
-
-} // namespace KeyGrab
-
-} // namespace Dali
-
// INTERNAL INCLUDES
#include <dali/public-api/adaptor-framework/window.h>
+#include <dali/public-api/adaptor-framework/key-grab.h>
#include <dali/internal/window-system/common/indicator-interface.h>
// EXTERNAL INCLUDES
*/
virtual int GetBrightness() const = 0;
+ /**
+ * @copydoc Dali::KeyGrab::GrabKey()
+ */
+ virtual bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode ) = 0;
+
+ /**
+ * @copydoc Dali::KeyGrab::UngrabKey()
+ */
+ virtual bool UngrabKey( Dali::KEY key ) = 0;
+
+ /**
+ * @copydoc Dali::KeyGrab::GrabKeyList()
+ */
+ virtual bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result ) = 0;
+
+ /**
+ * @copydoc Dali::KeyGrab::UngrabKeyList()
+ */
+ virtual bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ) = 0;
+
protected:
// Undefined
mSurface->SetTransparency( transparent );
}
+bool Window::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
+{
+ return mWindowBase->GrabKey( key, grabMode );
+}
+
+bool Window::UngrabKey( Dali::KEY key )
+{
+ return mWindowBase->UngrabKey( key );
+}
+
+bool Window::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
+{
+ return mWindowBase->GrabKeyList( key, grabMode, result );
+}
+
+bool Window::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
+{
+ return mWindowBase->UngrabKeyList( key, result );
+}
+
void Window::RotationDone( int orientation, int width, int height )
{
mSurface->RequestRotation( orientation, width, height );
#include <dali/internal/window-system/common/indicator-interface.h>
#include <dali/internal/adaptor/common/adaptor-impl.h>
#include <dali/public-api/adaptor-framework/window.h>
+#include <dali/public-api/adaptor-framework/key-grab.h>
#include <dali/devel-api/adaptor-framework/drag-and-drop-detector.h>
namespace Dali
void SetTransparency( bool transparent );
/**
+ * @copydoc Dali::KeyGrab::GrabKey()
+ */
+ bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode );
+
+ /**
+ * @copydoc Dali::KeyGrab::UngrabKey()
+ */
+ bool UngrabKey( Dali::KEY key );
+
+ /**
+ * @copydoc Dali::KeyGrab::GrabKeyList()
+ */
+ bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result );
+
+ /**
+ * @copydoc Dali::KeyGrab::UngrabKeyList()
+ */
+ bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result );
+
+ /**
* Called from Orientation after the Change signal has been sent
*/
void RotationDone( int orientation, int width, int height );
// INTERNAL HEADERS
#include <dali/internal/window-system/common/window-impl.h>
#include <dali/internal/window-system/tizen-wayland/window-render-surface-ecore-wl.h>
+#include <dali/internal/input/common/key-impl.h>
// EXTERNAL_HEADERS
#include <dali/public-api/object/any.h>
return mBrightness;
}
+bool WindowBaseEcoreWl::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
+{
+ Ecore_Wl_Window_Keygrab_Mode mode;
+
+ switch( grabMode )
+ {
+ case KeyGrab::TOPMOST:
+ {
+ mode = ECORE_WL_WINDOW_KEYGRAB_TOPMOST;
+ break;
+ }
+ case KeyGrab::SHARED:
+ {
+ mode = ECORE_WL_WINDOW_KEYGRAB_SHARED;
+ break;
+ }
+ case KeyGrab::OVERRIDE_EXCLUSIVE:
+ {
+ mode = ECORE_WL_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
+ break;
+ }
+ case KeyGrab::EXCLUSIVE:
+ {
+ mode = ECORE_WL_WINDOW_KEYGRAB_EXCLUSIVE;
+ break;
+ }
+ default:
+ {
+ return false;
+ }
+ }
+
+ return ecore_wl_window_keygrab_set( mEcoreWindow, KeyLookup::GetKeyName( key ), 0, 0, 0, mode );
+}
+
+bool WindowBaseEcoreWl::UngrabKey( Dali::KEY key )
+{
+ return ecore_wl_window_keygrab_unset( mEcoreWindow, KeyLookup::GetKeyName( key ), 0, 0 );
+}
+
+bool WindowBaseEcoreWl::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
+{
+ int keyCount = key.Count();
+ int keyGrabModeCount = grabMode.Count();
+
+ if( keyCount != keyGrabModeCount || keyCount == 0 )
+ {
+ return false;
+ }
+
+ eina_init();
+
+ Eina_List* keyList = NULL;
+ Ecore_Wl_Window_Keygrab_Info* info = new Ecore_Wl_Window_Keygrab_Info[keyCount];
+
+ for( int index = 0; index < keyCount; ++index )
+ {
+ info[index].key = const_cast< char* >( KeyLookup::GetKeyName( key[index] ) );
+
+ switch( grabMode[index] )
+ {
+ case KeyGrab::TOPMOST:
+ {
+ info[index].mode = ECORE_WL_WINDOW_KEYGRAB_TOPMOST;
+ break;
+ }
+ case KeyGrab::SHARED:
+ {
+ info[index].mode = ECORE_WL_WINDOW_KEYGRAB_SHARED;
+ break;
+ }
+ case KeyGrab::OVERRIDE_EXCLUSIVE:
+ {
+ info[index].mode = ECORE_WL_WINDOW_KEYGRAB_OVERRIDE_EXCLUSIVE;
+ break;
+ }
+ case KeyGrab::EXCLUSIVE:
+ {
+ info[index].mode = ECORE_WL_WINDOW_KEYGRAB_EXCLUSIVE;
+ break;
+ }
+ default:
+ {
+ info[index].mode = ECORE_WL_WINDOW_KEYGRAB_UNKNOWN;
+ break;
+ }
+ }
+
+ keyList = eina_list_append( keyList, &info );
+ }
+
+ Eina_List* grabList = ecore_wl_window_keygrab_list_set( mEcoreWindow, keyList );
+
+ result.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 )
+ {
+ int 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 )
+ {
+ result[index] = false;
+ }
+ ++index;
+ }
+ }
+ }
+
+ delete [] info;
+
+ eina_list_free( keyList );
+ eina_list_free( grabList );
+ eina_shutdown();
+
+ return true;
+}
+
+bool WindowBaseEcoreWl::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
+{
+ int keyCount = key.Count();
+ if( keyCount == 0 )
+ {
+ return false;
+ }
+
+ eina_init();
+
+ Eina_List* keyList = NULL;
+ Ecore_Wl_Window_Keygrab_Info* info = new Ecore_Wl_Window_Keygrab_Info[keyCount];
+
+ for( int index = 0; index < keyCount; ++index )
+ {
+ info[index].key = const_cast< char* >( KeyLookup::GetKeyName( key[index] ) );
+ keyList = eina_list_append( keyList, &info );
+ }
+
+ Eina_List* ungrabList = ecore_wl_window_keygrab_list_unset( mEcoreWindow, keyList );
+
+ result.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 )
+ {
+ int index = 0;
+ EINA_LIST_FOREACH( keyList, l, listData )
+ {
+ if( strcmp( static_cast< char* >( data ), static_cast< Ecore_Wl_Window_Keygrab_Info* >( listData )->key ) == 0 )
+ {
+ result[index] = false;
+ }
+ ++index;
+ }
+ }
+ }
+
+ delete [] info;
+
+ eina_list_free( keyList );
+ eina_list_free( ungrabList );
+ eina_shutdown();
+
+ return true;
+}
+
} // namespace Adaptor
} // namespace Internal
*/
virtual int GetBrightness() const override;
+ /**
+ * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
+ */
+ virtual bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode ) override;
+
+ /**
+ * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
+ */
+ virtual bool UngrabKey( Dali::KEY key ) override;
+
+ /**
+ * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
+ */
+ virtual bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result ) override;
+
+ /**
+ * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
+ */
+ virtual bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ) override;
+
protected:
// Undefined
return 0;
}
+bool WindowBaseEcoreX::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
+{
+ return false;
+}
+
+bool WindowBaseEcoreX::UngrabKey( Dali::KEY key )
+{
+ return false;
+}
+
+bool WindowBaseEcoreX::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
+{
+ return false;
+}
+
+bool WindowBaseEcoreX::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
+{
+ return false;
+}
+
} // namespace Adaptor
} // namespace Internal
*/
virtual int GetBrightness() const override;
+ /**
+ * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
+ */
+ virtual bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode ) override;
+
+ /**
+ * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
+ */
+ virtual bool UngrabKey( Dali::KEY key ) override;
+
+ /**
+ * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
+ */
+ virtual bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result ) override;
+
+ /**
+ * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
+ */
+ virtual bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ) override;
+
protected:
// Undefined