From 84db45cb2651d81301b5c3d1c3f977c13895c253 Mon Sep 17 00:00:00 2001 From: "joogab.yun" Date: Fri, 25 Aug 2023 13:49:32 +0900 Subject: [PATCH] Binding ecore_wl2_window_keyboard_grab and ecore_wl2_window_keyboard_ungrab api Change-Id: I844fc244b91468549649e801ac49b3ddcbebbe87 --- dali/devel-api/adaptor-framework/window-devel.cpp | 10 ++++++ dali/devel-api/adaptor-framework/window-devel.h | 17 ++++++++++ .../window-system/android/window-base-android.cpp | 10 ++++++ .../window-system/android/window-base-android.h | 10 ++++++ dali/internal/window-system/common/window-base.h | 16 ++++++++++ dali/internal/window-system/common/window-impl.cpp | 10 ++++++ dali/internal/window-system/common/window-impl.h | 10 ++++++ .../internal/window-system/macos/window-base-mac.h | 10 ++++++ .../window-system/macos/window-base-mac.mm | 10 ++++++ .../tizen-wayland/ecore-wl/window-base-ecore-wl.h | 10 ++++++ .../ecore-wl2/window-base-ecore-wl2.cpp | 37 ++++++++++++++++++++++ .../ecore-wl2/window-base-ecore-wl2.h | 10 ++++++ .../ubuntu-x11/window-base-ecore-x.cpp | 10 ++++++ .../window-system/ubuntu-x11/window-base-ecore-x.h | 10 ++++++ .../window-system/windows/window-base-win.cpp | 10 ++++++ .../window-system/windows/window-base-win.h | 10 ++++++ dali/internal/window-system/x11/window-base-x.cpp | 10 ++++++ dali/internal/window-system/x11/window-base-x.h | 10 ++++++ 18 files changed, 220 insertions(+) diff --git a/dali/devel-api/adaptor-framework/window-devel.cpp b/dali/devel-api/adaptor-framework/window-devel.cpp index e5ef80f..fdde5a7 100644 --- a/dali/devel-api/adaptor-framework/window-devel.cpp +++ b/dali/devel-api/adaptor-framework/window-devel.cpp @@ -329,6 +329,16 @@ void CursorVisibleSet(Window window, bool visible) GetImplementation(window).CursorVisibleSet(visible); } +bool KeyboardGrab(Window window, Device::Subclass::Type deviceSubclass) +{ + return GetImplementation(window).KeyboardGrab(deviceSubclass); +} + +bool KeyboardUnGrab(Window window) +{ + return GetImplementation(window).KeyboardUnGrab(); +} + InterceptKeyEventSignalType& InterceptKeyEventSignal(Window window) { return GetImplementation(window).InterceptKeyEventSignal(); diff --git a/dali/devel-api/adaptor-framework/window-devel.h b/dali/devel-api/adaptor-framework/window-devel.h index 994ea50..ace275e 100644 --- a/dali/devel-api/adaptor-framework/window-devel.h +++ b/dali/devel-api/adaptor-framework/window-devel.h @@ -592,6 +592,23 @@ DALI_ADAPTOR_API bool PointerWarp(Window window, int32_t x, int32_t y); DALI_ADAPTOR_API void CursorVisibleSet(Window window, bool visible); /** + * @brief Requests grab key events according to the requested device subtype + * + * @param[in] window The window instance. + * @param[in] deviceSubclass The deviceSubclass type. + * @return Returns true if KeyboardGrab succeeds. + */ +DALI_ADAPTOR_API bool KeyboardGrab(Window window, Device::Subclass::Type deviceSubclass); + +/** + * @brief Requests ungrab key events + * + * @param[in] window The window instance. + * @return Returns true if KeyboardUnGrab succeeds. + */ +DALI_ADAPTOR_API bool KeyboardUnGrab(Window window); + +/** * @brief The user would connect to this signal to intercept a KeyEvent at window. * * Intercepts KeyEvents in the window before dispatching KeyEvents to the control. diff --git a/dali/internal/window-system/android/window-base-android.cpp b/dali/internal/window-system/android/window-base-android.cpp index 7355b7f..c2cbdf4 100644 --- a/dali/internal/window-system/android/window-base-android.cpp +++ b/dali/internal/window-system/android/window-base-android.cpp @@ -459,6 +459,16 @@ void WindowBaseAndroid::CursorVisibleSet(bool visible) { } +bool WindowBaseAndroid::KeyboardGrab(Device::Subclass::Type deviceSubclass) +{ + return false; +} + +bool WindowBaseAndroid::KeyboardUnGrab() +{ + return false; +} + } // namespace Adaptor } // namespace Internal diff --git a/dali/internal/window-system/android/window-base-android.h b/dali/internal/window-system/android/window-base-android.h index abd3de4..c2a183c 100644 --- a/dali/internal/window-system/android/window-base-android.h +++ b/dali/internal/window-system/android/window-base-android.h @@ -484,6 +484,16 @@ public: */ void CursorVisibleSet(bool visible) override; + /** + * @copydoc Dali::Internal::Adaptor::WindowBase::KeyboardGrab() + */ + bool KeyboardGrab(Device::Subclass::Type deviceSubclass) override; + + /** + * @copydoc Dali::Internal::Adaptor::WindowBase::KeyboardUnGrab() + */ + bool KeyboardUnGrab() override; + private: /** * Second stage initialization diff --git a/dali/internal/window-system/common/window-base.h b/dali/internal/window-system/common/window-base.h index 204fdad..d9aca61 100644 --- a/dali/internal/window-system/common/window-base.h +++ b/dali/internal/window-system/common/window-base.h @@ -513,6 +513,22 @@ public: */ virtual void CursorVisibleSet(bool visible) = 0; + /** + * @brief Requests grab key events according to the requested device subtype + * + * @param[in] deviceSubclass The deviceSubclass type. + * @return Returns true if KeyboardGrab succeeds. + */ + virtual bool KeyboardGrab(Device::Subclass::Type deviceSubclass) = 0; + + /** + * @brief Requests ungrab key events + * + * @param[in] window The window instance. + * @return Returns true if KeyboardUnGrab succeeds. + */ + virtual bool KeyboardUnGrab() = 0; + // Signals /** diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index 332bbd4..ed618c2 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -1435,6 +1435,16 @@ void Window::CursorVisibleSet(bool visible) mWindowBase->CursorVisibleSet(visible); } +bool Window::KeyboardGrab(Device::Subclass::Type deviceSubclass) +{ + return mWindowBase->KeyboardGrab(deviceSubclass); +} + +bool Window::KeyboardUnGrab() +{ + return mWindowBase->KeyboardUnGrab(); +} + } // namespace Adaptor } // namespace Internal diff --git a/dali/internal/window-system/common/window-impl.h b/dali/internal/window-system/common/window-impl.h index 2b9b367..c9f558e 100644 --- a/dali/internal/window-system/common/window-impl.h +++ b/dali/internal/window-system/common/window-impl.h @@ -541,6 +541,16 @@ public: // Dali::Internal::Adaptor::SceneHolder */ void CursorVisibleSet(bool visible); + /** + * @copydoc Dali::DevelWindow::KeyboardGrab() + */ + bool KeyboardGrab(Device::Subclass::Type deviceSubclass); + + /** + * @copydoc Dali::DevelWindow::KeyboardUnGrab() + */ + bool KeyboardUnGrab(); + private: /** * @brief Enumeration for orietation mode. diff --git a/dali/internal/window-system/macos/window-base-mac.h b/dali/internal/window-system/macos/window-base-mac.h index 4a3390a..0cfa0cc 100644 --- a/dali/internal/window-system/macos/window-base-mac.h +++ b/dali/internal/window-system/macos/window-base-mac.h @@ -417,6 +417,16 @@ public: */ void CursorVisibleSet(bool visible) override; + /** + * @copydoc Dali::Internal::Adaptor::WindowBase::KeyboardGrab() + */ + bool KeyboardGrab(Device::Subclass::Type deviceSubclass) override; + + /** + * @copydoc Dali::Internal::Adaptor::WindowBase::KeyboardUnGrab() + */ + bool KeyboardUnGrab() override; + private: // Undefined WindowBaseCocoa(const WindowBaseCocoa&) = delete; diff --git a/dali/internal/window-system/macos/window-base-mac.mm b/dali/internal/window-system/macos/window-base-mac.mm index 43cc053..588c62a 100644 --- a/dali/internal/window-system/macos/window-base-mac.mm +++ b/dali/internal/window-system/macos/window-base-mac.mm @@ -750,6 +750,16 @@ void WindowBaseCocoa::CursorVisibleSet(bool visible) { } +bool WindowBaseCocoa::KeyboardGrab(Device::Subclass::Type deviceSubclass) +{ + return false; +} + +bool WindowBaseCocoa::KeyboardUnGrab() +{ + return false; +} + } // namespace Dali::Internal::Adaptor @implementation CocoaView diff --git a/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.h b/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.h index 177ea76..9621acd 100644 --- a/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.h +++ b/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.h @@ -539,6 +539,16 @@ public: */ void CursorVisibleSet(bool visible) override; + /** + * @copydoc Dali::Internal::Adaptor::WindowBase::KeyboardGrab() + */ + bool KeyboardGrab(Device::Subclass::Type deviceSubclass) override; + + /** + * @copydoc Dali::Internal::Adaptor::WindowBase::KeyboardUnGrab() + */ + bool KeyboardUnGrab() override; + private: /** * Second stage initialization diff --git a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp index 3120694..34e019e 100644 --- a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp +++ b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp @@ -3413,6 +3413,43 @@ void WindowBaseEcoreWl2::CursorVisibleSet(bool visible) ecore_wl2_window_cursor_visible_set(mEcoreWindow, visible); } +// Request grab key events according to the requested device subtype +//(For now, subtype could be '0'/'11'/'12' which equals to ECORE_DEVICE_SUBCLASS_NONE/REMOCON/VIRTUAL_KEYBOARD) +bool WindowBaseEcoreWl2::KeyboardGrab(Device::Subclass::Type deviceSubclass) +{ + Ecore_Device_Subclass ecoreDeviceSubclass; + switch(deviceSubclass) + { + case Device::Subclass::NONE: + { + ecoreDeviceSubclass = ECORE_DEVICE_SUBCLASS_NONE; + break; + } + case Device::Subclass::REMOCON: + { + ecoreDeviceSubclass = ECORE_DEVICE_SUBCLASS_REMOCON; + break; + } + case Device::Subclass::VIRTUAL_KEYBOARD: + { + ecoreDeviceSubclass = ECORE_DEVICE_SUBCLASS_VIRTUAL_KEYBOARD; + break; + } + default: + { + DALI_LOG_ERROR("deviceSubclass : %d type is not support, subtype could be 'NONE', 'REMOCON', 'VIRTUAL_KEYBOARD'\n"); + return false; + } + } + return ecore_wl2_window_keyboard_grab(mEcoreWindow, ecoreDeviceSubclass); +} + +// Request ungrab key events +bool WindowBaseEcoreWl2::KeyboardUnGrab() +{ + return ecore_wl2_window_keyboard_ungrab(mEcoreWindow); +} + } // namespace Adaptor } // namespace Internal diff --git a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h index 7240bff..271c518 100644 --- a/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h +++ b/dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h @@ -616,6 +616,16 @@ public: */ void CursorVisibleSet(bool visible) override; + /** + * @copydoc Dali::Internal::Adaptor::WindowBase::KeyboardGrab() + */ + bool KeyboardGrab(Device::Subclass::Type deviceSubclass) override; + + /** + * @copydoc Dali::Internal::Adaptor::WindowBase::KeyboardUnGrab() + */ + bool KeyboardUnGrab() override; + private: /** * Second stage initialization diff --git a/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp b/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp index e0b6e23..1b91b48 100644 --- a/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp +++ b/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp @@ -1046,6 +1046,16 @@ void WindowBaseEcoreX::CursorVisibleSet(bool visible) { } +bool WindowBaseEcoreX::KeyboardGrab(Device::Subclass::Type deviceSubclass) +{ + return false; +} + +bool WindowBaseEcoreX::KeyboardUnGrab() +{ + return false; +} + } // namespace Adaptor } // namespace Internal diff --git a/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h b/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h index 493a74b..b5330f4 100644 --- a/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h +++ b/dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h @@ -489,6 +489,16 @@ public: */ void CursorVisibleSet(bool visible) override; + /** + * @copydoc Dali::Internal::Adaptor::WindowBase::KeyboardGrab() + */ + bool KeyboardGrab(Device::Subclass::Type deviceSubclass) override; + + /** + * @copydoc Dali::Internal::Adaptor::WindowBase::KeyboardUnGrab() + */ + bool KeyboardUnGrab() override; + private: /** * Second stage initialization diff --git a/dali/internal/window-system/windows/window-base-win.cpp b/dali/internal/window-system/windows/window-base-win.cpp index 7d71d49..8f78ca7 100644 --- a/dali/internal/window-system/windows/window-base-win.cpp +++ b/dali/internal/window-system/windows/window-base-win.cpp @@ -681,6 +681,16 @@ void WindowBaseWin::CursorVisibleSet(bool visible) { } +bool WindowBaseWin::KeyboardGrab(Device::Subclass::Type deviceSubclass) +{ + return false; +} + +bool WindowBaseWin::KeyboardUnGrab() +{ + return false; +} + } // namespace Adaptor } // namespace Internal diff --git a/dali/internal/window-system/windows/window-base-win.h b/dali/internal/window-system/windows/window-base-win.h index 6006907..d615730 100644 --- a/dali/internal/window-system/windows/window-base-win.h +++ b/dali/internal/window-system/windows/window-base-win.h @@ -471,6 +471,16 @@ public: */ void CursorVisibleSet(bool visible) override; + /** + * @copydoc Dali::Internal::Adaptor::WindowBase::KeyboardGrab() + */ + bool KeyboardGrab(Device::Subclass::Type deviceSubclass) override; + + /** + * @copydoc Dali::Internal::Adaptor::WindowBase::KeyboardUnGrab() + */ + bool KeyboardUnGrab() override; + private: /** * Second stage initialization diff --git a/dali/internal/window-system/x11/window-base-x.cpp b/dali/internal/window-system/x11/window-base-x.cpp index 7a66fb5..1f21851 100644 --- a/dali/internal/window-system/x11/window-base-x.cpp +++ b/dali/internal/window-system/x11/window-base-x.cpp @@ -982,6 +982,16 @@ void WindowBaseX::CursorVisibleSet(bool visible) { } +bool WindowBaseX::KeyboardGrab(Device::Subclass::Type deviceSubclass) +{ + return false; +} + +bool WindowBaseX::KeyboardUnGrab() +{ + return false; +} + } // namespace Adaptor } // namespace Internal diff --git a/dali/internal/window-system/x11/window-base-x.h b/dali/internal/window-system/x11/window-base-x.h index aa60298..f102627 100644 --- a/dali/internal/window-system/x11/window-base-x.h +++ b/dali/internal/window-system/x11/window-base-x.h @@ -493,6 +493,16 @@ public: */ void CursorVisibleSet(bool visible) override; + /** + * @copydoc Dali::Internal::Adaptor::WindowBase::KeyboardGrab() + */ + bool KeyboardGrab(Device::Subclass::Type deviceSubclass) override; + + /** + * @copydoc Dali::Internal::Adaptor::WindowBase::KeyboardUnGrab() + */ + bool KeyboardUnGrab() override; + private: /** * Second stage initialization -- 2.7.4