From: Doyoun Kang Date: Thu, 13 Aug 2020 03:44:22 +0000 (+0900) Subject: DSWindow: add API for set/get DSWindowShell X-Git-Tag: accepted/tizen/unified/20200820.213435~71 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=78b86d4c4a91439d5947e2c302c26df26fdfc73f;p=platform%2Fcore%2Fuifw%2Flibds.git DSWindow: add API for set/get DSWindowShell Change-Id: Ie8fd7437694604fce63c28e36df5c344ed3e3a41 --- diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index 3b55f25..4ae3746 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -36,7 +36,8 @@ DSWindowPrivate::DSWindowPrivate(DSWindow *p_ptr) __h(1), __created(false), __hasFocus(false), - __waylandSurface(nullptr) + __waylandSurface(nullptr), + __winShell(nullptr) { } @@ -98,6 +99,23 @@ bool DSWindowPrivate::isCreated() return __created; } +bool DSWindowPrivate::setWindowShell(DSWindowShell *winShell) +{ + if (__winShell) + { + DSLOG_ERR("DSWindow", "Already exist DSWindowShell..."); + return false; + } + + __winShell = winShell; + return true; +} + +DSWindowShell *DSWindowPrivate::getWindowShell(void) +{ + return __winShell; +} + void DSWindowPrivate::__onSurfaceCommitted(std::shared_ptr waylandSurfaceCommitInfo) { DS_GET_PUB(DSWindow); @@ -242,6 +260,19 @@ DSWaylandSurface *DSWindow::surface() return priv->__waylandSurface.get(); } + +bool DSWindow::setWindowShell(DSWindowShell *winShell) +{ + DS_GET_PRIV(DSWindow); + return priv->setWindowShell(winShell); +} + +DSWindowShell *DSWindow::getWindowShell(void) +{ + DS_GET_PRIV(DSWindow); + return priv->getWindowShell(); +} + void DSWindow::registerCallbackSizeChanged(DSObject *slot, std::function)> func) { __sizeChangedSignal.connect(slot, func); diff --git a/src/DSWindow/DSWindow.h b/src/DSWindow/DSWindow.h index ec89151..e7ff5d7 100644 --- a/src/DSWindow/DSWindow.h +++ b/src/DSWindow/DSWindow.h @@ -29,6 +29,7 @@ #include "DSObject.h" #include "DSSignal.h" #include "IDSBuffer.h" +#include "DSWindowShell.h" namespace display_server { @@ -65,6 +66,9 @@ public: DSWaylandSurface *surface(); + bool setWindowShell(DSWindowShell *winShell); + DSWindowShell *getWindowShell(void); + void registerCallbackSizeChanged(DSObject *slot, std::function)> func); void registerCallbackBufferChanged(DSObject *slot, std::function)> func); diff --git a/src/DSWindow/DSWindowPrivate.h b/src/DSWindow/DSWindowPrivate.h index f29dc14..c19592f 100644 --- a/src/DSWindow/DSWindowPrivate.h +++ b/src/DSWindow/DSWindowPrivate.h @@ -27,6 +27,7 @@ #include "DSCore.h" #include "DSObjectPrivate.h" #include "DSWaylandSurface.h" +#include "DSWindowShell.h" namespace display_server { @@ -56,6 +57,9 @@ public: bool setFocus(void); bool isCreated(); + bool setWindowShell(DSWindowShell *winShell); + DSWindowShell *getWindowShell(void); + private: void __onSurfaceCommitted(std::shared_ptr waylandSurfaceCommitInfo); @@ -64,6 +68,7 @@ private: bool __created; bool __hasFocus; std::shared_ptr __waylandSurface; + DSWindowShell *__winShell; }; } diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index 2970658..9cce347 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -103,6 +103,9 @@ void DSZone::__onSurfaceCreated(std::shared_ptr waylandSurface // create DSWindowShell std::shared_ptr shell = __createWindowShell(window); + + // set DSWindowShell to DSWindow + window->setWindowShell(shell.get()); } void DSZone::__onShellSurfaceCreated(IDSWaylandShellSurface *waylandShellSurface) diff --git a/tests/DSWindow-test.cpp b/tests/DSWindow-test.cpp index 971aeea..f8e16ae 100644 --- a/tests/DSWindow-test.cpp +++ b/tests/DSWindow-test.cpp @@ -24,6 +24,7 @@ #include "libds-tests.h" #include "DSObject.h" #include "DSWindow.h" +#include "DSWindowShell.h" #include "DSStruct.h" using namespace display_server; @@ -86,3 +87,18 @@ TEST_F(DSWindowTest, BasicMethods) EXPECT_TRUE(win->setFocus() == true); EXPECT_TRUE(win->hasFocus() == true); } + +TEST_F(DSWindowTest, WindowShellTest) +{ + auto win = new DSWindow(); + EXPECT_TRUE(win != nullptr); + + auto winShell = new DSWindowShell(win); + EXPECT_TRUE(winShell != nullptr); + + EXPECT_TRUE(win->setWindowShell(winShell) == true); + + DSWindowShell *getWinShell = nullptr; + getWinShell = win->getWindowShell(); + EXPECT_TRUE(winShell == getWinShell); +} \ No newline at end of file