From abd81817db1a999bb899177be3aa5652954868ff Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Tue, 25 Aug 2020 18:29:31 +0900 Subject: [PATCH 01/16] DSRenderViewDaliImpl: register positionChanged callback of window Change-Id: I7d816751ae28b999f68bb0edb6da1907a8d38049 Signed-off-by: Joonbum Ko --- src/DSRender/DSRenderViewDaliImpl.cpp | 13 +++++++++++++ src/DSRender/DSRenderViewDaliImpl.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/DSRender/DSRenderViewDaliImpl.cpp b/src/DSRender/DSRenderViewDaliImpl.cpp index a004670..7cc724d 100644 --- a/src/DSRender/DSRenderViewDaliImpl.cpp +++ b/src/DSRender/DSRenderViewDaliImpl.cpp @@ -107,6 +107,7 @@ DSRenderViewDaliImpl::DSRenderViewDaliImpl(std::shared_ptr window, Dal window->registerCallbackBufferChanged(this, std::bind(&DSRenderViewDaliImpl::__onWindowBufferChanged, this, std::placeholders::_1)); window->registerCallbackWindowRaiseToTop(this, std::bind(&DSRenderViewDaliImpl::__onWindowRaiseToTopChanged, this, std::placeholders::_1)); window->registerCallbackWindowLowerToBottom(this, std::bind(&DSRenderViewDaliImpl::__onWindowLowerToBottomChanged, this, std::placeholders::_1)); + window->registerCallbackWindowPositionChanged(this, std::bind(&DSRenderViewDaliImpl::__onWindowPositionChanged, this, std::placeholders::_1)); } DSRenderViewDaliImpl::~DSRenderViewDaliImpl() @@ -190,4 +191,16 @@ void DSRenderViewDaliImpl::__onWindowLowerToBottomChanged(void *data) __updatedSignal.emit(nullptr); } +void DSRenderViewDaliImpl::__onWindowPositionChanged(void *data) +{ + DSLOG_INF("DSRenderViewDaliImpl", "__onWindowPositionChanged."); + + stPosition pos = __window->getPosition(); + + __textureViewActor.SetProperty(Actor::Property::VISIBLE, true); + __textureViewActor.SetProperty(Actor::Property::POSITION, Vector3( pos.x, pos.y, 0.0f )); + + __updatedSignal.emit(nullptr); +} + } // namespace display_server diff --git a/src/DSRender/DSRenderViewDaliImpl.h b/src/DSRender/DSRenderViewDaliImpl.h index 5048555..8ffd858 100644 --- a/src/DSRender/DSRenderViewDaliImpl.h +++ b/src/DSRender/DSRenderViewDaliImpl.h @@ -51,6 +51,7 @@ private: void __onWindowBufferChanged(std::shared_ptr buffer); void __onWindowRaiseToTopChanged(void *data); void __onWindowLowerToBottomChanged(void *data); + void __onWindowPositionChanged(void *data); std::shared_ptr __window; Dali::OffscreenWindow __offscreenWindow; -- 2.7.4 From 9fa0613792f40537572e7278fe55719fe6d9eae6 Mon Sep 17 00:00:00 2001 From: Duna Oh Date: Mon, 24 Aug 2020 10:25:24 +0900 Subject: [PATCH 02/16] DSWaylandTizenLaunchEffect/Splash: add skeleton code for tizen_launch_effect/splash Change-Id: Id600cd5f63056df52417934e5f9ca7df9b1fc591 --- samples/exampleClient.c | 8 ++ src/DSWaylandExtension/DSWaylandExtension.cpp | 15 ++- src/DSWaylandExtension/DSWaylandExtensionPrivate.h | 3 + src/DSWaylandServer/DSWaylandTizenLaunchEffect.cpp | 134 +++++++++++++++++++++ src/DSWaylandServer/DSWaylandTizenLaunchEffect.h | 54 +++++++++ .../DSWaylandTizenLaunchEffectPrivate.h | 62 ++++++++++ src/DSWaylandServer/DSWaylandTizenLaunchSplash.cpp | 71 +++++++++++ src/DSWaylandServer/DSWaylandTizenLaunchSplash.h | 48 ++++++++ .../DSWaylandTizenLaunchSplashPrivate.h | 60 +++++++++ src/meson.build | 6 + tests/DSWaylandTizenLaunchEffect-test.cpp | 64 ++++++++++ tests/meson.build | 1 + 12 files changed, 525 insertions(+), 1 deletion(-) create mode 100644 src/DSWaylandServer/DSWaylandTizenLaunchEffect.cpp create mode 100644 src/DSWaylandServer/DSWaylandTizenLaunchEffect.h create mode 100644 src/DSWaylandServer/DSWaylandTizenLaunchEffectPrivate.h create mode 100644 src/DSWaylandServer/DSWaylandTizenLaunchSplash.cpp create mode 100644 src/DSWaylandServer/DSWaylandTizenLaunchSplash.h create mode 100644 src/DSWaylandServer/DSWaylandTizenLaunchSplashPrivate.h create mode 100644 tests/DSWaylandTizenLaunchEffect-test.cpp diff --git a/samples/exampleClient.c b/samples/exampleClient.c index 929f72b..6726029 100644 --- a/samples/exampleClient.c +++ b/samples/exampleClient.c @@ -50,6 +50,8 @@ struct xkb_context *xkb_context = NULL; struct xkb_keymap *keymap = NULL; struct tizen_policy *tz_policy = NULL; struct tizen_launch_appinfo *tz_appinfo = NULL; +struct tizen_launch_effect *tz_launcheffect = NULL; +struct tizen_launch_splash *tz_launchsplash = NULL; struct zxdg_shell_v6 *zxdg_shell; struct zxdg_surface_v6 *zxdg_surface; struct zxdg_toplevel_v6 *zxdg_toplevel; @@ -483,6 +485,12 @@ global_registry_handler(void *data, struct wl_registry *registry, uint32_t id, { output = wl_registry_bind(registry, id, &wl_output_interface, 2); } + else if(strcmp(interface, "tizen_launch_effect") == 0) + { + tz_launcheffect = wl_registry_bind(registry, id, &tizen_launch_effect_interface, 1); + + tz_launchsplash = tizen_launch_effect_create_splash_img(tz_launcheffect); + } } static void diff --git a/src/DSWaylandExtension/DSWaylandExtension.cpp b/src/DSWaylandExtension/DSWaylandExtension.cpp index 0c27e6c..6534383 100644 --- a/src/DSWaylandExtension/DSWaylandExtension.cpp +++ b/src/DSWaylandExtension/DSWaylandExtension.cpp @@ -27,7 +27,7 @@ #include "DSWaylandZxdgShellV6.h" #include "DSWaylandTizenPolicy.h" #include "DSWaylandTizenAppinfo.h" - +#include "DSWaylandTizenLaunchEffect.h" namespace display_server { @@ -57,6 +57,7 @@ bool DSWaylandExtensionPrivate::init(DSWaylandCompositor *compositor) __initShell(); __initTizenPolicy(); __initTizenAppinfo(); + __initTizenLaunchEffect(); } catch(const std::runtime_error& e) { @@ -109,6 +110,18 @@ bool DSWaylandExtensionPrivate::__initTizenAppinfo(void) return true; } +bool DSWaylandExtensionPrivate::__initTizenLaunchEffect(void) +{ + __tzLaunchEffect = std::make_shared(__compositor); + if (__tzLaunchEffect == nullptr) + { + throw std::runtime_error(__func__); + return false; + } + + return true; +} + DSWaylandExtension::DSWaylandExtension(DSWaylandCompositor *compositor) : DS_INIT_PRIVATE_PTR(DSWaylandExtension) { diff --git a/src/DSWaylandExtension/DSWaylandExtensionPrivate.h b/src/DSWaylandExtension/DSWaylandExtensionPrivate.h index 361082b..2c063d3 100644 --- a/src/DSWaylandExtension/DSWaylandExtensionPrivate.h +++ b/src/DSWaylandExtension/DSWaylandExtensionPrivate.h @@ -30,6 +30,7 @@ namespace display_server class DSWaylandZxdgShellV6; class DSWaylandTizenPolicy; class DSWaylandTizenAppinfo; +class DSWaylandTizenLaunchEffect; class DSWaylandExtensionPrivate : public DSObjectPrivate { @@ -46,12 +47,14 @@ private: bool __initShell(void); bool __initTizenPolicy(void); bool __initTizenAppinfo(void); + bool __initTizenLaunchEffect(void); private: DSWaylandCompositor *__compositor; std::shared_ptr __zxdgShell; std::shared_ptr __tzPolicy; std::shared_ptr __tzAppinfo; + std::shared_ptr __tzLaunchEffect; }; diff --git a/src/DSWaylandServer/DSWaylandTizenLaunchEffect.cpp b/src/DSWaylandServer/DSWaylandTizenLaunchEffect.cpp new file mode 100644 index 0000000..30c78da --- /dev/null +++ b/src/DSWaylandServer/DSWaylandTizenLaunchEffect.cpp @@ -0,0 +1,134 @@ +/* +* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +#include "DSWaylandTizenLaunchEffect.h" +#include "DSWaylandTizenLaunchEffectPrivate.h" +#include "DSWaylandTizenLaunchSplash.h" +#include "DSWaylandClient.h" + +const int TIZEN_LAUNCH_EFFECT_VERSION = 1; + +namespace display_server +{ + +DSWaylandTizenLaunchEffectPrivate::DSWaylandTizenLaunchEffectPrivate(DSWaylandTizenLaunchEffect *p_ptr) + : DSObjectPrivate(p_ptr), + __p_ptr(p_ptr) +{ +} + +DSWaylandTizenLaunchEffectPrivate::~DSWaylandTizenLaunchEffectPrivate() +{ +} + +void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_initialize(DSWaylandCompositor *wlCompositor) +{ + ::wl_display *display; + display = wlCompositor->display(); + + init(display, TIZEN_LAUNCH_EFFECT_VERSION); +} + +void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_finalize(void) +{ + +} + +void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_bind_resource(Resource *resource) +{ + DSLOG_DBG("TizenLaunchEffectPriv", ""); +} +void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_destroy_resource(Resource *resource) +{ + DSLOG_DBG("TizenLaunchEffectPriv", ""); +} +void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_create_splash_img(Resource *resource, uint32_t id) +{ + DSLOG_DBG("TizenLaunchEffectPriv", ""); + + DSWaylandClient *waylandClient = DSWaylandClient::fromWlClient(resource->client()); + auto waylandSplash = std::make_shared(waylandClient, id); +} +void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_type_set(Resource *resource, const std::string &effect_type, uint32_t pid, struct ::wl_array *options) +{ + DSLOG_DBG("TizenLaunchEffectPriv", ""); +} +void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_type_unset(Resource *resource, uint32_t pid) +{ + DSLOG_DBG("TizenLaunchEffectPriv", ""); +} +void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_destroy(Resource *resource) +{ + DSLOG_DBG("TizenLaunchEffectPriv", ""); +} + +DSWaylandTizenLaunchEffect::DSWaylandTizenLaunchEffect(DSWaylandCompositor *wlCompositor) + : DS_INIT_PRIVATE_PTR(DSWaylandTizenLaunchEffect), + __wlCompositor(wlCompositor), + __isCreated(false) +{ + this->initialize(__wlCompositor); +} + +DSWaylandTizenLaunchEffect::~DSWaylandTizenLaunchEffect() +{ + if (isCreated()) + this->finalize(); +} + +bool DSWaylandTizenLaunchEffect::isCreated(void) +{ + return __isCreated; +} + +bool DSWaylandTizenLaunchEffect::initialize(DSWaylandCompositor *wlCompositor) +{ + if (!wlCompositor) return false; + if (isCreated()) + { + DSLOG_ERR("TizenLaunchEffect", "Already initialized"); + return true; + } + + DS_GET_PRIV(DSWaylandTizenLaunchEffect); + if (!priv) return false; + + __wlCompositor = wlCompositor; + __isCreated = true; + + priv->tizen_launch_effect_initialize(__wlCompositor); + + DSLOG_INF("TizenLaunchEffect", "TizenLaunchEffect initialized"); + return true; +} + +void DSWaylandTizenLaunchEffect::finalize(void) +{ + DS_GET_PRIV(DSWaylandTizenLaunchEffect); + priv->tizen_launch_effect_finalize(); + + DSLOG_INF("TizenLaunchEffect", "TizenLaunchEffect finalized"); + __isCreated = false; +} + +} \ No newline at end of file diff --git a/src/DSWaylandServer/DSWaylandTizenLaunchEffect.h b/src/DSWaylandServer/DSWaylandTizenLaunchEffect.h new file mode 100644 index 0000000..06a737e --- /dev/null +++ b/src/DSWaylandServer/DSWaylandTizenLaunchEffect.h @@ -0,0 +1,54 @@ +/* +* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +#ifndef __DS_WAYLAND_TIZEN_LAUNCHEFFECT_H__ +#define __DS_WAYLAND_TIZEN_LAUNCHEFFECT_H__ + +#include "DSWaylandCompositor.h" + +namespace display_server +{ + +class DSWaylandTizenLaunchEffectPrivate; + +class DSWaylandTizenLaunchEffect : public DSObject +{ +DS_PIMPL_USE_PRIVATE(DSWaylandTizenLaunchEffect); + +public: + DSWaylandTizenLaunchEffect(DSWaylandCompositor *wlCompositor); + virtual ~DSWaylandTizenLaunchEffect(); + + bool isCreated(void); + + bool initialize(DSWaylandCompositor *wlCompositor); + void finalize(void); + +private: + DSWaylandCompositor *__wlCompositor; + bool __isCreated; + +}; + +} +#endif \ No newline at end of file diff --git a/src/DSWaylandServer/DSWaylandTizenLaunchEffectPrivate.h b/src/DSWaylandServer/DSWaylandTizenLaunchEffectPrivate.h new file mode 100644 index 0000000..3fc6822 --- /dev/null +++ b/src/DSWaylandServer/DSWaylandTizenLaunchEffectPrivate.h @@ -0,0 +1,62 @@ +/* +* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +#ifndef __DS_WAYLAND_TIZEN_LAUNCHEFFECT_PRIVATE_H__ +#define __DS_WAYLAND_TIZEN_LAUNCHEFFECT_PRIVATE_H__ + +#include "dswayland-server-tizen-launch.h" + +#include "DSWaylandTizenLaunchEffect.h" + +namespace display_server +{ + +class DSWaylandTizenLaunchSplash; + +class DS_DECL_EXPORT DSWaylandTizenLaunchEffectPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_launch_effect +{ +DS_PIMPL_USE_PUBLIC(DSWaylandTizenLaunchEffect); + +public: + DSWaylandTizenLaunchEffectPrivate() = delete; + DSWaylandTizenLaunchEffectPrivate(DSWaylandTizenLaunchEffect *p_ptr); + ~DSWaylandTizenLaunchEffectPrivate() override; + + void tizen_launch_effect_initialize(DSWaylandCompositor *wlCompositor); + void tizen_launch_effect_finalize(void); + +protected: + void tizen_launch_effect_bind_resource(Resource *resource); + void tizen_launch_effect_destroy_resource(Resource *resource); + + void tizen_launch_effect_create_splash_img(Resource *resource, uint32_t id); + void tizen_launch_effect_type_set(Resource *resource, const std::string &effect_type, uint32_t pid, struct ::wl_array *options); + void tizen_launch_effect_type_unset(Resource *resource, uint32_t pid); + void tizen_launch_effect_destroy(Resource *resource); + +private: + +}; + +} +#endif \ No newline at end of file diff --git a/src/DSWaylandServer/DSWaylandTizenLaunchSplash.cpp b/src/DSWaylandServer/DSWaylandTizenLaunchSplash.cpp new file mode 100644 index 0000000..b3a734f --- /dev/null +++ b/src/DSWaylandServer/DSWaylandTizenLaunchSplash.cpp @@ -0,0 +1,71 @@ +/* +* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +#include "DSWaylandTizenLaunchSplash.h" +#include "DSWaylandTizenLaunchSplashPrivate.h" + +namespace display_server +{ + +DSWaylandTizenLaunchSplashPrivate::DSWaylandTizenLaunchSplashPrivate(DSWaylandTizenLaunchSplash *p_ptr) + : DSObjectPrivate(p_ptr), + __p_ptr(p_ptr) +{} +DSWaylandTizenLaunchSplashPrivate::DSWaylandTizenLaunchSplashPrivate(DSWaylandTizenLaunchSplash *p_ptr, DSWaylandClient *waylandClient, uint32_t id) + : DSObjectPrivate(p_ptr), + __p_ptr(p_ptr) +{ + if (id > 0) { + tizen_launch_splash::init(waylandClient->wlClient(), (int)id, 1); + } + +} +DSWaylandTizenLaunchSplashPrivate::~DSWaylandTizenLaunchSplashPrivate() +{} + +void DSWaylandTizenLaunchSplashPrivate::tizen_launch_splash_bind_resource(Resource *resource) +{} +void DSWaylandTizenLaunchSplashPrivate::tizen_launch_splash_destroy_resource(Resource *resource) +{} + +void DSWaylandTizenLaunchSplashPrivate::tizen_launch_splash_destroy(Resource *resource) +{} +void DSWaylandTizenLaunchSplashPrivate::tizen_launch_splash_launch(Resource *resource, const std::string &file, uint32_t file_type, uint32_t color_depth, uint32_t rotation, uint32_t indicator, const std::string &effect_type, const std::string &theme_type, struct ::wl_array *options) +{} +void DSWaylandTizenLaunchSplashPrivate::tizen_launch_splash_owner(Resource *resource, uint32_t pid) +{} +void DSWaylandTizenLaunchSplashPrivate::tizen_launch_splash_launch_v2(Resource *resource, const std::string &file, uint32_t file_type, uint32_t color_depth, uint32_t rotation, uint32_t indicator, const std::string &effect_type, const std::string &theme_type, struct ::wl_array *options, struct ::wl_array *extra_config) +{} + +DSWaylandTizenLaunchSplash::DSWaylandTizenLaunchSplash() +{} + +DSWaylandTizenLaunchSplash::DSWaylandTizenLaunchSplash(DSWaylandClient *waylandClient, uint32_t id) + : _d_ptr(std::make_unique(this, waylandClient, id)) +{} + +DSWaylandTizenLaunchSplash::~DSWaylandTizenLaunchSplash() +{} + + +} \ No newline at end of file diff --git a/src/DSWaylandServer/DSWaylandTizenLaunchSplash.h b/src/DSWaylandServer/DSWaylandTizenLaunchSplash.h new file mode 100644 index 0000000..3543562 --- /dev/null +++ b/src/DSWaylandServer/DSWaylandTizenLaunchSplash.h @@ -0,0 +1,48 @@ +/* +* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +#ifndef __DS_WAYLAND_TIZEN_LAUNCHSPLASH_H__ +#define __DS_WAYLAND_TIZEN_LAUNCHSPLASH_H__ + +#include "DSWaylandClient.h" + +namespace display_server +{ + +class DSWaylandTizenLaunchSplashPrivate; + +class DSWaylandTizenLaunchSplash : public DSObject +{ +DS_PIMPL_USE_PRIVATE(DSWaylandTizenLaunchSplash); + +public: + DSWaylandTizenLaunchSplash(); + DSWaylandTizenLaunchSplash(DSWaylandClient *waylandClient, uint32_t id); + virtual ~DSWaylandTizenLaunchSplash(); + +private: + +}; + +} +#endif diff --git a/src/DSWaylandServer/DSWaylandTizenLaunchSplashPrivate.h b/src/DSWaylandServer/DSWaylandTizenLaunchSplashPrivate.h new file mode 100644 index 0000000..f911d7a --- /dev/null +++ b/src/DSWaylandServer/DSWaylandTizenLaunchSplashPrivate.h @@ -0,0 +1,60 @@ +/* +* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +#ifndef __DS_WAYLAND_TIZEN_LAUNCHSPLASH_PRIVATE_H__ +#define __DS_WAYLAND_TIZEN_LAUNCHSPLASH_PRIVATE_H__ + +#include "dswayland-server-tizen-launch.h" + +#include "DSWaylandTizenLaunchSplash.h" + +namespace display_server +{ + +class DSWaylandTizenLaunchSplash; + +class DS_DECL_EXPORT DSWaylandTizenLaunchSplashPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_launch_splash +{ +DS_PIMPL_USE_PUBLIC(DSWaylandTizenLaunchSplash); + +public: + DSWaylandTizenLaunchSplashPrivate() = delete; + DSWaylandTizenLaunchSplashPrivate(DSWaylandTizenLaunchSplash *p_ptr); + DSWaylandTizenLaunchSplashPrivate(DSWaylandTizenLaunchSplash *p_ptr, DSWaylandClient *waylandClient, uint32_t id); + ~DSWaylandTizenLaunchSplashPrivate() override; + +protected: + void tizen_launch_splash_bind_resource(Resource *resource); + void tizen_launch_splash_destroy_resource(Resource *resource); + + void tizen_launch_splash_destroy(Resource *resource); + void tizen_launch_splash_launch(Resource *resource, const std::string &file, uint32_t file_type, uint32_t color_depth, uint32_t rotation, uint32_t indicator, const std::string &effect_type, const std::string &theme_type, struct ::wl_array *options); + void tizen_launch_splash_owner(Resource *resource, uint32_t pid); + void tizen_launch_splash_launch_v2(Resource *resource, const std::string &file, uint32_t file_type, uint32_t color_depth, uint32_t rotation, uint32_t indicator, const std::string &effect_type, const std::string &theme_type, struct ::wl_array *options, struct ::wl_array *extra_config); + +private: + +}; + +} +#endif \ No newline at end of file diff --git a/src/meson.build b/src/meson.build index 6b988da..d84f3d2 100644 --- a/src/meson.build +++ b/src/meson.build @@ -165,6 +165,12 @@ libds_wayland_srcs = [ 'DSWaylandServer/DSWaylandTizenAppinfoPrivate.h', 'DSWaylandServer/DSWaylandTizenAppinfo.h', 'DSWaylandServer/DSWaylandTizenAppinfo.cpp', + 'DSWaylandServer/DSWaylandTizenLaunchEffectPrivate.h', + 'DSWaylandServer/DSWaylandTizenLaunchEffect.h', + 'DSWaylandServer/DSWaylandTizenLaunchEffect.cpp', + 'DSWaylandServer/DSWaylandTizenLaunchSplashPrivate.h', + 'DSWaylandServer/DSWaylandTizenLaunchSplash.h', + 'DSWaylandServer/DSWaylandTizenLaunchSplash.cpp', 'DSWaylandServer/DSWaylandProtocolTracePrivate.h', 'DSWaylandServer/DSWaylandProtocolTrace.h', 'DSWaylandServer/DSWaylandProtocolTrace.cpp', diff --git a/tests/DSWaylandTizenLaunchEffect-test.cpp b/tests/DSWaylandTizenLaunchEffect-test.cpp new file mode 100644 index 0000000..6a1eecd --- /dev/null +++ b/tests/DSWaylandTizenLaunchEffect-test.cpp @@ -0,0 +1,64 @@ +/* +* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +#include "libds-tests.h" +#include "DSWaylandTizenLaunchEffect.h" + +using namespace display_server; + +class DSWaylandTizenLaunchEffectTest : public ::testing::Test +{ +public: + void SetUp(void) override + {} + void TearDown(void) override + {} +}; + +TEST_F(DSWaylandTizenLaunchEffectTest, New_LaunchEffect) +{ + DSWaylandCompositor *compositor = DSWaylandCompositor::getInstance(); + DSWaylandTizenLaunchEffect *tzLaunchEffect = new DSWaylandTizenLaunchEffect(compositor); + EXPECT_TRUE(tzLaunchEffect != nullptr); + + if (tzLaunchEffect) + delete tzLaunchEffect; + + DSWaylandCompositor::releaseInstance(); +} + +TEST_F(DSWaylandTizenLaunchEffectTest, Initialize_LaunchEffect) +{ + bool ret; + + DSWaylandCompositor *compositor = DSWaylandCompositor::getInstance(); + DSWaylandTizenLaunchEffect *tzLaunchEffect = new DSWaylandTizenLaunchEffect(compositor); + + ret = tzLaunchEffect->initialize(compositor); + EXPECT_TRUE(ret == true); + + if (tzLaunchEffect) + delete tzLaunchEffect; + + DSWaylandCompositor::releaseInstance(); +} \ No newline at end of file diff --git a/tests/meson.build b/tests/meson.build index cab5ea3..f790065 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -30,6 +30,7 @@ libds_tests_srcs = [ 'DSWaylandTizenSurface-test.cpp', 'DSWaylandTizenIndicator-test.cpp', 'DSWaylandTizenAppinfo-test.cpp', + 'DSWaylandTizenLaunchEffect-test.cpp', 'DSWaylandZxdgShellV6-test.cpp', 'DSWaylandBuffer-test.cpp', 'DSObject-test.cpp', -- 2.7.4 From c02687aa766483b9b4f3efd5d89269d43674b057 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Tue, 25 Aug 2020 17:33:31 +0900 Subject: [PATCH 03/16] DSWaylandTizenSurface: implementation Tizen Surface protocol Change-Id: I94eff8b11a74f6406d00118609c128edf6cde769 Signed-off-by: Junkyeong Kim --- src/DSWaylandServer/DSWaylandTizenSurface.cpp | 102 +++++++++++++++++++-- src/DSWaylandServer/DSWaylandTizenSurface.h | 25 +++-- src/DSWaylandServer/DSWaylandTizenSurfacePrivate.h | 36 ++++---- tests/DSWaylandTizenSurface-test.cpp | 14 +-- 4 files changed, 132 insertions(+), 45 deletions(-) diff --git a/src/DSWaylandServer/DSWaylandTizenSurface.cpp b/src/DSWaylandServer/DSWaylandTizenSurface.cpp index a9df7fc..d81d933 100644 --- a/src/DSWaylandServer/DSWaylandTizenSurface.cpp +++ b/src/DSWaylandServer/DSWaylandTizenSurface.cpp @@ -28,26 +28,56 @@ namespace display_server { /* DSWaylandTizenSurfaceShm */ -DSWaylandTizenSurfaceShmPrivate::DSWaylandTizenSurfaceShmPrivate(DSWaylandTizenSurfaceShm *p_ptr) +DSWaylandTizenSurfaceShmPrivate::DSWaylandTizenSurfaceShmPrivate(DSWaylandTizenSurfaceShm *p_ptr, DSWaylandCompositor *compositor) : DSObjectPrivate(p_ptr), - __p_ptr(p_ptr) + __p_ptr(p_ptr), + __shmFlusher(nullptr) { + if (!compositor) + return; + + tizen_surface_shm::init(compositor->display(), 2); } DSWaylandTizenSurfaceShmPrivate::~DSWaylandTizenSurfaceShmPrivate() { + if (__shmFlusher != nullptr) + { + delete __shmFlusher; + __shmFlusher = nullptr; + } } void DSWaylandTizenSurfaceShmPrivate::tizen_surface_shm_get_flusher(tizen_surface_shm::Resource *resource, uint32_t id, struct ::wl_resource *surface) { + if (__shmFlusher != nullptr) + { + if (__shmFlusher->getShmFlusherSurface() == surface) + { + DSLOG_ERR("DSWaylandShm", "cannot get shmflusher with same surface."); + return; + } + else + { + DSLOG_INF("DSWaylandShm", "delete previous shmflusher."); + delete __shmFlusher; + } + } + + __shmFlusher = new DSWaylandTizenSurfaceShmFlusher(resource->client(), id, surface); } void DSWaylandTizenSurfaceShmPrivate::tizen_surface_shm_destroy(tizen_surface_shm::Resource *resource) { + if (__shmFlusher != nullptr) + { + delete __shmFlusher; + __shmFlusher = nullptr; + } } -DSWaylandTizenSurfaceShm::DSWaylandTizenSurfaceShm() - : DS_INIT_PRIVATE_PTR(DSWaylandTizenSurfaceShm) +DSWaylandTizenSurfaceShm::DSWaylandTizenSurfaceShm(DSWaylandCompositor *compositor) + : _d_ptr(std::make_unique(this, compositor)) { } @@ -55,23 +85,53 @@ DSWaylandTizenSurfaceShm::~DSWaylandTizenSurfaceShm() { } +DSWaylandTizenSurfaceShmFlusher *DSWaylandTizenSurfaceShm::getShmFlusher(DSWaylandTizenSurfaceShm *TizenSurfaceShm) +{ + DS_GET_PRIV(DSWaylandTizenSurfaceShm); + + return priv->__shmFlusher; +} + + /* DSWaylandTizenSurfaceShmFlusher */ -DSWaylandTizenSurfaceShmFlusherPrivate::DSWaylandTizenSurfaceShmFlusherPrivate(DSWaylandTizenSurfaceShmFlusher *p_ptr) +DSWaylandTizenSurfaceShmFlusherPrivate::DSWaylandTizenSurfaceShmFlusherPrivate(DSWaylandTizenSurfaceShmFlusher *p_ptr, struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface) : DSObjectPrivate(p_ptr), - __p_ptr(p_ptr) + __p_ptr(p_ptr), + __surface(nullptr) { + init(client, id, 2); + __surface = surface; } DSWaylandTizenSurfaceShmFlusherPrivate::~DSWaylandTizenSurfaceShmFlusherPrivate() { } +void DSWaylandTizenSurfaceShmFlusherPrivate::tizen_surface_shm_flusher_bind_resource(Resource *resource) +{ +} + void DSWaylandTizenSurfaceShmFlusherPrivate::tizen_surface_shm_flusher_destroy(Resource *resource) { } -DSWaylandTizenSurfaceShmFlusher::DSWaylandTizenSurfaceShmFlusher() - : DS_INIT_PRIVATE_PTR(DSWaylandTizenSurfaceShmFlusher) +void DSWaylandTizenSurfaceShmFlusherPrivate::sendShmFlusherFlush(void) +{ + send_flush(); +} + +void DSWaylandTizenSurfaceShmFlusherPrivate::sendShmFlusherFreeFlush(void) +{ + send_free_flush(); +} + +struct ::wl_resource *DSWaylandTizenSurfaceShmFlusherPrivate::getShmFlusherSurface(void) +{ + return __surface; +} + +DSWaylandTizenSurfaceShmFlusher::DSWaylandTizenSurfaceShmFlusher(struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface) + : _d_ptr(std::make_unique(this, client, id, surface)) { } @@ -79,5 +139,29 @@ DSWaylandTizenSurfaceShmFlusher::~DSWaylandTizenSurfaceShmFlusher() { } -} // namespace display_server +void DSWaylandTizenSurfaceShmFlusher::sendShmFlusherFlush(void) +{ + DS_GET_PRIV(DSWaylandTizenSurfaceShmFlusher); + + DSLOG_INF("DSWaylandShmFlusher", "sendShmFlusherFlush"); + + priv->sendShmFlusherFlush(); +} + +void DSWaylandTizenSurfaceShmFlusher::sendShmFlusherFreeFlush(void) +{ + DS_GET_PRIV(DSWaylandTizenSurfaceShmFlusher); + DSLOG_INF("DSWaylandShmFlusher", "sendShmFlusherFreeFlush"); + + priv->sendShmFlusherFreeFlush(); +} + +struct ::wl_resource *DSWaylandTizenSurfaceShmFlusher::getShmFlusherSurface(void) +{ + DS_GET_PRIV(DSWaylandTizenSurfaceShmFlusher); + + return priv->getShmFlusherSurface(); +} + +} // namespace display_server diff --git a/src/DSWaylandServer/DSWaylandTizenSurface.h b/src/DSWaylandServer/DSWaylandTizenSurface.h index b36fa00..b46068c 100644 --- a/src/DSWaylandServer/DSWaylandTizenSurface.h +++ b/src/DSWaylandServer/DSWaylandTizenSurface.h @@ -26,6 +26,8 @@ #include #include +#include +#include namespace display_server { @@ -33,25 +35,30 @@ namespace display_server class DSWaylandTizenSurfaceShmPrivate; class DSWaylandTizenSurfaceShmFlusherPrivate; -class DS_DECL_EXPORT DSWaylandTizenSurfaceShm : public DSObject +class DS_DECL_EXPORT DSWaylandTizenSurfaceShmFlusher : public DSObject { -DS_PIMPL_USE_PRIVATE(DSWaylandTizenSurfaceShm); +DS_PIMPL_USE_PRIVATE(DSWaylandTizenSurfaceShmFlusher); public: - DSWaylandTizenSurfaceShm(); - virtual ~DSWaylandTizenSurfaceShm(); + DSWaylandTizenSurfaceShmFlusher(struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface); + virtual ~DSWaylandTizenSurfaceShmFlusher(); + + void sendShmFlusherFlush(void); + void sendShmFlusherFreeFlush(void); + struct ::wl_resource *getShmFlusherSurface(void); }; -class DS_DECL_EXPORT DSWaylandTizenSurfaceShmFlusher : public DSObject +class DS_DECL_EXPORT DSWaylandTizenSurfaceShm : public DSObject { -DS_PIMPL_USE_PRIVATE(DSWaylandTizenSurfaceShmFlusher); +DS_PIMPL_USE_PRIVATE(DSWaylandTizenSurfaceShm); public: - DSWaylandTizenSurfaceShmFlusher(); - virtual ~DSWaylandTizenSurfaceShmFlusher(); + DSWaylandTizenSurfaceShm(DSWaylandCompositor *compositor); + virtual ~DSWaylandTizenSurfaceShm(); + + DSWaylandTizenSurfaceShmFlusher *getShmFlusher(DSWaylandTizenSurfaceShm *TizenSurfaceShm); }; } #endif - diff --git a/src/DSWaylandServer/DSWaylandTizenSurfacePrivate.h b/src/DSWaylandServer/DSWaylandTizenSurfacePrivate.h index 805f0f2..90a184e 100644 --- a/src/DSWaylandServer/DSWaylandTizenSurfacePrivate.h +++ b/src/DSWaylandServer/DSWaylandTizenSurfacePrivate.h @@ -30,38 +30,42 @@ namespace display_server { -class DS_DECL_EXPORT DSWaylandTizenSurfaceShmPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_surface_shm +class DS_DECL_EXPORT DSWaylandTizenSurfaceShmFlusherPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_surface_shm_flusher { -DS_PIMPL_USE_PUBLIC(DSWaylandTizenSurfaceShm); +DS_PIMPL_USE_PUBLIC(DSWaylandTizenSurfaceShmFlusher); public: - DSWaylandTizenSurfaceShmPrivate() = delete; - DSWaylandTizenSurfaceShmPrivate(DSWaylandTizenSurfaceShm *p_ptr); - ~DSWaylandTizenSurfaceShmPrivate() override; + DSWaylandTizenSurfaceShmFlusherPrivate() = delete; + DSWaylandTizenSurfaceShmFlusherPrivate(DSWaylandTizenSurfaceShmFlusher *p_ptr, struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface); + ~DSWaylandTizenSurfaceShmFlusherPrivate() override; + + void sendShmFlusherFlush(void); + void sendShmFlusherFreeFlush(void); + struct ::wl_resource *getShmFlusherSurface(void); protected: - void tizen_surface_shm_get_flusher(Resource *resource, uint32_t id, struct ::wl_resource *surface) override; - void tizen_surface_shm_destroy(Resource *resource) override; + void tizen_surface_shm_flusher_bind_resource(Resource *resource) override; + void tizen_surface_shm_flusher_destroy(Resource *resource) override; private: - /* data */ + struct ::wl_resource *__surface; }; -class DS_DECL_EXPORT DSWaylandTizenSurfaceShmFlusherPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_surface_shm_flusher +class DS_DECL_EXPORT DSWaylandTizenSurfaceShmPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_surface_shm { -DS_PIMPL_USE_PUBLIC(DSWaylandTizenSurfaceShmFlusher); +DS_PIMPL_USE_PUBLIC(DSWaylandTizenSurfaceShm); public: - DSWaylandTizenSurfaceShmFlusherPrivate() = delete; - DSWaylandTizenSurfaceShmFlusherPrivate(DSWaylandTizenSurfaceShmFlusher *p_ptr); - ~DSWaylandTizenSurfaceShmFlusherPrivate() override; + DSWaylandTizenSurfaceShmPrivate() = delete; + DSWaylandTizenSurfaceShmPrivate(DSWaylandTizenSurfaceShm *p_ptr, DSWaylandCompositor *compositor); + ~DSWaylandTizenSurfaceShmPrivate() override; protected: - void tizen_surface_shm_flusher_destroy(Resource *resource) override; + void tizen_surface_shm_get_flusher(Resource *resource, uint32_t id, struct ::wl_resource *surface) override; + void tizen_surface_shm_destroy(Resource *resource) override; private: - /* data */ + DSWaylandTizenSurfaceShmFlusher *__shmFlusher; }; } #endif - diff --git a/tests/DSWaylandTizenSurface-test.cpp b/tests/DSWaylandTizenSurface-test.cpp index bb988a6..68cf4a3 100644 --- a/tests/DSWaylandTizenSurface-test.cpp +++ b/tests/DSWaylandTizenSurface-test.cpp @@ -37,19 +37,11 @@ public: TEST_F(DSWaylandTizenSurfaceTest, NewDSWaylandTizenSurfaceShm) { - DSWaylandTizenSurfaceShm *shm = new DSWaylandTizenSurfaceShm; + DSWaylandCompositor *comp = DSWaylandCompositor::getInstance(); + DSWaylandTizenSurfaceShm *shm = new DSWaylandTizenSurfaceShm(comp); EXPECT_TRUE(shm != nullptr); if (shm) delete shm; + DSWaylandCompositor::releaseInstance(); } - -TEST_F(DSWaylandTizenSurfaceTest, NewDSWaylandTizenSurfaceShmFlusher) -{ - DSWaylandTizenSurfaceShmFlusher *shmFlusher = new DSWaylandTizenSurfaceShmFlusher; - EXPECT_TRUE(shmFlusher != nullptr); - - if (shmFlusher) - delete shmFlusher; -} - -- 2.7.4 From 0e20ddeb2352a1dd7f56da15531b0763f5d53b54 Mon Sep 17 00:00:00 2001 From: jeon Date: Tue, 25 Aug 2020 16:52:37 +0900 Subject: [PATCH 04/16] DSTextInput: add a API to get InputPanel's geometry Change-Id: If38af6096bc355d2540385ecb508ab39148eba78 --- src/DSTextInput/DSTextInput.cpp | 5 ++++ src/DSTextInput/DSTextInputPrivate.h | 2 ++ src/DSWaylandServer/DSWaylandInputMethod.cpp | 6 ++++- src/DSWaylandServer/DSWaylandInputPanel.cpp | 27 ++++++++++++++++++++++ src/DSWaylandServer/DSWaylandInputPanel.h | 2 ++ src/DSWaylandServer/DSWaylandInputPanelSurface.h | 2 ++ .../DSWaylandInputPanelSurfacePrivate.h | 2 ++ tests/DSWaylandInputPanel-test.cpp | 12 ++++++++++ tests/DSWaylandInputPanelSurface-test.cpp | 14 +++++++++++ 9 files changed, 71 insertions(+), 1 deletion(-) diff --git a/src/DSTextInput/DSTextInput.cpp b/src/DSTextInput/DSTextInput.cpp index 59d5c73..ada2e08 100644 --- a/src/DSTextInput/DSTextInput.cpp +++ b/src/DSTextInput/DSTextInput.cpp @@ -290,6 +290,11 @@ void DSTextInputPrivate::changeInputPanelVisibility(bool visible) __wlInputPanel->changeVisibility(visible); } +stGeometry DSTextInputPrivate::inputPanelGetGeometry(DSWaylandSurface *window) +{ + return __wlInputPanel->getSurfaceGeometry(window); +} + DSTextInput::DSTextInput() : DS_INIT_PRIVATE_PTR(DSTextInput) diff --git a/src/DSTextInput/DSTextInputPrivate.h b/src/DSTextInput/DSTextInputPrivate.h index c187846..6796183 100644 --- a/src/DSTextInput/DSTextInputPrivate.h +++ b/src/DSTextInput/DSTextInputPrivate.h @@ -26,6 +26,7 @@ #include #include +#include namespace display_server { @@ -109,6 +110,7 @@ public: void updateInputPanelState(bool waitUpdate); void setInputPanelTransientFor(DSWaylandSurface *window); void changeInputPanelVisibility(bool visible); + stGeometry inputPanelGetGeometry(DSWaylandSurface *window); private: DSWaylandCompositor *__wlCompositor; diff --git a/src/DSWaylandServer/DSWaylandInputMethod.cpp b/src/DSWaylandServer/DSWaylandInputMethod.cpp index fc79bf1..59a2f7f 100644 --- a/src/DSWaylandServer/DSWaylandInputMethod.cpp +++ b/src/DSWaylandServer/DSWaylandInputMethod.cpp @@ -895,7 +895,11 @@ void DSWaylandInputMethod::contextUpdateCandidateState(unsigned int state) { __dsTextInputPrivate->contextShowInputPanel(); int x = 0, y = 0, w = 0, h = 0; - /* TODO: get gemetry from input panel */ + stGeometry geometry = __dsTextInputPrivate->inputPanelGetGeometry(nullptr); + x = geometry.x; + y = geometry.y; + w = geometry.w; + h = geometry.h; __dsTextInputPrivate->contextUpdateIseGeometry(x, y, w, h); } } diff --git a/src/DSWaylandServer/DSWaylandInputPanel.cpp b/src/DSWaylandServer/DSWaylandInputPanel.cpp index 82e2570..512130f 100644 --- a/src/DSWaylandServer/DSWaylandInputPanel.cpp +++ b/src/DSWaylandServer/DSWaylandInputPanel.cpp @@ -244,6 +244,11 @@ DSWaylandInputPanelFloating* DSWaylandInputPanel::getFloatingData() return __inputPanelFloating; } +stGeometry DSWaylandInputPanel::getSurfaceGeometry(DSWaylandSurface *wlSurface) +{ + return __inputPanelSurface->getGeometry(wlSurface); +} + void DSWaylandInputPanel::__onEventIdleEnterer(void *data) { } @@ -452,6 +457,22 @@ void DSWaylandInputPanelSurfacePrivate::setFloatingPosition(int x, int y) #endif } +stGeometry DSWaylandInputPanelSurfacePrivate::getGeometry(DSWaylandSurface *wlSurface) +{ + DSWindowManager *windowManager = DSWindowManager::getInstance(); + stGeometry geometry = {0, }; + for (auto it = __dataMap.begin(); it != __dataMap.end(); it++) + { + DSWaylandInputPanelSurfaceData *surfaceData = (*it).second; + if (!wlSurface || (wlSurface == surfaceData->getWlSurface())) + { + return windowManager->getWindowGeometry(surfaceData->getWlSurface()); + } + } + windowManager->releaseInstance(); + return geometry; +} + void DSWaylandInputPanelSurfacePrivate::input_panel_surface_destroy_resource(Resource *resource) { auto it = __dataMap.find(resource); @@ -610,6 +631,12 @@ void DSWaylandInputPanelSurface::setFloatingPosition(int x, int y) priv->setFloatingPosition(x, y); } +stGeometry DSWaylandInputPanelSurface::getGeometry(DSWaylandSurface *wlSurface) +{ + DS_GET_PRIV(DSWaylandInputPanelSurface); + + return priv->getGeometry(wlSurface); +} } diff --git a/src/DSWaylandServer/DSWaylandInputPanel.h b/src/DSWaylandServer/DSWaylandInputPanel.h index ab2f8bb..b2a81d0 100644 --- a/src/DSWaylandServer/DSWaylandInputPanel.h +++ b/src/DSWaylandServer/DSWaylandInputPanel.h @@ -26,6 +26,7 @@ #include "DSCore.h" #include "DSObject.h" +#include "DSStruct.h" #include "DSWaylandCompositor.h" #include "DSEventLoop.h" #include "DSTextInputPrivate.h" @@ -60,6 +61,7 @@ public: bool isEffectRunning(DSWaylandSurface *window); void setFloatingPosition(int x, int y); DSWaylandInputPanelFloating *getFloatingData(); + stGeometry getSurfaceGeometry(DSWaylandSurface *wlSurface); private: DSWaylandCompositor *__compositor; diff --git a/src/DSWaylandServer/DSWaylandInputPanelSurface.h b/src/DSWaylandServer/DSWaylandInputPanelSurface.h index becea30..ca90872 100644 --- a/src/DSWaylandServer/DSWaylandInputPanelSurface.h +++ b/src/DSWaylandServer/DSWaylandInputPanelSurface.h @@ -26,6 +26,7 @@ #include "DSCore.h" #include "DSObject.h" +#include "DSStruct.h" #include "DSWaylandInputPanel.h" namespace display_server @@ -49,6 +50,7 @@ public: bool isEffectRunning(DSWaylandSurface *window); void setPosition(DSWaylandSurface *window, int width, int height); void setFloatingPosition(int x, int y); + stGeometry getGeometry(DSWaylandSurface *wlSurface); protected: diff --git a/src/DSWaylandServer/DSWaylandInputPanelSurfacePrivate.h b/src/DSWaylandServer/DSWaylandInputPanelSurfacePrivate.h index 03300df..6644229 100644 --- a/src/DSWaylandServer/DSWaylandInputPanelSurfacePrivate.h +++ b/src/DSWaylandServer/DSWaylandInputPanelSurfacePrivate.h @@ -28,6 +28,7 @@ #include "DSCore.h" #include "DSObjectPrivate.h" +#include "DSStruct.h" #include "DSWaylandInputPanelSurface.h" namespace display_server @@ -51,6 +52,7 @@ public: void setTransientForSurface(DSWaylandSurface *parent); void updateSurfaceVisibility(bool visible); void setFloatingPosition(int x, int y); + stGeometry getGeometry(DSWaylandSurface *wlSurface); protected: void input_panel_surface_destroy_resource(Resource *resource); diff --git a/tests/DSWaylandInputPanel-test.cpp b/tests/DSWaylandInputPanel-test.cpp index 85f9778..3e369b7 100644 --- a/tests/DSWaylandInputPanel-test.cpp +++ b/tests/DSWaylandInputPanel-test.cpp @@ -180,3 +180,15 @@ TEST_F(DSWaylandInputPanelTest, GetFloatingData) DSWaylandCompositor::releaseInstance(); } +TEST_F(DSWaylandInputPanelTest, GetSurfaceGeometry) +{ + DSWaylandCompositor *comp = DSWaylandCompositor::getInstance(); + DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp); + EXPECT_TRUE(inputPanel != nullptr); + + inputPanel->getSurfaceGeometry(nullptr); + + delete inputPanel; + DSWaylandCompositor::releaseInstance(); +} + diff --git a/tests/DSWaylandInputPanelSurface-test.cpp b/tests/DSWaylandInputPanelSurface-test.cpp index 763a8e1..c6ee3e1 100644 --- a/tests/DSWaylandInputPanelSurface-test.cpp +++ b/tests/DSWaylandInputPanelSurface-test.cpp @@ -151,3 +151,17 @@ TEST_F(DSWaylandInputPanelSurfaceTest, SetFloatingPosition) DSWaylandCompositor::releaseInstance(); } +TEST_F(DSWaylandInputPanelSurfaceTest, GetGeometry) +{ + DSWaylandCompositor *comp = DSWaylandCompositor::getInstance(); + DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp); + DSWaylandInputPanelSurface *inputPanelSurface = new DSWaylandInputPanelSurface(comp, inputPanel); + EXPECT_TRUE(inputPanelSurface != nullptr); + + inputPanelSurface->getGeometry(nullptr); + + delete inputPanelSurface; + delete inputPanel; + DSWaylandCompositor::releaseInstance(); +} + -- 2.7.4 From 4d92edc63b107922cdb12d13c2641a67753c02a1 Mon Sep 17 00:00:00 2001 From: jeon Date: Tue, 25 Aug 2020 17:25:18 +0900 Subject: [PATCH 05/16] DSTextInput: add APIs to update InputPanel information to TextInput Change-Id: Ie667e30ea5b11762db7f71d45f649388f6c3e6f8 --- src/DSTextInput/DSTextInput.cpp | 10 ++++ src/DSTextInput/DSTextInputPrivate.h | 2 + src/DSWaylandServer/DSWaylandInputMethod.cpp | 7 +++ src/DSWaylandServer/DSWaylandInputMethod.h | 2 + src/DSWaylandServer/DSWaylandInputPanel.cpp | 9 +++- src/DSWaylandServer/DSWaylandInputPanel.h | 1 + src/DSWaylandServer/DSWaylandTextInput.cpp | 66 ++++++++++++++++++++++++- src/DSWaylandServer/DSWaylandTextInput.h | 4 ++ src/DSWaylandServer/DSWaylandTextInputManager.h | 3 ++ src/DSWaylandServer/DSWaylandTextInputPrivate.h | 4 ++ tests/DSWaylandInputMethod-test.cpp | 14 ++++++ tests/DSWaylandInputPanel-test.cpp | 12 +++++ tests/DSWaylandTextInput-test.cpp | 28 +++++++++++ tests/DSWaylandTextInputManager-test.cpp | 24 +++++++++ 14 files changed, 183 insertions(+), 3 deletions(-) diff --git a/src/DSTextInput/DSTextInput.cpp b/src/DSTextInput/DSTextInput.cpp index ada2e08..83e4eb7 100644 --- a/src/DSTextInput/DSTextInput.cpp +++ b/src/DSTextInput/DSTextInput.cpp @@ -164,6 +164,16 @@ void DSTextInputPrivate::predictionHintData(std::string key, std::string value) __wlInputMethod->predictionHintData(key, value); } +void DSTextInputPrivate::updateTextInputPanelState(bool state) +{ + __wlTextInputManager->updateTextInputPanelState(state); +} + +void DSTextInputPrivate::setGeometryUpdated(bool updated) +{ + __wlTextInputManager->setGeometryUpdated(updated); +} + void DSTextInputPrivate::contextCommitString(unsigned int serial, std::string text) { diff --git a/src/DSTextInput/DSTextInputPrivate.h b/src/DSTextInput/DSTextInputPrivate.h index 6796183..ae1199a 100644 --- a/src/DSTextInput/DSTextInputPrivate.h +++ b/src/DSTextInput/DSTextInputPrivate.h @@ -81,6 +81,8 @@ public: void setMimeType(std::string type); void finalizeContent(std::string text, unsigned int cursorPosition); void predictionHintData(std::string key, std::string value); + void updateTextInputPanelState(bool state); + void setGeometryUpdated(bool updated); /* DSWaylandInputMethodContext request */ void contextCommitString(unsigned int serial, std::string text); diff --git a/src/DSWaylandServer/DSWaylandInputMethod.cpp b/src/DSWaylandServer/DSWaylandInputMethod.cpp index 59a2f7f..cb279fa 100644 --- a/src/DSWaylandServer/DSWaylandInputMethod.cpp +++ b/src/DSWaylandServer/DSWaylandInputMethod.cpp @@ -286,6 +286,7 @@ void DSWaylandInputMethodContextPrivate::input_method_context_update_ise_geometr DS_GET_PUB(DSWaylandInputMethodContext); pub->__inputMethod->contextUpdateIseGeometry(serial, x, y, width, height); + pub->__inputMethod->setGeometryUpdated(true); } void DSWaylandInputMethodContextPrivate::input_method_context_recapture_string(Resource *resource, uint32_t serial, int32_t index, uint32_t length, const std::string &preedit, const std::string &preedit_commit, const std::string &commit) @@ -910,5 +911,11 @@ void DSWaylandInputMethod::contextReshowInputPanel() /* TODO: update input panel */ } +void DSWaylandInputMethod::setGeometryUpdated(bool updated) +{ + if (!__dsTextInputPrivate) return; + + __dsTextInputPrivate->setGeometryUpdated(updated); +} } diff --git a/src/DSWaylandServer/DSWaylandInputMethod.h b/src/DSWaylandServer/DSWaylandInputMethod.h index 6b66ec2..e4f9870 100644 --- a/src/DSWaylandServer/DSWaylandInputMethod.h +++ b/src/DSWaylandServer/DSWaylandInputMethod.h @@ -91,6 +91,8 @@ public: void contextUpdateCandidateState(unsigned int state); void contextReshowInputPanel(); + void setGeometryUpdated(bool updated); + protected: private: diff --git a/src/DSWaylandServer/DSWaylandInputPanel.cpp b/src/DSWaylandServer/DSWaylandInputPanel.cpp index 512130f..51ef817 100644 --- a/src/DSWaylandServer/DSWaylandInputPanel.cpp +++ b/src/DSWaylandServer/DSWaylandInputPanel.cpp @@ -249,6 +249,13 @@ stGeometry DSWaylandInputPanel::getSurfaceGeometry(DSWaylandSurface *wlSurface) return __inputPanelSurface->getGeometry(wlSurface); } +void DSWaylandInputPanel::updateTextInputPanelState(bool state) +{ + if (!__dsTextInputPrivate) return; + + __dsTextInputPrivate->updateTextInputPanelState(state); +} + void DSWaylandInputPanel::__onEventIdleEnterer(void *data) { } @@ -325,7 +332,7 @@ void DSWaylandInputPanelSurfacePrivate::show(DSWaylandInputPanelSurfaceData *sur { pub->__inputPanel->setWaitUpdate(false); pub->__inputPanel->changeVisibility(true); - pub->__inputPanel->updateInputPanelState(true); // temporary code + pub->__inputPanel->updateTextInputPanelState(true); /* TODO: * if (getfocus(surfaceData->getWlSurface())->parent) * { diff --git a/src/DSWaylandServer/DSWaylandInputPanel.h b/src/DSWaylandServer/DSWaylandInputPanel.h index b2a81d0..4217502 100644 --- a/src/DSWaylandServer/DSWaylandInputPanel.h +++ b/src/DSWaylandServer/DSWaylandInputPanel.h @@ -62,6 +62,7 @@ public: void setFloatingPosition(int x, int y); DSWaylandInputPanelFloating *getFloatingData(); stGeometry getSurfaceGeometry(DSWaylandSurface *wlSurface); + void updateTextInputPanelState(bool state); private: DSWaylandCompositor *__compositor; diff --git a/src/DSWaylandServer/DSWaylandTextInput.cpp b/src/DSWaylandServer/DSWaylandTextInput.cpp index fdfc2dd..e062cb0 100644 --- a/src/DSWaylandServer/DSWaylandTextInput.cpp +++ b/src/DSWaylandServer/DSWaylandTextInput.cpp @@ -193,6 +193,16 @@ void DSWaylandTextInputManager::contextCommitContent(unsigned int serial, std::s __textInput->sendCommitContent(serial, content, description, mimeTypes); } +void DSWaylandTextInputManager::updateTextInputPanelState(bool state) +{ + __textInput->updatePanelState(state); +} + +void DSWaylandTextInputManager::setGeometryUpdated(bool updated) +{ + __textInput->setGeometryUpdated(updated); +} + DSWaylandTextInputPrivate::DSWaylandTextInputPrivate(DSWaylandTextInput *p_ptr, DSWaylandCompositor *compositor) : DSObjectPrivate(p_ptr), @@ -262,6 +272,8 @@ void DSWaylandTextInputPrivate::showInputPanel(void *resource) pub->__dsTextInputPrivate->setInputPanelState(DSTextInputPrivate::InputPanelStateWillShow); /* TODO: pub->__dsTextInputPrivate->setInputPanelTransientFor(getDSWindow(__activatedResource)); */ } + + pub->__geometryUpdated = false; } void DSWaylandTextInputPrivate::text_input_destroy(Resource *resource) @@ -839,12 +851,50 @@ void DSWaylandTextInputPrivate::sendCommitContent(unsigned int serial, std::stri send_commit_content(__activatedResource->handle, serial, content, description, mimeTypes); } +void DSWaylandTextInputPrivate::updatePanelState(bool state) +{ + DS_GET_PUB(DSWaylandTextInput); + + if (!__activatedResource) + { + DSLOG_WRN("DSWaylandTextInput", "No Text Input For Resource"); + return; + } + + if (!pub->__geometryUpdated) + { + stGeometry geo = pub->__dsTextInputPrivate->inputPanelGetGeometry(nullptr); + if (!(geo.w <= 1 || geo.h <= 1)) + pub->sendInputPanelGeometry(geo.x, geo.y, geo.w, geo.h); + pub->__geometryUpdated = true; + } + + unsigned int inputPanelState = WL_TEXT_INPUT_INPUT_PANEL_STATE_HIDE; + if (state) inputPanelState = WL_TEXT_INPUT_INPUT_PANEL_STATE_SHOW; + + send_input_panel_state(__activatedResource->handle, inputPanelState); +} + +void DSWaylandTextInputPrivate::updatePanelGeometry(DSWaylandSurface *wlSurface) +{ + DS_GET_PUB(DSWaylandTextInput); + if ((pub->__dsTextInputPrivate->getInputPanelState() != DSTextInputPrivate::InputPanelStateWillHide) && + (pub->__dsTextInputPrivate->getInputPanelState() != DSTextInputPrivate::InputPanelStateDidHide) && + (pub->__geometryUpdated)) + { + stGeometry geo = pub->__dsTextInputPrivate->inputPanelGetGeometry(nullptr); + if (!(geo.w <= 1 || geo.h <= 1)) + pub->sendInputPanelGeometry(geo.x, geo.y, geo.w, geo.h); + } +} + DSWaylandTextInput::DSWaylandTextInput(DSWaylandCompositor *compositor, DSWaylandTextInputManager *textInputManager) : DSObject(), _d_ptr(std::make_unique(this, compositor)), __compositor(compositor), __textInputManager(textInputManager), - __dsTextInputPrivate(nullptr) + __dsTextInputPrivate(nullptr), + __geometryUpdated(false) { } @@ -852,7 +902,8 @@ DSWaylandTextInput::DSWaylandTextInput(DSWaylandCompositor *compositor, DSWaylan : DSObject(), _d_ptr(std::make_unique(this, compositor)), __compositor(compositor), __textInputManager(textInputManager), - __dsTextInputPrivate(dsTextInputPrivate) + __dsTextInputPrivate(dsTextInputPrivate), + __geometryUpdated(false) { } @@ -1044,5 +1095,16 @@ void DSWaylandTextInput::sendCommitContent(unsigned int serial, std::string cont priv->sendCommitContent(serial, content, description, mimeTypes); } +void DSWaylandTextInput::updatePanelState(bool state) +{ + DS_GET_PRIV(DSWaylandTextInput); + + priv->updatePanelState(state); +} + +void DSWaylandTextInput::setGeometryUpdated(bool updated) +{ + __geometryUpdated = updated; +} } diff --git a/src/DSWaylandServer/DSWaylandTextInput.h b/src/DSWaylandServer/DSWaylandTextInput.h index 7648814..7f56414 100644 --- a/src/DSWaylandServer/DSWaylandTextInput.h +++ b/src/DSWaylandServer/DSWaylandTextInput.h @@ -67,12 +67,16 @@ public: void sendInputPanelEvent(unsigned int serial, unsigned int eventType, unsigned int value); void sendCommitContent(unsigned int serial, std::string content, std::string description, std::string mimeTypes); + void updatePanelState(bool state); + void setGeometryUpdated(bool updated); + protected: private: DSWaylandCompositor *__compositor; DSWaylandTextInputManager *__textInputManager; DSTextInputPrivate *__dsTextInputPrivate; + bool __geometryUpdated; }; } diff --git a/src/DSWaylandServer/DSWaylandTextInputManager.h b/src/DSWaylandServer/DSWaylandTextInputManager.h index da94210..8523e10 100644 --- a/src/DSWaylandServer/DSWaylandTextInputManager.h +++ b/src/DSWaylandServer/DSWaylandTextInputManager.h @@ -69,6 +69,9 @@ public: void contextInputPanelEvent(unsigned int serial, unsigned int eventType, unsigned int value); void contextCommitContent(unsigned int serial, std::string content, std::string description, std::string mimeTypes); + void updateTextInputPanelState(bool state); + void setGeometryUpdated(bool updated); + protected: private: diff --git a/src/DSWaylandServer/DSWaylandTextInputPrivate.h b/src/DSWaylandServer/DSWaylandTextInputPrivate.h index 2d168d6..bf9ef9d 100644 --- a/src/DSWaylandServer/DSWaylandTextInputPrivate.h +++ b/src/DSWaylandServer/DSWaylandTextInputPrivate.h @@ -33,6 +33,8 @@ namespace display_server { +class DSWaylandSurface; + class DS_DECL_EXPORT DSWaylandTextInputPrivate : public DSObjectPrivate, public DSWaylandServer::wl_text_input { DS_PIMPL_USE_PUBLIC(DSWaylandTextInput); @@ -65,6 +67,8 @@ public: void sendRecaptureString(unsigned int serial, int index, unsigned int length, std::string preedit, std::string preeditCommit, std::string commit); void sendInputPanelEvent(unsigned int serial, unsigned int eventType, unsigned int value); void sendCommitContent(unsigned int serial, std::string content, std::string description, std::string mimeTypes); + void updatePanelState(bool state); + void updatePanelGeometry(DSWaylandSurface *wlSurface); protected: void text_input_destroy(Resource *resource); diff --git a/tests/DSWaylandInputMethod-test.cpp b/tests/DSWaylandInputMethod-test.cpp index f3de95b..152b953 100644 --- a/tests/DSWaylandInputMethod-test.cpp +++ b/tests/DSWaylandInputMethod-test.cpp @@ -640,3 +640,17 @@ TEST_F(DSWaylandInputMethodTest, ContextReshowInputPanel) DSWaylandCompositor::releaseInstance(); } +TEST_F(DSWaylandInputMethodTest, SetGeometryUpdated) +{ + DSWaylandCompositor *comp = DSWaylandCompositor::getInstance(); + DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(comp); + EXPECT_TRUE(inputMethod != nullptr); + + inputMethod->activate(0); + inputMethod->setGeometryUpdated(true); + inputMethod->deactivate(); + + delete inputMethod; + DSWaylandCompositor::releaseInstance(); +} + diff --git a/tests/DSWaylandInputPanel-test.cpp b/tests/DSWaylandInputPanel-test.cpp index 3e369b7..7e9b421 100644 --- a/tests/DSWaylandInputPanel-test.cpp +++ b/tests/DSWaylandInputPanel-test.cpp @@ -192,3 +192,15 @@ TEST_F(DSWaylandInputPanelTest, GetSurfaceGeometry) DSWaylandCompositor::releaseInstance(); } +TEST_F(DSWaylandInputPanelTest, UpdateTextInputPanelState) +{ + DSWaylandCompositor *comp = DSWaylandCompositor::getInstance(); + DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp); + EXPECT_TRUE(inputPanel != nullptr); + + inputPanel->updateTextInputPanelState(true); + + delete inputPanel; + DSWaylandCompositor::releaseInstance(); +} + diff --git a/tests/DSWaylandTextInput-test.cpp b/tests/DSWaylandTextInput-test.cpp index 814f46a..0befd84 100644 --- a/tests/DSWaylandTextInput-test.cpp +++ b/tests/DSWaylandTextInput-test.cpp @@ -361,3 +361,31 @@ TEST_F(DSWaylandTextInputTest, SendCommitContent) DSWaylandCompositor::releaseInstance(); } +TEST_F(DSWaylandTextInputTest, UpdatePanelState) +{ + DSWaylandCompositor *comp = DSWaylandCompositor::getInstance(); + DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp); + DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager); + EXPECT_TRUE(textInput != nullptr); + + textInput->updatePanelState(true); + + delete textInput; + delete textInputManager; + DSWaylandCompositor::releaseInstance(); +} + +TEST_F(DSWaylandTextInputTest, SetGeometryUpdated) +{ + DSWaylandCompositor *comp = DSWaylandCompositor::getInstance(); + DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp); + DSWaylandTextInput *textInput = new DSWaylandTextInput(comp, textInputManager); + EXPECT_TRUE(textInput != nullptr); + + textInput->setGeometryUpdated(true); + + delete textInput; + delete textInputManager; + DSWaylandCompositor::releaseInstance(); +} + diff --git a/tests/DSWaylandTextInputManager-test.cpp b/tests/DSWaylandTextInputManager-test.cpp index e6ab9c9..4f74e7f 100644 --- a/tests/DSWaylandTextInputManager-test.cpp +++ b/tests/DSWaylandTextInputManager-test.cpp @@ -314,3 +314,27 @@ TEST_F(DSWaylandTextInputManagerTest, ContextCommitContent) DSWaylandCompositor::releaseInstance(); } +TEST_F(DSWaylandTextInputManagerTest, UpdateTextInputPanelState) +{ + DSWaylandCompositor *comp = DSWaylandCompositor::getInstance(); + DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp); + EXPECT_TRUE(textInputManager != nullptr); + + textInputManager->updateTextInputPanelState(true); + + delete textInputManager; + DSWaylandCompositor::releaseInstance(); +} + +TEST_F(DSWaylandTextInputManagerTest, SetGeometryUpdated) +{ + DSWaylandCompositor *comp = DSWaylandCompositor::getInstance(); + DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(comp); + EXPECT_TRUE(textInputManager != nullptr); + + textInputManager->setGeometryUpdated(true); + + delete textInputManager; + DSWaylandCompositor::releaseInstance(); +} + -- 2.7.4 From f72a0923c3160e606bc8f5f049371cb7397237d3 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Tue, 25 Aug 2020 20:12:02 +0900 Subject: [PATCH 06/16] DSWindow: fix bug not to re-show window Change-Id: I9e8b7a7fd15c67ff37ba31f33c6e9da6afd36e7f --- src/DSWindow/DSWindow.cpp | 15 +++++++++++++++ src/DSWindow/DSWindowPrivate.h | 1 + 2 files changed, 16 insertions(+) diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index abf824d..644fa59 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -41,6 +41,7 @@ DSWindowPrivate::DSWindowPrivate(DSWindow *p_ptr) __committedW(0), __committedH(0), __created(false), + __visible(false), __hasFocus(false), __waylandSurface(nullptr), __winShell(nullptr), @@ -219,6 +220,20 @@ void DSWindowPrivate::__onSurfaceCommitted(std::shared_ptrbufferChanged()) { std::shared_ptr buffer = waylandSurfaceCommitInfo->getBuffer(); + if (buffer) + { + std::shared_ptr bufferSize = buffer->getSize(); + __committedW = bufferSize->w; + __committedH = bufferSize->h; + + if (!__visible) + __visible = true; + } + else + { + __visible = false; + __firstCommit = true; + } // emit a signal of the buffer changed pub->__bufferChangedSignal.emit(buffer); diff --git a/src/DSWindow/DSWindowPrivate.h b/src/DSWindow/DSWindowPrivate.h index 2e6e642..3109df7 100644 --- a/src/DSWindow/DSWindowPrivate.h +++ b/src/DSWindow/DSWindowPrivate.h @@ -89,6 +89,7 @@ private: unsigned int __zOrder; unsigned int __committedW, __committedH; bool __created; + bool __visible; bool __hasFocus; std::shared_ptr __waylandSurface; DSWindowShell *__winShell; -- 2.7.4 From 0a745e4edcb3900e19aab856dd9554520e8359ea Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Tue, 25 Aug 2020 20:47:02 +0900 Subject: [PATCH 07/16] DSWindow: call raiseOnTop/lowerToBottom in raise/lower Change-Id: If4127017fe58ade902396c86f9c212a9e3d37cf0 --- src/DSWindow/DSWindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index 644fa59..517d13e 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -360,6 +360,7 @@ bool DSWindow::raise(void) { DS_GET_PRIV(DSWindow); + raiseToTop(); return priv->raise(); } @@ -367,6 +368,7 @@ bool DSWindow::lower(void) { DS_GET_PRIV(DSWindow); + lowerToBottom(); return priv->lower(); } -- 2.7.4 From 29e3c0c78db1c33155fa9c90f5273ba4124f704d Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Tue, 25 Aug 2020 20:48:05 +0900 Subject: [PATCH 08/16] DSZone: remove code to call raiseOnTop whenever stack is changed Change-Id: I8feadfff78d0ecacd398e5e1ac72844b82e58ed1 --- src/DSZone/DSZone.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index 6c9a31e..f8774da 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -236,8 +236,6 @@ void DSZone::__prependWindowList(std::shared_ptr window) std::shared_ptr wTop(__windowList.front()); __windowStackChangedSignal.emit(wTop); - - wTop->raiseToTop(); } void DSZone::__appendWindowList(std::shared_ptr window) @@ -250,8 +248,6 @@ void DSZone::__appendWindowList(std::shared_ptr window) std::shared_ptr wTop(__windowList.front()); __windowStackChangedSignal.emit(wTop); - - wTop->raiseToTop(); } std::shared_ptr DSZone::__findWindow(DSWaylandSurface *dswlSurface) @@ -308,9 +304,6 @@ void DSZone::__destroyWindow(std::shared_ptr window) std::shared_ptr wTop(__windowList.front()); __windowStackChangedSignal.emit(wTop); - - if (!__windowList.empty()) - wTop->raiseToTop(); } void DSZone::__updateWindowOrder(void) -- 2.7.4 From 4c6d9c3c3c26181853b170dbb29d7c43739cb2cb Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Thu, 27 Aug 2020 11:27:32 +0900 Subject: [PATCH 09/16] change file name to DSWaylandTizenSurfaceShm Change-Id: I2c9df5d4beec114a2e07f839b5bf5fff0666e7f3 Signed-off-by: Junkyeong Kim --- .../{DSWaylandTizenSurface.cpp => DSWaylandTizenSurfaceShm.cpp} | 4 ++-- .../{DSWaylandTizenSurface.h => DSWaylandTizenSurfaceShm.h} | 4 ++-- ...ylandTizenSurfacePrivate.h => DSWaylandTizenSurfaceShmPrivate.h} | 6 +++--- src/meson.build | 6 +++--- ...ylandTizenSurface-test.cpp => DSWaylandTizenSurfaceShm-test.cpp} | 6 +++--- tests/meson.build | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) rename src/DSWaylandServer/{DSWaylandTizenSurface.cpp => DSWaylandTizenSurfaceShm.cpp} (98%) rename src/DSWaylandServer/{DSWaylandTizenSurface.h => DSWaylandTizenSurfaceShm.h} (96%) rename src/DSWaylandServer/{DSWaylandTizenSurfacePrivate.h => DSWaylandTizenSurfaceShmPrivate.h} (95%) rename tests/{DSWaylandTizenSurface-test.cpp => DSWaylandTizenSurfaceShm-test.cpp} (90%) diff --git a/src/DSWaylandServer/DSWaylandTizenSurface.cpp b/src/DSWaylandServer/DSWaylandTizenSurfaceShm.cpp similarity index 98% rename from src/DSWaylandServer/DSWaylandTizenSurface.cpp rename to src/DSWaylandServer/DSWaylandTizenSurfaceShm.cpp index d81d933..ae1147c 100644 --- a/src/DSWaylandServer/DSWaylandTizenSurface.cpp +++ b/src/DSWaylandServer/DSWaylandTizenSurfaceShm.cpp @@ -21,8 +21,8 @@ * DEALINGS IN THE SOFTWARE. */ -#include "DSWaylandTizenSurface.h" -#include "DSWaylandTizenSurfacePrivate.h" +#include "DSWaylandTizenSurfaceShm.h" +#include "DSWaylandTizenSurfaceShmPrivate.h" namespace display_server { diff --git a/src/DSWaylandServer/DSWaylandTizenSurface.h b/src/DSWaylandServer/DSWaylandTizenSurfaceShm.h similarity index 96% rename from src/DSWaylandServer/DSWaylandTizenSurface.h rename to src/DSWaylandServer/DSWaylandTizenSurfaceShm.h index b46068c..350f80e 100644 --- a/src/DSWaylandServer/DSWaylandTizenSurface.h +++ b/src/DSWaylandServer/DSWaylandTizenSurfaceShm.h @@ -21,8 +21,8 @@ * DEALINGS IN THE SOFTWARE. */ -#ifndef _DS_WAYLAND_TIZEN_SURFACE_H_ -#define _DS_WAYLAND_TIZEN_SURFACE_H_ +#ifndef _DS_WAYLAND_TIZEN_SURFACE_SHM_H_ +#define _DS_WAYLAND_TIZEN_SURFACE_SHM_H_ #include #include diff --git a/src/DSWaylandServer/DSWaylandTizenSurfacePrivate.h b/src/DSWaylandServer/DSWaylandTizenSurfaceShmPrivate.h similarity index 95% rename from src/DSWaylandServer/DSWaylandTizenSurfacePrivate.h rename to src/DSWaylandServer/DSWaylandTizenSurfaceShmPrivate.h index 90a184e..5709e4d 100644 --- a/src/DSWaylandServer/DSWaylandTizenSurfacePrivate.h +++ b/src/DSWaylandServer/DSWaylandTizenSurfaceShmPrivate.h @@ -21,11 +21,11 @@ * DEALINGS IN THE SOFTWARE. */ -#ifndef _DS_WAYLAND_TIZEN_SURFACE_PRIVATE_H_ -#define _DS_WAYLAND_TIZEN_SURFACE_PRIVATE_H_ +#ifndef _DS_WAYLAND_TIZEN_SURFACE_SHM_PRIVATE_H_ +#define _DS_WAYLAND_TIZEN_SURFACE_SHM_PRIVATE_H_ #include "dswayland-server-tizen-surface.h" -#include "DSWaylandTizenSurface.h" +#include "DSWaylandTizenSurfaceShm.h" namespace display_server { diff --git a/src/meson.build b/src/meson.build index d84f3d2..d008344 100644 --- a/src/meson.build +++ b/src/meson.build @@ -117,9 +117,9 @@ libds_wayland_srcs = [ 'DSWaylandServer/DSWaylandTizenPolicy.cpp', 'DSWaylandServer/DSWaylandTizenPosition.cpp', 'DSWaylandServer/DSWaylandTizenVisibility.cpp', - 'DSWaylandServer/DSWaylandTizenSurface.cpp', - 'DSWaylandServer/DSWaylandTizenSurface.h', - 'DSWaylandServer/DSWaylandTizenSurfacePrivate.h', + 'DSWaylandServer/DSWaylandTizenSurfaceShm.cpp', + 'DSWaylandServer/DSWaylandTizenSurfaceShm.h', + 'DSWaylandServer/DSWaylandTizenSurfaceShmPrivate.h', 'DSWaylandServer/DSWaylandZxdgShellV6.cpp', 'DSWaylandServer/DSWaylandZxdgShellV6.h', 'DSWaylandServer/DSWaylandZxdgShellV6Private.h', diff --git a/tests/DSWaylandTizenSurface-test.cpp b/tests/DSWaylandTizenSurfaceShm-test.cpp similarity index 90% rename from tests/DSWaylandTizenSurface-test.cpp rename to tests/DSWaylandTizenSurfaceShm-test.cpp index 68cf4a3..6471826 100644 --- a/tests/DSWaylandTizenSurface-test.cpp +++ b/tests/DSWaylandTizenSurfaceShm-test.cpp @@ -22,11 +22,11 @@ */ #include "libds-tests.h" -#include "DSWaylandTizenSurface.h" +#include "DSWaylandTizenSurfaceShm.h" using namespace display_server; -class DSWaylandTizenSurfaceTest : public ::testing::Test +class DSWaylandTizenSurfaceShmTest : public ::testing::Test { public: void SetUp(void) override @@ -35,7 +35,7 @@ public: {} }; -TEST_F(DSWaylandTizenSurfaceTest, NewDSWaylandTizenSurfaceShm) +TEST_F(DSWaylandTizenSurfaceShmTest, NewDSWaylandTizenSurfaceShm) { DSWaylandCompositor *comp = DSWaylandCompositor::getInstance(); DSWaylandTizenSurfaceShm *shm = new DSWaylandTizenSurfaceShm(comp); diff --git a/tests/meson.build b/tests/meson.build index f790065..1a91dbb 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -27,7 +27,7 @@ libds_tests_srcs = [ 'DSWaylandTizenInputDeviceManager-test.cpp', 'DSWaylandTizenInputDevice-test.cpp', 'DSWaylandTizenPolicy-test.cpp', - 'DSWaylandTizenSurface-test.cpp', + 'DSWaylandTizenSurfaceShm-test.cpp', 'DSWaylandTizenIndicator-test.cpp', 'DSWaylandTizenAppinfo-test.cpp', 'DSWaylandTizenLaunchEffect-test.cpp', -- 2.7.4 From 6e6a2c38623754ac42ee941662d7659686589100 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Thu, 27 Aug 2020 10:58:00 +0900 Subject: [PATCH 10/16] IDSWaylandShell/DSWaylandZxdgShellV6: send destroyed signal when DSWaylandSurface is destroyed Change-Id: I994d1ca4e7292c4408d44473a963d52fcf2c51bf --- src/DSWaylandServer/DSWaylandZxdgShellV6.cpp | 26 +++++++++++++++++++------- src/DSWaylandServer/DSWaylandZxdgShellV6.h | 9 +++++++-- src/DSWaylandServer/IDSWaylandShell.h | 1 + tests/DSWaylandZxdgShellV6-test.cpp | 25 +++++++++++++------------ 4 files changed, 40 insertions(+), 21 deletions(-) diff --git a/src/DSWaylandServer/DSWaylandZxdgShellV6.cpp b/src/DSWaylandServer/DSWaylandZxdgShellV6.cpp index f72a1e7..40ba862 100644 --- a/src/DSWaylandServer/DSWaylandZxdgShellV6.cpp +++ b/src/DSWaylandServer/DSWaylandZxdgShellV6.cpp @@ -88,6 +88,10 @@ void DSWaylandZxdgShellV6::registerCallbackShellSurfaceCreated(DSObject *slot, s __zxdgSurfaceCreatedSignal.connect(slot, func); } +void DSWaylandZxdgShellV6::registerCallbackShellSurfaceDestroyed(DSObject *slot, std::function func) +{ + __zxdgSurfaceDestroyedSignal.connect(slot, func); +} DSWaylandZxdgShellV6Private::DSWaylandZxdgShellV6Private(DSWaylandZxdgShellV6 *p_ptr) : DSObjectPrivate(p_ptr), __p_ptr(p_ptr) @@ -116,7 +120,7 @@ void DSWaylandZxdgShellV6Private::zxdg_shell_v6_get_xdg_surface(zxdg_shell_v6::R DSLOG_DBG("DSWaylandZxdgShell", ""); DS_GET_PUB(DSWaylandZxdgShellV6); - DSWaylandZxdgSurfaceV6 *zxdgSurf = new DSWaylandZxdgSurfaceV6(resource->client(), id, ZXDG_SURFACE_V6_VERSION); + DSWaylandZxdgSurfaceV6 *zxdgSurf = new DSWaylandZxdgSurfaceV6(resource->client(), id, ZXDG_SURFACE_V6_VERSION, pub); if (zxdgSurf) { zxdgSurf->setWlSurface(surface); @@ -130,8 +134,6 @@ void DSWaylandZxdgShellV6Private::zxdg_shell_v6_get_xdg_surface(zxdg_shell_v6::R DSLOG_DBG("DSWaylandZxdgShell", "DSWaylandZxdgSurface:%p, DSWaylandSurface:%p, wl_surface:%p", zxdgSurf, dswlSurface, surface); pub->addSurface(zxdgSurf); - // emit a signal of the zxdg surface created - pub->__zxdgSurfaceCreatedSignal.emit(zxdgSurf); } } void DSWaylandZxdgShellV6Private::zxdg_shell_v6_pong(zxdg_shell_v6::Resource *resource, uint32_t serial) @@ -143,11 +145,17 @@ void DSWaylandZxdgShellV6Private::addSurface(DSWaylandZxdgSurfaceV6 *zxdgSurf) for (DSWaylandZxdgSurfaceV6 *surf : __surfList) if (surf == zxdgSurf) return; + DS_GET_PUB(DSWaylandZxdgShellV6); + pub->__zxdgSurfaceCreatedSignal.emit(zxdgSurf); + __surfList.push_back(zxdgSurf); } void DSWaylandZxdgShellV6Private::delSurface(DSWaylandZxdgSurfaceV6 *zxdgSurf) { + DS_GET_PUB(DSWaylandZxdgShellV6); + pub->__zxdgSurfaceDestroyedSignal.emit(zxdgSurf); + __surfList.remove(zxdgSurf); } @@ -227,19 +235,23 @@ void DSWaylandZxdgPositionerV6Private::zxdg_positioner_v6_set_offset(zxdg_positi DSWaylandZxdgSurfaceV6 *****************************************/ -DSWaylandZxdgSurfaceV6::DSWaylandZxdgSurfaceV6() - : IDSWaylandShellSurface(), DS_INIT_PRIVATE_PTR(DSWaylandZxdgSurfaceV6) +DSWaylandZxdgSurfaceV6::DSWaylandZxdgSurfaceV6(DSWaylandZxdgShellV6 *xdgShell) + : IDSWaylandShellSurface(), DS_INIT_PRIVATE_PTR(DSWaylandZxdgSurfaceV6), + __xdgShell(xdgShell) { } -DSWaylandZxdgSurfaceV6::DSWaylandZxdgSurfaceV6(struct ::wl_client *client, int id, int ver) - : IDSWaylandShellSurface(), DS_INIT_PRIVATE_PTR(DSWaylandZxdgSurfaceV6) +DSWaylandZxdgSurfaceV6::DSWaylandZxdgSurfaceV6(struct ::wl_client *client, int id, int ver, DSWaylandZxdgShellV6 *xdgShell) + : IDSWaylandShellSurface(), DS_INIT_PRIVATE_PTR(DSWaylandZxdgSurfaceV6), + __xdgShell(xdgShell) { this->init(client, id, ver); } DSWaylandZxdgSurfaceV6::~DSWaylandZxdgSurfaceV6() { + if (__xdgShell) + __xdgShell->delSurface(this); } void DSWaylandZxdgSurfaceV6::init(struct ::wl_client *client, int id, int ver) diff --git a/src/DSWaylandServer/DSWaylandZxdgShellV6.h b/src/DSWaylandServer/DSWaylandZxdgShellV6.h index 6eb6446..0ba2f2a 100644 --- a/src/DSWaylandServer/DSWaylandZxdgShellV6.h +++ b/src/DSWaylandServer/DSWaylandZxdgShellV6.h @@ -61,9 +61,11 @@ public: std::list getSurfaceList(); void registerCallbackShellSurfaceCreated(DSObject *slot, std::function func); + void registerCallbackShellSurfaceDestroyed(DSObject *slot, std::function func); public: DSSignal __zxdgSurfaceCreatedSignal; + DSSignal __zxdgSurfaceDestroyedSignal; }; class DSWaylandZxdgPositionerV6 : public DSObject @@ -92,8 +94,8 @@ public: }; public: - DSWaylandZxdgSurfaceV6(); - DSWaylandZxdgSurfaceV6(struct ::wl_client *client, int id, int ver); + DSWaylandZxdgSurfaceV6(DSWaylandZxdgShellV6 *xdgShell); + DSWaylandZxdgSurfaceV6(struct ::wl_client *client, int id, int ver, DSWaylandZxdgShellV6 *xdgShell); virtual ~DSWaylandZxdgSurfaceV6(); void init(struct ::wl_client *client, int id, int ver); @@ -113,6 +115,9 @@ public: void getGeometry(int *x, int *y, int *w, int *h); std::string getWindowTitle(); std::string getAppID(); + +private: + DSWaylandZxdgShellV6 *__xdgShell; }; class DSWaylandZxdgToplevelV6 : public DSObject diff --git a/src/DSWaylandServer/IDSWaylandShell.h b/src/DSWaylandServer/IDSWaylandShell.h index 290efe0..d64a1bc 100644 --- a/src/DSWaylandServer/IDSWaylandShell.h +++ b/src/DSWaylandServer/IDSWaylandShell.h @@ -41,6 +41,7 @@ public: virtual ~IDSWaylandShell() = default; virtual void registerCallbackShellSurfaceCreated(DSObject *slot, std::function func) = 0; + virtual void registerCallbackShellSurfaceDestroyed(DSObject *slot, std::function func) = 0; }; diff --git a/tests/DSWaylandZxdgShellV6-test.cpp b/tests/DSWaylandZxdgShellV6-test.cpp index a0b9bc0..aae14f2 100644 --- a/tests/DSWaylandZxdgShellV6-test.cpp +++ b/tests/DSWaylandZxdgShellV6-test.cpp @@ -47,18 +47,21 @@ TEST_F(DSWaylandZxdgShellV6Test, NewDSWaylandZxdgShellV6) TEST_F(DSWaylandZxdgShellV6Test, ShellAddSurface) { DSWaylandZxdgShellV6 *zxdgShell = new DSWaylandZxdgShellV6; - DSWaylandZxdgSurfaceV6 *zxdgSurf = new DSWaylandZxdgSurfaceV6; + DSWaylandZxdgSurfaceV6 *zxdgSurface = new DSWaylandZxdgSurfaceV6(zxdgShell); EXPECT_TRUE(zxdgShell != nullptr); - EXPECT_TRUE(zxdgSurf != nullptr); + EXPECT_TRUE(zxdgSurface != nullptr); - zxdgShell->addSurface(zxdgSurf); + zxdgShell->addSurface(zxdgSurface); EXPECT_TRUE(true); + + if (zxdgSurface) delete zxdgSurface; + if (zxdgShell) delete zxdgShell; } TEST_F(DSWaylandZxdgShellV6Test, ShellGetSurfaceList) { DSWaylandZxdgShellV6 *zxdgShell = new DSWaylandZxdgShellV6; - DSWaylandZxdgSurfaceV6 *zxdgSurface = new DSWaylandZxdgSurfaceV6; + DSWaylandZxdgSurfaceV6 *zxdgSurface = new DSWaylandZxdgSurfaceV6(zxdgShell); EXPECT_TRUE(zxdgShell != nullptr); EXPECT_TRUE(zxdgSurface != nullptr); @@ -70,10 +73,8 @@ TEST_F(DSWaylandZxdgShellV6Test, ShellGetSurfaceList) EXPECT_TRUE(*iter == zxdgSurface); } - if (zxdgShell) - delete zxdgShell; - if (zxdgSurface) - delete zxdgSurface; + if (zxdgSurface) delete zxdgSurface; + if (zxdgShell) delete zxdgShell; } TEST_F(DSWaylandZxdgShellV6Test, NewDSWaylandZxdgPositionerV6) @@ -87,7 +88,7 @@ TEST_F(DSWaylandZxdgShellV6Test, NewDSWaylandZxdgPositionerV6) TEST_F(DSWaylandZxdgShellV6Test, NewDSWaylandZxdgSurfaceV6) { - DSWaylandZxdgSurfaceV6 *zxdgSurface = new DSWaylandZxdgSurfaceV6; + DSWaylandZxdgSurfaceV6 *zxdgSurface = new DSWaylandZxdgSurfaceV6(nullptr); EXPECT_TRUE(zxdgSurface != nullptr); if (zxdgSurface) @@ -99,7 +100,7 @@ TEST_F(DSWaylandZxdgShellV6Test, SetSurface) auto dsSurface = std::make_shared(); EXPECT_TRUE(dsSurface != nullptr); - auto zxdgSurface = std::make_shared(); + auto zxdgSurface = std::make_shared(nullptr); EXPECT_TRUE(zxdgSurface != nullptr); if (zxdgSurface && dsSurface) @@ -114,7 +115,7 @@ TEST_F(DSWaylandZxdgShellV6Test, SetSurface) TEST_F(DSWaylandZxdgShellV6Test, SurfaceSetWindowTitle) { - DSWaylandZxdgSurfaceV6 *zxdgSurface = new DSWaylandZxdgSurfaceV6; + DSWaylandZxdgSurfaceV6 *zxdgSurface = new DSWaylandZxdgSurfaceV6(nullptr); std::string inputStr("test"); EXPECT_TRUE(zxdgSurface != nullptr); @@ -127,7 +128,7 @@ TEST_F(DSWaylandZxdgShellV6Test, SurfaceSetWindowTitle) TEST_F(DSWaylandZxdgShellV6Test, SurfaceSetAppID) { - DSWaylandZxdgSurfaceV6 *zxdgSurface = new DSWaylandZxdgSurfaceV6; + DSWaylandZxdgSurfaceV6 *zxdgSurface = new DSWaylandZxdgSurfaceV6(nullptr); std::string inputStr("test"); EXPECT_TRUE(zxdgSurface != nullptr); -- 2.7.4 From 4ceb0ea7a56359dfe9541a90d24a0ee3889e6145 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Thu, 27 Aug 2020 10:59:48 +0900 Subject: [PATCH 11/16] DSZone: add DSWaylandSurface destroyed callback function Change-Id: I4a6f59a68b5850dad82644c2bd6a492fbf19acdb --- src/DSZone/DSZone.cpp | 32 +++++++++++++++++++++++++++++--- src/DSZone/DSZone.h | 1 + 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index f8774da..58ce34c 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -57,7 +57,10 @@ DSZone::DSZone() __waylandShell = __waylandCompositor->getShell(); if (__waylandShell) + { __waylandShell->registerCallbackShellSurfaceCreated(this, std::bind(&DSZone::__onShellSurfaceCreated, this, std::placeholders::_1)); + __waylandShell->registerCallbackShellSurfaceDestroyed(this, std::bind(&DSZone::__onShellSurfaceDestroyed, this, std::placeholders::_1)); + } } __setSupportAuxHints(); @@ -179,7 +182,7 @@ void DSZone::__onSurfaceDestroy(std::shared_ptr waylandSurface void DSZone::__onShellSurfaceCreated(IDSWaylandShellSurface *waylandShellSurface) { - DSLOG_DBG("DSZone", "waylandShellSurface:(pure:%p)", waylandShellSurface); + DSLOG_DBG("DSZone", "Created waylandShellSurface:(pure:%p)", waylandShellSurface); if (waylandShellSurface) { @@ -202,6 +205,31 @@ void DSZone::__onShellSurfaceCreated(IDSWaylandShellSurface *waylandShellSurface } } +void DSZone::__onShellSurfaceDestroyed(IDSWaylandShellSurface *waylandShellSurface) +{ + DSLOG_DBG("DSZone", "Destroyed waylandShellSurface:(pure:%p)", waylandShellSurface); + + if (waylandShellSurface) + { + struct ::wl_resource *wlSurface = waylandShellSurface->getWlSurface(); + DSLOG_DBG("DSZone", "get wl_surface:%p", wlSurface); + + DSWaylandSurface *dsSurface = waylandShellSurface->getSurface(); + DSLOG_DBG("DSZone", "get DSWaylandSurface:%p", dsSurface); + + if (dsSurface) + { + // find DSWindowShell associated with DSWaylandSurface + DSWindowShell *dsWinShell = __findWindowShell(dsSurface); + if (dsWinShell) + { + DSLOG_DBG("DSZONE", "Find DSWindowShell (%p)... setShellSurface to nullptr!", dsWinShell); + dsWinShell->setShellSurface(nullptr); + } + } + } +} + // for Test void DSZone::callCallbackWindowShellCreated(std::shared_ptr winShell) { @@ -278,8 +306,6 @@ DSWindowShell *DSZone::__findWindowShell(DSWaylandSurface *dswlSurface) } dsWinShell = iter->second; - DSLOG_DBG("DSZone", "Find DSWindowShell(%p)... DSWaylandSurface(%p)", dsWinShell, dswlSurface); - return dsWinShell; } diff --git a/src/DSZone/DSZone.h b/src/DSZone/DSZone.h index 48df95a..338d070 100644 --- a/src/DSZone/DSZone.h +++ b/src/DSZone/DSZone.h @@ -95,6 +95,7 @@ private: void __onSurfaceDestroy(std::shared_ptr waylandSurface); void __onShellSurfaceCreated(IDSWaylandShellSurface *waylandShellSurface); + void __onShellSurfaceDestroyed(IDSWaylandShellSurface *waylandShellSurface); std::shared_ptr __createWindow(std::shared_ptr waylandSurface); void __destroyWindow(std::shared_ptr window); -- 2.7.4 From d5e51f84a2c582362029923bfbdfcc75fbf67900 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Thu, 27 Aug 2020 11:24:43 +0900 Subject: [PATCH 12/16] DSWindow/DSWindowShell: send configure event when DSWindowShell is set to DSWindow Change-Id: I3a2c21d3cd51c92d742f3292d8fbee7b66cba0c8 --- src/DSWindow/DSWindow.cpp | 4 +--- src/DSWindowShell/DSWindowShellPrivate.cpp | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index 517d13e..a83e758 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -206,8 +206,7 @@ void DSWindowPrivate::__onSurfaceCommitted(std::shared_ptr Date: Thu, 27 Aug 2020 12:36:50 +0900 Subject: [PATCH 13/16] DSRenderViewDaliImpl: emit update signal when DSWindow destroyed. Change-Id: I0bd58e1e4f1d9e5e96606324c35dbde5c1b0cd43 Signed-off-by: Joonbum Ko --- src/DSRender/DSRenderViewDaliImpl.cpp | 22 +++++++++++++++++++--- src/DSRender/DSRenderViewDaliImpl.h | 3 +++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/DSRender/DSRenderViewDaliImpl.cpp b/src/DSRender/DSRenderViewDaliImpl.cpp index 7cc724d..ef3c1f2 100644 --- a/src/DSRender/DSRenderViewDaliImpl.cpp +++ b/src/DSRender/DSRenderViewDaliImpl.cpp @@ -84,7 +84,8 @@ Geometry DSRenderViewDaliImpl::CreateTexturedQuad() DSRenderViewDaliImpl::DSRenderViewDaliImpl(std::shared_ptr window, Dali::OffscreenWindow offscreenWindow) : __window(window), - __offscreenWindow(offscreenWindow) + __offscreenWindow(offscreenWindow), + __windowDestroyed(false) { std::string fragmentShader = "#extension GL_OES_EGL_image_external:require\n"; fragmentShader += FRAGMENT_SHADER; @@ -104,6 +105,7 @@ DSRenderViewDaliImpl::DSRenderViewDaliImpl(std::shared_ptr window, Dal offscreenWindow.Add(__textureViewActor); // callbacks + window->registerCallbackWindowDestroyed(this, std::bind(&DSRenderViewDaliImpl::__onWindowDestroyed, this, std::placeholders::_1)); window->registerCallbackBufferChanged(this, std::bind(&DSRenderViewDaliImpl::__onWindowBufferChanged, this, std::placeholders::_1)); window->registerCallbackWindowRaiseToTop(this, std::bind(&DSRenderViewDaliImpl::__onWindowRaiseToTopChanged, this, std::placeholders::_1)); window->registerCallbackWindowLowerToBottom(this, std::bind(&DSRenderViewDaliImpl::__onWindowLowerToBottomChanged, this, std::placeholders::_1)); @@ -112,8 +114,10 @@ DSRenderViewDaliImpl::DSRenderViewDaliImpl(std::shared_ptr window, Dal DSRenderViewDaliImpl::~DSRenderViewDaliImpl() { - __textureViewActor.RemoveRenderer(__renderer); - __offscreenWindow.Remove(__textureViewActor); + if (!__windowDestroyed) { + __textureViewActor.RemoveRenderer(__renderer); + __offscreenWindow.Remove(__textureViewActor); + } } bool DSRenderViewDaliImpl::setBuffer(std::shared_ptr buffer) @@ -156,6 +160,18 @@ void DSRenderViewDaliImpl::registerCallbackUpdated(DSObject *slot, std::function __updatedSignal.connect(slot, func); } +void DSRenderViewDaliImpl::__onWindowDestroyed(void *data) +{ + DSLOG_INF("DSRenderViewDaliImpl", "__onWindowDestroyed."); + + __textureViewActor.RemoveRenderer(__renderer); + __offscreenWindow.Remove(__textureViewActor); + + __windowDestroyed = true; + + __updatedSignal.emit(nullptr); +} + void DSRenderViewDaliImpl::__onWindowBufferChanged(std::shared_ptr buffer) { if (buffer) { diff --git a/src/DSRender/DSRenderViewDaliImpl.h b/src/DSRender/DSRenderViewDaliImpl.h index 8ffd858..f982bc5 100644 --- a/src/DSRender/DSRenderViewDaliImpl.h +++ b/src/DSRender/DSRenderViewDaliImpl.h @@ -48,6 +48,7 @@ public: Dali::Geometry CreateTexturedQuad(); private: + void __onWindowDestroyed(void *data); void __onWindowBufferChanged(std::shared_ptr buffer); void __onWindowRaiseToTopChanged(void *data); void __onWindowLowerToBottomChanged(void *data); @@ -58,6 +59,8 @@ private: Dali::Renderer __renderer; Dali::Actor __textureViewActor; + bool __windowDestroyed; + DSSignal __updatedSignal; }; -- 2.7.4 From 3b30a98a14643822d3c7d40088b1c162865ce681 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Thu, 27 Aug 2020 13:25:38 +0900 Subject: [PATCH 14/16] Revert "DSRenderViewDaliImpl: emit update signal when DSWindow destroyed." This reverts commit b2d52c11f9d584876887fb61d7ea2085627c2640. Change-Id: I23afcb6fd0c6a850bd0098dd8c26b0bbba54b76a --- src/DSRender/DSRenderViewDaliImpl.cpp | 22 +++------------------- src/DSRender/DSRenderViewDaliImpl.h | 3 --- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/src/DSRender/DSRenderViewDaliImpl.cpp b/src/DSRender/DSRenderViewDaliImpl.cpp index ef3c1f2..7cc724d 100644 --- a/src/DSRender/DSRenderViewDaliImpl.cpp +++ b/src/DSRender/DSRenderViewDaliImpl.cpp @@ -84,8 +84,7 @@ Geometry DSRenderViewDaliImpl::CreateTexturedQuad() DSRenderViewDaliImpl::DSRenderViewDaliImpl(std::shared_ptr window, Dali::OffscreenWindow offscreenWindow) : __window(window), - __offscreenWindow(offscreenWindow), - __windowDestroyed(false) + __offscreenWindow(offscreenWindow) { std::string fragmentShader = "#extension GL_OES_EGL_image_external:require\n"; fragmentShader += FRAGMENT_SHADER; @@ -105,7 +104,6 @@ DSRenderViewDaliImpl::DSRenderViewDaliImpl(std::shared_ptr window, Dal offscreenWindow.Add(__textureViewActor); // callbacks - window->registerCallbackWindowDestroyed(this, std::bind(&DSRenderViewDaliImpl::__onWindowDestroyed, this, std::placeholders::_1)); window->registerCallbackBufferChanged(this, std::bind(&DSRenderViewDaliImpl::__onWindowBufferChanged, this, std::placeholders::_1)); window->registerCallbackWindowRaiseToTop(this, std::bind(&DSRenderViewDaliImpl::__onWindowRaiseToTopChanged, this, std::placeholders::_1)); window->registerCallbackWindowLowerToBottom(this, std::bind(&DSRenderViewDaliImpl::__onWindowLowerToBottomChanged, this, std::placeholders::_1)); @@ -114,10 +112,8 @@ DSRenderViewDaliImpl::DSRenderViewDaliImpl(std::shared_ptr window, Dal DSRenderViewDaliImpl::~DSRenderViewDaliImpl() { - if (!__windowDestroyed) { - __textureViewActor.RemoveRenderer(__renderer); - __offscreenWindow.Remove(__textureViewActor); - } + __textureViewActor.RemoveRenderer(__renderer); + __offscreenWindow.Remove(__textureViewActor); } bool DSRenderViewDaliImpl::setBuffer(std::shared_ptr buffer) @@ -160,18 +156,6 @@ void DSRenderViewDaliImpl::registerCallbackUpdated(DSObject *slot, std::function __updatedSignal.connect(slot, func); } -void DSRenderViewDaliImpl::__onWindowDestroyed(void *data) -{ - DSLOG_INF("DSRenderViewDaliImpl", "__onWindowDestroyed."); - - __textureViewActor.RemoveRenderer(__renderer); - __offscreenWindow.Remove(__textureViewActor); - - __windowDestroyed = true; - - __updatedSignal.emit(nullptr); -} - void DSRenderViewDaliImpl::__onWindowBufferChanged(std::shared_ptr buffer) { if (buffer) { diff --git a/src/DSRender/DSRenderViewDaliImpl.h b/src/DSRender/DSRenderViewDaliImpl.h index f982bc5..8ffd858 100644 --- a/src/DSRender/DSRenderViewDaliImpl.h +++ b/src/DSRender/DSRenderViewDaliImpl.h @@ -48,7 +48,6 @@ public: Dali::Geometry CreateTexturedQuad(); private: - void __onWindowDestroyed(void *data); void __onWindowBufferChanged(std::shared_ptr buffer); void __onWindowRaiseToTopChanged(void *data); void __onWindowLowerToBottomChanged(void *data); @@ -59,8 +58,6 @@ private: Dali::Renderer __renderer; Dali::Actor __textureViewActor; - bool __windowDestroyed; - DSSignal __updatedSignal; }; -- 2.7.4 From 8d1947d4e43d027517716a6a790b89a5911ea143 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Thu, 27 Aug 2020 13:28:46 +0900 Subject: [PATCH 15/16] DSWindow: remove destroy callback registration and related things. Change-Id: I31556af6e096d751b67a8bdfed30b478f7162fb1 Signed-off-by: Joonbum Ko --- src/DSWindow/DSWindow.cpp | 6 ------ src/DSWindow/DSWindow.h | 2 -- 2 files changed, 8 deletions(-) diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index a83e758..e4cf6f1 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -252,7 +252,6 @@ DSWindow::DSWindow(std::shared_ptr waylandSurface) DSWindow::~DSWindow() { - this->__windowDestroySignal.emit(nullptr); } bool DSWindow::create(std::shared_ptr waylandSurface) @@ -517,11 +516,6 @@ void DSWindow::registerCallbackBufferChanged(DSObject *slot, std::function func) -{ - __windowDestroySignal.connect(slot, func); -} - void DSWindow::registerCallbackWindowRaiseToTop(DSObject *slot, std::function func) { __windowRaiseToTopSignal.connect(slot, func); diff --git a/src/DSWindow/DSWindow.h b/src/DSWindow/DSWindow.h index ebdf453..2a70cd0 100644 --- a/src/DSWindow/DSWindow.h +++ b/src/DSWindow/DSWindow.h @@ -95,7 +95,6 @@ public: void registerCallbackSizeChanged(DSObject *slot, std::function)> func); void registerCallbackBufferChanged(DSObject *slot, std::function)> func); - void registerCallbackWindowDestroyed(DSObject *slot, std::function func); void registerCallbackWindowRaiseToTop(DSObject *slot, std::function func); void registerCallbackWindowLowerToBottom(DSObject *slot, std::function func); void registerCallbackWindowPositionChanged(DSObject *slot, std::function func); @@ -108,7 +107,6 @@ private: // signals DSSignal> __sizeChangedSignal; DSSignal> __bufferChangedSignal; - DSSignal __windowDestroySignal; DSSignal __windowRaiseToTopSignal; DSSignal __windowLowerToBottomSignal; DSSignal __windowPositionChangedSignal; -- 2.7.4 From d061dc65a7020ce400f0943033f5f7b6eab72c49 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Thu, 27 Aug 2020 13:33:56 +0900 Subject: [PATCH 16/16] DSRenderViewDaliImpl: emit update signal when RenderView destroyed. Change-Id: I82178b76767c5ccd2dcbbdb78909d29b2baab887 Signed-off-by: Joonbum Ko --- src/DSRender/DSRenderViewDaliImpl.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/DSRender/DSRenderViewDaliImpl.cpp b/src/DSRender/DSRenderViewDaliImpl.cpp index 7cc724d..8b8ac15 100644 --- a/src/DSRender/DSRenderViewDaliImpl.cpp +++ b/src/DSRender/DSRenderViewDaliImpl.cpp @@ -114,6 +114,8 @@ DSRenderViewDaliImpl::~DSRenderViewDaliImpl() { __textureViewActor.RemoveRenderer(__renderer); __offscreenWindow.Remove(__textureViewActor); + + __updatedSignal.emit(nullptr); } bool DSRenderViewDaliImpl::setBuffer(std::shared_ptr buffer) -- 2.7.4