From e384ee552b226f61a5b42cfae9c95f73a90abf1f Mon Sep 17 00:00:00 2001 From: Daekwang Ryu Date: Mon, 12 Jun 2023 13:30:59 +0900 Subject: [PATCH] Use WindowData in the constructors of Application and Window This patch makes Internal Application and Window use WindowData. This doesn't affect existing APIs. We don't need to add a New function in the Application anymore because of new parameter of Window. Change-Id: I7d211232f88ec1b3d6eaf6519dc61c79edb2c8ac --- .../adaptor-framework/application-devel.cpp | 11 ++++-- dali/devel-api/adaptor-framework/window-devel.cpp | 6 ++- dali/internal/adaptor/common/application-impl.cpp | 39 ++++++++++--------- dali/internal/adaptor/common/application-impl.h | 15 +++----- .../tizen-wayland/component-application-impl.cpp | 16 ++++---- .../tizen-wayland/component-application-impl.h | 8 ++-- .../tizen-wayland/component-application.cpp | 7 +++- .../tizen-wearable/watch-application-impl.cpp | 16 ++++---- .../tizen-wearable/watch-application-impl.h | 10 ++--- .../tizen-wearable/watch-application.cpp | 8 +++- .../android/widget-application-impl-android.cpp | 16 ++++---- .../android/widget-application-impl-android.h | 8 ++-- .../system/common/widget-application-impl.cpp | 16 ++++---- .../system/common/widget-application-impl.h | 7 ++-- .../system/macos/widget-application-impl-mac.cpp | 17 +++++---- .../system/macos/widget-application-impl-mac.h | 9 +++-- .../widget-application-impl-tizen.cpp | 30 ++++++++------- .../tizen-wayland/widget-application-impl-tizen.h | 10 +++-- .../ubuntu-x11/widget-application-impl-x.cpp | 16 ++++---- .../system/ubuntu-x11/widget-application-impl-x.h | 8 ++-- .../system/windows/widget-application-impl-win.cpp | 16 ++++---- .../system/windows/widget-application-impl-win.h | 8 ++-- dali/internal/window-system/common/window-impl.cpp | 10 ++--- dali/internal/window-system/common/window-impl.h | 12 ++---- dali/public-api/adaptor-framework/application.cpp | 44 ++++++++++++++-------- .../adaptor-framework/widget-application.cpp | 5 ++- dali/public-api/adaptor-framework/window.cpp | 11 +++++- dali/public-api/adaptor-framework/window.h | 12 ++++++ 28 files changed, 231 insertions(+), 160 deletions(-) diff --git a/dali/devel-api/adaptor-framework/application-devel.cpp b/dali/devel-api/adaptor-framework/application-devel.cpp index 886620a..11ab483 100644 --- a/dali/devel-api/adaptor-framework/application-devel.cpp +++ b/dali/devel-api/adaptor-framework/application-devel.cpp @@ -38,14 +38,19 @@ Application New(int* argc, char** argv[], const std::string& stylesheet, Applica internal->SetCommandLineOptions(argc, argv); internal->SetStyleSheet(stylesheet); - internal->GetWindow().SetTransparency((windowMode == Application::OPAQUE ? false : true)); + internal->GetWindow().SetTransparency((windowMode == Application::TRANSPARENT)); - //Store only the value before adaptor is created + // Store only the value before adaptor is created internal->StoreWindowPositionSize(positionSize); } else { - internal = Internal::Adaptor::Application::New(argc, argv, stylesheet, windowMode, positionSize, Internal::Adaptor::Framework::NORMAL, type, false); + WindowData windowData; + windowData.SetPositionSize(positionSize); + windowData.SetTransparency(windowMode == Application::TRANSPARENT); + windowData.SetWindowType(type); + + internal = Internal::Adaptor::Application::New(argc, argv, stylesheet, Internal::Adaptor::Framework::NORMAL, false, windowData); } return Application(internal.Get()); } diff --git a/dali/devel-api/adaptor-framework/window-devel.cpp b/dali/devel-api/adaptor-framework/window-devel.cpp index 897ea9f..f39033d 100644 --- a/dali/devel-api/adaptor-framework/window-devel.cpp +++ b/dali/devel-api/adaptor-framework/window-devel.cpp @@ -48,7 +48,11 @@ Window New(Any surface, PositionSize windowPosition, const std::string& name, co if(isNewWindowAllowed) { - Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(surface, windowPosition, name, className, WindowType::NORMAL, isTransparent); + WindowData windowData; + windowData.SetPositionSize(windowPosition); + windowData.SetTransparency(isTransparent); + windowData.SetWindowType(WindowType::NORMAL); + Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(surface, name, className, windowData); Integration::SceneHolder sceneHolder = Integration::SceneHolder(window); if(isAdaptorAvailable) diff --git a/dali/internal/adaptor/common/application-impl.cpp b/dali/internal/adaptor/common/application-impl.cpp index 5fb0f6f..d6afc6d 100644 --- a/dali/internal/adaptor/common/application-impl.cpp +++ b/dali/internal/adaptor/common/application-impl.cpp @@ -64,16 +64,14 @@ DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_APPLICATION, true); ApplicationPtr Application::gPreInitializedApplication(NULL); ApplicationPtr Application::New( - int* argc, - char** argv[], - const std::string& stylesheet, - Dali::Application::WINDOW_MODE windowMode, - const PositionSize& positionSize, - Framework::Type applicationType, - WindowType type, - bool useUiThread) -{ - ApplicationPtr application(new Application(argc, argv, stylesheet, windowMode, positionSize, applicationType, type, useUiThread)); + int* argc, + char** argv[], + const std::string& stylesheet, + Framework::Type applicationType, + bool useUiThread, + const WindowData& windowData) +{ + ApplicationPtr application(new Application(argc, argv, stylesheet, applicationType, useUiThread, windowData)); return application; } @@ -82,14 +80,14 @@ void Application::PreInitialize(int* argc, char** argv[]) if(!gPreInitializedApplication) { Dali::TextAbstraction::FontClientPreInitialize(); - - gPreInitializedApplication = new Application(argc, argv, "", Dali::Application::OPAQUE, PositionSize(), Framework::NORMAL, WindowType::NORMAL, false); + WindowData windowData; + gPreInitializedApplication = new Application(argc, argv, "", Framework::NORMAL, false, windowData); gPreInitializedApplication->mLaunchpadState = Launchpad::PRE_INITIALIZED; gPreInitializedApplication->CreateWindow(); // Only create window } } -Application::Application(int* argc, char** argv[], const std::string& stylesheet, Dali::Application::WINDOW_MODE windowMode, const PositionSize& positionSize, Framework::Type applicationType, WindowType type, bool useUiThread) +Application::Application(int* argc, char** argv[], const std::string& stylesheet, Framework::Type applicationType, bool useUiThread, const WindowData& windowData) : mInitSignal(), mTerminateSignal(), mPauseSignal(), @@ -104,12 +102,12 @@ Application::Application(int* argc, char** argv[], const std::string& stylesheet mAdaptor(nullptr), mEnvironmentOptions(nullptr), mMainWindow(), - mMainWindowMode(windowMode), + mMainWindowMode(windowData.GetTransparency() ? WINDOW_MODE::TRANSPARENT : WINDOW_MODE::OPAQUE), mMainWindowName(), mStylesheet(stylesheet), - mWindowPositionSize(positionSize), + mWindowPositionSize(windowData.GetPositionSize()), mLaunchpadState(Launchpad::NONE), - mDefaultWindowType(type), + mDefaultWindowType(windowData.GetWindowType()), mUseUiThread(useUiThread), mSlotDelegate(this) { @@ -208,6 +206,9 @@ void Application::ChangePreInitializedWindowInfo() void Application::CreateWindow() { Internal::Adaptor::Window* window; + WindowData windowData; + windowData.SetTransparency(mMainWindowMode); + windowData.SetWindowType(mDefaultWindowType); WindowSystem::Initialize(); @@ -236,13 +237,15 @@ void Application::CreateWindow() mMainWindowName = windowName; } - window = Internal::Adaptor::Window::New(mWindowPositionSize, mMainWindowName, windowClassName, mDefaultWindowType, mMainWindowMode == Dali::Application::TRANSPARENT); + windowData.SetPositionSize(mWindowPositionSize); + window = Internal::Adaptor::Window::New(mMainWindowName, windowClassName, windowData); } else { // The position, size and the window name of the pre-initialized application will be updated in ChangePreInitializedWindowInfo() // when the real application is launched. - window = Internal::Adaptor::Window::New(mWindowPositionSize, "", "", mDefaultWindowType, mMainWindowMode == Dali::Application::TRANSPARENT); + windowData.SetPositionSize(mWindowPositionSize); + window = Internal::Adaptor::Window::New("", "", windowData); } mMainWindow = Dali::Window(window); diff --git a/dali/internal/adaptor/common/application-impl.h b/dali/internal/adaptor/common/application-impl.h index a881314..6eeb016 100644 --- a/dali/internal/adaptor/common/application-impl.h +++ b/dali/internal/adaptor/common/application-impl.h @@ -78,13 +78,12 @@ public: * @param[in] argc A pointer to the number of arguments * @param[in] argv A pointer to the argument list * @param[in] stylesheet The path to user defined theme file - * @param[in] windowMode A member of Dali::Application::WINDOW_MODE - * @param[in] positionSize A position and a size of the window * @param[in] applicationType A member of Dali::Framework::Type - * @param[in] type It is window type for default window. * @param[in] useUiThread True if the application would create a UI thread + * @param[in] windowData The window data + * */ - static ApplicationPtr New(int* argc, char** argv[], const std::string& stylesheet, WINDOW_MODE windowMode, const PositionSize& positionSize, Framework::Type applicationType, WindowType type, bool useUiThread); + static ApplicationPtr New(int* argc, char** argv[], const std::string& stylesheet, Framework::Type applicationType, bool useUiThread, const WindowData& windowData); /** * @copydoc Dali::DevelApplication::PreInitialize() @@ -459,13 +458,11 @@ protected: * @param[in] argc A pointer to the number of arguments * @param[in] argv A pointer to the argument list * @param[in] stylesheet The path to user defined theme file - * @param[in] windowMode A member of Dali::Application::WINDOW_MODE - * @param[in] positionSize A position and a size of the window * @param[in] applicationType A member of Dali::Framework::Type - * @param[in] type The default window's type. - * @param[in] useUiThread True if the application would create UI thread + * @param[in] useUiThread True if the application would create UI thread + * @param[in] windowData The WindowData */ - Application(int* argc, char** argv[], const std::string& stylesheet, WINDOW_MODE windowMode, const PositionSize& positionSize, Framework::Type applicationType, WindowType type, bool useUiThread); + Application(int* argc, char** argv[], const std::string& stylesheet, Framework::Type applicationType, bool useUiThread, const WindowData& windowData); /** * Destructor diff --git a/dali/internal/adaptor/tizen-wayland/component-application-impl.cpp b/dali/internal/adaptor/tizen-wayland/component-application-impl.cpp index 09f3aa4..b69a99f 100644 --- a/dali/internal/adaptor/tizen-wayland/component-application-impl.cpp +++ b/dali/internal/adaptor/tizen-wayland/component-application-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 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. @@ -25,17 +25,17 @@ namespace Internal namespace Adaptor { ComponentApplicationPtr ComponentApplication::New( - int* argc, - char** argv[], - const std::string& stylesheet, - Dali::Application::WINDOW_MODE windowMode) + int* argc, + char** argv[], + const std::string& stylesheet, + const WindowData& windowData) { - ComponentApplicationPtr application(new ComponentApplication(argc, argv, stylesheet, windowMode)); + ComponentApplicationPtr application(new ComponentApplication(argc, argv, stylesheet, windowData)); return application; } -ComponentApplication::ComponentApplication(int* argc, char** argv[], const std::string& stylesheet, Dali::Application::WINDOW_MODE windowMode) -: Application(argc, argv, stylesheet, windowMode, PositionSize(), Framework::COMPONENT, WindowType::NORMAL, false) +ComponentApplication::ComponentApplication(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData) +: Application(argc, argv, stylesheet, Framework::COMPONENT, false, windowData) { } diff --git a/dali/internal/adaptor/tizen-wayland/component-application-impl.h b/dali/internal/adaptor/tizen-wayland/component-application-impl.h index b84104b..10b7fb0 100644 --- a/dali/internal/adaptor/tizen-wayland/component-application-impl.h +++ b/dali/internal/adaptor/tizen-wayland/component-application-impl.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_COMPONENT_APPLICATION_H /* - * Copyright (c) 2021 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. @@ -47,15 +47,15 @@ public: * @param[in] argc A pointer to the number of arguments * @param[in] argv A pointer to the argument list * @param[in] stylesheet The path to user defined theme file - * @param[in] windowMode A member of WINDOW_MODE + * @param[in] windowData The window data * @return A handle to the ComponentApplication */ - static ComponentApplicationPtr New(int* argc, char** argv[], const std::string& stylesheet, WINDOW_MODE windowMode); + static ComponentApplicationPtr New(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData); /** * @brief The default constructor. */ - ComponentApplication(int* argc, char** argv[], const std::string& stylesheet, WINDOW_MODE windowMode); + ComponentApplication(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData); /** * @brief Undefined copy constructor. diff --git a/dali/internal/adaptor/tizen-wayland/component-application.cpp b/dali/internal/adaptor/tizen-wayland/component-application.cpp index a04f8a3..9c790c6 100644 --- a/dali/internal/adaptor/tizen-wayland/component-application.cpp +++ b/dali/internal/adaptor/tizen-wayland/component-application.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 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. @@ -35,7 +35,10 @@ ComponentApplication ComponentApplication::New(int* argc, char** argv[]) ComponentApplication ComponentApplication::New(int* argc, char** argv[], const std::string& stylesheet) { - Internal::Adaptor::ComponentApplicationPtr internal = Internal::Adaptor::ComponentApplication::New(argc, argv, stylesheet, TRANSPARENT); + WindowData windowData; + windowData.SetTransparency(true); + + Internal::Adaptor::ComponentApplicationPtr internal = Internal::Adaptor::ComponentApplication::New(argc, argv, stylesheet, windowData); return ComponentApplication(internal.Get()); } diff --git a/dali/internal/adaptor/tizen-wayland/tizen-wearable/watch-application-impl.cpp b/dali/internal/adaptor/tizen-wayland/tizen-wearable/watch-application-impl.cpp index 7f7a7f1..49d06f6 100644 --- a/dali/internal/adaptor/tizen-wayland/tizen-wearable/watch-application-impl.cpp +++ b/dali/internal/adaptor/tizen-wayland/tizen-wearable/watch-application-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 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. @@ -40,17 +40,17 @@ unsigned int GetEnvWatchRenderRefreshRate() } // unnamed namespace WatchApplicationPtr WatchApplication::New( - int* argc, - char** argv[], - const std::string& stylesheet, - Dali::WatchApplication::WINDOW_MODE windowMode) + int* argc, + char** argv[], + const std::string& stylesheet, + const WindowData& windowData) { - WatchApplicationPtr watch(new WatchApplication(argc, argv, stylesheet, windowMode)); + WatchApplicationPtr watch(new WatchApplication(argc, argv, stylesheet, windowData)); return watch; } -WatchApplication::WatchApplication(int* argc, char** argv[], const std::string& stylesheet, Dali::Application::WINDOW_MODE windowMode) -: Application(argc, argv, stylesheet, windowMode, PositionSize(), Framework::WATCH, WindowType::NORMAL, false), +WatchApplication::WatchApplication(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData) +: Application(argc, argv, stylesheet, Framework::WATCH, false, windowData), mState(UNINITIALIZED) { } diff --git a/dali/internal/adaptor/tizen-wayland/tizen-wearable/watch-application-impl.h b/dali/internal/adaptor/tizen-wayland/tizen-wearable/watch-application-impl.h index dbae797..6079d64 100644 --- a/dali/internal/adaptor/tizen-wayland/tizen-wearable/watch-application-impl.h +++ b/dali/internal/adaptor/tizen-wayland/tizen-wearable/watch-application-impl.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_WATCH_APPLICATION_H /* - * Copyright (c) 2021 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. @@ -56,18 +56,18 @@ public: * @param[in] argc A pointer to the number of arguments * @param[in] argv A pointer to the argument list * @param[in] stylesheet The path to user defined theme file - * @param[in] windowMode A member of Dali::Watch::WINDOW_MODE + * @param[in] windowData The window data */ - static WatchApplicationPtr New(int* argc, char** argv[], const std::string& stylesheet, WINDOW_MODE windowMode); + static WatchApplicationPtr New(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData); /** * Private Constructor * @param[in] argc A pointer to the number of arguments * @param[in] argv A pointer to the argument list * @param[in] stylesheet The path to user defined theme file - * @param[in] windowMode A member of Dali::Watch::WINDOW_MODE + * @param[in] windowData The window data */ - WatchApplication(int* argc, char** argv[], const std::string& stylesheet, WINDOW_MODE windowMode); + WatchApplication(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData); /** * Destructor diff --git a/dali/internal/adaptor/tizen-wayland/tizen-wearable/watch-application.cpp b/dali/internal/adaptor/tizen-wayland/tizen-wearable/watch-application.cpp index 9827e37..cd0cf6f 100644 --- a/dali/internal/adaptor/tizen-wayland/tizen-wearable/watch-application.cpp +++ b/dali/internal/adaptor/tizen-wayland/tizen-wearable/watch-application.cpp @@ -33,13 +33,17 @@ WatchApplication WatchApplication::New() WatchApplication WatchApplication::New(int* argc, char** argv[]) { - Internal::Adaptor::WatchApplicationPtr internal = Internal::Adaptor::WatchApplication::New(argc, argv, "", OPAQUE); + WindowData windowData; + windowData.SetTransparency(false); + Internal::Adaptor::WatchApplicationPtr internal = Internal::Adaptor::WatchApplication::New(argc, argv, "", windowData); return WatchApplication(internal.Get()); } WatchApplication WatchApplication::New(int* argc, char** argv[], const std::string& stylesheet) { - Internal::Adaptor::WatchApplicationPtr internal = Internal::Adaptor::WatchApplication::New(argc, argv, stylesheet, OPAQUE); + WindowData windowData; + windowData.SetTransparency(false); + Internal::Adaptor::WatchApplicationPtr internal = Internal::Adaptor::WatchApplication::New(argc, argv, stylesheet, windowData); return WatchApplication(internal.Get()); } diff --git a/dali/internal/system/android/widget-application-impl-android.cpp b/dali/internal/system/android/widget-application-impl-android.cpp index 65d95a6..6686c62 100644 --- a/dali/internal/system/android/widget-application-impl-android.cpp +++ b/dali/internal/system/android/widget-application-impl-android.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 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. @@ -28,13 +28,14 @@ namespace Adaptor WidgetApplicationPtr WidgetApplicationAndroid::New( int* argc, char** argv[], - const std::string& stylesheet) + const std::string& stylesheet, + const WindowData& windowData) { - return new WidgetApplicationAndroid(argc, argv, stylesheet); + return new WidgetApplicationAndroid(argc, argv, stylesheet, windowData); } -WidgetApplicationAndroid::WidgetApplicationAndroid(int* argc, char** argv[], const std::string& stylesheet) -: WidgetApplication(argc, argv, stylesheet) +WidgetApplicationAndroid::WidgetApplicationAndroid(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData) +: WidgetApplication(argc, argv, stylesheet, windowData) { DALI_LOG_ERROR("WidgetApplication is not implemented in Android profile.\n"); } @@ -53,10 +54,11 @@ namespace WidgetApplicationFactory * @param[in] argc A pointer to the number of arguments * @param[in] argv A pointer to the argument list * @param[in] stylesheet The path to user defined theme file + * @param[in] windowData The window data */ -WidgetApplicationPtr Create(int* argc, char** argv[], const std::string& stylesheet) +WidgetApplicationPtr Create(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData) { - return WidgetApplicationAndroid::New(argc, argv, stylesheet); + return WidgetApplicationAndroid::New(argc, argv, stylesheet, windowData); } } // namespace WidgetApplicationFactory diff --git a/dali/internal/system/android/widget-application-impl-android.h b/dali/internal/system/android/widget-application-impl-android.h index 7e93d98..22fe8c8 100644 --- a/dali/internal/system/android/widget-application-impl-android.h +++ b/dali/internal/system/android/widget-application-impl-android.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_WIDGET_APPLICATION_IMPL_ANDROID_H /* - * Copyright (c) 2021 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. @@ -45,8 +45,9 @@ public: * @param[in] argc A pointer to the number of arguments * @param[in] argv A pointer to the argument list * @param[in] stylesheet The path to user defined theme file + * @param[in] windowData The window data */ - static WidgetApplicationPtr New(int* argc, char** argv[], const std::string& stylesheet); + static WidgetApplicationPtr New(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData); public: /** @@ -60,8 +61,9 @@ protected: * @param[in] argc A pointer to the number of arguments * @param[in] argv A pointer to the argument list * @param[in] stylesheet The path to user defined theme file + * @param[in] windowData The window data */ - WidgetApplicationAndroid(int* argc, char** argv[], const std::string& stylesheet); + WidgetApplicationAndroid(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData); /** * Destructor diff --git a/dali/internal/system/common/widget-application-impl.cpp b/dali/internal/system/common/widget-application-impl.cpp index 5c7aef6..0586aca 100644 --- a/dali/internal/system/common/widget-application-impl.cpp +++ b/dali/internal/system/common/widget-application-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 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. @@ -33,22 +33,24 @@ namespace WidgetApplicationFactory * @param[in] argc A pointer to the number of arguments * @param[in] argv A pointer to the argument list * @param[in] stylesheet The path to user defined theme file + * @param[in] windowData The window data */ -WidgetApplicationPtr Create(int* argc, char** argv[], const std::string& stylesheet); +WidgetApplicationPtr Create(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData); } // namespace WidgetApplicationFactory WidgetApplicationPtr WidgetApplication::New( int* argc, char** argv[], - const std::string& stylesheet) + const std::string& stylesheet, + const WindowData& windowData) { - //WidgetApplicationPtr //widgetApplication( new WidgetApplication (argc, argv, stylesheet ) ); - return WidgetApplicationFactory::Create(argc, argv, stylesheet); + // WidgetApplicationPtr //widgetApplication( new WidgetApplication (argc, argv, stylesheet ) ); + return WidgetApplicationFactory::Create(argc, argv, stylesheet, windowData); } -WidgetApplication::WidgetApplication(int* argc, char** argv[], const std::string& stylesheet) -: Application(argc, argv, stylesheet, Dali::WidgetApplication::OPAQUE, PositionSize(), Framework::WIDGET, WindowType::NORMAL, false) +WidgetApplication::WidgetApplication(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData) +: Application(argc, argv, stylesheet, Framework::WIDGET, false, windowData) { DALI_LOG_ERROR("WidgetApplication is not implemented in UBUNTU profile.\n"); } diff --git a/dali/internal/system/common/widget-application-impl.h b/dali/internal/system/common/widget-application-impl.h index 32079ca..3e0274a 100644 --- a/dali/internal/system/common/widget-application-impl.h +++ b/dali/internal/system/common/widget-application-impl.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_WIDGET_APPLICATION_IMPL_H /* - * Copyright (c) 2021 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. @@ -48,8 +48,9 @@ public: * @param[in] argc A pointer to the number of arguments * @param[in] argv A pointer to the argument list * @param[in] stylesheet The path to user defined theme file + * @param[in] windowData The window data */ - static WidgetApplicationPtr New(int* argc, char** argv[], const std::string& stylesheet); + static WidgetApplicationPtr New(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData); public: /** @@ -64,7 +65,7 @@ protected: * @param[in] argv A pointer to the argument list * @param[in] stylesheet The path to user defined theme file */ - WidgetApplication(int* argc, char** argv[], const std::string& stylesheet); + WidgetApplication(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData); /** * Destructor diff --git a/dali/internal/system/macos/widget-application-impl-mac.cpp b/dali/internal/system/macos/widget-application-impl-mac.cpp index 4bc9bc9..27cd693 100644 --- a/dali/internal/system/macos/widget-application-impl-mac.cpp +++ b/dali/internal/system/macos/widget-application-impl-mac.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 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. @@ -28,16 +28,18 @@ namespace Adaptor WidgetApplicationPtr WidgetApplicationCocoa::New( int* argc, char** argv[], - const std::string& stylesheet) + const std::string& stylesheet, + const WindowData& windowData) { - return new WidgetApplicationCocoa(argc, argv, stylesheet); + return new WidgetApplicationCocoa(argc, argv, stylesheet, windowData); } WidgetApplicationCocoa::WidgetApplicationCocoa( int* argc, char** argv[], - const std::string& stylesheet) -: WidgetApplication(argc, argv, stylesheet) + const std::string& stylesheet, + const WindowData& windowData) +: WidgetApplication(argc, argv, stylesheet, windowData) { DALI_LOG_ERROR("WidgetApplication is not implemented in MACOS profile.\n"); } @@ -60,10 +62,11 @@ namespace WidgetApplicationFactory * @param[in] argc A pointer to the number of arguments * @param[in] argv A pointer to the argument list * @param[in] stylesheet The path to user defined theme file + * @param[in] windowData The window data */ -WidgetApplicationPtr Create(int* argc, char** argv[], const std::string& stylesheet) +WidgetApplicationPtr Create(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData) { - return WidgetApplicationCocoa::New(argc, argv, stylesheet); + return WidgetApplicationCocoa::New(argc, argv, stylesheet, windowData); } } // namespace WidgetApplicationFactory diff --git a/dali/internal/system/macos/widget-application-impl-mac.h b/dali/internal/system/macos/widget-application-impl-mac.h index 444933c..7f5dbf4 100644 --- a/dali/internal/system/macos/widget-application-impl-mac.h +++ b/dali/internal/system/macos/widget-application-impl-mac.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_WIDGET_APPLICATION_IMPL_WIN_H /* - * Copyright (c) 2021 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. @@ -49,11 +49,13 @@ public: * @param[in] argc A pointer to the number of arguments * @param[in] argv A pointer to the argument list * @param[in] stylesheet The path to user defined theme file + * @param[in] windowData The window data */ static WidgetApplicationPtr New( int* argc, char** argv[], - const std::string& stylesheet); + const std::string& stylesheet, + const WindowData& windowData); public: /** @@ -69,8 +71,9 @@ protected: * @param[in] argc A pointer to the number of arguments * @param[in] argv A pointer to the argument list * @param[in] stylesheet The path to user defined theme file + * @param[in] windowData The window data */ - WidgetApplicationCocoa(int* argc, char** argv[], const std::string& stylesheet); + WidgetApplicationCocoa(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData); /** * Destructor diff --git a/dali/internal/system/tizen-wayland/widget-application-impl-tizen.cpp b/dali/internal/system/tizen-wayland/widget-application-impl-tizen.cpp index 2faa238..bd76bf4 100644 --- a/dali/internal/system/tizen-wayland/widget-application-impl-tizen.cpp +++ b/dali/internal/system/tizen-wayland/widget-application-impl-tizen.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 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. @@ -19,12 +19,12 @@ #include // INTERNAL INCLUDE +#include #include #include #include #include #include -#include // EXTERNAL INCLUDES #include @@ -42,7 +42,7 @@ namespace * Finally widget framework receive feedback from widget. */ #ifdef OVER_TIZEN_VERSION_7 -bool OnKeyEventCallback(const char *id, screen_connector_event_type_e eventType, int keyCode, const char *keyName, long long cls, long long subcls, const char* identifier, long long timestamp, void *userData) +bool OnKeyEventCallback(const char* id, screen_connector_event_type_e eventType, int keyCode, const char* keyName, long long cls, long long subcls, const char* identifier, long long timestamp, void* userData) { Dali::Internal::Adaptor::WidgetApplicationTizen* application = static_cast(userData); @@ -57,13 +57,13 @@ bool OnKeyEventCallback(const char *id, screen_connector_event_type_e eventType, state = Dali::KeyEvent::UP; } - bool consumed = true; - std::string keyEventName = std::string(keyName); - Dali::KeyEvent event = Dali::DevelKeyEvent::New(keyEventName, "", "", keyCode, 0, timestamp, state, "", "", Device::Class::NONE, Device::Subclass::NONE); + bool consumed = true; + std::string keyEventName = std::string(keyName); + Dali::KeyEvent event = Dali::DevelKeyEvent::New(keyEventName, "", "", keyCode, 0, timestamp, state, "", "", Device::Class::NONE, Device::Subclass::NONE); if(application) { - std::string widgetId = std::string(id); + std::string widgetId = std::string(id); widget_base_instance_h instanceHandle = application->GetWidgetInstanceFromWidgetId(widgetId); if(instanceHandle) { @@ -265,13 +265,14 @@ namespace Adaptor WidgetApplicationPtr WidgetApplicationTizen::New( int* argc, char** argv[], - const std::string& stylesheet) + const std::string& stylesheet, + const WindowData& windowData) { - return new WidgetApplicationTizen(argc, argv, stylesheet); + return new WidgetApplicationTizen(argc, argv, stylesheet, windowData); } -WidgetApplicationTizen::WidgetApplicationTizen(int* argc, char** argv[], const std::string& stylesheet) -: WidgetApplication(argc, argv, stylesheet), +WidgetApplicationTizen::WidgetApplicationTizen(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData) +: WidgetApplication(argc, argv, stylesheet, windowData), mConnectedKeyEvent(false), mReceivedKeyEvent(false) { @@ -390,7 +391,7 @@ void WidgetApplicationTizen::ConnectKeyEvent(Dali::Window window) void WidgetApplicationTizen::OnWindowKeyEvent(const Dali::KeyEvent& event) { - //If Widget Application consume key event, this api is not called. + // If Widget Application consume key event, this api is not called. mReceivedKeyEvent = true; } @@ -436,10 +437,11 @@ namespace WidgetApplicationFactory * @param[in] argc A pointer to the number of arguments * @param[in] argv A pointer to the argument list * @param[in] stylesheet The path to user defined theme file + * @param[in] windowData The window data */ -Dali::Internal::Adaptor::WidgetApplicationPtr Create(int* argc, char** argv[], const std::string& stylesheet) +Dali::Internal::Adaptor::WidgetApplicationPtr Create(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData) { - return WidgetApplicationTizen::New(argc, argv, stylesheet); + return WidgetApplicationTizen::New(argc, argv, stylesheet, windowData); } } // namespace WidgetApplicationFactory diff --git a/dali/internal/system/tizen-wayland/widget-application-impl-tizen.h b/dali/internal/system/tizen-wayland/widget-application-impl-tizen.h index 80166bd..8b20e80 100644 --- a/dali/internal/system/tizen-wayland/widget-application-impl-tizen.h +++ b/dali/internal/system/tizen-wayland/widget-application-impl-tizen.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_WIDGET_APPLICATION_TIZEN_H /* - * Copyright (c) 2021 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. @@ -19,8 +19,8 @@ */ // EXTERNAL INCLUDES -#include #include +#include // INTERNAL INCLUDES #include @@ -52,8 +52,9 @@ public: * @param[in] argc A pointer to the number of arguments * @param[in] argv A pointer to the argument list * @param[in] stylesheet The path to user defined theme file + * @param[in] windowData The window data */ - static WidgetApplicationPtr New(int* argc, char** argv[], const std::string& stylesheet); + static WidgetApplicationPtr New(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData); public: /** @@ -136,8 +137,9 @@ protected: * @param[in] argc A pointer to the number of arguments * @param[in] argv A pointer to the argument list * @param[in] stylesheet The path to user defined theme file + * @param[in] windowData The window data */ - WidgetApplicationTizen(int* argc, char** argv[], const std::string& stylesheet); + WidgetApplicationTizen(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData); /** * Destructor diff --git a/dali/internal/system/ubuntu-x11/widget-application-impl-x.cpp b/dali/internal/system/ubuntu-x11/widget-application-impl-x.cpp index 7502746..a0ca7c4 100644 --- a/dali/internal/system/ubuntu-x11/widget-application-impl-x.cpp +++ b/dali/internal/system/ubuntu-x11/widget-application-impl-x.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 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. @@ -28,13 +28,14 @@ namespace Adaptor WidgetApplicationPtr WidgetApplicationUbuntu::New( int* argc, char** argv[], - const std::string& stylesheet) + const std::string& stylesheet, + const WindowData& windowData) { - return new WidgetApplicationUbuntu(argc, argv, stylesheet); + return new WidgetApplicationUbuntu(argc, argv, stylesheet, windowData); } -WidgetApplicationUbuntu::WidgetApplicationUbuntu(int* argc, char** argv[], const std::string& stylesheet) -: WidgetApplication(argc, argv, stylesheet) +WidgetApplicationUbuntu::WidgetApplicationUbuntu(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData) +: WidgetApplication(argc, argv, stylesheet, windowData) { DALI_LOG_ERROR("WidgetApplication is not implemented in UBUNTU profile.\n"); } @@ -55,10 +56,11 @@ namespace WidgetApplicationFactory * @param[in] argc A pointer to the number of arguments * @param[in] argv A pointer to the argument list * @param[in] stylesheet The path to user defined theme file + * @param[in] windowData The window data */ -WidgetApplicationPtr Create(int* argc, char** argv[], const std::string& stylesheet) +WidgetApplicationPtr Create(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData) { - return WidgetApplicationUbuntu::New(argc, argv, stylesheet); + return WidgetApplicationUbuntu::New(argc, argv, stylesheet, windowData); } } // namespace WidgetApplicationFactory diff --git a/dali/internal/system/ubuntu-x11/widget-application-impl-x.h b/dali/internal/system/ubuntu-x11/widget-application-impl-x.h index 30ee74e..640e907 100644 --- a/dali/internal/system/ubuntu-x11/widget-application-impl-x.h +++ b/dali/internal/system/ubuntu-x11/widget-application-impl-x.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_WIDGET_APPLICATION_IMPL_UBUNTU_H /* - * Copyright (c) 2021 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. @@ -45,8 +45,9 @@ public: * @param[in] argc A pointer to the number of arguments * @param[in] argv A pointer to the argument list * @param[in] stylesheet The path to user defined theme file + * @param[in] windowData The window data */ - static WidgetApplicationPtr New(int* argc, char** argv[], const std::string& stylesheet); + static WidgetApplicationPtr New(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData); public: /** @@ -60,8 +61,9 @@ protected: * @param[in] argc A pointer to the number of arguments * @param[in] argv A pointer to the argument list * @param[in] stylesheet The path to user defined theme file + * @param[in] windowData The window data */ - WidgetApplicationUbuntu(int* argc, char** argv[], const std::string& stylesheet); + WidgetApplicationUbuntu(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData); /** * Destructor diff --git a/dali/internal/system/windows/widget-application-impl-win.cpp b/dali/internal/system/windows/widget-application-impl-win.cpp index da883da..22e5fc8 100644 --- a/dali/internal/system/windows/widget-application-impl-win.cpp +++ b/dali/internal/system/windows/widget-application-impl-win.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 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. @@ -28,13 +28,14 @@ namespace Adaptor WidgetApplicationPtr WidgetApplicationWin::New( int* argc, char** argv[], - const std::string& stylesheet) + const std::string& stylesheet, + const WindowData& windowData) { - return new WidgetApplicationWin(argc, argv, stylesheet); + return new WidgetApplicationWin(argc, argv, stylesheet, windowData); } -WidgetApplicationWin::WidgetApplicationWin(int* argc, char** argv[], const std::string& stylesheet) -: WidgetApplication(argc, argv, stylesheet) +WidgetApplicationWin::WidgetApplicationWin(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData) +: WidgetApplication(argc, argv, stylesheet, windowData) { DALI_LOG_ERROR("WidgetApplication is not implemented in UBUNTU profile.\n"); } @@ -55,10 +56,11 @@ namespace WidgetApplicationFactory * @param[in] argc A pointer to the number of arguments * @param[in] argv A pointer to the argument list * @param[in] stylesheet The path to user defined theme file + * @param[in] windowData The window data */ -WidgetApplicationPtr Create(int* argc, char** argv[], const std::string& stylesheet) +WidgetApplicationPtr Create(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData) { - return WidgetApplicationWin::New(argc, argv, stylesheet); + return WidgetApplicationWin::New(argc, argv, stylesheet, windowData); } } // namespace WidgetApplicationFactory diff --git a/dali/internal/system/windows/widget-application-impl-win.h b/dali/internal/system/windows/widget-application-impl-win.h index a9786fe..8bef0c4 100644 --- a/dali/internal/system/windows/widget-application-impl-win.h +++ b/dali/internal/system/windows/widget-application-impl-win.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_WIDGET_APPLICATION_IMPL_WIN_H /* - * Copyright (c) 2021 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. @@ -45,8 +45,9 @@ public: * @param[in] argc A pointer to the number of arguments * @param[in] argv A pointer to the argument list * @param[in] stylesheet The path to user defined theme file + * @param[in] windowData The window data */ - static WidgetApplicationPtr New(int* argc, char** argv[], const std::string& stylesheet); + static WidgetApplicationPtr New(int* argc, char** argv[], const std::string& stylesheet, const WindowData& windowData); public: /** @@ -60,8 +61,9 @@ protected: * @param[in] argc A pointer to the number of arguments * @param[in] argv A pointer to the argument list * @param[in] stylesheet The path to user defined theme file + * @param[in] windowData The window data */ - WidgetApplicationWin(int* argc, char** argv[], const std::string& stylesheet); + WidgetApplicationWin(int* argc, char** argv[], const std::string& stylesheet const WindowData& windowData); /** * Destructor diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index f1b62f8..371e4aa 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -58,17 +58,17 @@ Debug::Filter* gWindowLogFilter = Debug::Filter::New(Debug::NoLogging, false, "L #endif } // unnamed namespace -Window* Window::New(const PositionSize& positionSize, const std::string& name, const std::string& className, Dali::WindowType type, bool isTransparent) +Window* Window::New(const std::string& name, const std::string& className, const WindowData& windowData) { Any surface; - return Window::New(surface, positionSize, name, className, type, isTransparent); + return Window::New(surface, name, className, windowData); } -Window* Window::New(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className, Dali::WindowType type, bool isTransparent) +Window* Window::New(Any surface, const std::string& name, const std::string& className, const WindowData& windowData) { Window* window = new Window(); - window->mIsTransparent = isTransparent; - window->Initialize(surface, positionSize, name, className, type); + window->mIsTransparent = windowData.GetTransparency(); + window->Initialize(surface, windowData.GetPositionSize(), name, className, windowData.GetWindowType()); return window; } diff --git a/dali/internal/window-system/common/window-impl.h b/dali/internal/window-system/common/window-impl.h index e78d32b..331ea05 100644 --- a/dali/internal/window-system/common/window-impl.h +++ b/dali/internal/window-system/common/window-impl.h @@ -76,26 +76,22 @@ public: /** * @brief Create a new Window. This should only be called once by the Application class - * @param[in] positionSize The position and size of the window * @param[in] name The window title * @param[in] className The window class name - * @param[in] type Window type. - * @param[in] isTransparent Whether window is transparent + * @param[in] windowData The window data * @return A newly allocated Window */ - static Window* New(const PositionSize& positionSize, const std::string& name, const std::string& className, Dali::WindowType type, bool isTransparent = false); + static Window* New(const std::string& name, const std::string& className, const WindowData& windowData); /** * @brief Create a new Window. This should only be called once by the Application class * @param[in] surface The surface used to render on. - * @param[in] positionSize The position and size of the window * @param[in] name The window title * @param[in] className The window class name - * @param[in] type Window type. - * @param[in] isTransparent Whether window is transparent + * @param[in] windowData The window data * @return A newly allocated Window */ - static Window* New(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className, Dali::WindowType type, bool isTransparent = false); + static Window* New(Any surface, const std::string& name, const std::string& className, const WindowData& windowData); /** * @copydoc Dali::Window::SetClass() diff --git a/dali/public-api/adaptor-framework/application.cpp b/dali/public-api/adaptor-framework/application.cpp index 36db754..5db7add 100644 --- a/dali/public-api/adaptor-framework/application.cpp +++ b/dali/public-api/adaptor-framework/application.cpp @@ -42,7 +42,10 @@ Application Application::New(int* argc, char** argv[]) } else { - internal = Internal::Adaptor::Application::New(argc, argv, "", OPAQUE, PositionSize(), Internal::Adaptor::Framework::NORMAL, WindowType::NORMAL, false); + WindowData windowData; + windowData.SetTransparency(false); + + internal = Internal::Adaptor::Application::New(argc, argv, "", Internal::Adaptor::Framework::NORMAL, false, windowData); } return Application(internal.Get()); } @@ -58,7 +61,10 @@ Application Application::New(int* argc, char** argv[], const std::string& styles } else { - internal = Internal::Adaptor::Application::New(argc, argv, stylesheet, OPAQUE, PositionSize(), Internal::Adaptor::Framework::NORMAL, WindowType::NORMAL, false); + WindowData windowData; + windowData.SetTransparency(false); + + internal = Internal::Adaptor::Application::New(argc, argv, stylesheet, Internal::Adaptor::Framework::NORMAL, false, windowData); } return Application(internal.Get()); } @@ -72,11 +78,14 @@ Application Application::New(int* argc, char** argv[], const std::string& styles internal->SetCommandLineOptions(argc, argv); internal->SetStyleSheet(stylesheet); - internal->GetWindow().SetTransparency((windowMode == Application::OPAQUE ? false : true)); + internal->GetWindow().SetTransparency((windowMode == Application::TRANSPARENT)); } else { - internal = Internal::Adaptor::Application::New(argc, argv, stylesheet, windowMode, PositionSize(), Internal::Adaptor::Framework::NORMAL, WindowType::NORMAL, false); + WindowData windowData; + windowData.SetTransparency(windowMode == Application::TRANSPARENT); + + internal = Internal::Adaptor::Application::New(argc, argv, stylesheet, Internal::Adaptor::Framework::NORMAL, false, windowData); } return Application(internal.Get()); } @@ -90,14 +99,18 @@ Application Application::New(int* argc, char** argv[], const std::string& styles internal->SetCommandLineOptions(argc, argv); internal->SetStyleSheet(stylesheet); - internal->GetWindow().SetTransparency((windowMode == Application::OPAQUE ? false : true)); + internal->GetWindow().SetTransparency(windowMode == Application::TRANSPARENT); - //Store only the value before adaptor is created + // Store only the value before adaptor is created internal->StoreWindowPositionSize(positionSize); } else { - internal = Internal::Adaptor::Application::New(argc, argv, stylesheet, windowMode, positionSize, Internal::Adaptor::Framework::NORMAL, WindowType::NORMAL, false); + WindowData windowData; + windowData.SetPositionSize(positionSize); + windowData.SetTransparency(windowMode == Application::TRANSPARENT); + + internal = Internal::Adaptor::Application::New(argc, argv, stylesheet, Internal::Adaptor::Framework::NORMAL, false, windowData); } return Application(internal.Get()); } @@ -111,14 +124,18 @@ Application Application::New(int* argc, char** argv[], const std::string& styles internal->SetCommandLineOptions(argc, argv); internal->SetStyleSheet(stylesheet); - internal->GetWindow().SetTransparency((windowMode == Application::OPAQUE ? false : true)); + internal->GetWindow().SetTransparency(windowMode == Application::TRANSPARENT); - //Store only the value before adaptor is created + // Store only the value before adaptor is created internal->StoreWindowPositionSize(positionSize); } else { - internal = Internal::Adaptor::Application::New(argc, argv, stylesheet, windowMode, positionSize, Internal::Adaptor::Framework::NORMAL, WindowType::NORMAL, useUiThread); + WindowData windowData; + windowData.SetPositionSize(positionSize); + windowData.SetTransparency(windowMode == Application::TRANSPARENT); + + internal = Internal::Adaptor::Application::New(argc, argv, stylesheet, Internal::Adaptor::Framework::NORMAL, useUiThread, windowData); } return Application(internal.Get()); } @@ -141,12 +158,7 @@ Application Application::New(int* argc, char** argv[], const std::string& styles } else { - // clang-format off - internal = Internal::Adaptor::Application::New(argc, argv, stylesheet, - windowData.GetTransparency() ? WINDOW_MODE::TRANSPARENT : WINDOW_MODE::OPAQUE, - windowData.GetPositionSize(), Internal::Adaptor::Framework::NORMAL, - windowData.GetWindowType(), useUiThread); - // clang-format on + internal = Internal::Adaptor::Application::New(argc, argv, stylesheet, Internal::Adaptor::Framework::NORMAL, useUiThread, windowData); } return Application(internal.Get()); } diff --git a/dali/public-api/adaptor-framework/widget-application.cpp b/dali/public-api/adaptor-framework/widget-application.cpp index b1f1854..5fca88f 100644 --- a/dali/public-api/adaptor-framework/widget-application.cpp +++ b/dali/public-api/adaptor-framework/widget-application.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. @@ -32,7 +32,8 @@ WidgetApplication WidgetApplication::New(int* argc, char** argv[], const std::st preInitializedApplication.Reset(); } - Internal::Adaptor::WidgetApplicationPtr internal = Internal::Adaptor::WidgetApplication::New(argc, argv, stylesheet); + WindowData windowData; + Internal::Adaptor::WidgetApplicationPtr internal = Internal::Adaptor::WidgetApplication::New(argc, argv, stylesheet, windowData); return WidgetApplication(internal.Get()); } diff --git a/dali/public-api/adaptor-framework/window.cpp b/dali/public-api/adaptor-framework/window.cpp index 069b57e..5e750a8 100644 --- a/dali/public-api/adaptor-framework/window.cpp +++ b/dali/public-api/adaptor-framework/window.cpp @@ -36,6 +36,15 @@ Window Window::New(PositionSize posSize, const std::string& name, bool isTranspa Window Window::New(PositionSize posSize, const std::string& name, const std::string& className, bool isTransparent) { + WindowData windowData; + windowData.SetPositionSize(posSize); + windowData.SetTransparency(isTransparent); + windowData.SetWindowType(WindowType::NORMAL); + return Dali::Window::New(name, "", windowData); +} + +Window Window::New(const std::string& name, const std::string& className, const WindowData& windowData) +{ Window newWindow; const bool isAdaptorAvailable = Dali::Adaptor::IsAvailable(); @@ -49,7 +58,7 @@ Window Window::New(PositionSize posSize, const std::string& name, const std::str if(isNewWindowAllowed) { - Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(posSize, name, className, WindowType::NORMAL, isTransparent); + Internal::Adaptor::Window* window = Internal::Adaptor::Window::New(name, className, windowData); Integration::SceneHolder sceneHolder = Integration::SceneHolder(window); diff --git a/dali/public-api/adaptor-framework/window.h b/dali/public-api/adaptor-framework/window.h index 64d191a..6959335 100644 --- a/dali/public-api/adaptor-framework/window.h +++ b/dali/public-api/adaptor-framework/window.h @@ -19,6 +19,7 @@ */ // EXTERNAL INCLUDES +#include #include #include #include @@ -106,6 +107,17 @@ public: static Window New(PositionSize windowPosition, const std::string& name, const std::string& className, bool isTransparent = false); /** + * @brief Creates an initialized handle to a new Window. + * @SINCE_2_2.33 + * @param[in] name The Window title + * @param[in] className The Window class name + * @param[in] windowData The window data + * @note This creates an extra window in addition to the default main window + * @return A new Window + */ + static Window New(const std::string& name, const std::string& className, const WindowData& windowData); + + /** * @brief Creates an uninitialized handle. * * This can be initialized using Dali::Application::GetWindow() or -- 2.7.4