From 77339f99655f3f6ddbfc2feb29aba471f9917b7b Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Thu, 27 Aug 2020 13:35:13 +0900 Subject: [PATCH 01/16] DSRenderViewDaliImpl: add info logs to know when renderView created or destroyed. Change-Id: I01367fc9c4a63514d5d35e7d670268850237c124 Signed-off-by: Joonbum Ko --- src/DSRender/DSRenderViewDaliImpl.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/DSRender/DSRenderViewDaliImpl.cpp b/src/DSRender/DSRenderViewDaliImpl.cpp index 8b8ac15..a72214f 100644 --- a/src/DSRender/DSRenderViewDaliImpl.cpp +++ b/src/DSRender/DSRenderViewDaliImpl.cpp @@ -108,10 +108,14 @@ DSRenderViewDaliImpl::DSRenderViewDaliImpl(std::shared_ptr window, Dal 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)); + + DSLOG_INF("DSRenderViewDaliImpl", "RenderView created. window(%p)", __window.get()); } DSRenderViewDaliImpl::~DSRenderViewDaliImpl() { + DSLOG_INF("DSRenderViewDaliImpl", "RenderView destroyed. window(%p)", __window.get()); + __textureViewActor.RemoveRenderer(__renderer); __offscreenWindow.Remove(__textureViewActor); -- 2.7.4 From 02226131da49732f414ea555c0b9a88f5919a61d Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Thu, 27 Aug 2020 13:04:49 +0900 Subject: [PATCH 02/16] DSWaylandSurface: send Surface destroy signal in surface_destroy() Change-Id: I5bd04e184628e8bf2deaeee028c9f734c72b2f28 --- src/DSWaylandServer/DSWaylandSurface.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/DSWaylandServer/DSWaylandSurface.cpp b/src/DSWaylandServer/DSWaylandSurface.cpp index 4d4ce31..b11b735 100644 --- a/src/DSWaylandServer/DSWaylandSurface.cpp +++ b/src/DSWaylandServer/DSWaylandSurface.cpp @@ -115,6 +115,10 @@ void DSWaylandSurfacePrivate::surface_bind_resource(Resource *resource) void DSWaylandSurfacePrivate::surface_destroy_resource(Resource *resource) { +} + +void DSWaylandSurfacePrivate::surface_destroy(Resource *resource) +{ DS_GET_PUB(DSWaylandSurface); DSWaylandCompositor *dswCompositor = DSWaylandCompositor::getInstance(); @@ -125,10 +129,6 @@ void DSWaylandSurfacePrivate::surface_destroy_resource(Resource *resource) DSWaylandCompositor::releaseInstance(); } -void DSWaylandSurfacePrivate::surface_destroy(Resource *resource) -{ -} - void DSWaylandSurfacePrivate::surface_attach(Resource *resource, struct ::wl_resource *buffer, int32_t x, int32_t y) { DSWaylandSurfaceCommitInfoPrivate *commitInfoPendingPriv = DSWaylandSurfaceCommitInfoPrivate::getPrivate(__commitInfoPending.get()); -- 2.7.4 From ce201ba5b6506098102270b75254111429b431cb Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Thu, 27 Aug 2020 15:43:55 +0900 Subject: [PATCH 03/16] DSWaylandSurface: fix bug for sending destroy signal Change-Id: I3a0b97237013a36ce9e85cd19d4fd4c4a338edb6 --- src/DSWaylandServer/DSWaylandSurface.cpp | 30 ++++++++++++++++++++------- src/DSWaylandServer/DSWaylandSurfacePrivate.h | 4 ++++ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/DSWaylandServer/DSWaylandSurface.cpp b/src/DSWaylandServer/DSWaylandSurface.cpp index b11b735..9e180de 100644 --- a/src/DSWaylandServer/DSWaylandSurface.cpp +++ b/src/DSWaylandServer/DSWaylandSurface.cpp @@ -76,6 +76,7 @@ bool DSWaylandSurfaceCommitInfo::bufferChanged() DSWaylandSurfacePrivate::DSWaylandSurfacePrivate(DSWaylandSurface *p_ptr) : DSObjectPrivate(p_ptr), __p_ptr(p_ptr), + __deleted(false), __commitInfoPending{std::make_unique()}, __commitInfo{std::make_shared()}, __waylandClient(nullptr), @@ -86,6 +87,7 @@ DSWaylandSurfacePrivate::DSWaylandSurfacePrivate(DSWaylandSurface *p_ptr) DSWaylandSurfacePrivate::DSWaylandSurfacePrivate(DSWaylandSurface *p_ptr, DSWaylandClient *waylandClient, uint32_t id) : DSObjectPrivate(p_ptr), __p_ptr(p_ptr), + __deleted(false), __commitInfoPending{std::make_unique()}, __commitInfo{std::make_shared()}, __waylandClient(waylandClient), @@ -115,18 +117,12 @@ void DSWaylandSurfacePrivate::surface_bind_resource(Resource *resource) void DSWaylandSurfacePrivate::surface_destroy_resource(Resource *resource) { + __sendSurfaceDestroy(); } void DSWaylandSurfacePrivate::surface_destroy(Resource *resource) { - DS_GET_PUB(DSWaylandSurface); - - DSWaylandCompositor *dswCompositor = DSWaylandCompositor::getInstance(); - if (dswCompositor) - { - dswCompositor->sendSurfaceDestroy(pub); - } - DSWaylandCompositor::releaseInstance(); + __sendSurfaceDestroy(); } void DSWaylandSurfacePrivate::surface_attach(Resource *resource, struct ::wl_resource *buffer, int32_t x, int32_t y) @@ -219,6 +215,24 @@ void DSWaylandSurfacePrivate::surface_damage_buffer(Resource *resource, int32_t commitInfoPendingPriv->damageBuffer.height = height; } +void DSWaylandSurfacePrivate::__sendSurfaceDestroy(void) +{ + if (__deleted) return; + + DS_GET_PUB(DSWaylandSurface); + + DSWaylandCompositor *dswCompositor = DSWaylandCompositor::getInstance(); + if (dswCompositor) + { + dswCompositor->sendSurfaceDestroy(pub); + } + DSWaylandCompositor::releaseInstance(); + + __deleted = true; +} + + + DS_WAYLAND_IMPL_FROM_RESOURCE(DSWaylandSurface); /* DSWaylandSurface */ diff --git a/src/DSWaylandServer/DSWaylandSurfacePrivate.h b/src/DSWaylandServer/DSWaylandSurfacePrivate.h index 0ed0577..0f09d5b 100644 --- a/src/DSWaylandServer/DSWaylandSurfacePrivate.h +++ b/src/DSWaylandServer/DSWaylandSurfacePrivate.h @@ -109,6 +109,10 @@ protected: void surface_damage_buffer(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) override; private: + void __sendSurfaceDestroy(void); + +private: + bool __deleted; std::unique_ptr __commitInfoPending; std::shared_ptr __commitInfo; DSWaylandClient *__waylandClient; -- 2.7.4 From e735ebe67fb335b4c878b82d669b28cb911d8fbd Mon Sep 17 00:00:00 2001 From: Sung-Jin Park Date: Thu, 27 Aug 2020 17:45:55 +0900 Subject: [PATCH 04/16] DSWaylandKeyboard: send kernel keycode to wayland client(s) Change-Id: Ifb0a8f6a2e361c927e1327c758b40fd48aa5c2b8 Signed-off-by: Sung-Jin Park --- src/DSWaylandServer/DSWaylandKeyboard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DSWaylandServer/DSWaylandKeyboard.cpp b/src/DSWaylandServer/DSWaylandKeyboard.cpp index 8002088..851c169 100644 --- a/src/DSWaylandServer/DSWaylandKeyboard.cpp +++ b/src/DSWaylandServer/DSWaylandKeyboard.cpp @@ -206,7 +206,7 @@ void DSWaylandKeyboardPrivate::sendKey(uint32_t key, uint32_t state) auto func = [&](std::pair res) { if (res.first == __focusClient) - send_key(res.second->handle, __compositor->nextSerial(), __seat->getCurrentEventTime(), key, state); + send_key(res.second->handle, __compositor->nextSerial(), __seat->getCurrentEventTime(), key - 8, state); }; std::for_each(resMap.begin(), resMap.end(), func); } -- 2.7.4 From 324b39c970c6cca30254bd7cd59ac5e27acfaf31 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Thu, 27 Aug 2020 17:21:21 +0900 Subject: [PATCH 05/16] add DSWaylandTizenSurface interface Change-Id: I695ee10c2f716682199baaf4736e9d0d51da8655 Signed-off-by: Junkyeong Kim --- src/DSWaylandServer/DSWaylandTizenSurface.cpp | 213 +++++++++++++++++++++ src/DSWaylandServer/DSWaylandTizenSurface.h | 66 +++++++ src/DSWaylandServer/DSWaylandTizenSurfacePrivate.h | 81 ++++++++ src/meson.build | 3 + tests/DSWaylandTizenSurface-test.cpp | 47 +++++ tests/meson.build | 1 + 6 files changed, 411 insertions(+) create mode 100644 src/DSWaylandServer/DSWaylandTizenSurface.cpp create mode 100644 src/DSWaylandServer/DSWaylandTizenSurface.h create mode 100644 src/DSWaylandServer/DSWaylandTizenSurfacePrivate.h create mode 100644 tests/DSWaylandTizenSurface-test.cpp diff --git a/src/DSWaylandServer/DSWaylandTizenSurface.cpp b/src/DSWaylandServer/DSWaylandTizenSurface.cpp new file mode 100644 index 0000000..0a693cb --- /dev/null +++ b/src/DSWaylandServer/DSWaylandTizenSurface.cpp @@ -0,0 +1,213 @@ +/* +* 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 "DSWaylandTizenSurface.h" +#include "DSWaylandTizenSurfacePrivate.h" + +namespace display_server +{ + +/* DSWaylandTizenSurface */ +DSWaylandTizenSurfacePrivate::DSWaylandTizenSurfacePrivate(DSWaylandTizenSurface *p_ptr, DSWaylandCompositor *compositor) + : DSObjectPrivate(p_ptr), + __p_ptr(p_ptr), + __resource_id_cnt(0) +{ + if (!compositor) + return; + + init(compositor->display(), 1); +} + +DSWaylandTizenSurfacePrivate::~DSWaylandTizenSurfacePrivate() +{ +} + +void DSWaylandTizenSurfacePrivate::tizen_surface_bind_resource(Resource *resource) +{ +} + +void DSWaylandTizenSurfacePrivate::tizen_surface_destroy_resource(Resource *resource) +{ +} + +void DSWaylandTizenSurfacePrivate::tizen_surface_get_tizen_resource(Resource *resource, uint32_t id, struct ::wl_resource *surface) +{ + DSWaylandTizenResource *tizenResource = nullptr; + + for (DSWaylandTizenResource *temp : __resourceList) + if (temp->getResourceSurface() == surface) return; + + tizenResource = new DSWaylandTizenResource(resource->client(), id, surface); + if (tizenResource == nullptr) + { + DSLOG_ERR("DSWaylandTizenSurface", "fail get tizen resource"); + return; + } + + __resource_id_cnt++; + tizenResource->setResourceId(__resource_id_cnt); + + __resourceList.push_back(tizenResource); + + tizenResource->sendResourceId(); +} + +void DSWaylandTizenSurfacePrivate::tizen_surface_destroy(Resource *resource) +{ +} + +DSWaylandTizenResource *DSWaylandTizenSurfacePrivate::getTizenResource(struct ::wl_resource *surface) +{ + DSWaylandTizenResource *tizenResource = nullptr; + + for (DSWaylandTizenResource *temp : __resourceList) + { + if (temp->getResourceSurface() == surface) + { + tizenResource = temp; + break; + } + } + + return tizenResource; +} + +void DSWaylandTizenSurfacePrivate::delTizenResource(DSWaylandTizenResource *tizenResource) +{ + __resourceList.remove(tizenResource); +} + +DSWaylandTizenSurface::DSWaylandTizenSurface(DSWaylandCompositor *compositor) + : _d_ptr(std::make_unique(this, compositor)) +{ +} + +DSWaylandTizenSurface::~DSWaylandTizenSurface() +{ +} + +DSWaylandTizenResource *DSWaylandTizenSurface::getTizenResource(struct ::wl_resource *surface) +{ + DS_GET_PRIV(DSWaylandTizenSurface); + + return priv->getTizenResource(surface); +} + +void DSWaylandTizenSurface::delTizenResource(DSWaylandTizenResource *tizenResource) +{ + DS_GET_PRIV(DSWaylandTizenSurface); + + priv->delTizenResource(tizenResource); +} + +/* DSWaylandTizenResource */ +DSWaylandTizenResourcePrivate::DSWaylandTizenResourcePrivate(DSWaylandTizenResource *p_ptr, struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface) + : DSObjectPrivate(p_ptr), + __p_ptr(p_ptr), + __surface(surface), + __resource_id(0) +{ + init(client, id, 1); +} + +DSWaylandTizenResourcePrivate::~DSWaylandTizenResourcePrivate() +{ +} + +void DSWaylandTizenResourcePrivate::tizen_resource_bind_resource(Resource *resource) +{ +} + +void DSWaylandTizenResourcePrivate::tizen_resource_destroy_resource(Resource *resource) +{ +} + +void DSWaylandTizenResourcePrivate::tizen_resource_destroy(Resource *resource) +{ +} + +struct ::wl_resource *DSWaylandTizenResourcePrivate::getResourceSurface(void) +{ + return __surface; +} + +void DSWaylandTizenResourcePrivate::sendResourceId(void) +{ + send_resource_id(__resource_id); +} + +void DSWaylandTizenResourcePrivate::setResourceId(uint32_t tizenResourceId) +{ + __resource_id = tizenResourceId; +} + +uint32_t DSWaylandTizenResourcePrivate::getResourceId(void) +{ + return __resource_id; +} + +DSWaylandTizenResource::DSWaylandTizenResource(struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface) + : _d_ptr(std::make_unique(this, client, id, surface)) +{ +} + +DSWaylandTizenResource::~DSWaylandTizenResource() +{ +} + +struct ::wl_resource *DSWaylandTizenResource::getResourceSurface(void) +{ + DS_GET_PRIV(DSWaylandTizenResource); + + return priv->getResourceSurface(); +} + +void DSWaylandTizenResource::sendResourceId(void) +{ + DS_GET_PRIV(DSWaylandTizenResource); + + DSLOG_INF("DSWaylandTizenResource", "send Resource Id"); + + priv->sendResourceId(); +} + +void DSWaylandTizenResource::setResourceId(uint32_t tizenResourceId) +{ + DS_GET_PRIV(DSWaylandTizenResource); + + DSLOG_INF("DSWaylandTizenResource", "send Resource Id"); + + priv->setResourceId(tizenResourceId); +} + +uint32_t DSWaylandTizenResource::getResourceId(void) +{ + DS_GET_PRIV(DSWaylandTizenResource); + + DSLOG_INF("DSWaylandTizenResource", "send Resource Id"); + + return priv->getResourceId(); +} + +} // namespace display_server diff --git a/src/DSWaylandServer/DSWaylandTizenSurface.h b/src/DSWaylandServer/DSWaylandTizenSurface.h new file mode 100644 index 0000000..6621b53 --- /dev/null +++ b/src/DSWaylandServer/DSWaylandTizenSurface.h @@ -0,0 +1,66 @@ +/* +* 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_SURFACE_H_ +#define _DS_WAYLAND_TIZEN_SURFACE_H_ + +#include +#include +#include +#include + +namespace display_server +{ + +class DSWaylandTizenSurfacePrivate; +class DSWaylandTizenResourcePrivate; + +class DS_DECL_EXPORT DSWaylandTizenResource : public DSObject +{ +DS_PIMPL_USE_PRIVATE(DSWaylandTizenResource); + +public: + DSWaylandTizenResource(struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface); + virtual ~DSWaylandTizenResource(); + + struct ::wl_resource *getResourceSurface(void); + void sendResourceId(void); + void setResourceId(uint32_t tizenResourceId); + uint32_t getResourceId(void); +}; + +class DS_DECL_EXPORT DSWaylandTizenSurface : public DSObject +{ +DS_PIMPL_USE_PRIVATE(DSWaylandTizenSurface); + +public: + DSWaylandTizenSurface(DSWaylandCompositor *compositor); + virtual ~DSWaylandTizenSurface(); + + DSWaylandTizenResource *getTizenResource(struct ::wl_resource *surface); + void delTizenResource(DSWaylandTizenResource *resource); +}; + +} + +#endif diff --git a/src/DSWaylandServer/DSWaylandTizenSurfacePrivate.h b/src/DSWaylandServer/DSWaylandTizenSurfacePrivate.h new file mode 100644 index 0000000..27ea899 --- /dev/null +++ b/src/DSWaylandServer/DSWaylandTizenSurfacePrivate.h @@ -0,0 +1,81 @@ +/* +* 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_SURFACE_PRIVATE_H_ +#define _DS_WAYLAND_TIZEN_SURFACE_PRIVATE_H_ + +#include "dswayland-server-tizen-extension.h" +#include "DSWaylandTizenSurface.h" + +namespace display_server +{ + +class DS_DECL_EXPORT DSWaylandTizenResourcePrivate : public DSObjectPrivate, public DSWaylandServer::tizen_resource +{ +DS_PIMPL_USE_PUBLIC(DSWaylandTizenResource); + +public: + DSWaylandTizenResourcePrivate() = delete; + DSWaylandTizenResourcePrivate(DSWaylandTizenResource *p_ptr, struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface); + ~DSWaylandTizenResourcePrivate() override; + + struct ::wl_resource *getResourceSurface(void); + void sendResourceId(void); + void setResourceId(uint32_t tizenResourceId); + uint32_t getResourceId(void); + +protected: + void tizen_resource_bind_resource(Resource *resource) override; + void tizen_resource_destroy_resource(Resource *resource) override; + void tizen_resource_destroy(Resource *resource) override; +private: + struct ::wl_resource *__surface; + uint32_t __resource_id; +}; + +class DS_DECL_EXPORT DSWaylandTizenSurfacePrivate : public DSObjectPrivate, public DSWaylandServer::tizen_surface +{ +DS_PIMPL_USE_PUBLIC(DSWaylandTizenSurface); + +public: + DSWaylandTizenSurfacePrivate() = delete; + DSWaylandTizenSurfacePrivate(DSWaylandTizenSurface *p_ptr, DSWaylandCompositor *compositor); + ~DSWaylandTizenSurfacePrivate() override; + + DSWaylandTizenResource *getTizenResource(struct ::wl_resource *surface); + void delTizenResource(DSWaylandTizenResource *resource); + +protected: + void tizen_surface_bind_resource(Resource *resource) override; + void tizen_surface_destroy_resource(Resource *resource) override; + void tizen_surface_get_tizen_resource(Resource *resource, uint32_t id, struct ::wl_resource *surface) override; + void tizen_surface_destroy(Resource *resource) override; + +private: + std::list __resourceList; + uint32_t __resource_id_cnt; //TO DO : have to manage more proper class +}; + +} + +#endif diff --git a/src/meson.build b/src/meson.build index d008344..7042c46 100644 --- a/src/meson.build +++ b/src/meson.build @@ -117,6 +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', diff --git a/tests/DSWaylandTizenSurface-test.cpp b/tests/DSWaylandTizenSurface-test.cpp new file mode 100644 index 0000000..b4d04c7 --- /dev/null +++ b/tests/DSWaylandTizenSurface-test.cpp @@ -0,0 +1,47 @@ +/* +* 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 "DSWaylandTizenSurface.h" + +using namespace display_server; + +class DSWaylandTizenSurfaceTest : public ::testing::Test +{ +public: + void SetUp(void) override + {} + void TearDown(void) override + {} +}; + +TEST_F(DSWaylandTizenSurfaceTest, NewDSWaylandTizenSurface) +{ + DSWaylandCompositor *comp = DSWaylandCompositor::getInstance(); + DSWaylandTizenSurface *tizenSurface = new DSWaylandTizenSurface(comp); + EXPECT_TRUE(tizenSurface != nullptr); + + if (tizenSurface) + delete tizenSurface; + DSWaylandCompositor::releaseInstance(); +} diff --git a/tests/meson.build b/tests/meson.build index 1a91dbb..58a1ec4 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -27,6 +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', -- 2.7.4 From c6352432edd6b00adadd58e9297c29e8897fcda2 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Thu, 27 Aug 2020 11:37:54 +0900 Subject: [PATCH 06/16] test: fix the memory leak Change-Id: I5dc49f0fdb34aaa0cfb646fe600667dc0d78cc4b --- tests/DSBufferManager-test.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/DSBufferManager-test.cpp b/tests/DSBufferManager-test.cpp index 59b6233..e21c556 100644 --- a/tests/DSBufferManager-test.cpp +++ b/tests/DSBufferManager-test.cpp @@ -46,4 +46,6 @@ TEST_F(DSBufferManagerTest, GetBufferManager) { DSBufferManager* bufferManager = DSBufferManager::getInstance(); EXPECT_TRUE(bufferManager != nullptr); + + DSBufferManager::releaseInstance(); } -- 2.7.4 From f7f5571ba145799bf5da72075d80f040bafa61e6 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Thu, 27 Aug 2020 12:43:25 +0900 Subject: [PATCH 07/16] test: remove aquirebuffer and setTargetBuffer Change-Id: I58779ae8d1240907baa83f6fd0f5f66331dc8dca --- tests/DSRenderEngineDaliImpl-test.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/tests/DSRenderEngineDaliImpl-test.cpp b/tests/DSRenderEngineDaliImpl-test.cpp index b1d342f..227026d 100644 --- a/tests/DSRenderEngineDaliImpl-test.cpp +++ b/tests/DSRenderEngineDaliImpl-test.cpp @@ -44,8 +44,10 @@ public: void SetUp(void) override { Ecore_Timer *timer = nullptr; + + DSWaylandCompositor::getInstance(); __eventLoop = DSEventLoop::getInstance(); - double delayInSecond = 0.1; + double delayInSecond = 0.5; auto timerCb = [](void *data) -> Eina_Bool { DSEventLoop *loop = (DSEventLoop *)data; EXPECT_TRUE(loop->quit() == true); @@ -64,6 +66,7 @@ public: { __eventLoop->quit(); DSEventLoop::releaseInstance(); + DSWaylandCompositor::releaseInstance(); unsetenv("XDG_RUNTIME_DIR"); unsetenv("TBM_DISPLAY_SERVER"); @@ -201,11 +204,6 @@ TEST_F(DSRenderEngineDaliTest, RenderEngine_RenderOnlyOneFrame) EXPECT_TRUE(bufferQueue->canAcquireBuffer(true)); - auto buffer = bufferQueue->acquireBuffer(); - EXPECT_TRUE(buffer != nullptr); - - EXPECT_TRUE(deviceHWC->setTargetBuffer(buffer)); - // commit EXPECT_TRUE(deviceHWC->commit()); @@ -297,11 +295,6 @@ TEST_F(DSRenderEngineDaliTest, RenderEngine_ComposeTwoWindow) EXPECT_TRUE(bufferQueue->canAcquireBuffer(true)); - auto buffer = bufferQueue->acquireBuffer(); - EXPECT_TRUE(buffer != nullptr); - - EXPECT_TRUE(deviceHWC->setTargetBuffer(buffer)); - // commit EXPECT_TRUE(deviceHWC->commit()); -- 2.7.4 From b130c99aedcd7c2732938b3668f8a1397c43f419 Mon Sep 17 00:00:00 2001 From: Duna Oh Date: Thu, 27 Aug 2020 12:44:17 +0900 Subject: [PATCH 08/16] DSWaylandTizenLaunchSplash: fix the segmentation fault on tizen_launch_splash::destroy_func Change-Id: I678e8ec443b5b9ecb84dcf34a67ccdfdbed8b1d1 --- src/DSWaylandServer/DSWaylandTizenLaunchEffect.cpp | 3 ++- .../DSWaylandTizenLaunchEffectPrivate.h | 1 + src/DSWaylandServer/DSWaylandTizenLaunchSplash.cpp | 25 +++++++++++----------- src/DSWaylandServer/DSWaylandTizenLaunchSplash.h | 5 ++--- .../DSWaylandTizenLaunchSplashPrivate.h | 3 ++- 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/DSWaylandServer/DSWaylandTizenLaunchEffect.cpp b/src/DSWaylandServer/DSWaylandTizenLaunchEffect.cpp index 30c78da..9b0c1df 100644 --- a/src/DSWaylandServer/DSWaylandTizenLaunchEffect.cpp +++ b/src/DSWaylandServer/DSWaylandTizenLaunchEffect.cpp @@ -67,7 +67,8 @@ void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_create_splash_img(Re DSLOG_DBG("TizenLaunchEffectPriv", ""); DSWaylandClient *waylandClient = DSWaylandClient::fromWlClient(resource->client()); - auto waylandSplash = std::make_shared(waylandClient, id); + std::shared_ptr tzSplash = std::make_shared(waylandClient, id, TIZEN_LAUNCH_EFFECT_VERSION); + __tzSplashList.push_front(tzSplash); } void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_type_set(Resource *resource, const std::string &effect_type, uint32_t pid, struct ::wl_array *options) { diff --git a/src/DSWaylandServer/DSWaylandTizenLaunchEffectPrivate.h b/src/DSWaylandServer/DSWaylandTizenLaunchEffectPrivate.h index 3fc6822..ad31c16 100644 --- a/src/DSWaylandServer/DSWaylandTizenLaunchEffectPrivate.h +++ b/src/DSWaylandServer/DSWaylandTizenLaunchEffectPrivate.h @@ -55,6 +55,7 @@ protected: void tizen_launch_effect_destroy(Resource *resource); private: + std::list> __tzSplashList; }; diff --git a/src/DSWaylandServer/DSWaylandTizenLaunchSplash.cpp b/src/DSWaylandServer/DSWaylandTizenLaunchSplash.cpp index b3a734f..96dd7c0 100644 --- a/src/DSWaylandServer/DSWaylandTizenLaunchSplash.cpp +++ b/src/DSWaylandServer/DSWaylandTizenLaunchSplash.cpp @@ -31,17 +31,16 @@ DSWaylandTizenLaunchSplashPrivate::DSWaylandTizenLaunchSplashPrivate(DSWaylandTi : DSObjectPrivate(p_ptr), __p_ptr(p_ptr) {} -DSWaylandTizenLaunchSplashPrivate::DSWaylandTizenLaunchSplashPrivate(DSWaylandTizenLaunchSplash *p_ptr, DSWaylandClient *waylandClient, uint32_t id) - : DSObjectPrivate(p_ptr), - __p_ptr(p_ptr) + +DSWaylandTizenLaunchSplashPrivate::~DSWaylandTizenLaunchSplashPrivate() +{} + +void DSWaylandTizenLaunchSplashPrivate::init(DSWaylandClient *waylandClient, uint32_t id, int version) { if (id > 0) { - tizen_launch_splash::init(waylandClient->wlClient(), (int)id, 1); + tizen_launch_splash::init(waylandClient->wlClient(), (int)id, version); } - } -DSWaylandTizenLaunchSplashPrivate::~DSWaylandTizenLaunchSplashPrivate() -{} void DSWaylandTizenLaunchSplashPrivate::tizen_launch_splash_bind_resource(Resource *resource) {} @@ -57,12 +56,12 @@ void DSWaylandTizenLaunchSplashPrivate::tizen_launch_splash_owner(Resource *reso 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(DSWaylandClient *waylandClient, uint32_t id, int version) + : DSObject(), DS_INIT_PRIVATE_PTR(DSWaylandTizenLaunchSplash) +{ + DS_GET_PRIV(DSWaylandTizenLaunchSplash); + priv->init(waylandClient, id, version); +} DSWaylandTizenLaunchSplash::~DSWaylandTizenLaunchSplash() {} diff --git a/src/DSWaylandServer/DSWaylandTizenLaunchSplash.h b/src/DSWaylandServer/DSWaylandTizenLaunchSplash.h index 3543562..3536c93 100644 --- a/src/DSWaylandServer/DSWaylandTizenLaunchSplash.h +++ b/src/DSWaylandServer/DSWaylandTizenLaunchSplash.h @@ -36,9 +36,8 @@ class DSWaylandTizenLaunchSplash : public DSObject DS_PIMPL_USE_PRIVATE(DSWaylandTizenLaunchSplash); public: - DSWaylandTizenLaunchSplash(); - DSWaylandTizenLaunchSplash(DSWaylandClient *waylandClient, uint32_t id); - virtual ~DSWaylandTizenLaunchSplash(); + DSWaylandTizenLaunchSplash(DSWaylandClient *waylandClient, uint32_t id, int version); + ~DSWaylandTizenLaunchSplash() override; private: diff --git a/src/DSWaylandServer/DSWaylandTizenLaunchSplashPrivate.h b/src/DSWaylandServer/DSWaylandTizenLaunchSplashPrivate.h index f911d7a..6aa9015 100644 --- a/src/DSWaylandServer/DSWaylandTizenLaunchSplashPrivate.h +++ b/src/DSWaylandServer/DSWaylandTizenLaunchSplashPrivate.h @@ -40,9 +40,10 @@ DS_PIMPL_USE_PUBLIC(DSWaylandTizenLaunchSplash); public: DSWaylandTizenLaunchSplashPrivate() = delete; DSWaylandTizenLaunchSplashPrivate(DSWaylandTizenLaunchSplash *p_ptr); - DSWaylandTizenLaunchSplashPrivate(DSWaylandTizenLaunchSplash *p_ptr, DSWaylandClient *waylandClient, uint32_t id); ~DSWaylandTizenLaunchSplashPrivate() override; + void init(DSWaylandClient *waylandClient, uint32_t id, int version); + protected: void tizen_launch_splash_bind_resource(Resource *resource); void tizen_launch_splash_destroy_resource(Resource *resource); -- 2.7.4 From bed837f7cee3945eb80cdc3c5d8d747f73f88698 Mon Sep 17 00:00:00 2001 From: jeon Date: Fri, 28 Aug 2020 10:33:32 +0900 Subject: [PATCH 09/16] DSWaylandExtension: enable tizen_surface interface Change-Id: If9b229fecf00ad75d72f6debfb9859dd39c614d0 --- src/DSWaylandExtension/DSWaylandExtension.cpp | 15 +++++++++++++++ src/DSWaylandExtension/DSWaylandExtensionPrivate.h | 3 +++ 2 files changed, 18 insertions(+) diff --git a/src/DSWaylandExtension/DSWaylandExtension.cpp b/src/DSWaylandExtension/DSWaylandExtension.cpp index 6534383..e806860 100644 --- a/src/DSWaylandExtension/DSWaylandExtension.cpp +++ b/src/DSWaylandExtension/DSWaylandExtension.cpp @@ -28,6 +28,7 @@ #include "DSWaylandTizenPolicy.h" #include "DSWaylandTizenAppinfo.h" #include "DSWaylandTizenLaunchEffect.h" +#include "DSWaylandTizenSurface.h" namespace display_server { @@ -58,6 +59,7 @@ bool DSWaylandExtensionPrivate::init(DSWaylandCompositor *compositor) __initTizenPolicy(); __initTizenAppinfo(); __initTizenLaunchEffect(); + __initTizenSurface(); } catch(const std::runtime_error& e) { @@ -122,6 +124,19 @@ bool DSWaylandExtensionPrivate::__initTizenLaunchEffect(void) return true; } +bool DSWaylandExtensionPrivate::__initTizenSurface(void) +{ + __tzSurface = std::make_shared(__compositor); + if (__tzSurface == 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 2c063d3..e6aa09a 100644 --- a/src/DSWaylandExtension/DSWaylandExtensionPrivate.h +++ b/src/DSWaylandExtension/DSWaylandExtensionPrivate.h @@ -31,6 +31,7 @@ class DSWaylandZxdgShellV6; class DSWaylandTizenPolicy; class DSWaylandTizenAppinfo; class DSWaylandTizenLaunchEffect; +class DSWaylandTizenSurface; class DSWaylandExtensionPrivate : public DSObjectPrivate { @@ -48,6 +49,7 @@ private: bool __initTizenPolicy(void); bool __initTizenAppinfo(void); bool __initTizenLaunchEffect(void); + bool __initTizenSurface(void); private: DSWaylandCompositor *__compositor; @@ -55,6 +57,7 @@ private: std::shared_ptr __tzPolicy; std::shared_ptr __tzAppinfo; std::shared_ptr __tzLaunchEffect; + std::shared_ptr __tzSurface; }; -- 2.7.4 From f291785f3d8d14a21458a15cf8c73465da7189ff Mon Sep 17 00:00:00 2001 From: jeon Date: Fri, 28 Aug 2020 11:13:31 +0900 Subject: [PATCH 10/16] tizen_policy_ext: add header for tizen_policy_ext protocol Change-Id: I10c4937f038955082300404d258ad4360e8bab06 --- src/DSWaylandServer/tizen_policy_ext-protocol.c | 54 ++++++++ .../tizen_policy_ext-server-protocol.h | 151 +++++++++++++++++++++ src/meson.build | 2 + 3 files changed, 207 insertions(+) create mode 100644 src/DSWaylandServer/tizen_policy_ext-protocol.c create mode 100644 src/DSWaylandServer/tizen_policy_ext-server-protocol.h diff --git a/src/DSWaylandServer/tizen_policy_ext-protocol.c b/src/DSWaylandServer/tizen_policy_ext-protocol.c new file mode 100644 index 0000000..6b49f50 --- /dev/null +++ b/src/DSWaylandServer/tizen_policy_ext-protocol.c @@ -0,0 +1,54 @@ +#include +#include +#include "wayland-util.h" + +extern const struct wl_interface tizen_rotation_interface; +extern const struct wl_interface wl_surface_interface; + +static const struct wl_interface *types[] = { + NULL, + NULL, + NULL, + NULL, + NULL, + &tizen_rotation_interface, + &wl_surface_interface, + &wl_surface_interface, +}; + +static const struct wl_message tizen_policy_ext_requests[] = { + { "get_rotation", "no", types + 5 }, + { "get_active_angle", "?o", types + 7 }, +}; + +static const struct wl_message tizen_policy_ext_events[] = { + { "active_angle", "u", types + 0 }, +}; + +WL_EXPORT const struct wl_interface tizen_policy_ext_interface3 = { + "tizen_policy_ext", 3, + 2, tizen_policy_ext_requests, + 1, tizen_policy_ext_events, +}; + +static const struct wl_message tizen_rotation_requests[] = { + { "destroy", "", types + 0 }, + { "set_available_angles", "u", types + 0 }, + { "set_preferred_angle", "u", types + 0 }, + { "ack_angle_change", "u", types + 0 }, + { "set_geometry_hint", "3uuuuu", types + 0 }, +}; + +static const struct wl_message tizen_rotation_events[] = { + { "available_angles_done", "u", types + 0 }, + { "preferred_angle_done", "u", types + 0 }, + { "angle_change", "uu", types + 0 }, + { "angle_change_with_resize", "2uuuu", types + 0 }, +}; + +WL_EXPORT const struct wl_interface tizen_rotation_interface = { + "tizen_rotation", 3, + 5, tizen_rotation_requests, + 4, tizen_rotation_events, +}; + diff --git a/src/DSWaylandServer/tizen_policy_ext-server-protocol.h b/src/DSWaylandServer/tizen_policy_ext-server-protocol.h new file mode 100644 index 0000000..4a08b79 --- /dev/null +++ b/src/DSWaylandServer/tizen_policy_ext-server-protocol.h @@ -0,0 +1,151 @@ +#ifndef TIZEN_POLICY_EXT_SERVER_PROTOCOL_H +#define TIZEN_POLICY_EXT_SERVER_PROTOCOL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include "wayland-server.h" + +struct wl_client; +struct wl_resource; + +struct tizen_policy_ext; +struct tizen_rotation; +struct wl_surface; + +extern const struct wl_interface tizen_policy_ext_interface3; +extern const struct wl_interface tizen_rotation_interface; + +struct tizen_policy_ext_interface { + /** + * get_rotation - (none) + * @id: new rotation object + * @surface: surface object + */ + void (*get_rotation)(struct wl_client *client, + struct wl_resource *resource, + uint32_t id, + struct wl_resource *surface); + /** + * get_active_angle - get a current active angle + * @surface: (none) + * + * + */ + void (*get_active_angle)(struct wl_client *client, + struct wl_resource *resource, + struct wl_resource *surface); +}; + +#define TIZEN_POLICY_EXT_ACTIVE_ANGLE 0 + +#define TIZEN_POLICY_EXT_ACTIVE_ANGLE_SINCE_VERSION 1 + +static inline void +tizen_policy_ext_send_active_angle(struct wl_resource *resource_, uint32_t angle) +{ + wl_resource_post_event(resource_, TIZEN_POLICY_EXT_ACTIVE_ANGLE, angle); +} + +#ifndef TIZEN_ROTATION_ANGLE_ENUM +#define TIZEN_ROTATION_ANGLE_ENUM +enum tizen_rotation_angle { + TIZEN_ROTATION_ANGLE_NONE = 0, + TIZEN_ROTATION_ANGLE_0 = 1, + TIZEN_ROTATION_ANGLE_90 = 2, + TIZEN_ROTATION_ANGLE_180 = 4, + TIZEN_ROTATION_ANGLE_270 = 8, +}; +#endif /* TIZEN_ROTATION_ANGLE_ENUM */ + +struct tizen_rotation_interface { + /** + * destroy - destroy tizen_rotation + * + * + */ + void (*destroy)(struct wl_client *client, + struct wl_resource *resource); + /** + * set_available_angles - (none) + * @angles: (none) + */ + void (*set_available_angles)(struct wl_client *client, + struct wl_resource *resource, + uint32_t angles); + /** + * set_preferred_angle - (none) + * @angle: (none) + */ + void (*set_preferred_angle)(struct wl_client *client, + struct wl_resource *resource, + uint32_t angle); + /** + * ack_angle_change - ack a angle_change + * @serial: a serial to angle_change for + * + * + */ + void (*ack_angle_change)(struct wl_client *client, + struct wl_resource *resource, + uint32_t serial); + /** + * set_geometry_hint - (none) + * @angle: (none) + * @x: (none) + * @y: (none) + * @width: (none) + * @height: (none) + * @since: 3 + */ + void (*set_geometry_hint)(struct wl_client *client, + struct wl_resource *resource, + uint32_t angle, + uint32_t x, + uint32_t y, + uint32_t w, + uint32_t h); +}; + +#define TIZEN_ROTATION_AVAILABLE_ANGLES_DONE 0 +#define TIZEN_ROTATION_PREFERRED_ANGLE_DONE 1 +#define TIZEN_ROTATION_ANGLE_CHANGE 2 +#define TIZEN_ROTATION_ANGLE_CHANGE_WITH_RESIZE 3 + +#define TIZEN_ROTATION_AVAILABLE_ANGLES_DONE_SINCE_VERSION 1 +#define TIZEN_ROTATION_PREFERRED_ANGLE_DONE_SINCE_VERSION 1 +#define TIZEN_ROTATION_ANGLE_CHANGE_SINCE_VERSION 1 +#define TIZEN_ROTATION_ANGLE_CHANGE_WITH_RESIZE_SINCE_VERSION 2 + +static inline void +tizen_rotation_send_available_angles_done(struct wl_resource *resource_, uint32_t angles) +{ + wl_resource_post_event(resource_, TIZEN_ROTATION_AVAILABLE_ANGLES_DONE, angles); +} + +static inline void +tizen_rotation_send_preferred_angle_done(struct wl_resource *resource_, uint32_t angle) +{ + wl_resource_post_event(resource_, TIZEN_ROTATION_PREFERRED_ANGLE_DONE, angle); +} + +static inline void +tizen_rotation_send_angle_change(struct wl_resource *resource_, uint32_t angle, uint32_t serial) +{ + wl_resource_post_event(resource_, TIZEN_ROTATION_ANGLE_CHANGE, angle, serial); +} + +static inline void +tizen_rotation_send_angle_change_with_resize(struct wl_resource *resource_, uint32_t angle, uint32_t serial, uint32_t width, uint32_t height) +{ + wl_resource_post_event(resource_, TIZEN_ROTATION_ANGLE_CHANGE_WITH_RESIZE, angle, serial, width, height); +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/meson.build b/src/meson.build index 7042c46..7691d3b 100644 --- a/src/meson.build +++ b/src/meson.build @@ -177,6 +177,8 @@ libds_wayland_srcs = [ 'DSWaylandServer/DSWaylandProtocolTracePrivate.h', 'DSWaylandServer/DSWaylandProtocolTrace.h', 'DSWaylandServer/DSWaylandProtocolTrace.cpp', + 'DSWaylandServer/tizen_policy_ext-server-protocol.h', + 'DSWaylandServer/tizen_policy_ext-protocol.c', ] libds_srcs += libds_wayland_srcs -- 2.7.4 From a3895c82fb2c09e5991a3ca7de362514f926da28 Mon Sep 17 00:00:00 2001 From: jeon Date: Fri, 28 Aug 2020 11:14:42 +0900 Subject: [PATCH 11/16] DSWaylandServer: build a tizen_policy_ext class Change-Id: I66d18becc6b51fd1f2a3b8c6de05e53fa8317fe3 --- src/DSWaylandServer/dswayland-server-tizen_policy_ext.cpp | 12 +++++++----- src/DSWaylandServer/dswayland-server-tizen_policy_ext.h | 3 ++- src/meson.build | 2 ++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/DSWaylandServer/dswayland-server-tizen_policy_ext.cpp b/src/DSWaylandServer/dswayland-server-tizen_policy_ext.cpp index 6a035da..97e129e 100644 --- a/src/DSWaylandServer/dswayland-server-tizen_policy_ext.cpp +++ b/src/DSWaylandServer/dswayland-server-tizen_policy_ext.cpp @@ -1,6 +1,8 @@ /* Protocol XML file : wayland-extension/tizen_policy_ext.xml */ -#include "dswayland-server-tizen-policy-ext.h" +#include +#include "tizen_policy_ext-server-protocol.h" +#include "dswayland-server-tizen_policy_ext.h" #ifndef DS_UNLIKELY #define DS_UNLIKELY(X) X @@ -105,7 +107,7 @@ namespace DSWaylandServer { void tizen_policy_ext::init(struct ::wl_display *display, int version) { - m_global = wl_global_create(display, &::tizen_policy_ext_interface, version, this, bind_func); + m_global = wl_global_create(display, &::tizen_policy_ext_interface3, version, this, bind_func); m_globalVersion = version; m_displayDestroyedListener.notify = tizen_policy_ext::display_destroy_func; m_displayDestroyedListener.parent = this; @@ -114,7 +116,7 @@ namespace DSWaylandServer { const struct wl_interface *tizen_policy_ext::interface() { - return &::tizen_policy_ext_interface; + return &::tizen_policy_ext_interface3; } tizen_policy_ext::Resource *tizen_policy_ext::tizen_policy_ext_allocate() @@ -156,7 +158,7 @@ namespace DSWaylandServer { tizen_policy_ext::Resource *tizen_policy_ext::bind(struct ::wl_client *client, uint32_t id, int version) { DS_ASSERT_X(!wl_client_get_object(client, id), "DSWaylandObject bind", "binding to object %u more than once", id); - struct ::wl_resource *handle = wl_resource_create(client, &::tizen_policy_ext_interface, version, id); + struct ::wl_resource *handle = wl_resource_create(client, &::tizen_policy_ext_interface3, version, id); return bind(handle); } @@ -174,7 +176,7 @@ namespace DSWaylandServer { { if (DS_UNLIKELY(!resource)) return NULL; - if (wl_resource_instance_of(resource, &::tizen_policy_ext_interface, &m_tizen_policy_ext_interface)) + if (wl_resource_instance_of(resource, &::tizen_policy_ext_interface3, &m_tizen_policy_ext_interface)) return static_cast(wl_resource_get_user_data(resource)); return NULL; } diff --git a/src/DSWaylandServer/dswayland-server-tizen_policy_ext.h b/src/DSWaylandServer/dswayland-server-tizen_policy_ext.h index 66d7b92..9069fe7 100644 --- a/src/DSWaylandServer/dswayland-server-tizen_policy_ext.h +++ b/src/DSWaylandServer/dswayland-server-tizen_policy_ext.h @@ -4,7 +4,8 @@ #define __DS_TIZEN_POLICY_EXT_PROTOCOL_H__ #include "wayland-server-core.h" -#include "tizen-policy-ext-server-protocol.h" +#include +#include "tizen_policy_ext-server-protocol.h" #include #include #include diff --git a/src/meson.build b/src/meson.build index 7691d3b..48b1a58 100644 --- a/src/meson.build +++ b/src/meson.build @@ -97,6 +97,8 @@ libds_wayland_srcs = [ 'DSWaylandServer/dswayland-server-tizen-launch.h', 'DSWaylandServer/dswayland-server-input-method.cpp', 'DSWaylandServer/dswayland-server-input-method.h', + 'DSWaylandServer/dswayland-server-tizen_policy_ext.cpp', + 'DSWaylandServer/dswayland-server-tizen_policy_ext.h', 'DSWaylandServer/DSWaylandCallback.cpp', 'DSWaylandServer/DSWaylandCallback.h', 'DSWaylandServer/DSWaylandCallbackPrivate.h', -- 2.7.4 From 12e548b96606eeb6626215f1cedf1ff393f7c2b9 Mon Sep 17 00:00:00 2001 From: jeon Date: Fri, 28 Aug 2020 11:15:51 +0900 Subject: [PATCH 12/16] DSWaylandTizenPolicyExt: Add skeleton codes to get tizen_rotation Change-Id: I81c7b38aa548dde8997954794ea6134a4e575e94 --- src/DSWaylandServer/DSWaylandTizenPolicyExt.cpp | 162 +++++++++++++++++++++ src/DSWaylandServer/DSWaylandTizenPolicyExt.h | 66 +++++++++ .../DSWaylandTizenPolicyExtPrivate.h | 77 ++++++++++ src/meson.build | 3 + 4 files changed, 308 insertions(+) create mode 100644 src/DSWaylandServer/DSWaylandTizenPolicyExt.cpp create mode 100644 src/DSWaylandServer/DSWaylandTizenPolicyExt.h create mode 100644 src/DSWaylandServer/DSWaylandTizenPolicyExtPrivate.h diff --git a/src/DSWaylandServer/DSWaylandTizenPolicyExt.cpp b/src/DSWaylandServer/DSWaylandTizenPolicyExt.cpp new file mode 100644 index 0000000..2ffff5b --- /dev/null +++ b/src/DSWaylandServer/DSWaylandTizenPolicyExt.cpp @@ -0,0 +1,162 @@ +/* +* 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 "DSWaylandTizenPolicyExt.h" +#include "DSWaylandTizenPolicyExtPrivate.h" + +namespace display_server +{ + +/* DSWaylandTizenPolicyExt */ +DSWaylandTizenPolicyExtPrivate::DSWaylandTizenPolicyExtPrivate(DSWaylandTizenPolicyExt *p_ptr, DSWaylandCompositor *compositor) + : DSObjectPrivate(p_ptr), + __p_ptr(p_ptr), + __resource_id_cnt(0) +{ + if (!compositor) + return; + + init(compositor->display(), 3); +} + +DSWaylandTizenPolicyExtPrivate::~DSWaylandTizenPolicyExtPrivate() +{ +} + +void DSWaylandTizenPolicyExtPrivate::tizen_policy_ext_bind_resource(Resource *resource) +{ +} + +void DSWaylandTizenPolicyExtPrivate::tizen_policy_ext_destroy_resource(Resource *resource) +{ +} + +void DSWaylandTizenPolicyExtPrivate::tizen_policy_ext_get_rotation(Resource *resource, uint32_t id, struct ::wl_resource *surface) +{ + DSWaylandTizenRotation *tizenRotation = nullptr; + + for (DSWaylandTizenRotation *temp : __rotationList) + if (temp->getRotationSurface() == surface) return; + + tizenRotation = new DSWaylandTizenRotation(resource->client(), id, surface); + if (tizenRotation == nullptr) + { + DSLOG_ERR("DSWaylandTizenPolicyExt", "fail get tizen resource"); + return; + } + + __rotationList.push_back(tizenRotation); +} + +DSWaylandTizenRotation *DSWaylandTizenPolicyExtPrivate::getTizenRotation(struct ::wl_resource *surface) +{ + DSWaylandTizenRotation *tizenRotation = nullptr; + + for (DSWaylandTizenRotation *temp : __rotationList) + { + if (temp->getRotationSurface() == surface) + { + tizenRotation = temp; + break; + } + } + + return tizenRotation; +} + +void DSWaylandTizenPolicyExtPrivate::delTizenRotation(DSWaylandTizenRotation *tizenRotation) +{ + __rotationList.remove(tizenRotation); +} + +DSWaylandTizenPolicyExt::DSWaylandTizenPolicyExt(DSWaylandCompositor *compositor) + : _d_ptr(std::make_unique(this, compositor)) +{ +} + +DSWaylandTizenPolicyExt::~DSWaylandTizenPolicyExt() +{ +} + +DSWaylandTizenRotation *DSWaylandTizenPolicyExt::getTizenRotation(struct ::wl_resource *surface) +{ + DS_GET_PRIV(DSWaylandTizenPolicyExt); + + return priv->getTizenRotation(surface); +} + +void DSWaylandTizenPolicyExt::delTizenRotation(DSWaylandTizenRotation *tizenRotation) +{ + DS_GET_PRIV(DSWaylandTizenPolicyExt); + + priv->delTizenRotation(tizenRotation); +} + +/* DSWaylandTizenRotation */ +DSWaylandTizenRotationPrivate::DSWaylandTizenRotationPrivate(DSWaylandTizenRotation *p_ptr, struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface) + : DSObjectPrivate(p_ptr), + __p_ptr(p_ptr), + __surface(surface), + __resource_id(0) +{ + init(client, id, 3); +} + +DSWaylandTizenRotationPrivate::~DSWaylandTizenRotationPrivate() +{ +} + +void DSWaylandTizenRotationPrivate::tizen_rotation_bind_resource(Resource *resource) +{ +} + +void DSWaylandTizenRotationPrivate::tizen_rotation_destroy_resource(Resource *resource) +{ +} + +void DSWaylandTizenRotationPrivate::tizen_rotation_destroy(Resource *resource) +{ +} + +struct ::wl_resource *DSWaylandTizenRotationPrivate::getRotationSurface(void) +{ + return __surface; +} + +DSWaylandTizenRotation::DSWaylandTizenRotation(struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface) + : _d_ptr(std::make_unique(this, client, id, surface)) +{ +} + +DSWaylandTizenRotation::~DSWaylandTizenRotation() +{ +} + +struct ::wl_resource *DSWaylandTizenRotation::getRotationSurface(void) +{ + DS_GET_PRIV(DSWaylandTizenRotation); + + return priv->getRotationSurface(); +} + +} // namespace display_server diff --git a/src/DSWaylandServer/DSWaylandTizenPolicyExt.h b/src/DSWaylandServer/DSWaylandTizenPolicyExt.h new file mode 100644 index 0000000..eef13dc --- /dev/null +++ b/src/DSWaylandServer/DSWaylandTizenPolicyExt.h @@ -0,0 +1,66 @@ +/* +* 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_POLICY_EXT_H_ +#define _DS_WAYLAND_TIZEN_POLICY_EXT_H_ + +#include +#include +#include +#include + +namespace display_server +{ + +class DSWaylandTizenPolicyExtPrivate; +class DSWaylandTizenRotationPrivate; + +class DS_DECL_EXPORT DSWaylandTizenRotation : public DSObject +{ +DS_PIMPL_USE_PRIVATE(DSWaylandTizenRotation); + +public: + DSWaylandTizenRotation(struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface); + virtual ~DSWaylandTizenRotation(); + + struct ::wl_resource *getRotationSurface(void); + void sendResourceId(void); + void setResourceId(uint32_t tizenResourceId); + uint32_t getResourceId(void); +}; + +class DS_DECL_EXPORT DSWaylandTizenPolicyExt : public DSObject +{ +DS_PIMPL_USE_PRIVATE(DSWaylandTizenPolicyExt); + +public: + DSWaylandTizenPolicyExt(DSWaylandCompositor *compositor); + virtual ~DSWaylandTizenPolicyExt(); + + DSWaylandTizenRotation *getTizenRotation(struct ::wl_resource *surface); + void delTizenRotation(DSWaylandTizenRotation *resource); +}; + +} + +#endif diff --git a/src/DSWaylandServer/DSWaylandTizenPolicyExtPrivate.h b/src/DSWaylandServer/DSWaylandTizenPolicyExtPrivate.h new file mode 100644 index 0000000..cfa4e79 --- /dev/null +++ b/src/DSWaylandServer/DSWaylandTizenPolicyExtPrivate.h @@ -0,0 +1,77 @@ +/* +* 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_POLICY_EXT_PRIVATE_H_ +#define _DS_WAYLAND_TIZEN_POLICY_EXT_PRIVATE_H_ + +#include "dswayland-server-tizen_policy_ext.h" +#include "DSWaylandTizenPolicyExt.h" + +namespace display_server +{ + +class DS_DECL_EXPORT DSWaylandTizenRotationPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_rotation +{ +DS_PIMPL_USE_PUBLIC(DSWaylandTizenRotation); + +public: + DSWaylandTizenRotationPrivate() = delete; + DSWaylandTizenRotationPrivate(DSWaylandTizenRotation *p_ptr, struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface); + ~DSWaylandTizenRotationPrivate() override; + + struct ::wl_resource *getRotationSurface(void); + +protected: + void tizen_rotation_bind_resource(Resource *resource) override; + void tizen_rotation_destroy_resource(Resource *resource) override; + void tizen_rotation_destroy(Resource *resource) override; +private: + struct ::wl_resource *__surface; + uint32_t __resource_id; +}; + +class DS_DECL_EXPORT DSWaylandTizenPolicyExtPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_policy_ext +{ +DS_PIMPL_USE_PUBLIC(DSWaylandTizenPolicyExt); + +public: + DSWaylandTizenPolicyExtPrivate() = delete; + DSWaylandTizenPolicyExtPrivate(DSWaylandTizenPolicyExt *p_ptr, DSWaylandCompositor *compositor); + ~DSWaylandTizenPolicyExtPrivate() override; + + DSWaylandTizenRotation *getTizenRotation(struct ::wl_resource *surface); + void delTizenRotation(DSWaylandTizenRotation *resource); + +protected: + void tizen_policy_ext_bind_resource(Resource *resource) override; + void tizen_policy_ext_destroy_resource(Resource *resource) override; + void tizen_policy_ext_get_rotation(Resource *resource, uint32_t id, struct ::wl_resource *surface) override; + +private: + std::list __rotationList; + uint32_t __resource_id_cnt; //TO DO : have to manage more proper class +}; + +} + +#endif diff --git a/src/meson.build b/src/meson.build index 48b1a58..ea39c2c 100644 --- a/src/meson.build +++ b/src/meson.build @@ -179,6 +179,9 @@ libds_wayland_srcs = [ 'DSWaylandServer/DSWaylandProtocolTracePrivate.h', 'DSWaylandServer/DSWaylandProtocolTrace.h', 'DSWaylandServer/DSWaylandProtocolTrace.cpp', + 'DSWaylandServer/DSWaylandTizenPolicyExt.h', + 'DSWaylandServer/DSWaylandTizenPolicyExtPrivate.h', + 'DSWaylandServer/DSWaylandTizenPolicyExt.cpp', 'DSWaylandServer/tizen_policy_ext-server-protocol.h', 'DSWaylandServer/tizen_policy_ext-protocol.c', ] -- 2.7.4 From cbb81338cc9b9bd1fdaa168541f3e3fff9b69e16 Mon Sep 17 00:00:00 2001 From: jeon Date: Fri, 28 Aug 2020 11:16:29 +0900 Subject: [PATCH 13/16] DSWaylandExtension: enable tizen_policy_ext interface Change-Id: Ia1d264562c4c7e4d3abf1573f787db8cc54a0971 --- src/DSWaylandExtension/DSWaylandExtension.cpp | 14 ++++++++++++++ src/DSWaylandExtension/DSWaylandExtensionPrivate.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/src/DSWaylandExtension/DSWaylandExtension.cpp b/src/DSWaylandExtension/DSWaylandExtension.cpp index e806860..e6c5906 100644 --- a/src/DSWaylandExtension/DSWaylandExtension.cpp +++ b/src/DSWaylandExtension/DSWaylandExtension.cpp @@ -29,6 +29,7 @@ #include "DSWaylandTizenAppinfo.h" #include "DSWaylandTizenLaunchEffect.h" #include "DSWaylandTizenSurface.h" +#include "DSWaylandTizenPolicyExt.h" namespace display_server { @@ -60,6 +61,7 @@ bool DSWaylandExtensionPrivate::init(DSWaylandCompositor *compositor) __initTizenAppinfo(); __initTizenLaunchEffect(); __initTizenSurface(); + __initTizenPolicyExt(); } catch(const std::runtime_error& e) { @@ -136,6 +138,18 @@ bool DSWaylandExtensionPrivate::__initTizenSurface(void) return true; } +bool DSWaylandExtensionPrivate::__initTizenPolicyExt(void) +{ + __tzPolicyExt = std::make_shared(__compositor); + if (__tzPolicyExt == 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 e6aa09a..7ac92cd 100644 --- a/src/DSWaylandExtension/DSWaylandExtensionPrivate.h +++ b/src/DSWaylandExtension/DSWaylandExtensionPrivate.h @@ -32,6 +32,7 @@ class DSWaylandTizenPolicy; class DSWaylandTizenAppinfo; class DSWaylandTizenLaunchEffect; class DSWaylandTizenSurface; +class DSWaylandTizenPolicyExt; class DSWaylandExtensionPrivate : public DSObjectPrivate { @@ -50,6 +51,7 @@ private: bool __initTizenAppinfo(void); bool __initTizenLaunchEffect(void); bool __initTizenSurface(void); + bool __initTizenPolicyExt(void); private: DSWaylandCompositor *__compositor; @@ -58,6 +60,7 @@ private: std::shared_ptr __tzAppinfo; std::shared_ptr __tzLaunchEffect; std::shared_ptr __tzSurface; + std::shared_ptr __tzPolicyExt; }; -- 2.7.4 From 261c4faab542584aabab61027904538d82d5e55b Mon Sep 17 00:00:00 2001 From: jeon Date: Fri, 28 Aug 2020 11:23:54 +0900 Subject: [PATCH 14/16] DSWaylandTizenPolicyExt: add a simple testcase Change-Id: I389834826ed202009e12b39a0b67f6bc1e95767a --- tests/DSWaylandTizenPolicyExt-test.cpp | 47 ++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tests/DSWaylandTizenPolicyExt-test.cpp diff --git a/tests/DSWaylandTizenPolicyExt-test.cpp b/tests/DSWaylandTizenPolicyExt-test.cpp new file mode 100644 index 0000000..f5868e3 --- /dev/null +++ b/tests/DSWaylandTizenPolicyExt-test.cpp @@ -0,0 +1,47 @@ +/* +* 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 "DSWaylandTizenPolicyExt.h" + +using namespace display_server; + +class DSWaylandTizenPolicyExtTest : public ::testing::Test +{ +public: + void SetUp(void) override + {} + void TearDown(void) override + {} +}; + +TEST_F(DSWaylandTizenPolicyExtTest, NewDSWaylandTizenPolicyExt) +{ + DSWaylandCompositor *comp = DSWaylandCompositor::getInstance(); + DSWaylandTizenPolicyExt *tizenPolicyExt = new DSWaylandTizenPolicyExt(comp); + EXPECT_TRUE(tizenPolicyExt != nullptr); + + if (tizenPolicyExt) + delete tizenPolicyExt; + DSWaylandCompositor::releaseInstance(); +} -- 2.7.4 From ec9b525190aee08dc5feb6d1fbedfad1c5110118 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Fri, 28 Aug 2020 12:58:25 +0900 Subject: [PATCH 15/16] DSWindowShell: move wm policy functionalities from DSWindow to DSWindowShell move firstCommit, visible and changedGeometry Change-Id: I75a5805587a93091f274cbc99f7813ff70b695c1 --- src/DSWindow/DSWindow.cpp | 43 ------------------------------ src/DSWindow/DSWindowPrivate.h | 5 ---- src/DSWindowShell/DSWindowShellPrivate.cpp | 36 ++++++++++++++++++++++++- src/DSWindowShell/DSWindowShellPrivate.h | 6 ++++- 4 files changed, 40 insertions(+), 50 deletions(-) diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index e4cf6f1..6267a96 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -41,12 +41,9 @@ DSWindowPrivate::DSWindowPrivate(DSWindow *p_ptr) __committedW(0), __committedH(0), __created(false), - __visible(false), __hasFocus(false), __waylandSurface(nullptr), __winShell(nullptr), - __firstCommit(true), - __changedGeometry(false), __acceptsFocus(true), __allowUserGeometry(false), __title(""), @@ -181,14 +178,6 @@ DSWindowShell *DSWindowPrivate::getWindowShell(void) return __winShell; } -void DSWindowPrivate::sendConfigure(void) -{ - if (__winShell) - { - __winShell->sendConfigure(); - } -} - bool DSWindowPrivate::setVkbdFloating(bool set) { __vkbd_floating = set; @@ -204,34 +193,8 @@ 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; - } // emit a signal of the buffer changed pub->__bufferChangedSignal.emit(buffer); @@ -411,8 +374,6 @@ void DSWindow::setPosition(int x, int y) priv->__x = x; priv->__y = y; - priv->__changedGeometry = true; - __windowPositionChangedSignal.emit(nullptr); } @@ -444,8 +405,6 @@ void DSWindow::setSize(unsigned int w, unsigned int h) priv->__w = w; priv->__h = h; - - priv->__changedGeometry = true; } void DSWindow::setSize(stSize size) @@ -454,8 +413,6 @@ void DSWindow::setSize(stSize size) priv->__w = size.w; priv->__h = size.h; - - priv->__changedGeometry = true; } void DSWindow::setZOrder(unsigned int zOrder) diff --git a/src/DSWindow/DSWindowPrivate.h b/src/DSWindow/DSWindowPrivate.h index 3109df7..a6a8200 100644 --- a/src/DSWindow/DSWindowPrivate.h +++ b/src/DSWindow/DSWindowPrivate.h @@ -73,8 +73,6 @@ public: bool setWindowShell(DSWindowShell *winShell); DSWindowShell *getWindowShell(void); - void sendConfigure(void); - bool setVkbdFloating(bool set); bool getVkbdFloating(); @@ -89,12 +87,9 @@ private: unsigned int __zOrder; unsigned int __committedW, __committedH; bool __created; - bool __visible; bool __hasFocus; std::shared_ptr __waylandSurface; DSWindowShell *__winShell; - bool __firstCommit; - bool __changedGeometry; bool __acceptsFocus; bool __allowUserGeometry; std::string __title; diff --git a/src/DSWindowShell/DSWindowShellPrivate.cpp b/src/DSWindowShell/DSWindowShellPrivate.cpp index 897f91c..65778c3 100644 --- a/src/DSWindowShell/DSWindowShellPrivate.cpp +++ b/src/DSWindowShell/DSWindowShellPrivate.cpp @@ -70,8 +70,12 @@ DSWindowShellPrivate::DSWindowShellPrivate(DSWindowShell *p_ptr, DSWindow *windo __reqX(0), __reqY(0), __reqW(0), __reqH(0), __parent(nullptr), - __layer(0) + __layer(0), + __firstCommit(true), + __changedGeometry(false), + __visible(false) { + __window->registerCallbackBufferChanged(this, std::bind(&DSWindowShellPrivate::__onWindowBufferChanged, this, std::placeholders::_1)); } DSWindowShellPrivate::~DSWindowShellPrivate() @@ -172,6 +176,7 @@ bool DSWindowShellPrivate::__handleUserGeometryHint(bool setUserGeometry) __x = __y = __w = __h = 0; __window->setPosition(__x, __y); __window->setSize(__w, __h); + __changedGeometry = true; } else { @@ -187,6 +192,7 @@ bool DSWindowShellPrivate::__handleUserGeometryHint(bool setUserGeometry) __window->setPosition(__x, __y); __window->setSize(__w, __h); + __changedGeometry = true; } } @@ -209,6 +215,7 @@ bool DSWindowShellPrivate::create(int x, int y, unsigned int w, unsigned int h, { __window->setPosition(__x, __y); __window->setSize(__w, __h); + __changedGeometry = true; } return true; @@ -245,6 +252,7 @@ bool DSWindowShellPrivate::setZone(DSZone *zone) __window->setPosition(__x, __y); __window->setSize(__w, __h); + __changedGeometry = true; } } else @@ -336,6 +344,7 @@ bool DSWindowShellPrivate::setPosition(int x, int y) __x = x; __y = y; __window->setPosition(__x, __y); + __changedGeometry = true; } } else @@ -397,6 +406,7 @@ bool DSWindowShellPrivate::setGeometry(int x, int y, unsigned int w, unsigned in __h = h; __window->setPosition(__x, __y); __window->setSize(__w, __h); + __changedGeometry = true; } } else @@ -645,4 +655,28 @@ void DSWindowShellPrivate::sendConfigure(void) } } +void DSWindowShellPrivate::__onWindowBufferChanged(std::shared_ptr buffer) +{ + if (__firstCommit) + { + DSLOG_DBG("DSWindow", "First Commit!!! "); + __firstCommit = false; + } + + if (__changedGeometry) + { + std::shared_ptr bufferSize = buffer->getSize(); + DSLOG_DBG("DSWindow", "Geometry Changed!!! Send Configure... geo(%d,%d,%d,%d) commit(%d,%d)", __x, __y, __w, __h, bufferSize->w, bufferSize->h); + sendConfigure(); + __changedGeometry = false; + } + + if (buffer) { + __visible = true; + } else { + __visible = false; + } + +} + } // namespace display_server diff --git a/src/DSWindowShell/DSWindowShellPrivate.h b/src/DSWindowShell/DSWindowShellPrivate.h index 25e27ae..5057859 100644 --- a/src/DSWindowShell/DSWindowShellPrivate.h +++ b/src/DSWindowShell/DSWindowShellPrivate.h @@ -38,7 +38,7 @@ struct stWindowAuxHint bool deleted; }; -class DSWindowShellPrivate +class DSWindowShellPrivate : public DSObject { DS_PIMPL_USE_PUBLIC(DSWindowShell) @@ -126,6 +126,7 @@ private: bool __create(int x, int y, unsigned int w, unsigned int h, DSWindowShell *pWin, DSWindowShell *pParent); bool __findInChildList(DSWindowShell *parentWinShell); bool __setParent(DSWindowShell *parentWinShell); + void __onWindowBufferChanged(std::shared_ptr buffer); struct stWindowAuxHint* __findAuxHint(int32_t id); void __handleAuxHint(stWindowAuxHint *hint); @@ -141,6 +142,9 @@ private: unsigned int __reqW, __reqH; // requested size by client DSWindowShell *__parent; int __layer; + bool __firstCommit; + bool __changedGeometry; + bool __visible; std::list __childList; std::list __auxHintsList; }; -- 2.7.4 From f5868e767fd2e51ea80f06cde3ac82b6c0488315 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Fri, 28 Aug 2020 13:04:31 +0900 Subject: [PATCH 16/16] DSWindowShell: make sendConfigure method be a private method Change-Id: I0d539c18a74c93fac6d53d1f6a2b072651f0ca9c --- src/DSWindowShell/DSWindowShell.cpp | 8 -------- src/DSWindowShell/DSWindowShell.h | 2 -- src/DSWindowShell/DSWindowShellPrivate.cpp | 6 +++--- src/DSWindowShell/DSWindowShellPrivate.h | 6 +++--- 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/DSWindowShell/DSWindowShell.cpp b/src/DSWindowShell/DSWindowShell.cpp index 8b9a78b..6798b79 100644 --- a/src/DSWindowShell/DSWindowShell.cpp +++ b/src/DSWindowShell/DSWindowShell.cpp @@ -372,12 +372,4 @@ bool DSWindowShell::getVkbdFloating() return priv->getVkbdFloating(); } -void DSWindowShell::sendConfigure(void) -{ - DS_GET_PRIV(DSWindowShell); - - priv->sendConfigure(); -} - - } // namespace display_server diff --git a/src/DSWindowShell/DSWindowShell.h b/src/DSWindowShell/DSWindowShell.h index 7690094..f2452f7 100644 --- a/src/DSWindowShell/DSWindowShell.h +++ b/src/DSWindowShell/DSWindowShell.h @@ -116,8 +116,6 @@ public: bool setVkbdFloating(bool set); bool getVkbdFloating(); - void sendConfigure(void); - protected: private: diff --git a/src/DSWindowShell/DSWindowShellPrivate.cpp b/src/DSWindowShell/DSWindowShellPrivate.cpp index 65778c3..7435cbf 100644 --- a/src/DSWindowShell/DSWindowShellPrivate.cpp +++ b/src/DSWindowShell/DSWindowShellPrivate.cpp @@ -276,7 +276,7 @@ void DSWindowShellPrivate::setShellSurface(IDSWaylandShellSurface *shellSurface) { __shellSurface = shellSurface; DSLOG_DBG("DSWindowShell", "Set ShellSurface(%p). Send configure", shellSurface); - sendConfigure(); + __sendConfigure(); } IDSWaylandShellSurface *DSWindowShellPrivate::getShellSurface(void) @@ -647,7 +647,7 @@ bool DSWindowShellPrivate::getVkbdFloating() return false; } -void DSWindowShellPrivate::sendConfigure(void) +void DSWindowShellPrivate::__sendConfigure(void) { if (__shellSurface) { @@ -667,7 +667,7 @@ void DSWindowShellPrivate::__onWindowBufferChanged(std::shared_ptr bu { std::shared_ptr bufferSize = buffer->getSize(); DSLOG_DBG("DSWindow", "Geometry Changed!!! Send Configure... geo(%d,%d,%d,%d) commit(%d,%d)", __x, __y, __w, __h, bufferSize->w, bufferSize->h); - sendConfigure(); + __sendConfigure(); __changedGeometry = false; } diff --git a/src/DSWindowShell/DSWindowShellPrivate.h b/src/DSWindowShell/DSWindowShellPrivate.h index 5057859..1d1924c 100644 --- a/src/DSWindowShell/DSWindowShellPrivate.h +++ b/src/DSWindowShell/DSWindowShellPrivate.h @@ -120,18 +120,18 @@ public: bool setVkbdFloating(bool set); bool getVkbdFloating(); - void sendConfigure(void); - private: bool __create(int x, int y, unsigned int w, unsigned int h, DSWindowShell *pWin, DSWindowShell *pParent); bool __findInChildList(DSWindowShell *parentWinShell); bool __setParent(DSWindowShell *parentWinShell); - void __onWindowBufferChanged(std::shared_ptr buffer); + void __sendConfigure(void); struct stWindowAuxHint* __findAuxHint(int32_t id); void __handleAuxHint(stWindowAuxHint *hint); bool __handleUserGeometryHint(bool setUserGeometry); + void __onWindowBufferChanged(std::shared_ptr buffer); + private: DSWindow *__window; IDSWaylandShellSurface *__shellSurface; -- 2.7.4