From 7374cfcd389816802d4d0f5b3261ddcdb1e4a33e Mon Sep 17 00:00:00 2001 From: "joogab.yun" Date: Tue, 19 Dec 2023 19:48:26 +0900 Subject: [PATCH] [Tizen] Add Get/Set native window id on SceneHoder and Window Change-Id: I355ef2207dcbb386ab29ee237d14bfc860a65791 --- dali/devel-api/adaptor-framework/window-devel.h | 2 +- dali/integration-api/adaptor-framework/scene-holder-impl.cpp | 5 +++++ dali/integration-api/adaptor-framework/scene-holder-impl.h | 5 +++++ dali/integration-api/adaptor-framework/scene-holder.cpp | 5 +++++ dali/integration-api/adaptor-framework/scene-holder.h | 7 +++++++ dali/internal/window-system/common/gl-window-impl.cpp | 3 ++- dali/internal/window-system/common/window-impl.cpp | 3 +++ dali/internal/window-system/macos/window-base-mac.mm | 1 + .../window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.cpp | 2 ++ .../tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp | 2 ++ dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp | 2 ++ dali/internal/window-system/windows/window-base-win.cpp | 2 ++ dali/internal/window-system/x11/window-base-x.cpp | 1 + 13 files changed, 38 insertions(+), 2 deletions(-) diff --git a/dali/devel-api/adaptor-framework/window-devel.h b/dali/devel-api/adaptor-framework/window-devel.h index 2a92b07..7b63e0b 100644 --- a/dali/devel-api/adaptor-framework/window-devel.h +++ b/dali/devel-api/adaptor-framework/window-devel.h @@ -261,7 +261,7 @@ DALI_ADAPTOR_API int GetPhysicalOrientation(Window window); DALI_ADAPTOR_API void SetAvailableOrientations(Window window, const Dali::Vector& orientations); /** - * @brief Gets current window ID. + * @brief Gets the native window id. * * @param[in] window The window instance */ diff --git a/dali/integration-api/adaptor-framework/scene-holder-impl.cpp b/dali/integration-api/adaptor-framework/scene-holder-impl.cpp index 5b82cc7..011b87f 100644 --- a/dali/integration-api/adaptor-framework/scene-holder-impl.cpp +++ b/dali/integration-api/adaptor-framework/scene-holder-impl.cpp @@ -436,6 +436,11 @@ bool SceneHolder::IsGeometryHittestEnabled() return mScene.IsGeometryHittestEnabled(); } +int32_t SceneHolder::GetNativeId() const +{ + return mScene.GetNativeId(); +} + void SceneHolder::AddFrameRenderedCallback(std::unique_ptr callback, int32_t frameId) { mScene.AddFrameRenderedCallback(std::move(callback), frameId); diff --git a/dali/integration-api/adaptor-framework/scene-holder-impl.h b/dali/integration-api/adaptor-framework/scene-holder-impl.h index a0eafa8..144bc13 100644 --- a/dali/integration-api/adaptor-framework/scene-holder-impl.h +++ b/dali/integration-api/adaptor-framework/scene-holder-impl.h @@ -221,6 +221,11 @@ public: bool IsGeometryHittestEnabled(); /** + * @copydoc Dali::Integration::SceneHolder::GetNativeId + */ + int32_t GetNativeId() const; + + /** * @brief Adds a callback that is called when the frame rendering is done by the graphics driver. * * @param[in] callback The function to call diff --git a/dali/integration-api/adaptor-framework/scene-holder.cpp b/dali/integration-api/adaptor-framework/scene-holder.cpp index 860169a..188b936 100644 --- a/dali/integration-api/adaptor-framework/scene-holder.cpp +++ b/dali/integration-api/adaptor-framework/scene-holder.cpp @@ -123,6 +123,11 @@ RenderTaskList SceneHolder::GetRenderTaskList() return GetImplementation(*this).GetRenderTaskList(); } +int32_t SceneHolder::GetNativeId() const +{ + return GetImplementation(*this).GetNativeId(); +} + SceneHolder SceneHolder::Get(Actor actor) { return Internal::Adaptor::SceneHolder::Get(actor); diff --git a/dali/integration-api/adaptor-framework/scene-holder.h b/dali/integration-api/adaptor-framework/scene-holder.h index 5f3fc21..b7a4bd4 100644 --- a/dali/integration-api/adaptor-framework/scene-holder.h +++ b/dali/integration-api/adaptor-framework/scene-holder.h @@ -200,6 +200,13 @@ public: RenderTaskList GetRenderTaskList(); /** + * @brief Gets the native window id + * + * @return The native window id + */ + int32_t GetNativeId() const; + + /** * @brief Retrieve the SceneHolder that the given actor is added to. * * @param[in] actor The actor diff --git a/dali/internal/window-system/common/gl-window-impl.cpp b/dali/internal/window-system/common/gl-window-impl.cpp index 1a33ca2..4e993e0 100644 --- a/dali/internal/window-system/common/gl-window-impl.cpp +++ b/dali/internal/window-system/common/gl-window-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * Copyright (c) 2023 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. @@ -511,6 +511,7 @@ void GlWindow::OnWheelEvent(Dali::Integration::WheelEvent& wheelEvent) void GlWindow::OnKeyEvent(Dali::Integration::KeyEvent& keyEvent) { Dali::KeyEvent event = Dali::DevelKeyEvent::New(keyEvent.keyName, keyEvent.logicalKey, keyEvent.keyString, keyEvent.keyCode, keyEvent.keyModifier, keyEvent.time, static_cast(keyEvent.state), keyEvent.compose, keyEvent.deviceName, keyEvent.deviceClass, keyEvent.deviceSubclass); + Dali::DevelKeyEvent::SetWindowId(event, keyEvent.windowId); Dali::GlWindow handle(this); mKeyEventSignal.Emit(event); } diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index 5ba1cf4..3ff5ecd 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -258,6 +258,8 @@ void Window::OnAdaptorSet(Dali::Adaptor& adaptor) { bool isGeometry = Dali::Internal::Adaptor::WindowSystem::IsGeometryHittestEnabled(); mScene.SetGeometryHittestEnabled(isGeometry); + + mScene.SetNativeId(GetNativeId()); } // If you call the 'Show' before creating the adaptor, the application cannot know the app resource id. @@ -1089,6 +1091,7 @@ void Window::OnWheelEvent(Dali::Integration::WheelEvent& wheelEvent) void Window::OnKeyEvent(Dali::Integration::KeyEvent& keyEvent) { mLastKeyEvent = Dali::DevelKeyEvent::New(keyEvent.keyName, keyEvent.logicalKey, keyEvent.keyString, keyEvent.keyCode, keyEvent.keyModifier, keyEvent.time, static_cast(keyEvent.state), keyEvent.compose, keyEvent.deviceName, keyEvent.deviceClass, keyEvent.deviceSubclass); + DevelKeyEvent::SetWindowId(mLastKeyEvent, keyEvent.windowId); FeedKeyEvent(keyEvent); } diff --git a/dali/internal/window-system/macos/window-base-mac.mm b/dali/internal/window-system/macos/window-base-mac.mm index f7ee40c..52a049b 100644 --- a/dali/internal/window-system/macos/window-base-mac.mm +++ b/dali/internal/window-system/macos/window-base-mac.mm @@ -287,6 +287,7 @@ void WindowBaseCocoa::Impl::OnKey(NSEvent *event, Integration::KeyEvent::State k "WindowBaseCocoa::Impl::OnKey(%s)\n", [event.characters UTF8String] ); + keyEvent.windowId = mThis->GetNativeWindowId(); mThis->mKeyEventSignal.Emit(keyEvent); } diff --git a/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.cpp b/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.cpp index 1d7ae2b..ecd3ec6 100644 --- a/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.cpp +++ b/dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.cpp @@ -986,6 +986,7 @@ void WindowBaseEcoreWl::OnKeyDown(void* data, int type, void* event) GetDeviceSubclass(ecore_device_subclass_get(keyEvent->dev), deviceSubclass); Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::DOWN, compose, deviceName, deviceClass, deviceSubclass); + keyEvent.windowId = GetNativeWindowId(); mKeyEventSignal.Emit(keyEvent); } @@ -1049,6 +1050,7 @@ void WindowBaseEcoreWl::OnKeyUp(void* data, int type, void* event) GetDeviceSubclass(ecore_device_subclass_get(keyEvent->dev), deviceSubclass); Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::UP, compose, deviceName, deviceClass, deviceSubclass); + keyEvent.windowId = GetNativeWindowId(); mKeyEventSignal.Emit(keyEvent); } 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 2800176..9f02a2a 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 @@ -1540,6 +1540,7 @@ void WindowBaseEcoreWl2::OnKeyDown(void* data, int type, void* event) Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::DOWN, compose, deviceName, deviceClass, deviceSubclass); keyEvent.isRepeat = isRepeat; + keyEvent.windowId = GetNativeWindowId(); mKeyEventSignal.Emit(keyEvent); } @@ -1611,6 +1612,7 @@ void WindowBaseEcoreWl2::OnKeyUp(void* data, int type, void* event) GetDeviceSubclass(ecore_device_subclass_get(keyEvent->dev), deviceSubclass); Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::UP, compose, deviceName, deviceClass, deviceSubclass); + keyEvent.windowId = GetNativeWindowId(); mKeyEventSignal.Emit(keyEvent); } 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 fa085a4..daf5247 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 @@ -565,6 +565,7 @@ void WindowBaseEcoreX::OnKeyDown(void* data, int type, void* event) } Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::DOWN, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS); + keyEvent.windowId = GetNativeWindowId(); mKeyEventSignal.Emit(keyEvent); } @@ -605,6 +606,7 @@ void WindowBaseEcoreX::OnKeyUp(void* data, int type, void* event) } Integration::KeyEvent keyEvent(keyName, logicalKey, keyString, keyCode, modifier, time, Integration::KeyEvent::UP, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS); + keyEvent.windowId = GetNativeWindowId(); mKeyEventSignal.Emit(keyEvent); } diff --git a/dali/internal/window-system/windows/window-base-win.cpp b/dali/internal/window-system/windows/window-base-win.cpp index 1c3e8bf..7621a02 100644 --- a/dali/internal/window-system/windows/window-base-win.cpp +++ b/dali/internal/window-system/windows/window-base-win.cpp @@ -212,6 +212,7 @@ void WindowBaseWin::OnKeyDown(int type, TWinEventInfo* event) keyString.push_back(event->wParam); Integration::KeyEvent keyEvent(keyName, emptyString, keyString, keyCode, modifier, time, Integration::KeyEvent::DOWN, emptyString, emptyString, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS); + keyEvent.windowId = GetNativeWindowId(); mKeyEventSignal.Emit(keyEvent); } @@ -235,6 +236,7 @@ void WindowBaseWin::OnKeyUp(int type, TWinEventInfo* event) keyString.push_back(event->wParam); Integration::KeyEvent keyEvent(keyName, emptyString, keyString, keyCode, modifier, time, Integration::KeyEvent::UP, emptyString, emptyString, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS); + keyEvent.windowId = GetNativeWindowId(); mKeyEventSignal.Emit(keyEvent); } diff --git a/dali/internal/window-system/x11/window-base-x.cpp b/dali/internal/window-system/x11/window-base-x.cpp index da92eff..ab62841 100644 --- a/dali/internal/window-system/x11/window-base-x.cpp +++ b/dali/internal/window-system/x11/window-base-x.cpp @@ -559,6 +559,7 @@ Integration::KeyEvent WindowBaseX::CreateKeyEvent(WindowSystemX::X11KeyEvent* ke unsigned long time(keyEvent->timestamp); Integration::KeyEvent daliKeyEvent{keyName, logicalKey, keyString, keyCode, modifier, time, state, compose, DEFAULT_DEVICE_NAME, DEFAULT_DEVICE_CLASS, DEFAULT_DEVICE_SUBCLASS}; + daliKeyEvent.windowId = GetNativeWindowId(); return daliKeyEvent; } -- 2.7.4