From 393989d84c128ec003cf1de144ef3658c14ee572 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Tue, 25 Aug 2020 14:50:18 +0900 Subject: [PATCH 01/16] DSWindowShell: implement raise/lower/activate Change-Id: I97afb6786594587791c37499ed874ee6364794d8 --- src/DSWindowShell/DSWindowShellPrivate.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/DSWindowShell/DSWindowShellPrivate.cpp b/src/DSWindowShell/DSWindowShellPrivate.cpp index f70ebf0..20eeff5 100644 --- a/src/DSWindowShell/DSWindowShellPrivate.cpp +++ b/src/DSWindowShell/DSWindowShellPrivate.cpp @@ -495,12 +495,18 @@ int DSWindowShellPrivate::getLayer(void) bool DSWindowShellPrivate::raise(void) { - return true; + if (__window) + return __window->raise(); + + return false; } bool DSWindowShellPrivate::lower(void) { - return true; + if (__window) + return __window->lower(); + + return false; } bool DSWindowShellPrivate::unsetFocus(void) @@ -527,7 +533,10 @@ bool DSWindowShellPrivate::isFocused(void) bool DSWindowShellPrivate::activate(void) { - return true; + if (__window) + return __window->raiseToTop(); + + return false; } bool DSWindowShellPrivate::isActivated(void) -- 2.7.4 From fa80de055a2cd186eccf44c42b5bc907cd1d8a2f Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 25 Aug 2020 14:38:42 +0900 Subject: [PATCH 02/16] DSZone: send stackChanged Signal when there is a window on the list. Change-Id: I1001aa81c92b4dbc0b2d5041e02fe0450aab46ea --- src/DSZone/DSZone.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index c1027be..3973120 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -304,9 +304,11 @@ void DSZone::__destroyWindow(std::shared_ptr window) __stackChanged = true; __updateWindowOrder(); - std::shared_ptr wTop(__windowList.front()); - wTop->raiseToTop(); - __windowStackChangedSignal.emit(wTop); + if (!__windowList.empty()) { + std::shared_ptr wTop(__windowList.front()); + wTop->raiseToTop(); + __windowStackChangedSignal.emit(wTop); + } } void DSZone::__updateWindowOrder(void) -- 2.7.4 From d74f12b0cb6155dddf71db43c20ca678b3d4086e Mon Sep 17 00:00:00 2001 From: jeon Date: Tue, 25 Aug 2020 16:09:15 +0900 Subject: [PATCH 03/16] DSWaylandServer: set temporary size to BaseOutputResolution Change-Id: I3df77c32564de2e0e8131d33ab75c65e1b998412 --- src/DSWaylandServer/DSWaylandTizenAppinfo.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/DSWaylandServer/DSWaylandTizenAppinfo.cpp b/src/DSWaylandServer/DSWaylandTizenAppinfo.cpp index 44d5416..8f4a684 100644 --- a/src/DSWaylandServer/DSWaylandTizenAppinfo.cpp +++ b/src/DSWaylandServer/DSWaylandTizenAppinfo.cpp @@ -87,6 +87,9 @@ void DSWaylandTizenAppinfoPrivate::tizen_launch_appinfo_get_base_output_resoluti result = pub->__dsAppinfoMgr->getBaseOutputResolution(pid, &res_w, &res_h); if (!result) { /* TODO: Read configured resolution values */ + /* FIXME : get base resolution from the correct way */ + res_w = 720; + res_h = 1280; } send_base_output_resolution_done(resource->handle, pid, res_w, res_h); DSLOG_DBG("TizenAppinfoPriv", "SEND base_output_resolution_done event with width(%d), height(%d)", res_w, res_h); -- 2.7.4 From 8e815fa90c0586a2110de0f1e4bb4d5e7058c2e1 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Tue, 25 Aug 2020 14:38:17 +0900 Subject: [PATCH 04/16] DSRenderViewDaliImpl: Move the emit updatedSignal to setBuffer. - setBuffer is clearer than the __onWindowBufferChanged callback. - This modification is required to properly verify the function of setBuffer in libds-test. Change-Id: I29c565ad5bc4cd19a926d6a8e418325c4ff3bad6 Signed-off-by: Joonbum Ko --- src/DSRender/DSRenderViewDaliImpl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DSRender/DSRenderViewDaliImpl.cpp b/src/DSRender/DSRenderViewDaliImpl.cpp index 5182934..d1aac16 100644 --- a/src/DSRender/DSRenderViewDaliImpl.cpp +++ b/src/DSRender/DSRenderViewDaliImpl.cpp @@ -139,6 +139,8 @@ bool DSRenderViewDaliImpl::setBuffer(std::shared_ptr buffer) __textureViewActor.SetProperty(Actor::Property::VISIBLE, false); } + __updatedSignal.emit(nullptr); + return true; } @@ -165,8 +167,6 @@ void DSRenderViewDaliImpl::__onWindowBufferChanged(std::shared_ptr bu DSLOG_ERR("DSRenderViewDaliImpl", "setBuffer fails."); return; } - - __updatedSignal.emit(nullptr); } void DSRenderViewDaliImpl::__onWindowRaiseToTopChanged(void *data) -- 2.7.4 From 235ed23cfd02afc85bc194f9ca786c961cc88b3a Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 25 Aug 2020 16:22:11 +0900 Subject: [PATCH 05/16] test: enqueue buffer Change-Id: I410b5f3b1fbab0616ccd20a2e28dc418e1db1484 --- tests/DSDisplayDeviceTDMImpl-test.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/DSDisplayDeviceTDMImpl-test.cpp b/tests/DSDisplayDeviceTDMImpl-test.cpp index a366e19..7f9f47c 100644 --- a/tests/DSDisplayDeviceTDMImpl-test.cpp +++ b/tests/DSDisplayDeviceTDMImpl-test.cpp @@ -295,8 +295,7 @@ TEST_F(DSDisplayDeviceTDMImplTest, DeviceHWC_commit) auto buffer = bufferQueue->dequeueBuffer(); EXPECT_TRUE(buffer != nullptr); - - EXPECT_TRUE(deviceHWC->setTargetBuffer(buffer)); + EXPECT_TRUE(bufferQueue->enqueueBuffer(buffer)); // commit EXPECT_TRUE(deviceHWC->commit()); -- 2.7.4 From 53468212c2e2a3afc1e56942c376458502e2a92b Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Tue, 25 Aug 2020 15:35:41 +0900 Subject: [PATCH 06/16] DSWindow: send positionChanged signal when window's position is changed Change-Id: Iab9cca37ffcf22c48e9380078c38dca22c616c0d --- src/DSWindow/DSWindow.cpp | 7 +++++++ src/DSWindow/DSWindow.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index 41e5288..5854b0d 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -391,6 +391,8 @@ void DSWindow::setPosition(int x, int y) priv->__y = y; priv->__changedGeometry = true; + + __windowPositionChangedSignal.emit(nullptr); } stPosition DSWindow::getPosition(void) @@ -503,4 +505,9 @@ void DSWindow::registerCallbackWindowRaiseToTop(DSObject *slot, std::function func) +{ + __windowPositionChangedSignal.connect(slot, func); +} + } // namespace display_server diff --git a/src/DSWindow/DSWindow.h b/src/DSWindow/DSWindow.h index 21ef2b0..627065e 100644 --- a/src/DSWindow/DSWindow.h +++ b/src/DSWindow/DSWindow.h @@ -96,6 +96,7 @@ public: void registerCallbackBufferChanged(DSObject *slot, std::function)> func); void registerCallbackWindowDestroyed(DSObject *slot, std::function func); void registerCallbackWindowRaiseToTop(DSObject *slot, std::function func); + void registerCallbackWindowPositionChanged(DSObject *slot, std::function func); protected: //virtual bool _onFocus(void); @@ -107,6 +108,7 @@ private: DSSignal> __bufferChangedSignal; DSSignal __windowDestroySignal; DSSignal __windowRaiseToTopSignal; + DSSignal __windowPositionChangedSignal; }; } -- 2.7.4 From 9f69b1204869a602c66ae5f6b51da730e207281b Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 25 Aug 2020 16:57:52 +0900 Subject: [PATCH 07/16] DSZone: donot check if window list is empty when zone sends stackChanged signal. Change-Id: Iabadf761ef4fdc4b9ad8bbf8771f4921e16aff95 --- src/DSZone/DSZone.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index 3973120..6c9a31e 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -235,8 +235,9 @@ void DSZone::__prependWindowList(std::shared_ptr window) __updateWindowOrder(); std::shared_ptr wTop(__windowList.front()); - wTop->raiseToTop(); __windowStackChangedSignal.emit(wTop); + + wTop->raiseToTop(); } void DSZone::__appendWindowList(std::shared_ptr window) @@ -248,8 +249,9 @@ void DSZone::__appendWindowList(std::shared_ptr window) __updateWindowOrder(); std::shared_ptr wTop(__windowList.front()); - wTop->raiseToTop(); __windowStackChangedSignal.emit(wTop); + + wTop->raiseToTop(); } std::shared_ptr DSZone::__findWindow(DSWaylandSurface *dswlSurface) @@ -304,11 +306,11 @@ void DSZone::__destroyWindow(std::shared_ptr window) __stackChanged = true; __updateWindowOrder(); - if (!__windowList.empty()) { - std::shared_ptr wTop(__windowList.front()); + std::shared_ptr wTop(__windowList.front()); + __windowStackChangedSignal.emit(wTop); + + if (!__windowList.empty()) wTop->raiseToTop(); - __windowStackChangedSignal.emit(wTop); - } } void DSZone::__updateWindowOrder(void) -- 2.7.4 From 82d887f55f117a83c1b2f24499e4096d9161c3c0 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Tue, 25 Aug 2020 18:58:32 +0900 Subject: [PATCH 08/16] DSDisplayDeviceHWCWindowTDMTargetImpl: set target buffer in updateFrame Change-Id: I744ec61de0f180f8d11ce2e34aa645525661ab2e --- src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMTargetImpl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMTargetImpl.cpp b/src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMTargetImpl.cpp index 81b9f5d..abc3893 100644 --- a/src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMTargetImpl.cpp +++ b/src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMTargetImpl.cpp @@ -70,7 +70,8 @@ bool DSDisplayDeviceHWCWindowTDMTargetImpl::updateFrame() __buffer = nullptr; } - __buffer= dsBuffer; + __buffer = dsBuffer; + __deviceHWC->setTargetBuffer(__buffer); return true; } @@ -79,7 +80,6 @@ void DSDisplayDeviceHWCWindowTDMTargetImpl::presentFrame() { if (__buffer) { __presentBuffer = std::move(__buffer); - __deviceHWC->setTargetBuffer(__presentBuffer); } } -- 2.7.4 From 73a7e7580b70d69770c7101dd35a46edce1e985c Mon Sep 17 00:00:00 2001 From: Sung-Jin Park Date: Tue, 25 Aug 2020 18:35:58 +0900 Subject: [PATCH 09/16] DSWaylandSurface: add getClient() Change-Id: I625fe50c72cb2224fb2d2a7712075c0f69a4b6a0 Signed-off-by: Sung-Jin Park --- src/DSWaylandServer/DSWaylandSurface.cpp | 10 ++++++++++ src/DSWaylandServer/DSWaylandSurface.h | 1 + src/DSWaylandServer/DSWaylandSurfacePrivate.h | 1 + 3 files changed, 12 insertions(+) diff --git a/src/DSWaylandServer/DSWaylandSurface.cpp b/src/DSWaylandServer/DSWaylandSurface.cpp index 26afa18..4d4ce31 100644 --- a/src/DSWaylandServer/DSWaylandSurface.cpp +++ b/src/DSWaylandServer/DSWaylandSurface.cpp @@ -23,6 +23,7 @@ #include "DSWaylandSurface.h" #include "DSWaylandSurfacePrivate.h" +#include "DSWaylandClient.h" namespace display_server { @@ -77,6 +78,7 @@ DSWaylandSurfacePrivate::DSWaylandSurfacePrivate(DSWaylandSurface *p_ptr) __p_ptr(p_ptr), __commitInfoPending{std::make_unique()}, __commitInfo{std::make_shared()}, + __waylandClient(nullptr), __bufferManager{DSBufferManager::getInstance()}, __resId(0) {} @@ -86,6 +88,7 @@ DSWaylandSurfacePrivate::DSWaylandSurfacePrivate(DSWaylandSurface *p_ptr, DSWayl __p_ptr(p_ptr), __commitInfoPending{std::make_unique()}, __commitInfo{std::make_shared()}, + __waylandClient(waylandClient), __bufferManager{DSBufferManager::getInstance()}, __resId(0) { @@ -242,6 +245,13 @@ struct ::wl_resource *DSWaylandSurface::getWlResource() return priv->resource()->handle; } +DSWaylandClient *DSWaylandSurface::getClient() +{ + DS_GET_PRIV(DSWaylandSurface); + + return priv->__waylandClient; +} + bool DSWaylandSurface::hasResource() { DS_GET_PRIV(DSWaylandSurface); diff --git a/src/DSWaylandServer/DSWaylandSurface.h b/src/DSWaylandServer/DSWaylandSurface.h index d9cac4a..f6cf2ca 100644 --- a/src/DSWaylandServer/DSWaylandSurface.h +++ b/src/DSWaylandServer/DSWaylandSurface.h @@ -64,6 +64,7 @@ public: void registerCallbackSurfaceCommitted(DSObject *slot, std::function commitInfo)> func); struct ::wl_resource *getWlResource(); + DSWaylandClient *getClient(); bool hasResource(); uint32_t getResourceId(); diff --git a/src/DSWaylandServer/DSWaylandSurfacePrivate.h b/src/DSWaylandServer/DSWaylandSurfacePrivate.h index 4b37613..0ed0577 100644 --- a/src/DSWaylandServer/DSWaylandSurfacePrivate.h +++ b/src/DSWaylandServer/DSWaylandSurfacePrivate.h @@ -111,6 +111,7 @@ protected: private: std::unique_ptr __commitInfoPending; std::shared_ptr __commitInfo; + DSWaylandClient *__waylandClient; DSBufferManager *__bufferManager; uint32_t __resId; }; -- 2.7.4 From 500c21a70b4b72fb2c090a8dc60341c6f9048106 Mon Sep 17 00:00:00 2001 From: Sung-Jin Park Date: Tue, 25 Aug 2020 18:36:54 +0900 Subject: [PATCH 10/16] DSWaylandKeyboard: sendEnter when the focused client get wl_keyboard Change-Id: I2f36a87bfbe34bda11ed91b0c197de958f09c11e Signed-off-by: Sung-Jin Park --- src/DSWaylandServer/DSWaylandKeyboard.cpp | 17 ++++++++++++++++- src/DSWaylandServer/DSWaylandKeyboardPrivate.h | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/DSWaylandServer/DSWaylandKeyboard.cpp b/src/DSWaylandServer/DSWaylandKeyboard.cpp index 3ca2388..8002088 100644 --- a/src/DSWaylandServer/DSWaylandKeyboard.cpp +++ b/src/DSWaylandServer/DSWaylandKeyboard.cpp @@ -211,6 +211,21 @@ void DSWaylandKeyboardPrivate::sendKey(uint32_t key, uint32_t state) std::for_each(resMap.begin(), resMap.end(), func); } +void DSWaylandKeyboardPrivate::__addClient(struct ::wl_client *wlClient, uint32_t id, int version) +{ + wl_keyboard::add(wlClient, id, version); + + if (__focusSurface && __focusSurface->hasResource()) + { + DSWaylandClient *waylandClient = __focusSurface->getClient(); + if (waylandClient && (waylandClient->wlClient() == wlClient)) + { + DSLOG_INF("DSWaylandKeyboardPrivate", "Send enter to focusSurface(%p)", __focusSurface); + sendEnter(__focusSurface->getWlResource()); + } + } +} + /* Begin Public Class Implementation */ DSWaylandKeyboard::DSWaylandKeyboard(DSWaylandSeat *seat) : DSObject(), _d_ptr(std::make_unique(seat, this)) @@ -264,7 +279,7 @@ void DSWaylandKeyboard::addClient(DSWaylandClient *client, uint32_t id, int vers DSLOG_INF("DSWaylandKeyboard", "addClient(dswlClient=%p, id=%u, version=%d", client, id, version); - priv->add(client->wlClient(), id, version); + priv->__addClient(client->wlClient(), id, version); } void DSWaylandKeyboard::setFocus(DSWaylandSurface *waylandSurface) diff --git a/src/DSWaylandServer/DSWaylandKeyboardPrivate.h b/src/DSWaylandServer/DSWaylandKeyboardPrivate.h index f3be21d..48f4665 100644 --- a/src/DSWaylandServer/DSWaylandKeyboardPrivate.h +++ b/src/DSWaylandServer/DSWaylandKeyboardPrivate.h @@ -64,6 +64,8 @@ protected: void sendModifiers(struct ::wl_resource *surface); private: + void __addClient(struct ::wl_client *wlClient, uint32_t id, int version); + DSWaylandSeat *__seat; DSXkb *__xkb; DSWaylandCompositor *__compositor; -- 2.7.4 From 664ca00454b4b7249507d836c2b741426a1aa40c Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Tue, 25 Aug 2020 18:01:57 +0900 Subject: [PATCH 11/16] DSWindow: make lowerToBottom method and registerCallback method of it. Change-Id: I414fb66abe5510e0116f48d50a233f2086618677 Signed-off-by: Joonbum Ko --- src/DSWindow/DSWindow.cpp | 12 ++++++++++++ src/DSWindow/DSWindow.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index 5854b0d..abf824d 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -362,6 +362,13 @@ bool DSWindow::raiseToTop() return true; } +bool DSWindow::lowerToBottom() +{ + __windowLowerToBottomSignal.emit(nullptr); + + return true; +} + bool DSWindow::unsetFocus(void) { DS_GET_PRIV(DSWindow); @@ -505,6 +512,11 @@ void DSWindow::registerCallbackWindowRaiseToTop(DSObject *slot, std::function func) +{ + __windowLowerToBottomSignal.connect(slot, func); +} + void DSWindow::registerCallbackWindowPositionChanged(DSObject *slot, std::function func) { __windowPositionChangedSignal.connect(slot, func); diff --git a/src/DSWindow/DSWindow.h b/src/DSWindow/DSWindow.h index 627065e..ebdf453 100644 --- a/src/DSWindow/DSWindow.h +++ b/src/DSWindow/DSWindow.h @@ -69,6 +69,7 @@ public: bool raise(void); bool lower(void); bool raiseToTop(); + bool lowerToBottom(); bool unsetFocus(void); bool setFocus(void); @@ -96,6 +97,7 @@ public: 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); protected: @@ -108,6 +110,7 @@ private: DSSignal> __bufferChangedSignal; DSSignal __windowDestroySignal; DSSignal __windowRaiseToTopSignal; + DSSignal __windowLowerToBottomSignal; DSSignal __windowPositionChangedSignal; }; -- 2.7.4 From 42e6ac7ca9662e79589ece248874bffa243dd7e8 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Tue, 25 Aug 2020 18:05:17 +0900 Subject: [PATCH 12/16] DSRenderViewDaliImpl: register lowerToBottom callback of window Change-Id: I9dabc8630aa33e137726304053eb61ff36d4deb5 Signed-off-by: Joonbum Ko --- src/DSRender/DSRenderViewDaliImpl.cpp | 11 +++++++++++ src/DSRender/DSRenderViewDaliImpl.h | 1 + 2 files changed, 12 insertions(+) diff --git a/src/DSRender/DSRenderViewDaliImpl.cpp b/src/DSRender/DSRenderViewDaliImpl.cpp index d1aac16..a004670 100644 --- a/src/DSRender/DSRenderViewDaliImpl.cpp +++ b/src/DSRender/DSRenderViewDaliImpl.cpp @@ -106,6 +106,7 @@ DSRenderViewDaliImpl::DSRenderViewDaliImpl(std::shared_ptr window, Dal // callbacks 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)); } DSRenderViewDaliImpl::~DSRenderViewDaliImpl() @@ -179,4 +180,14 @@ void DSRenderViewDaliImpl::__onWindowRaiseToTopChanged(void *data) __updatedSignal.emit(nullptr); } +void DSRenderViewDaliImpl::__onWindowLowerToBottomChanged(void *data) +{ + DSLOG_INF("DSRenderViewDaliImpl", "__onWindowLowerToBottomChanged."); + + __textureViewActor.SetProperty(Actor::Property::VISIBLE, true); + __textureViewActor.LowerToBottom(); + + __updatedSignal.emit(nullptr); +} + } // namespace display_server diff --git a/src/DSRender/DSRenderViewDaliImpl.h b/src/DSRender/DSRenderViewDaliImpl.h index d6fe3f6..5048555 100644 --- a/src/DSRender/DSRenderViewDaliImpl.h +++ b/src/DSRender/DSRenderViewDaliImpl.h @@ -50,6 +50,7 @@ public: private: void __onWindowBufferChanged(std::shared_ptr buffer); void __onWindowRaiseToTopChanged(void *data); + void __onWindowLowerToBottomChanged(void *data); std::shared_ptr __window; Dali::OffscreenWindow __offscreenWindow; -- 2.7.4 From abd81817db1a999bb899177be3aa5652954868ff Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Tue, 25 Aug 2020 18:29:31 +0900 Subject: [PATCH 13/16] DSRenderViewDaliImpl: register positionChanged callback of window Change-Id: I7d816751ae28b999f68bb0edb6da1907a8d38049 Signed-off-by: Joonbum Ko --- src/DSRender/DSRenderViewDaliImpl.cpp | 13 +++++++++++++ src/DSRender/DSRenderViewDaliImpl.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/DSRender/DSRenderViewDaliImpl.cpp b/src/DSRender/DSRenderViewDaliImpl.cpp index a004670..7cc724d 100644 --- a/src/DSRender/DSRenderViewDaliImpl.cpp +++ b/src/DSRender/DSRenderViewDaliImpl.cpp @@ -107,6 +107,7 @@ DSRenderViewDaliImpl::DSRenderViewDaliImpl(std::shared_ptr window, Dal window->registerCallbackBufferChanged(this, std::bind(&DSRenderViewDaliImpl::__onWindowBufferChanged, this, std::placeholders::_1)); window->registerCallbackWindowRaiseToTop(this, std::bind(&DSRenderViewDaliImpl::__onWindowRaiseToTopChanged, this, std::placeholders::_1)); window->registerCallbackWindowLowerToBottom(this, std::bind(&DSRenderViewDaliImpl::__onWindowLowerToBottomChanged, this, std::placeholders::_1)); + window->registerCallbackWindowPositionChanged(this, std::bind(&DSRenderViewDaliImpl::__onWindowPositionChanged, this, std::placeholders::_1)); } DSRenderViewDaliImpl::~DSRenderViewDaliImpl() @@ -190,4 +191,16 @@ void DSRenderViewDaliImpl::__onWindowLowerToBottomChanged(void *data) __updatedSignal.emit(nullptr); } +void DSRenderViewDaliImpl::__onWindowPositionChanged(void *data) +{ + DSLOG_INF("DSRenderViewDaliImpl", "__onWindowPositionChanged."); + + stPosition pos = __window->getPosition(); + + __textureViewActor.SetProperty(Actor::Property::VISIBLE, true); + __textureViewActor.SetProperty(Actor::Property::POSITION, Vector3( pos.x, pos.y, 0.0f )); + + __updatedSignal.emit(nullptr); +} + } // namespace display_server diff --git a/src/DSRender/DSRenderViewDaliImpl.h b/src/DSRender/DSRenderViewDaliImpl.h index 5048555..8ffd858 100644 --- a/src/DSRender/DSRenderViewDaliImpl.h +++ b/src/DSRender/DSRenderViewDaliImpl.h @@ -51,6 +51,7 @@ private: void __onWindowBufferChanged(std::shared_ptr buffer); void __onWindowRaiseToTopChanged(void *data); void __onWindowLowerToBottomChanged(void *data); + void __onWindowPositionChanged(void *data); std::shared_ptr __window; Dali::OffscreenWindow __offscreenWindow; -- 2.7.4 From 9fa0613792f40537572e7278fe55719fe6d9eae6 Mon Sep 17 00:00:00 2001 From: Duna Oh Date: Mon, 24 Aug 2020 10:25:24 +0900 Subject: [PATCH 14/16] DSWaylandTizenLaunchEffect/Splash: add skeleton code for tizen_launch_effect/splash Change-Id: Id600cd5f63056df52417934e5f9ca7df9b1fc591 --- samples/exampleClient.c | 8 ++ src/DSWaylandExtension/DSWaylandExtension.cpp | 15 ++- src/DSWaylandExtension/DSWaylandExtensionPrivate.h | 3 + src/DSWaylandServer/DSWaylandTizenLaunchEffect.cpp | 134 +++++++++++++++++++++ src/DSWaylandServer/DSWaylandTizenLaunchEffect.h | 54 +++++++++ .../DSWaylandTizenLaunchEffectPrivate.h | 62 ++++++++++ src/DSWaylandServer/DSWaylandTizenLaunchSplash.cpp | 71 +++++++++++ src/DSWaylandServer/DSWaylandTizenLaunchSplash.h | 48 ++++++++ .../DSWaylandTizenLaunchSplashPrivate.h | 60 +++++++++ src/meson.build | 6 + tests/DSWaylandTizenLaunchEffect-test.cpp | 64 ++++++++++ tests/meson.build | 1 + 12 files changed, 525 insertions(+), 1 deletion(-) create mode 100644 src/DSWaylandServer/DSWaylandTizenLaunchEffect.cpp create mode 100644 src/DSWaylandServer/DSWaylandTizenLaunchEffect.h create mode 100644 src/DSWaylandServer/DSWaylandTizenLaunchEffectPrivate.h create mode 100644 src/DSWaylandServer/DSWaylandTizenLaunchSplash.cpp create mode 100644 src/DSWaylandServer/DSWaylandTizenLaunchSplash.h create mode 100644 src/DSWaylandServer/DSWaylandTizenLaunchSplashPrivate.h create mode 100644 tests/DSWaylandTizenLaunchEffect-test.cpp diff --git a/samples/exampleClient.c b/samples/exampleClient.c index 929f72b..6726029 100644 --- a/samples/exampleClient.c +++ b/samples/exampleClient.c @@ -50,6 +50,8 @@ struct xkb_context *xkb_context = NULL; struct xkb_keymap *keymap = NULL; struct tizen_policy *tz_policy = NULL; struct tizen_launch_appinfo *tz_appinfo = NULL; +struct tizen_launch_effect *tz_launcheffect = NULL; +struct tizen_launch_splash *tz_launchsplash = NULL; struct zxdg_shell_v6 *zxdg_shell; struct zxdg_surface_v6 *zxdg_surface; struct zxdg_toplevel_v6 *zxdg_toplevel; @@ -483,6 +485,12 @@ global_registry_handler(void *data, struct wl_registry *registry, uint32_t id, { output = wl_registry_bind(registry, id, &wl_output_interface, 2); } + else if(strcmp(interface, "tizen_launch_effect") == 0) + { + tz_launcheffect = wl_registry_bind(registry, id, &tizen_launch_effect_interface, 1); + + tz_launchsplash = tizen_launch_effect_create_splash_img(tz_launcheffect); + } } static void diff --git a/src/DSWaylandExtension/DSWaylandExtension.cpp b/src/DSWaylandExtension/DSWaylandExtension.cpp index 0c27e6c..6534383 100644 --- a/src/DSWaylandExtension/DSWaylandExtension.cpp +++ b/src/DSWaylandExtension/DSWaylandExtension.cpp @@ -27,7 +27,7 @@ #include "DSWaylandZxdgShellV6.h" #include "DSWaylandTizenPolicy.h" #include "DSWaylandTizenAppinfo.h" - +#include "DSWaylandTizenLaunchEffect.h" namespace display_server { @@ -57,6 +57,7 @@ bool DSWaylandExtensionPrivate::init(DSWaylandCompositor *compositor) __initShell(); __initTizenPolicy(); __initTizenAppinfo(); + __initTizenLaunchEffect(); } catch(const std::runtime_error& e) { @@ -109,6 +110,18 @@ bool DSWaylandExtensionPrivate::__initTizenAppinfo(void) return true; } +bool DSWaylandExtensionPrivate::__initTizenLaunchEffect(void) +{ + __tzLaunchEffect = std::make_shared(__compositor); + if (__tzLaunchEffect == nullptr) + { + throw std::runtime_error(__func__); + return false; + } + + return true; +} + DSWaylandExtension::DSWaylandExtension(DSWaylandCompositor *compositor) : DS_INIT_PRIVATE_PTR(DSWaylandExtension) { diff --git a/src/DSWaylandExtension/DSWaylandExtensionPrivate.h b/src/DSWaylandExtension/DSWaylandExtensionPrivate.h index 361082b..2c063d3 100644 --- a/src/DSWaylandExtension/DSWaylandExtensionPrivate.h +++ b/src/DSWaylandExtension/DSWaylandExtensionPrivate.h @@ -30,6 +30,7 @@ namespace display_server class DSWaylandZxdgShellV6; class DSWaylandTizenPolicy; class DSWaylandTizenAppinfo; +class DSWaylandTizenLaunchEffect; class DSWaylandExtensionPrivate : public DSObjectPrivate { @@ -46,12 +47,14 @@ private: bool __initShell(void); bool __initTizenPolicy(void); bool __initTizenAppinfo(void); + bool __initTizenLaunchEffect(void); private: DSWaylandCompositor *__compositor; std::shared_ptr __zxdgShell; std::shared_ptr __tzPolicy; std::shared_ptr __tzAppinfo; + std::shared_ptr __tzLaunchEffect; }; diff --git a/src/DSWaylandServer/DSWaylandTizenLaunchEffect.cpp b/src/DSWaylandServer/DSWaylandTizenLaunchEffect.cpp new file mode 100644 index 0000000..30c78da --- /dev/null +++ b/src/DSWaylandServer/DSWaylandTizenLaunchEffect.cpp @@ -0,0 +1,134 @@ +/* +* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +#include "DSWaylandTizenLaunchEffect.h" +#include "DSWaylandTizenLaunchEffectPrivate.h" +#include "DSWaylandTizenLaunchSplash.h" +#include "DSWaylandClient.h" + +const int TIZEN_LAUNCH_EFFECT_VERSION = 1; + +namespace display_server +{ + +DSWaylandTizenLaunchEffectPrivate::DSWaylandTizenLaunchEffectPrivate(DSWaylandTizenLaunchEffect *p_ptr) + : DSObjectPrivate(p_ptr), + __p_ptr(p_ptr) +{ +} + +DSWaylandTizenLaunchEffectPrivate::~DSWaylandTizenLaunchEffectPrivate() +{ +} + +void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_initialize(DSWaylandCompositor *wlCompositor) +{ + ::wl_display *display; + display = wlCompositor->display(); + + init(display, TIZEN_LAUNCH_EFFECT_VERSION); +} + +void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_finalize(void) +{ + +} + +void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_bind_resource(Resource *resource) +{ + DSLOG_DBG("TizenLaunchEffectPriv", ""); +} +void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_destroy_resource(Resource *resource) +{ + DSLOG_DBG("TizenLaunchEffectPriv", ""); +} +void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_create_splash_img(Resource *resource, uint32_t id) +{ + DSLOG_DBG("TizenLaunchEffectPriv", ""); + + DSWaylandClient *waylandClient = DSWaylandClient::fromWlClient(resource->client()); + auto waylandSplash = std::make_shared(waylandClient, id); +} +void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_type_set(Resource *resource, const std::string &effect_type, uint32_t pid, struct ::wl_array *options) +{ + DSLOG_DBG("TizenLaunchEffectPriv", ""); +} +void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_type_unset(Resource *resource, uint32_t pid) +{ + DSLOG_DBG("TizenLaunchEffectPriv", ""); +} +void DSWaylandTizenLaunchEffectPrivate::tizen_launch_effect_destroy(Resource *resource) +{ + DSLOG_DBG("TizenLaunchEffectPriv", ""); +} + +DSWaylandTizenLaunchEffect::DSWaylandTizenLaunchEffect(DSWaylandCompositor *wlCompositor) + : DS_INIT_PRIVATE_PTR(DSWaylandTizenLaunchEffect), + __wlCompositor(wlCompositor), + __isCreated(false) +{ + this->initialize(__wlCompositor); +} + +DSWaylandTizenLaunchEffect::~DSWaylandTizenLaunchEffect() +{ + if (isCreated()) + this->finalize(); +} + +bool DSWaylandTizenLaunchEffect::isCreated(void) +{ + return __isCreated; +} + +bool DSWaylandTizenLaunchEffect::initialize(DSWaylandCompositor *wlCompositor) +{ + if (!wlCompositor) return false; + if (isCreated()) + { + DSLOG_ERR("TizenLaunchEffect", "Already initialized"); + return true; + } + + DS_GET_PRIV(DSWaylandTizenLaunchEffect); + if (!priv) return false; + + __wlCompositor = wlCompositor; + __isCreated = true; + + priv->tizen_launch_effect_initialize(__wlCompositor); + + DSLOG_INF("TizenLaunchEffect", "TizenLaunchEffect initialized"); + return true; +} + +void DSWaylandTizenLaunchEffect::finalize(void) +{ + DS_GET_PRIV(DSWaylandTizenLaunchEffect); + priv->tizen_launch_effect_finalize(); + + DSLOG_INF("TizenLaunchEffect", "TizenLaunchEffect finalized"); + __isCreated = false; +} + +} \ No newline at end of file diff --git a/src/DSWaylandServer/DSWaylandTizenLaunchEffect.h b/src/DSWaylandServer/DSWaylandTizenLaunchEffect.h new file mode 100644 index 0000000..06a737e --- /dev/null +++ b/src/DSWaylandServer/DSWaylandTizenLaunchEffect.h @@ -0,0 +1,54 @@ +/* +* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +#ifndef __DS_WAYLAND_TIZEN_LAUNCHEFFECT_H__ +#define __DS_WAYLAND_TIZEN_LAUNCHEFFECT_H__ + +#include "DSWaylandCompositor.h" + +namespace display_server +{ + +class DSWaylandTizenLaunchEffectPrivate; + +class DSWaylandTizenLaunchEffect : public DSObject +{ +DS_PIMPL_USE_PRIVATE(DSWaylandTizenLaunchEffect); + +public: + DSWaylandTizenLaunchEffect(DSWaylandCompositor *wlCompositor); + virtual ~DSWaylandTizenLaunchEffect(); + + bool isCreated(void); + + bool initialize(DSWaylandCompositor *wlCompositor); + void finalize(void); + +private: + DSWaylandCompositor *__wlCompositor; + bool __isCreated; + +}; + +} +#endif \ No newline at end of file diff --git a/src/DSWaylandServer/DSWaylandTizenLaunchEffectPrivate.h b/src/DSWaylandServer/DSWaylandTizenLaunchEffectPrivate.h new file mode 100644 index 0000000..3fc6822 --- /dev/null +++ b/src/DSWaylandServer/DSWaylandTizenLaunchEffectPrivate.h @@ -0,0 +1,62 @@ +/* +* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +#ifndef __DS_WAYLAND_TIZEN_LAUNCHEFFECT_PRIVATE_H__ +#define __DS_WAYLAND_TIZEN_LAUNCHEFFECT_PRIVATE_H__ + +#include "dswayland-server-tizen-launch.h" + +#include "DSWaylandTizenLaunchEffect.h" + +namespace display_server +{ + +class DSWaylandTizenLaunchSplash; + +class DS_DECL_EXPORT DSWaylandTizenLaunchEffectPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_launch_effect +{ +DS_PIMPL_USE_PUBLIC(DSWaylandTizenLaunchEffect); + +public: + DSWaylandTizenLaunchEffectPrivate() = delete; + DSWaylandTizenLaunchEffectPrivate(DSWaylandTizenLaunchEffect *p_ptr); + ~DSWaylandTizenLaunchEffectPrivate() override; + + void tizen_launch_effect_initialize(DSWaylandCompositor *wlCompositor); + void tizen_launch_effect_finalize(void); + +protected: + void tizen_launch_effect_bind_resource(Resource *resource); + void tizen_launch_effect_destroy_resource(Resource *resource); + + void tizen_launch_effect_create_splash_img(Resource *resource, uint32_t id); + void tizen_launch_effect_type_set(Resource *resource, const std::string &effect_type, uint32_t pid, struct ::wl_array *options); + void tizen_launch_effect_type_unset(Resource *resource, uint32_t pid); + void tizen_launch_effect_destroy(Resource *resource); + +private: + +}; + +} +#endif \ No newline at end of file diff --git a/src/DSWaylandServer/DSWaylandTizenLaunchSplash.cpp b/src/DSWaylandServer/DSWaylandTizenLaunchSplash.cpp new file mode 100644 index 0000000..b3a734f --- /dev/null +++ b/src/DSWaylandServer/DSWaylandTizenLaunchSplash.cpp @@ -0,0 +1,71 @@ +/* +* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +#include "DSWaylandTizenLaunchSplash.h" +#include "DSWaylandTizenLaunchSplashPrivate.h" + +namespace display_server +{ + +DSWaylandTizenLaunchSplashPrivate::DSWaylandTizenLaunchSplashPrivate(DSWaylandTizenLaunchSplash *p_ptr) + : DSObjectPrivate(p_ptr), + __p_ptr(p_ptr) +{} +DSWaylandTizenLaunchSplashPrivate::DSWaylandTizenLaunchSplashPrivate(DSWaylandTizenLaunchSplash *p_ptr, DSWaylandClient *waylandClient, uint32_t id) + : DSObjectPrivate(p_ptr), + __p_ptr(p_ptr) +{ + if (id > 0) { + tizen_launch_splash::init(waylandClient->wlClient(), (int)id, 1); + } + +} +DSWaylandTizenLaunchSplashPrivate::~DSWaylandTizenLaunchSplashPrivate() +{} + +void DSWaylandTizenLaunchSplashPrivate::tizen_launch_splash_bind_resource(Resource *resource) +{} +void DSWaylandTizenLaunchSplashPrivate::tizen_launch_splash_destroy_resource(Resource *resource) +{} + +void DSWaylandTizenLaunchSplashPrivate::tizen_launch_splash_destroy(Resource *resource) +{} +void DSWaylandTizenLaunchSplashPrivate::tizen_launch_splash_launch(Resource *resource, const std::string &file, uint32_t file_type, uint32_t color_depth, uint32_t rotation, uint32_t indicator, const std::string &effect_type, const std::string &theme_type, struct ::wl_array *options) +{} +void DSWaylandTizenLaunchSplashPrivate::tizen_launch_splash_owner(Resource *resource, uint32_t pid) +{} +void DSWaylandTizenLaunchSplashPrivate::tizen_launch_splash_launch_v2(Resource *resource, const std::string &file, uint32_t file_type, uint32_t color_depth, uint32_t rotation, uint32_t indicator, const std::string &effect_type, const std::string &theme_type, struct ::wl_array *options, struct ::wl_array *extra_config) +{} + +DSWaylandTizenLaunchSplash::DSWaylandTizenLaunchSplash() +{} + +DSWaylandTizenLaunchSplash::DSWaylandTizenLaunchSplash(DSWaylandClient *waylandClient, uint32_t id) + : _d_ptr(std::make_unique(this, waylandClient, id)) +{} + +DSWaylandTizenLaunchSplash::~DSWaylandTizenLaunchSplash() +{} + + +} \ No newline at end of file diff --git a/src/DSWaylandServer/DSWaylandTizenLaunchSplash.h b/src/DSWaylandServer/DSWaylandTizenLaunchSplash.h new file mode 100644 index 0000000..3543562 --- /dev/null +++ b/src/DSWaylandServer/DSWaylandTizenLaunchSplash.h @@ -0,0 +1,48 @@ +/* +* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +#ifndef __DS_WAYLAND_TIZEN_LAUNCHSPLASH_H__ +#define __DS_WAYLAND_TIZEN_LAUNCHSPLASH_H__ + +#include "DSWaylandClient.h" + +namespace display_server +{ + +class DSWaylandTizenLaunchSplashPrivate; + +class DSWaylandTizenLaunchSplash : public DSObject +{ +DS_PIMPL_USE_PRIVATE(DSWaylandTizenLaunchSplash); + +public: + DSWaylandTizenLaunchSplash(); + DSWaylandTizenLaunchSplash(DSWaylandClient *waylandClient, uint32_t id); + virtual ~DSWaylandTizenLaunchSplash(); + +private: + +}; + +} +#endif diff --git a/src/DSWaylandServer/DSWaylandTizenLaunchSplashPrivate.h b/src/DSWaylandServer/DSWaylandTizenLaunchSplashPrivate.h new file mode 100644 index 0000000..f911d7a --- /dev/null +++ b/src/DSWaylandServer/DSWaylandTizenLaunchSplashPrivate.h @@ -0,0 +1,60 @@ +/* +* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +#ifndef __DS_WAYLAND_TIZEN_LAUNCHSPLASH_PRIVATE_H__ +#define __DS_WAYLAND_TIZEN_LAUNCHSPLASH_PRIVATE_H__ + +#include "dswayland-server-tizen-launch.h" + +#include "DSWaylandTizenLaunchSplash.h" + +namespace display_server +{ + +class DSWaylandTizenLaunchSplash; + +class DS_DECL_EXPORT DSWaylandTizenLaunchSplashPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_launch_splash +{ +DS_PIMPL_USE_PUBLIC(DSWaylandTizenLaunchSplash); + +public: + DSWaylandTizenLaunchSplashPrivate() = delete; + DSWaylandTizenLaunchSplashPrivate(DSWaylandTizenLaunchSplash *p_ptr); + DSWaylandTizenLaunchSplashPrivate(DSWaylandTizenLaunchSplash *p_ptr, DSWaylandClient *waylandClient, uint32_t id); + ~DSWaylandTizenLaunchSplashPrivate() override; + +protected: + void tizen_launch_splash_bind_resource(Resource *resource); + void tizen_launch_splash_destroy_resource(Resource *resource); + + void tizen_launch_splash_destroy(Resource *resource); + void tizen_launch_splash_launch(Resource *resource, const std::string &file, uint32_t file_type, uint32_t color_depth, uint32_t rotation, uint32_t indicator, const std::string &effect_type, const std::string &theme_type, struct ::wl_array *options); + void tizen_launch_splash_owner(Resource *resource, uint32_t pid); + void tizen_launch_splash_launch_v2(Resource *resource, const std::string &file, uint32_t file_type, uint32_t color_depth, uint32_t rotation, uint32_t indicator, const std::string &effect_type, const std::string &theme_type, struct ::wl_array *options, struct ::wl_array *extra_config); + +private: + +}; + +} +#endif \ No newline at end of file diff --git a/src/meson.build b/src/meson.build index 6b988da..d84f3d2 100644 --- a/src/meson.build +++ b/src/meson.build @@ -165,6 +165,12 @@ libds_wayland_srcs = [ 'DSWaylandServer/DSWaylandTizenAppinfoPrivate.h', 'DSWaylandServer/DSWaylandTizenAppinfo.h', 'DSWaylandServer/DSWaylandTizenAppinfo.cpp', + 'DSWaylandServer/DSWaylandTizenLaunchEffectPrivate.h', + 'DSWaylandServer/DSWaylandTizenLaunchEffect.h', + 'DSWaylandServer/DSWaylandTizenLaunchEffect.cpp', + 'DSWaylandServer/DSWaylandTizenLaunchSplashPrivate.h', + 'DSWaylandServer/DSWaylandTizenLaunchSplash.h', + 'DSWaylandServer/DSWaylandTizenLaunchSplash.cpp', 'DSWaylandServer/DSWaylandProtocolTracePrivate.h', 'DSWaylandServer/DSWaylandProtocolTrace.h', 'DSWaylandServer/DSWaylandProtocolTrace.cpp', diff --git a/tests/DSWaylandTizenLaunchEffect-test.cpp b/tests/DSWaylandTizenLaunchEffect-test.cpp new file mode 100644 index 0000000..6a1eecd --- /dev/null +++ b/tests/DSWaylandTizenLaunchEffect-test.cpp @@ -0,0 +1,64 @@ +/* +* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +#include "libds-tests.h" +#include "DSWaylandTizenLaunchEffect.h" + +using namespace display_server; + +class DSWaylandTizenLaunchEffectTest : public ::testing::Test +{ +public: + void SetUp(void) override + {} + void TearDown(void) override + {} +}; + +TEST_F(DSWaylandTizenLaunchEffectTest, New_LaunchEffect) +{ + DSWaylandCompositor *compositor = DSWaylandCompositor::getInstance(); + DSWaylandTizenLaunchEffect *tzLaunchEffect = new DSWaylandTizenLaunchEffect(compositor); + EXPECT_TRUE(tzLaunchEffect != nullptr); + + if (tzLaunchEffect) + delete tzLaunchEffect; + + DSWaylandCompositor::releaseInstance(); +} + +TEST_F(DSWaylandTizenLaunchEffectTest, Initialize_LaunchEffect) +{ + bool ret; + + DSWaylandCompositor *compositor = DSWaylandCompositor::getInstance(); + DSWaylandTizenLaunchEffect *tzLaunchEffect = new DSWaylandTizenLaunchEffect(compositor); + + ret = tzLaunchEffect->initialize(compositor); + EXPECT_TRUE(ret == true); + + if (tzLaunchEffect) + delete tzLaunchEffect; + + DSWaylandCompositor::releaseInstance(); +} \ No newline at end of file diff --git a/tests/meson.build b/tests/meson.build index cab5ea3..f790065 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -30,6 +30,7 @@ libds_tests_srcs = [ 'DSWaylandTizenSurface-test.cpp', 'DSWaylandTizenIndicator-test.cpp', 'DSWaylandTizenAppinfo-test.cpp', + 'DSWaylandTizenLaunchEffect-test.cpp', 'DSWaylandZxdgShellV6-test.cpp', 'DSWaylandBuffer-test.cpp', 'DSObject-test.cpp', -- 2.7.4 From c02687aa766483b9b4f3efd5d89269d43674b057 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Tue, 25 Aug 2020 17:33:31 +0900 Subject: [PATCH 15/16] DSWaylandTizenSurface: implementation Tizen Surface protocol Change-Id: I94eff8b11a74f6406d00118609c128edf6cde769 Signed-off-by: Junkyeong Kim --- src/DSWaylandServer/DSWaylandTizenSurface.cpp | 102 +++++++++++++++++++-- src/DSWaylandServer/DSWaylandTizenSurface.h | 25 +++-- src/DSWaylandServer/DSWaylandTizenSurfacePrivate.h | 36 ++++---- tests/DSWaylandTizenSurface-test.cpp | 14 +-- 4 files changed, 132 insertions(+), 45 deletions(-) diff --git a/src/DSWaylandServer/DSWaylandTizenSurface.cpp b/src/DSWaylandServer/DSWaylandTizenSurface.cpp index a9df7fc..d81d933 100644 --- a/src/DSWaylandServer/DSWaylandTizenSurface.cpp +++ b/src/DSWaylandServer/DSWaylandTizenSurface.cpp @@ -28,26 +28,56 @@ namespace display_server { /* DSWaylandTizenSurfaceShm */ -DSWaylandTizenSurfaceShmPrivate::DSWaylandTizenSurfaceShmPrivate(DSWaylandTizenSurfaceShm *p_ptr) +DSWaylandTizenSurfaceShmPrivate::DSWaylandTizenSurfaceShmPrivate(DSWaylandTizenSurfaceShm *p_ptr, DSWaylandCompositor *compositor) : DSObjectPrivate(p_ptr), - __p_ptr(p_ptr) + __p_ptr(p_ptr), + __shmFlusher(nullptr) { + if (!compositor) + return; + + tizen_surface_shm::init(compositor->display(), 2); } DSWaylandTizenSurfaceShmPrivate::~DSWaylandTizenSurfaceShmPrivate() { + if (__shmFlusher != nullptr) + { + delete __shmFlusher; + __shmFlusher = nullptr; + } } void DSWaylandTizenSurfaceShmPrivate::tizen_surface_shm_get_flusher(tizen_surface_shm::Resource *resource, uint32_t id, struct ::wl_resource *surface) { + if (__shmFlusher != nullptr) + { + if (__shmFlusher->getShmFlusherSurface() == surface) + { + DSLOG_ERR("DSWaylandShm", "cannot get shmflusher with same surface."); + return; + } + else + { + DSLOG_INF("DSWaylandShm", "delete previous shmflusher."); + delete __shmFlusher; + } + } + + __shmFlusher = new DSWaylandTizenSurfaceShmFlusher(resource->client(), id, surface); } void DSWaylandTizenSurfaceShmPrivate::tizen_surface_shm_destroy(tizen_surface_shm::Resource *resource) { + if (__shmFlusher != nullptr) + { + delete __shmFlusher; + __shmFlusher = nullptr; + } } -DSWaylandTizenSurfaceShm::DSWaylandTizenSurfaceShm() - : DS_INIT_PRIVATE_PTR(DSWaylandTizenSurfaceShm) +DSWaylandTizenSurfaceShm::DSWaylandTizenSurfaceShm(DSWaylandCompositor *compositor) + : _d_ptr(std::make_unique(this, compositor)) { } @@ -55,23 +85,53 @@ DSWaylandTizenSurfaceShm::~DSWaylandTizenSurfaceShm() { } +DSWaylandTizenSurfaceShmFlusher *DSWaylandTizenSurfaceShm::getShmFlusher(DSWaylandTizenSurfaceShm *TizenSurfaceShm) +{ + DS_GET_PRIV(DSWaylandTizenSurfaceShm); + + return priv->__shmFlusher; +} + + /* DSWaylandTizenSurfaceShmFlusher */ -DSWaylandTizenSurfaceShmFlusherPrivate::DSWaylandTizenSurfaceShmFlusherPrivate(DSWaylandTizenSurfaceShmFlusher *p_ptr) +DSWaylandTizenSurfaceShmFlusherPrivate::DSWaylandTizenSurfaceShmFlusherPrivate(DSWaylandTizenSurfaceShmFlusher *p_ptr, struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface) : DSObjectPrivate(p_ptr), - __p_ptr(p_ptr) + __p_ptr(p_ptr), + __surface(nullptr) { + init(client, id, 2); + __surface = surface; } DSWaylandTizenSurfaceShmFlusherPrivate::~DSWaylandTizenSurfaceShmFlusherPrivate() { } +void DSWaylandTizenSurfaceShmFlusherPrivate::tizen_surface_shm_flusher_bind_resource(Resource *resource) +{ +} + void DSWaylandTizenSurfaceShmFlusherPrivate::tizen_surface_shm_flusher_destroy(Resource *resource) { } -DSWaylandTizenSurfaceShmFlusher::DSWaylandTizenSurfaceShmFlusher() - : DS_INIT_PRIVATE_PTR(DSWaylandTizenSurfaceShmFlusher) +void DSWaylandTizenSurfaceShmFlusherPrivate::sendShmFlusherFlush(void) +{ + send_flush(); +} + +void DSWaylandTizenSurfaceShmFlusherPrivate::sendShmFlusherFreeFlush(void) +{ + send_free_flush(); +} + +struct ::wl_resource *DSWaylandTizenSurfaceShmFlusherPrivate::getShmFlusherSurface(void) +{ + return __surface; +} + +DSWaylandTizenSurfaceShmFlusher::DSWaylandTizenSurfaceShmFlusher(struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface) + : _d_ptr(std::make_unique(this, client, id, surface)) { } @@ -79,5 +139,29 @@ DSWaylandTizenSurfaceShmFlusher::~DSWaylandTizenSurfaceShmFlusher() { } -} // namespace display_server +void DSWaylandTizenSurfaceShmFlusher::sendShmFlusherFlush(void) +{ + DS_GET_PRIV(DSWaylandTizenSurfaceShmFlusher); + + DSLOG_INF("DSWaylandShmFlusher", "sendShmFlusherFlush"); + + priv->sendShmFlusherFlush(); +} + +void DSWaylandTizenSurfaceShmFlusher::sendShmFlusherFreeFlush(void) +{ + DS_GET_PRIV(DSWaylandTizenSurfaceShmFlusher); + DSLOG_INF("DSWaylandShmFlusher", "sendShmFlusherFreeFlush"); + + priv->sendShmFlusherFreeFlush(); +} + +struct ::wl_resource *DSWaylandTizenSurfaceShmFlusher::getShmFlusherSurface(void) +{ + DS_GET_PRIV(DSWaylandTizenSurfaceShmFlusher); + + return priv->getShmFlusherSurface(); +} + +} // namespace display_server diff --git a/src/DSWaylandServer/DSWaylandTizenSurface.h b/src/DSWaylandServer/DSWaylandTizenSurface.h index b36fa00..b46068c 100644 --- a/src/DSWaylandServer/DSWaylandTizenSurface.h +++ b/src/DSWaylandServer/DSWaylandTizenSurface.h @@ -26,6 +26,8 @@ #include #include +#include +#include namespace display_server { @@ -33,25 +35,30 @@ namespace display_server class DSWaylandTizenSurfaceShmPrivate; class DSWaylandTizenSurfaceShmFlusherPrivate; -class DS_DECL_EXPORT DSWaylandTizenSurfaceShm : public DSObject +class DS_DECL_EXPORT DSWaylandTizenSurfaceShmFlusher : public DSObject { -DS_PIMPL_USE_PRIVATE(DSWaylandTizenSurfaceShm); +DS_PIMPL_USE_PRIVATE(DSWaylandTizenSurfaceShmFlusher); public: - DSWaylandTizenSurfaceShm(); - virtual ~DSWaylandTizenSurfaceShm(); + DSWaylandTizenSurfaceShmFlusher(struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface); + virtual ~DSWaylandTizenSurfaceShmFlusher(); + + void sendShmFlusherFlush(void); + void sendShmFlusherFreeFlush(void); + struct ::wl_resource *getShmFlusherSurface(void); }; -class DS_DECL_EXPORT DSWaylandTizenSurfaceShmFlusher : public DSObject +class DS_DECL_EXPORT DSWaylandTizenSurfaceShm : public DSObject { -DS_PIMPL_USE_PRIVATE(DSWaylandTizenSurfaceShmFlusher); +DS_PIMPL_USE_PRIVATE(DSWaylandTizenSurfaceShm); public: - DSWaylandTizenSurfaceShmFlusher(); - virtual ~DSWaylandTizenSurfaceShmFlusher(); + DSWaylandTizenSurfaceShm(DSWaylandCompositor *compositor); + virtual ~DSWaylandTizenSurfaceShm(); + + DSWaylandTizenSurfaceShmFlusher *getShmFlusher(DSWaylandTizenSurfaceShm *TizenSurfaceShm); }; } #endif - diff --git a/src/DSWaylandServer/DSWaylandTizenSurfacePrivate.h b/src/DSWaylandServer/DSWaylandTizenSurfacePrivate.h index 805f0f2..90a184e 100644 --- a/src/DSWaylandServer/DSWaylandTizenSurfacePrivate.h +++ b/src/DSWaylandServer/DSWaylandTizenSurfacePrivate.h @@ -30,38 +30,42 @@ namespace display_server { -class DS_DECL_EXPORT DSWaylandTizenSurfaceShmPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_surface_shm +class DS_DECL_EXPORT DSWaylandTizenSurfaceShmFlusherPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_surface_shm_flusher { -DS_PIMPL_USE_PUBLIC(DSWaylandTizenSurfaceShm); +DS_PIMPL_USE_PUBLIC(DSWaylandTizenSurfaceShmFlusher); public: - DSWaylandTizenSurfaceShmPrivate() = delete; - DSWaylandTizenSurfaceShmPrivate(DSWaylandTizenSurfaceShm *p_ptr); - ~DSWaylandTizenSurfaceShmPrivate() override; + DSWaylandTizenSurfaceShmFlusherPrivate() = delete; + DSWaylandTizenSurfaceShmFlusherPrivate(DSWaylandTizenSurfaceShmFlusher *p_ptr, struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface); + ~DSWaylandTizenSurfaceShmFlusherPrivate() override; + + void sendShmFlusherFlush(void); + void sendShmFlusherFreeFlush(void); + struct ::wl_resource *getShmFlusherSurface(void); protected: - void tizen_surface_shm_get_flusher(Resource *resource, uint32_t id, struct ::wl_resource *surface) override; - void tizen_surface_shm_destroy(Resource *resource) override; + void tizen_surface_shm_flusher_bind_resource(Resource *resource) override; + void tizen_surface_shm_flusher_destroy(Resource *resource) override; private: - /* data */ + struct ::wl_resource *__surface; }; -class DS_DECL_EXPORT DSWaylandTizenSurfaceShmFlusherPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_surface_shm_flusher +class DS_DECL_EXPORT DSWaylandTizenSurfaceShmPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_surface_shm { -DS_PIMPL_USE_PUBLIC(DSWaylandTizenSurfaceShmFlusher); +DS_PIMPL_USE_PUBLIC(DSWaylandTizenSurfaceShm); public: - DSWaylandTizenSurfaceShmFlusherPrivate() = delete; - DSWaylandTizenSurfaceShmFlusherPrivate(DSWaylandTizenSurfaceShmFlusher *p_ptr); - ~DSWaylandTizenSurfaceShmFlusherPrivate() override; + DSWaylandTizenSurfaceShmPrivate() = delete; + DSWaylandTizenSurfaceShmPrivate(DSWaylandTizenSurfaceShm *p_ptr, DSWaylandCompositor *compositor); + ~DSWaylandTizenSurfaceShmPrivate() override; protected: - void tizen_surface_shm_flusher_destroy(Resource *resource) override; + void tizen_surface_shm_get_flusher(Resource *resource, uint32_t id, struct ::wl_resource *surface) override; + void tizen_surface_shm_destroy(Resource *resource) override; private: - /* data */ + DSWaylandTizenSurfaceShmFlusher *__shmFlusher; }; } #endif - diff --git a/tests/DSWaylandTizenSurface-test.cpp b/tests/DSWaylandTizenSurface-test.cpp index bb988a6..68cf4a3 100644 --- a/tests/DSWaylandTizenSurface-test.cpp +++ b/tests/DSWaylandTizenSurface-test.cpp @@ -37,19 +37,11 @@ public: TEST_F(DSWaylandTizenSurfaceTest, NewDSWaylandTizenSurfaceShm) { - DSWaylandTizenSurfaceShm *shm = new DSWaylandTizenSurfaceShm; + DSWaylandCompositor *comp = DSWaylandCompositor::getInstance(); + DSWaylandTizenSurfaceShm *shm = new DSWaylandTizenSurfaceShm(comp); EXPECT_TRUE(shm != nullptr); if (shm) delete shm; + DSWaylandCompositor::releaseInstance(); } - -TEST_F(DSWaylandTizenSurfaceTest, NewDSWaylandTizenSurfaceShmFlusher) -{ - DSWaylandTizenSurfaceShmFlusher *shmFlusher = new DSWaylandTizenSurfaceShmFlusher; - EXPECT_TRUE(shmFlusher != nullptr); - - if (shmFlusher) - delete shmFlusher; -} - -- 2.7.4 From 0e20ddeb2352a1dd7f56da15531b0763f5d53b54 Mon Sep 17 00:00:00 2001 From: jeon Date: Tue, 25 Aug 2020 16:52:37 +0900 Subject: [PATCH 16/16] DSTextInput: add a API to get InputPanel's geometry Change-Id: If38af6096bc355d2540385ecb508ab39148eba78 --- src/DSTextInput/DSTextInput.cpp | 5 ++++ src/DSTextInput/DSTextInputPrivate.h | 2 ++ src/DSWaylandServer/DSWaylandInputMethod.cpp | 6 ++++- src/DSWaylandServer/DSWaylandInputPanel.cpp | 27 ++++++++++++++++++++++ src/DSWaylandServer/DSWaylandInputPanel.h | 2 ++ src/DSWaylandServer/DSWaylandInputPanelSurface.h | 2 ++ .../DSWaylandInputPanelSurfacePrivate.h | 2 ++ tests/DSWaylandInputPanel-test.cpp | 12 ++++++++++ tests/DSWaylandInputPanelSurface-test.cpp | 14 +++++++++++ 9 files changed, 71 insertions(+), 1 deletion(-) diff --git a/src/DSTextInput/DSTextInput.cpp b/src/DSTextInput/DSTextInput.cpp index 59d5c73..ada2e08 100644 --- a/src/DSTextInput/DSTextInput.cpp +++ b/src/DSTextInput/DSTextInput.cpp @@ -290,6 +290,11 @@ void DSTextInputPrivate::changeInputPanelVisibility(bool visible) __wlInputPanel->changeVisibility(visible); } +stGeometry DSTextInputPrivate::inputPanelGetGeometry(DSWaylandSurface *window) +{ + return __wlInputPanel->getSurfaceGeometry(window); +} + DSTextInput::DSTextInput() : DS_INIT_PRIVATE_PTR(DSTextInput) diff --git a/src/DSTextInput/DSTextInputPrivate.h b/src/DSTextInput/DSTextInputPrivate.h index c187846..6796183 100644 --- a/src/DSTextInput/DSTextInputPrivate.h +++ b/src/DSTextInput/DSTextInputPrivate.h @@ -26,6 +26,7 @@ #include #include +#include namespace display_server { @@ -109,6 +110,7 @@ public: void updateInputPanelState(bool waitUpdate); void setInputPanelTransientFor(DSWaylandSurface *window); void changeInputPanelVisibility(bool visible); + stGeometry inputPanelGetGeometry(DSWaylandSurface *window); private: DSWaylandCompositor *__wlCompositor; diff --git a/src/DSWaylandServer/DSWaylandInputMethod.cpp b/src/DSWaylandServer/DSWaylandInputMethod.cpp index fc79bf1..59a2f7f 100644 --- a/src/DSWaylandServer/DSWaylandInputMethod.cpp +++ b/src/DSWaylandServer/DSWaylandInputMethod.cpp @@ -895,7 +895,11 @@ void DSWaylandInputMethod::contextUpdateCandidateState(unsigned int state) { __dsTextInputPrivate->contextShowInputPanel(); int x = 0, y = 0, w = 0, h = 0; - /* TODO: get gemetry from input panel */ + stGeometry geometry = __dsTextInputPrivate->inputPanelGetGeometry(nullptr); + x = geometry.x; + y = geometry.y; + w = geometry.w; + h = geometry.h; __dsTextInputPrivate->contextUpdateIseGeometry(x, y, w, h); } } diff --git a/src/DSWaylandServer/DSWaylandInputPanel.cpp b/src/DSWaylandServer/DSWaylandInputPanel.cpp index 82e2570..512130f 100644 --- a/src/DSWaylandServer/DSWaylandInputPanel.cpp +++ b/src/DSWaylandServer/DSWaylandInputPanel.cpp @@ -244,6 +244,11 @@ DSWaylandInputPanelFloating* DSWaylandInputPanel::getFloatingData() return __inputPanelFloating; } +stGeometry DSWaylandInputPanel::getSurfaceGeometry(DSWaylandSurface *wlSurface) +{ + return __inputPanelSurface->getGeometry(wlSurface); +} + void DSWaylandInputPanel::__onEventIdleEnterer(void *data) { } @@ -452,6 +457,22 @@ void DSWaylandInputPanelSurfacePrivate::setFloatingPosition(int x, int y) #endif } +stGeometry DSWaylandInputPanelSurfacePrivate::getGeometry(DSWaylandSurface *wlSurface) +{ + DSWindowManager *windowManager = DSWindowManager::getInstance(); + stGeometry geometry = {0, }; + for (auto it = __dataMap.begin(); it != __dataMap.end(); it++) + { + DSWaylandInputPanelSurfaceData *surfaceData = (*it).second; + if (!wlSurface || (wlSurface == surfaceData->getWlSurface())) + { + return windowManager->getWindowGeometry(surfaceData->getWlSurface()); + } + } + windowManager->releaseInstance(); + return geometry; +} + void DSWaylandInputPanelSurfacePrivate::input_panel_surface_destroy_resource(Resource *resource) { auto it = __dataMap.find(resource); @@ -610,6 +631,12 @@ void DSWaylandInputPanelSurface::setFloatingPosition(int x, int y) priv->setFloatingPosition(x, y); } +stGeometry DSWaylandInputPanelSurface::getGeometry(DSWaylandSurface *wlSurface) +{ + DS_GET_PRIV(DSWaylandInputPanelSurface); + + return priv->getGeometry(wlSurface); +} } diff --git a/src/DSWaylandServer/DSWaylandInputPanel.h b/src/DSWaylandServer/DSWaylandInputPanel.h index ab2f8bb..b2a81d0 100644 --- a/src/DSWaylandServer/DSWaylandInputPanel.h +++ b/src/DSWaylandServer/DSWaylandInputPanel.h @@ -26,6 +26,7 @@ #include "DSCore.h" #include "DSObject.h" +#include "DSStruct.h" #include "DSWaylandCompositor.h" #include "DSEventLoop.h" #include "DSTextInputPrivate.h" @@ -60,6 +61,7 @@ public: bool isEffectRunning(DSWaylandSurface *window); void setFloatingPosition(int x, int y); DSWaylandInputPanelFloating *getFloatingData(); + stGeometry getSurfaceGeometry(DSWaylandSurface *wlSurface); private: DSWaylandCompositor *__compositor; diff --git a/src/DSWaylandServer/DSWaylandInputPanelSurface.h b/src/DSWaylandServer/DSWaylandInputPanelSurface.h index becea30..ca90872 100644 --- a/src/DSWaylandServer/DSWaylandInputPanelSurface.h +++ b/src/DSWaylandServer/DSWaylandInputPanelSurface.h @@ -26,6 +26,7 @@ #include "DSCore.h" #include "DSObject.h" +#include "DSStruct.h" #include "DSWaylandInputPanel.h" namespace display_server @@ -49,6 +50,7 @@ public: bool isEffectRunning(DSWaylandSurface *window); void setPosition(DSWaylandSurface *window, int width, int height); void setFloatingPosition(int x, int y); + stGeometry getGeometry(DSWaylandSurface *wlSurface); protected: diff --git a/src/DSWaylandServer/DSWaylandInputPanelSurfacePrivate.h b/src/DSWaylandServer/DSWaylandInputPanelSurfacePrivate.h index 03300df..6644229 100644 --- a/src/DSWaylandServer/DSWaylandInputPanelSurfacePrivate.h +++ b/src/DSWaylandServer/DSWaylandInputPanelSurfacePrivate.h @@ -28,6 +28,7 @@ #include "DSCore.h" #include "DSObjectPrivate.h" +#include "DSStruct.h" #include "DSWaylandInputPanelSurface.h" namespace display_server @@ -51,6 +52,7 @@ public: void setTransientForSurface(DSWaylandSurface *parent); void updateSurfaceVisibility(bool visible); void setFloatingPosition(int x, int y); + stGeometry getGeometry(DSWaylandSurface *wlSurface); protected: void input_panel_surface_destroy_resource(Resource *resource); diff --git a/tests/DSWaylandInputPanel-test.cpp b/tests/DSWaylandInputPanel-test.cpp index 85f9778..3e369b7 100644 --- a/tests/DSWaylandInputPanel-test.cpp +++ b/tests/DSWaylandInputPanel-test.cpp @@ -180,3 +180,15 @@ TEST_F(DSWaylandInputPanelTest, GetFloatingData) DSWaylandCompositor::releaseInstance(); } +TEST_F(DSWaylandInputPanelTest, GetSurfaceGeometry) +{ + DSWaylandCompositor *comp = DSWaylandCompositor::getInstance(); + DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp); + EXPECT_TRUE(inputPanel != nullptr); + + inputPanel->getSurfaceGeometry(nullptr); + + delete inputPanel; + DSWaylandCompositor::releaseInstance(); +} + diff --git a/tests/DSWaylandInputPanelSurface-test.cpp b/tests/DSWaylandInputPanelSurface-test.cpp index 763a8e1..c6ee3e1 100644 --- a/tests/DSWaylandInputPanelSurface-test.cpp +++ b/tests/DSWaylandInputPanelSurface-test.cpp @@ -151,3 +151,17 @@ TEST_F(DSWaylandInputPanelSurfaceTest, SetFloatingPosition) DSWaylandCompositor::releaseInstance(); } +TEST_F(DSWaylandInputPanelSurfaceTest, GetGeometry) +{ + DSWaylandCompositor *comp = DSWaylandCompositor::getInstance(); + DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(comp); + DSWaylandInputPanelSurface *inputPanelSurface = new DSWaylandInputPanelSurface(comp, inputPanel); + EXPECT_TRUE(inputPanelSurface != nullptr); + + inputPanelSurface->getGeometry(nullptr); + + delete inputPanelSurface; + delete inputPanel; + DSWaylandCompositor::releaseInstance(); +} + -- 2.7.4