From 4ceb0ea7a56359dfe9541a90d24a0ee3889e6145 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Thu, 27 Aug 2020 10:59:48 +0900 Subject: [PATCH 01/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 02/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 03/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 04/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 05/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 06/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 From 77339f99655f3f6ddbfc2feb29aba471f9917b7b Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Thu, 27 Aug 2020 13:35:13 +0900 Subject: [PATCH 07/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 08/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 09/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 10/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 11/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 12/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 13/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 14/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 15/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 16/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