From a81d42ed6b4bb8603836dfc442b6f3fb199bcb6f Mon Sep 17 00:00:00 2001 From: Sung-Jin Park Date: Mon, 27 Jul 2020 19:53:29 +0900 Subject: [PATCH 01/16] DSWindow: add geometric information, apis and integration DSWindow*.cpp into DSWindow.cpp Change-Id: Ic9be2b9ec07164efa5ffc7e0eb9ad8da4518e326 Signed-off-by: Sung-Jin Park --- src/DSCore/DSStruct.h | 9 +++ src/DSWindow/DSWindow.cpp | 153 +++++++++++++++++++++++++++++++++++++-- src/DSWindow/DSWindow.h | 12 +++ src/DSWindow/DSWindowPrivate.cpp | 82 --------------------- src/DSWindow/DSWindowPrivate.h | 20 ++++- src/meson.build | 3 +- tests/DSWindow-test.cpp | 60 +++++++++++---- 7 files changed, 232 insertions(+), 107 deletions(-) delete mode 100644 src/DSWindow/DSWindowPrivate.cpp diff --git a/src/DSCore/DSStruct.h b/src/DSCore/DSStruct.h index 92f8e39..fb9aa51 100644 --- a/src/DSCore/DSStruct.h +++ b/src/DSCore/DSStruct.h @@ -8,6 +8,7 @@ namespace display_server using stPosition = struct _stPosition; using stRect = struct _stRect; +using stGeometry = struct _stGeometry; struct _stPosition { @@ -23,6 +24,14 @@ struct _stRect uint32_t h; }; +struct _stGeometry +{ + int x; + int y; + unsigned int w; + unsigned int h; +}; + } // namespace display_server #endif //__DS_STRUCT_H__ diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index 5c2b797..52d6eba 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -4,20 +4,129 @@ namespace display_server { +DSWindowPrivate::DSWindowPrivate(DSWindow *p_ptr) + : DSObjectPrivate(p_ptr), + __p_ptr(p_ptr), + __x(0), + __y(0), + __w(1), + __h(1), + __created(false), + __hasFocus(false) +{ +} + +DSWindowPrivate::~DSWindowPrivate() +{ +} + +bool DSWindowPrivate::create(DSWindow *pParent) +{ + // get screen position (x, y) + + // get screen width (w, h) + + __created = __create(__x, __y, __w, __h, pParent); + return __created; +} + +bool DSWindowPrivate::create(int x, int y, unsigned int w, unsigned int h, DSWindow *pParent) +{ + __created = __create(x, y, w, h, pParent); + return __created; +} + +void DSWindowPrivate::destroy(void) +{ +} + +bool DSWindowPrivate::show(void) +{ + return true; +} + +bool DSWindowPrivate::hide(bool autoFocus) +{ + return true; +} + +int DSWindowPrivate::showState(void) +{ + return 0; +} + +bool DSWindowPrivate::setLayer(int layer) +{ + return true; +} + +bool DSWindowPrivate::raise(void) +{ + return true; +} + +bool DSWindowPrivate::lower(void) +{ + return true; +} + +bool DSWindowPrivate::setFocus(void) +{ + return true; +} + +bool DSWindowPrivate::__create(int x, int y, unsigned int w, unsigned int h, DSWindow *pParent) +{ + DS_GET_PUB(DSWindow); + + __x = x; + __y = y; + __w = w; + __h = h; + pub->__parentWindow = pParent; + + // Do something + + return true; +} + +bool DSWindowPrivate::isCreated() +{ + return __created; +} + DSWindow::DSWindow() - : DS_INIT_PRIVATE_PTR(DSWindow) -{} + : DS_INIT_PRIVATE_PTR(DSWindow), + __parentWindow(nullptr) +{ +} + +DSWindow::DSWindow(DSWindow *pParent) + : DS_INIT_PRIVATE_PTR(DSWindow), + __parentWindow(pParent) +{ + create(pParent); +} + +DSWindow::DSWindow(DSWindow *pParent, int x, int y, unsigned int w, unsigned h) + : DS_INIT_PRIVATE_PTR(DSWindow), + __parentWindow(pParent) +{ + create(x, y, w, h, pParent); +} DSWindow::~DSWindow() -{} +{ + +} bool DSWindow::create(DSWindow *pParent) { DS_GET_PRIV(DSWindow); - if (priv->create(this, pParent) == false) + if (!priv->isCreated()) { - return false; + return priv->create(pParent); } return true; @@ -27,9 +136,9 @@ bool DSWindow::create(int x, int y, unsigned int w, unsigned int h, DSWindow *pP { DS_GET_PRIV(DSWindow); - if (priv->create(x, y, w, h, this, pParent) == false) + if (!priv->isCreated()) { - return false; + return priv->create(x, y, w, h, pParent); } return true; @@ -92,5 +201,35 @@ bool DSWindow::setFocus(void) return priv->setFocus(); } +bool DSWindow::hasFocus(void) +{ + DS_GET_PRIV(DSWindow); + + return priv->__hasFocus; +} + +DSWindow *DSWindow::getParent() +{ + return __parentWindow; +} + +void DSWindow::setParent(DSWindow *pParent) +{ + DSLOG_INF("DSWindow", "Parent window has been changed. (%p -> %p)", __parentWindow, pParent); + __parentWindow = pParent; +} + +stGeometry DSWindow::getGeometry() +{ + DS_GET_PRIV(DSWindow); + + stGeometry geom; + geom.x = priv->__x; + geom.y = priv->__y; + geom.w = priv->__w; + geom.h = priv->__h; + + return geom; +} } // namespace display_server \ No newline at end of file diff --git a/src/DSWindow/DSWindow.h b/src/DSWindow/DSWindow.h index cd59a0d..fca506b 100644 --- a/src/DSWindow/DSWindow.h +++ b/src/DSWindow/DSWindow.h @@ -2,6 +2,7 @@ #define _DS_WINDOW_H_ #include "DSCore.h" +#include "DSStruct.h" #include "DSObject.h" namespace display_server @@ -15,6 +16,8 @@ class DSWindow : public DSObject public: explicit DSWindow(); + DSWindow(DSWindow *pParent); + DSWindow(DSWindow *pParent, int x, int y, unsigned int w, unsigned h); virtual ~DSWindow(); bool create(DSWindow *pParent); @@ -31,10 +34,19 @@ public: bool lower(void); bool setFocus(void); + bool hasFocus(void); + + DSWindow *getParent(); + void setParent(DSWindow *pParent); + + stGeometry getGeometry(); protected: //virtual bool _onFocus(void); //virtual bool _onShowStateChange(void); + +private: + DSWindow *__parentWindow; }; } diff --git a/src/DSWindow/DSWindowPrivate.cpp b/src/DSWindow/DSWindowPrivate.cpp deleted file mode 100644 index caa062a..0000000 --- a/src/DSWindow/DSWindowPrivate.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#include "DSWindow.h" -#include "DSWindowPrivate.h" - -namespace display_server -{ - -DSWindowPrivate::DSWindowPrivate(DSWindow *p_ptr) - : DSObjectPrivate(p_ptr), - __p_ptr(p_ptr) -{ -} - -DSWindowPrivate::~DSWindowPrivate() -{ -} - -bool DSWindowPrivate::create(DSWindow *pWin, DSWindow *pParent) -{ - int x = 0; - int y = 0; - unsigned int w = 1; - unsigned int h = 1; - - // get screen position (x, y) - - // get screen width (w, h) - - return __create(x, y, w, h, pWin, pParent); -} - -bool DSWindowPrivate::create(int x, int y, unsigned int w, unsigned int h, DSWindow *pWin, DSWindow *pParent) -{ - return __create(x, y, w, h, pWin, pParent); -} - -void DSWindowPrivate::destroy(void) -{ -} - -bool DSWindowPrivate::show(void) -{ - return true; -} - -bool DSWindowPrivate::hide(bool autoFocus) -{ - return true; -} - -int DSWindowPrivate::showState(void) -{ - return 0; -} - -bool DSWindowPrivate::setLayer(int layer) -{ - return true; -} - -bool DSWindowPrivate::raise(void) -{ - return true; -} - -bool DSWindowPrivate::lower(void) -{ - return true; -} - -bool DSWindowPrivate::setFocus(void) -{ - return true; -} - -bool DSWindowPrivate::__create(int x, int y, unsigned int w, unsigned int h, DSWindow *pWin, DSWindow *pParent) -{ - // Do something - - return true; -} - -} // namespace display_server \ No newline at end of file diff --git a/src/DSWindow/DSWindowPrivate.h b/src/DSWindow/DSWindowPrivate.h index 507cd56..44f284b 100644 --- a/src/DSWindow/DSWindowPrivate.h +++ b/src/DSWindow/DSWindowPrivate.h @@ -1,9 +1,14 @@ #ifndef _DS_WINDOW_PRIVATE_H_ #define _DS_WINDOW_PRIVATE_H_ +#include "DSCore.h" +#include "DSObjectPrivate.h" + namespace display_server { +class DSWindow; + class DSWindowPrivate : public DSObjectPrivate { DS_PIMPL_USE_PUBLIC(DSWindow) @@ -13,8 +18,8 @@ public: DSWindowPrivate(DSWindow *p_ptr); ~DSWindowPrivate(); - bool create(DSWindow *pWin, DSWindow *pParent); - bool create(int x, int y, unsigned int w, unsigned int h, DSWindow *pWin, DSWindow *pParent); + bool create(DSWindow *pParent); + bool create(int x, int y, unsigned int w, unsigned int h, DSWindow *pParent); void destroy(void); @@ -27,10 +32,17 @@ public: bool lower(void); bool setFocus(void); + bool isCreated(); private: - bool __create(int x, int y, unsigned int w, unsigned int h, DSWindow *pWin, DSWindow *pParent); - + bool __create(int x, int y, unsigned int w, unsigned int h, DSWindow *pParent); + + int __x; + int __y; + unsigned int __w; + unsigned int __h; + bool __created; + bool __hasFocus; }; } diff --git a/src/meson.build b/src/meson.build index 4b4b283..24bfcf4 100644 --- a/src/meson.build +++ b/src/meson.build @@ -47,8 +47,9 @@ libds_srcs = [ 'DSSignal/DSSignal.h', 'DSCore/DSStruct.h', 'DSCore/DSCore.h', + 'DSWindow/DSWindow.h', + 'DSWindow/DSWindowPrivate.h', 'DSWindow/DSWindow.cpp', - 'DSWindow/DSWindowPrivate.cpp', 'DSWindowShell/DSWindowShell.cpp', 'DSWindowShell/DSWindowShellPrivate.cpp', 'DSZone/DSZone.cpp', diff --git a/tests/DSWindow-test.cpp b/tests/DSWindow-test.cpp index 07b41fe..9838ca8 100644 --- a/tests/DSWindow-test.cpp +++ b/tests/DSWindow-test.cpp @@ -1,6 +1,7 @@ #include "libds-tests.h" #include "DSObject.h" #include "DSWindow.h" +#include "DSStruct.h" using namespace display_server; @@ -15,26 +16,59 @@ public: TEST_F(DSWindowTest, NewDSWindow) { - std::unique_ptr Window = std::make_unique(); - EXPECT_TRUE(Window != nullptr); + DSWindow *win = new DSWindow(); + EXPECT_TRUE(win != nullptr); +} + +TEST_F(DSWindowTest, NewDSWindowWithParent) +{ + DSWindow *wParent = new DSWindow(); + EXPECT_TRUE(wParent != nullptr); + + DSWindow *wChild = new DSWindow(wParent); + EXPECT_TRUE(wChild != nullptr); +} + +TEST_F(DSWindowTest, NewDSWindowWithGeometry) +{ + int x = 100; + int y = 100; + unsigned int w = 500; + unsigned int h = 500; + + DSWindow *win = new DSWindow(nullptr, x, y, w, h); + EXPECT_TRUE(win != nullptr); + + stGeometry geom = win->getGeometry(); + EXPECT_TRUE(geom.x == x); + EXPECT_TRUE(geom.y == y); + EXPECT_TRUE(geom.w == w); + EXPECT_TRUE(geom.h == h); } TEST_F(DSWindowTest, BasicMethods) { - std::unique_ptr Window = std::make_unique(); - EXPECT_TRUE(Window != nullptr); + bool hasFocus = false; + + DSWindow *win = new DSWindow(); + EXPECT_TRUE(win != nullptr); + EXPECT_TRUE(win->create(0, 0, 720, 1280, nullptr) == true); - EXPECT_TRUE(Window->create(nullptr) == true); - EXPECT_TRUE(Window->create(0, 0, 720, 1280, nullptr) == true); + stGeometry geom = win->getGeometry(); + EXPECT_TRUE(geom.x == 0); + EXPECT_TRUE(geom.y == 0); + EXPECT_TRUE(geom.w == 720); + EXPECT_TRUE(geom.h == 1280); - EXPECT_TRUE(Window->show() == true); - EXPECT_TRUE(Window->hide(true) == true); - EXPECT_TRUE(Window->showState() == 0); + EXPECT_TRUE(win->show() == true); + EXPECT_TRUE(win->hide(true) == true); + EXPECT_TRUE(win->showState() == 0); - EXPECT_TRUE(Window->setLayer(100) == true); + EXPECT_TRUE(win->setLayer(100) == true); - EXPECT_TRUE(Window->raise() == true); - EXPECT_TRUE(Window->lower() == true); + EXPECT_TRUE(win->raise() == true); + EXPECT_TRUE(win->lower() == true); - EXPECT_TRUE(Window->setFocus() == true); + hasFocus = win->setFocus(); + EXPECT_TRUE(hasFocus == win->hasFocus()); } \ No newline at end of file -- 2.7.4 From 7aa7513660b79c8d2893e63715412d104d390340 Mon Sep 17 00:00:00 2001 From: Sung-Jin Park Date: Mon, 27 Jul 2020 20:57:58 +0900 Subject: [PATCH 02/16] DSClient: add basic implementation and tests Change-Id: I27fca5fcd93959353304506c68daee9810beb864 Signed-off-by: Sung-Jin Park --- src/DSClient/DSClient.cpp | 99 +++++++++++++++++++++++ src/DSClient/DSClient.h | 36 +++++++++ src/DSClient/DSClientPrivate.h | 30 +++++++ src/meson.build | 4 + tests/DSClient-test.cpp | 176 +++++++++++++++++++++++++++++++++++++++++ tests/meson.build | 3 +- 6 files changed, 347 insertions(+), 1 deletion(-) create mode 100644 src/DSClient/DSClient.cpp create mode 100644 src/DSClient/DSClient.h create mode 100644 src/DSClient/DSClientPrivate.h create mode 100644 tests/DSClient-test.cpp diff --git a/src/DSClient/DSClient.cpp b/src/DSClient/DSClient.cpp new file mode 100644 index 0000000..45b72ac --- /dev/null +++ b/src/DSClient/DSClient.cpp @@ -0,0 +1,99 @@ +#include "DSClient.h" +#include "DSClientPrivate.h" +#include "DSWaylandCompositor.h" +#include "DSWaylandClient.h" +#include "DSWindow.h" + +namespace display_server +{ + +/* Begin Private Class Implementation */ +DSClientPrivate::DSClientPrivate(DSClient *client, DSWaylandClient *dswlClient) + : DSObjectPrivate(client), + __p_ptr(client), + __dswlComp(nullptr), + __dswlClient(dswlClient), + __numWindows(0) +{ + __windows.clear(); +} + +DSClientPrivate::~DSClientPrivate() +{ + __windows.clear(); +} + +/* Begin Public Class Implementation */ +DSClient::DSClient(DSCompositor *compositor) + : _d_ptr(std::make_unique(this, nullptr)), + __compositor(compositor) +{ + +} +DSClient::DSClient(DSCompositor *compositor, DSWaylandClient *dswlClient) + : _d_ptr(std::make_unique(this, dswlClient)), + __compositor(compositor) +{ + +} + +DSClient::~DSClient() +{ +} + +void DSClient::addWindow(DSWindow *window) +{ + DS_GET_PRIV(DSClient); + + for (auto win : priv->__windows) + { + if (window == win) + { + DSLOG_ERR("DSClient", "Window(%p) exists already.", window); + return; + } + } + + priv->__windows.push_back(window); + return; +} + +bool DSClient::removeWindow(DSWindow *window) +{ + DS_GET_PRIV(DSClient); + + for (auto win : priv->__windows) + { + if (window == win) + { + priv->__windows.remove(window); + DSLOG_ERR("DSClient", "Window(%p) has been removed.", window); + return true; + } + } + + return false; +} + +std::list DSClient::getWindows() +{ + DS_GET_PRIV(DSClient); + + return priv->__windows; +} + +uint32_t DSClient::numWindows() +{ + DS_GET_PRIV(DSClient); + + return priv->__numWindows; +} + +bool DSClient::hasWindow() +{ + DS_GET_PRIV(DSClient); + + return priv->__numWindows ? true : false; +} + +} // namespace display_server diff --git a/src/DSClient/DSClient.h b/src/DSClient/DSClient.h new file mode 100644 index 0000000..9f851ce --- /dev/null +++ b/src/DSClient/DSClient.h @@ -0,0 +1,36 @@ +#ifndef __DS_SEAT_H__ +#define __DS_SEAT_H__ + +#include "DSCore.h" +#include "DSObject.h" + +namespace display_server +{ + +class DSClientPrivate; +class DSWaylandClient; +class DSCompositor; +class DSWindow; + +class DSClient : public DSObject +{ + DS_PIMPL_USE_PRIVATE(DSClient) +public: + DSClient() = delete; + DSClient(DSCompositor *compositor); + DSClient(DSCompositor *compositor, DSWaylandClient *dswlClient); + ~DSClient() override; + + void addWindow(DSWindow *window); + bool removeWindow(DSWindow *window); + std::list getWindows(); + uint32_t numWindows(); + bool hasWindow(); + +private: + DSCompositor *__compositor; +}; + +} + +#endif //__DS_SEAT_H__ \ No newline at end of file diff --git a/src/DSClient/DSClientPrivate.h b/src/DSClient/DSClientPrivate.h new file mode 100644 index 0000000..62ef3b8 --- /dev/null +++ b/src/DSClient/DSClientPrivate.h @@ -0,0 +1,30 @@ +#ifndef __DS_SEAT_PRIVATE_H__ +#define __DS_SEAT_PRIVATE_H__ + +#include "DSCore.h" +#include "DSObjectPrivate.h" + +namespace display_server +{ + +class DSClient; +class DSWaylandCompositor; + +class DSClientPrivate : public DSObjectPrivate +{ + DS_PIMPL_USE_PUBLIC(DSClient); +public: + DSClientPrivate() = delete; + DSClientPrivate(DSClient *client, DSWaylandClient *dswlClient); + ~DSClientPrivate() override; + +private: + DSWaylandCompositor *__dswlComp; + DSWaylandClient *__dswlClient; + std::list __windows;//use if one or more windows in a client + int __numWindows; +}; + +} + +#endif //__DS_SEAT_PRIVATE_H__ \ No newline at end of file diff --git a/src/meson.build b/src/meson.build index 24bfcf4..4a06e85 100644 --- a/src/meson.build +++ b/src/meson.build @@ -53,6 +53,9 @@ libds_srcs = [ 'DSWindowShell/DSWindowShell.cpp', 'DSWindowShell/DSWindowShellPrivate.cpp', 'DSZone/DSZone.cpp', + 'DSClient/DSClientPrivate.h', + 'DSClient/DSClient.h', + 'DSClient/DSClient.cpp', ] libds_wayland_srcs = [ @@ -169,6 +172,7 @@ libds_include_dirs = include_directories( './DSWindow', './DSWindowShell', './DSZone', + './DSClient', ) libds_lib = shared_library( diff --git a/tests/DSClient-test.cpp b/tests/DSClient-test.cpp new file mode 100644 index 0000000..ba5db7d --- /dev/null +++ b/tests/DSClient-test.cpp @@ -0,0 +1,176 @@ +#include "libds-tests.h" +#include "DSObject.h" +#include "DSClient.h" +#include "DSCompositor.h" +#include "DSWaylandCompositor.h" +#include "DSWindow.h" +#include "DSWaylandClient.h" +#include + +using namespace display_server; + +class DSClientTest : public ::testing::Test +{ +public: + void SetUp(void) override + { + setenv("XDG_RUNTIME_DIR", "/run", 1); + } + void TearDown(void) override + { + unsetenv("XDG_RUNTIME_DIR"); + } +}; + +class MockCompositor : public DSCompositor +{ +public: + MockCompositor() {} + ~MockCompositor() {} + + std::shared_ptr _onInitialized() override + { + auto canvas = std::make_shared(); + return canvas; + } + + void _onOutputAdded(std::shared_ptr output) override + {} + + void _onOutputRemoved(std::shared_ptr output) override + {} + + void _onInputAdded(std::shared_ptr input) override + {} + + void _onInputRemoved(std::shared_ptr input) override + {} +}; + +TEST_F(DSClientTest, NewDSClientWithDSWaylandClient) +{ + DSCompositor *comp = new MockCompositor(); + EXPECT_TRUE(comp != nullptr); + + if (comp) + { + DSWaylandCompositor *dswlComp = DSWaylandCompositor::getInstance(); + EXPECT_TRUE(dswlComp != nullptr); + + if (dswlComp) + { + /* client must be created with a valid wl_client ptr later. */ + DSWaylandClient *dswlClient = new DSWaylandClient(dswlComp, (wl_client *)nullptr); + EXPECT_TRUE(dswlClient != nullptr); + + if (dswlClient) + { + DSClient *client = new DSClient(comp, dswlClient); + EXPECT_TRUE(client != nullptr); + + if (client) + delete client; + + delete dswlClient; + } + + DSWaylandCompositor::releaseInstance(); + } + + delete comp; + } +} + +TEST_F(DSClientTest, AddRemoveHasWindow) +{ + DSCompositor *comp = new MockCompositor(); + EXPECT_TRUE(comp != nullptr); + + if (comp) + { + DSWindow *win = new DSWindow(); + EXPECT_TRUE(win != nullptr); + + if (win) + { + DSClient *client = new DSClient(comp); + EXPECT_TRUE(client != nullptr); + + if (client) + { + client->addWindow(win); + EXPECT_TRUE(client->hasWindow() == true); + + client->removeWindow(win); + EXPECT_TRUE(client->hasWindow() != true); + + delete client; + } + + delete win; + } + + delete comp; + } +} + +TEST_F(DSClientTest, GetWindowsNumWindows) +{ + DSCompositor *comp = new MockCompositor(); + EXPECT_TRUE(comp != nullptr); + + if (comp) + { + DSWindow *win1 = new DSWindow(); + EXPECT_TRUE(win1 != nullptr); + + DSWindow *win2 = new DSWindow(); + EXPECT_TRUE(win2 != nullptr); + + DSWindow *win3 = new DSWindow(); + EXPECT_TRUE(win3 != nullptr); + + if (win1 && win2 && win3) + { + DSClient *client = new DSClient(comp); + EXPECT_TRUE(client != nullptr); + + if (client) + { + client->addWindow(win1); + EXPECT_TRUE(client->numWindows() == 1); + client->addWindow(win2); + EXPECT_TRUE(client->numWindows() == 2); + client->addWindow(win3); + EXPECT_TRUE(client->numWindows() == 3); + + int cnt = 3; + std::list winList = client->getWindows(); + for (auto win : winList) + { + if (win == win1 || + win == win2 || + win == win3) + cnt--; + } + + EXPECT_TRUE(cnt == 0); + + client->removeWindow(win1); + EXPECT_TRUE(client->numWindows() == 2); + client->removeWindow(win2); + EXPECT_TRUE(client->numWindows() == 1); + client->removeWindow(win3); + EXPECT_TRUE(client->numWindows() == 0); + + delete client; + } + + delete win1; + delete win2; + delete win3; + } + + delete comp; + } +} diff --git a/tests/meson.build b/tests/meson.build index 22ac7a0..4a741c1 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -35,7 +35,8 @@ libds_tests_srcs = [ 'DSWaylandPointer-test.cpp', 'DSWaylandKeyboard-test.cpp', 'DSWaylandTouch-test.cpp', - 'DSZone-test.cpp' + 'DSZone-test.cpp', + 'DSClient-test.cpp' ] gmock_dep = dependency('gmock', method : 'pkg-config') -- 2.7.4 From dfa7453d7b9b30341d7079df7d7bb7efd2018cfb Mon Sep 17 00:00:00 2001 From: jeon Date: Tue, 28 Jul 2020 08:18:21 +0900 Subject: [PATCH 03/16] DSWaylandInputMethod: add skeleton codes for wl_input_method and wl_input_method_context Change-Id: Ib432d18df446f8f19a4338ba584a443e03b53ac2 --- packaging/libds.spec | 1 + src/DSWaylandServer/DSWaylandInputMethod.cpp | 157 +++++++++++++++++++++ src/DSWaylandServer/DSWaylandInputMethod.h | 27 ++++ src/DSWaylandServer/DSWaylandInputMethodContext.h | 27 ++++ .../DSWaylandInputMethodContextPrivate.h | 54 +++++++ src/DSWaylandServer/DSWaylandInputMethodPrivate.h | 24 ++++ src/meson.build | 10 +- 7 files changed, 299 insertions(+), 1 deletion(-) create mode 100644 src/DSWaylandServer/DSWaylandInputMethod.cpp create mode 100644 src/DSWaylandServer/DSWaylandInputMethod.h create mode 100644 src/DSWaylandServer/DSWaylandInputMethodContext.h create mode 100644 src/DSWaylandServer/DSWaylandInputMethodContextPrivate.h create mode 100644 src/DSWaylandServer/DSWaylandInputMethodPrivate.h diff --git a/packaging/libds.spec b/packaging/libds.spec index 9b432b6..c47a179 100644 --- a/packaging/libds.spec +++ b/packaging/libds.spec @@ -14,6 +14,7 @@ BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(libtdm) BuildRequires: pkgconfig(wayland-server) BuildRequires: pkgconfig(tizen-extension-server) +BuildRequires: pkgconfig(input-method-server) BuildRequires: pkgconfig(text-server) BuildRequires: pkgconfig(tizen-launch-server) BuildRequires: pkgconfig(tizen-surface-server) diff --git a/src/DSWaylandServer/DSWaylandInputMethod.cpp b/src/DSWaylandServer/DSWaylandInputMethod.cpp new file mode 100644 index 0000000..e361ae4 --- /dev/null +++ b/src/DSWaylandServer/DSWaylandInputMethod.cpp @@ -0,0 +1,157 @@ +#include "DSWaylandInputMethodContext.h" +#include "DSWaylandInputMethodContextPrivate.h" +#include "DSWaylandInputMethod.h" +#include "DSWaylandInputMethodPrivate.h" + +namespace display_server { + +DSWaylandInputMethodContextPrivate::DSWaylandInputMethodContextPrivate(DSWaylandInputMethodContext *p_ptr) + : DSObjectPrivate(p_ptr), + __p_ptr(p_ptr) +{ +} + +DSWaylandInputMethodContextPrivate::~DSWaylandInputMethodContextPrivate() +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_destroy(Resource *resource) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_commit_string(Resource *resource, uint32_t serial, const std::string &text) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_preedit_string(Resource *resource, uint32_t serial, const std::string &text, const std::string &commit) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_preedit_styling(Resource *resource, uint32_t index, uint32_t length, uint32_t style) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_preedit_cursor(Resource *resource, int32_t index) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_delete_surrounding_text(Resource *resource, int32_t index, uint32_t length) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_cursor_position(Resource *resource, int32_t index, int32_t anchor) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_modifiers_map(Resource *resource, wl_array *map) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_keysym(Resource *resource, uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_grab_keyboard(Resource *resource, uint32_t keyboard) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_key(Resource *resource, uint32_t serial, uint32_t time, uint32_t key, uint32_t state) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_modifiers(Resource *resource, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_language(Resource *resource, uint32_t serial, const std::string &language) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_text_direction(Resource *resource, uint32_t serial, uint32_t direction) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_selection_region(Resource *resource, uint32_t serial, int32_t start, int32_t end) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_private_command(Resource *resource, uint32_t serial, const std::string &command) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_update_input_panel_data(Resource *resource, uint32_t serial, const std::string &input_panel_data, uint32_t input_panel_data_length) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_hide_input_panel(Resource *resource, uint32_t serial) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_get_selection_text(Resource *resource, int32_t fd) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_get_surrounding_text(Resource *resource, uint32_t maxlen_before, uint32_t maxlen_after, int32_t fd) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_filter_key_event_done(Resource *resource, uint32_t serial, uint32_t state) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_update_ise_geometry(Resource *resource, uint32_t serial, uint32_t x, uint32_t y, uint32_t width, uint32_t height) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_recapture_string(Resource *resource, uint32_t serial, int32_t index, uint32_t length, const std::string &preedit, const std::string &preedit_commit, const std::string &commit) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_input_panel_event(Resource *resource, uint32_t serial, uint32_t event_type, uint32_t value) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_commit_content(Resource *resource, uint32_t serial, const std::string &content, const std::string &description, const std::string &mime_types) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_update_candidate_state(Resource *resource, uint32_t state) +{ +} + +void DSWaylandInputMethodContextPrivate::input_method_context_reshow_input_panel(Resource *resource) +{ +} + + +DSWaylandInputMethodContext::DSWaylandInputMethodContext() + : DSObject(), _d_ptr(std::make_unique(this)) +{ +} + +DSWaylandInputMethodContext::~DSWaylandInputMethodContext() +{ +} + + +DSWaylandInputMethodPrivate::DSWaylandInputMethodPrivate(DSWaylandInputMethod *p_ptr) + : DSObjectPrivate(p_ptr), + __p_ptr(p_ptr) +{ +} + +DSWaylandInputMethodPrivate::~DSWaylandInputMethodPrivate() +{ +} + + +DSWaylandInputMethod::DSWaylandInputMethod() + : DSObject(), _d_ptr(std::make_unique(this)) +{ +} + +DSWaylandInputMethod::~DSWaylandInputMethod() +{ +} + +} \ No newline at end of file diff --git a/src/DSWaylandServer/DSWaylandInputMethod.h b/src/DSWaylandServer/DSWaylandInputMethod.h new file mode 100644 index 0000000..caf0317 --- /dev/null +++ b/src/DSWaylandServer/DSWaylandInputMethod.h @@ -0,0 +1,27 @@ +#ifndef __DS_WAYLAND_INPUT_METHOD_H__ +#define __DS_WAYLAND_INPUT_METHOD_H__ + +#include "DSCore.h" +#include "DSObject.h" + +namespace display_server +{ + +class DSWaylandInputMethodPrivate; + +class DS_DECL_EXPORT DSWaylandInputMethod : public DSObject +{ +DS_PIMPL_USE_PRIVATE(DSWaylandInputMethod); +public: + DSWaylandInputMethod(); + ~DSWaylandInputMethod() override; + +protected: + +private: + +}; + +} + +#endif //__DS_WAYLAND_INPUT_METHOD_H__ diff --git a/src/DSWaylandServer/DSWaylandInputMethodContext.h b/src/DSWaylandServer/DSWaylandInputMethodContext.h new file mode 100644 index 0000000..b4fb94a --- /dev/null +++ b/src/DSWaylandServer/DSWaylandInputMethodContext.h @@ -0,0 +1,27 @@ +#ifndef __DS_WAYLAND_INPUT_METHOD_CONTEXT_H__ +#define __DS_WAYLAND_INPUT_METHOD_CONTEXT_H__ + +#include "DSCore.h" +#include "DSObject.h" + +namespace display_server +{ + +class DSWaylandInputMethodContextPrivate; + +class DS_DECL_EXPORT DSWaylandInputMethodContext : public DSObject +{ +DS_PIMPL_USE_PRIVATE(DSWaylandInputMethodContext); +public: + DSWaylandInputMethodContext(); + ~DSWaylandInputMethodContext() override; + +protected: + +private: + +}; + +} + +#endif //__DS_WAYLAND_INPUT_METHOD_CONTEXT_H__ diff --git a/src/DSWaylandServer/DSWaylandInputMethodContextPrivate.h b/src/DSWaylandServer/DSWaylandInputMethodContextPrivate.h new file mode 100644 index 0000000..0b362b3 --- /dev/null +++ b/src/DSWaylandServer/DSWaylandInputMethodContextPrivate.h @@ -0,0 +1,54 @@ +#ifndef __DS_WAYLAND_INPUT_METHOD_CONTEXT_PRIVATE_H__ +#define __DS_WAYLAND_INPUT_METHOD_CONTEXT_PRIVATE_H__ + +#include "dswayland-server-input-method.h" + +#include "DSCore.h" +#include "DSObjectPrivate.h" +#include "DSWaylandInputMethodContext.h" + +namespace display_server +{ + +class DS_DECL_EXPORT DSWaylandInputMethodContextPrivate : public DSObjectPrivate, public DSWaylandServer::wl_input_method_context +{ +DS_PIMPL_USE_PUBLIC(DSWaylandInputMethodContext); +public: + DSWaylandInputMethodContextPrivate(DSWaylandInputMethodContext *p_ptr); + ~DSWaylandInputMethodContextPrivate() override; + +protected: + void input_method_context_destroy(Resource *resource); + void input_method_context_commit_string(Resource *resource, uint32_t serial, const std::string &text); + void input_method_context_preedit_string(Resource *resource, uint32_t serial, const std::string &text, const std::string &commit); + void input_method_context_preedit_styling(Resource *resource, uint32_t index, uint32_t length, uint32_t style); + void input_method_context_preedit_cursor(Resource *resource, int32_t index); + void input_method_context_delete_surrounding_text(Resource *resource, int32_t index, uint32_t length); + void input_method_context_cursor_position(Resource *resource, int32_t index, int32_t anchor); + void input_method_context_modifiers_map(Resource *resource, wl_array *map); + void input_method_context_keysym(Resource *resource, uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers); + void input_method_context_grab_keyboard(Resource *resource, uint32_t keyboard); + void input_method_context_key(Resource *resource, uint32_t serial, uint32_t time, uint32_t key, uint32_t state); + void input_method_context_modifiers(Resource *resource, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group); + void input_method_context_language(Resource *resource, uint32_t serial, const std::string &language); + void input_method_context_text_direction(Resource *resource, uint32_t serial, uint32_t direction); + void input_method_context_selection_region(Resource *resource, uint32_t serial, int32_t start, int32_t end); + void input_method_context_private_command(Resource *resource, uint32_t serial, const std::string &command); + void input_method_context_update_input_panel_data(Resource *resource, uint32_t serial, const std::string &input_panel_data, uint32_t input_panel_data_length); + void input_method_context_hide_input_panel(Resource *resource, uint32_t serial); + void input_method_context_get_selection_text(Resource *resource, int32_t fd); + void input_method_context_get_surrounding_text(Resource *resource, uint32_t maxlen_before, uint32_t maxlen_after, int32_t fd); + void input_method_context_filter_key_event_done(Resource *resource, uint32_t serial, uint32_t state); + void input_method_context_update_ise_geometry(Resource *resource, uint32_t serial, uint32_t x, uint32_t y, uint32_t width, uint32_t height); + void input_method_context_recapture_string(Resource *resource, uint32_t serial, int32_t index, uint32_t length, const std::string &preedit, const std::string &preedit_commit, const std::string &commit); + void input_method_context_input_panel_event(Resource *resource, uint32_t serial, uint32_t event_type, uint32_t value); + void input_method_context_commit_content(Resource *resource, uint32_t serial, const std::string &content, const std::string &description, const std::string &mime_types); + void input_method_context_update_candidate_state(Resource *resource, uint32_t state); + void input_method_context_reshow_input_panel(Resource *resource); + +}; + +} + +#endif //__DS_WAYLAND_INPUT_METHOD_CONTEXT_PRIVATE_H__ + diff --git a/src/DSWaylandServer/DSWaylandInputMethodPrivate.h b/src/DSWaylandServer/DSWaylandInputMethodPrivate.h new file mode 100644 index 0000000..dfc4e48 --- /dev/null +++ b/src/DSWaylandServer/DSWaylandInputMethodPrivate.h @@ -0,0 +1,24 @@ +#ifndef __DS_WAYLAND_INPUT_METHOD_PRIVATE_H__ +#define __DS_WAYLAND_INPUT_METHOD_PRIVATE_H__ + +#include "dswayland-server-input-method.h" + +#include "DSCore.h" +#include "DSObjectPrivate.h" +#include "DSWaylandInputMethod.h" + +namespace display_server +{ + +class DS_DECL_EXPORT DSWaylandInputMethodPrivate : public DSObjectPrivate, public DSWaylandServer::wl_input_method +{ +DS_PIMPL_USE_PUBLIC(DSWaylandInputMethod); +public: + DSWaylandInputMethodPrivate(DSWaylandInputMethod *p_ptr); + ~DSWaylandInputMethodPrivate() override; +}; + +} + +#endif //__DS_WAYLAND_INPUT_METHOD_PRIVATE_H__ + diff --git a/src/meson.build b/src/meson.build index 4a06e85..7e5401b 100644 --- a/src/meson.build +++ b/src/meson.build @@ -73,6 +73,8 @@ libds_wayland_srcs = [ 'DSWaylandServer/dswayland-server-text.h', 'DSWaylandServer/dswayland-server-tizen-launch.cpp', 'DSWaylandServer/dswayland-server-tizen-launch.h', + 'DSWaylandServer/dswayland-server-input-method.cpp', + 'DSWaylandServer/dswayland-server-input-method.h', 'DSWaylandServer/DSWaylandCallback.cpp', 'DSWaylandServer/DSWaylandCallback.h', 'DSWaylandServer/DSWaylandCallbackPrivate.h', @@ -118,6 +120,11 @@ libds_wayland_srcs = [ 'DSWaylandServer/DSWaylandTizenIndicatorPrivate.h', 'DSWaylandServer/DSWaylandTizenIndicator.h', 'DSWaylandServer/DSWaylandTizenIndicator.cpp', + 'DSWaylandServer/DSWaylandInputMethodContextPrivate.h', + 'DSWaylandServer/DSWaylandInputMethodContext.h', + 'DSWaylandServer/DSWaylandInputMethodPrivate.h', + 'DSWaylandServer/DSWaylandInputMethod.h', + 'DSWaylandServer/DSWaylandInputMethod.cpp', ] libds_srcs += libds_wayland_srcs @@ -141,10 +148,11 @@ tizen_ext_dep = dependency('tizen-extension-server') xdg_shell_unstable_v6_dep = dependency('xdg-shell-unstable-v6-server') xdg_shell_dep = dependency('xdg-shell-server') tizen_surface_dep = dependency('tizen-surface-server') +input_method_dep = dependency('input-method-server') text_dep = dependency('text-server') tizen_launch_dep = dependency('tizen-launch-server') -tizen_ext_deps = [tizen_ext_dep, text_dep, tizen_launch_dep, tizen_surface_dep] +tizen_ext_deps = [tizen_ext_dep, input_method_dep, text_dep, tizen_launch_dep, tizen_surface_dep] tizen_ext_deps = [tizen_ext_deps, xdg_shell_unstable_v6_dep, xdg_shell_dep] libds_deps = [ecore_dep] -- 2.7.4 From 9f7978450d98e10f4e56ec5fa3f74b85fcc78652 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 28 Jul 2020 14:46:08 +0900 Subject: [PATCH 04/16] Test: enable RenderEngine_RenderFrame, RenderView_SetBuffer at DSRenderEngineEcoreEvasTest Change-Id: I7dd49ef99d493ae85f0faf5f98d4b664d72d38f2 --- tests/DSRenderEngineEcoreEvasImpl-test.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/DSRenderEngineEcoreEvasImpl-test.cpp b/tests/DSRenderEngineEcoreEvasImpl-test.cpp index 1aaaf67..6f04055 100644 --- a/tests/DSRenderEngineEcoreEvasImpl-test.cpp +++ b/tests/DSRenderEngineEcoreEvasImpl-test.cpp @@ -22,7 +22,6 @@ TEST_F(DSRenderEngineEcoreEvasTest, RenderEngine_Create) EXPECT_TRUE(renderEngine != nullptr); } -#if 0 // There is a crash issue on evas_shutdown(). I am waiting for fixing it. TEST_F(DSRenderEngineEcoreEvasTest, RenderEngine_MakeRenderView) { std::shared_ptr bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); @@ -57,4 +56,3 @@ TEST_F(DSRenderEngineEcoreEvasTest, RenderEngine_RenderFrame) EXPECT_TRUE(renderView->setBuffer(buffer)); EXPECT_TRUE(renderEngine->renderFrame()); } -#endif \ No newline at end of file -- 2.7.4 From 0a4699c9640deb940e179c543a023be8021de0f5 Mon Sep 17 00:00:00 2001 From: jeon Date: Tue, 28 Jul 2020 15:11:11 +0900 Subject: [PATCH 05/16] DSWaylandTextInput: add skeleton codes for wl_text_input and wl_text_input_manager Change-Id: Ibf6033d3634c444dd83a77f5082a4f6f7be2f078 --- src/DSWaylandServer/DSWaylandTextInput.cpp | 153 +++++++++++++++++++++ src/DSWaylandServer/DSWaylandTextInput.h | 27 ++++ src/DSWaylandServer/DSWaylandTextInputManager.h | 27 ++++ .../DSWaylandTextInputManagerPrivate.h | 27 ++++ src/DSWaylandServer/DSWaylandTextInputPrivate.h | 51 +++++++ src/meson.build | 5 + 6 files changed, 290 insertions(+) create mode 100644 src/DSWaylandServer/DSWaylandTextInput.cpp create mode 100644 src/DSWaylandServer/DSWaylandTextInput.h create mode 100644 src/DSWaylandServer/DSWaylandTextInputManager.h create mode 100644 src/DSWaylandServer/DSWaylandTextInputManagerPrivate.h create mode 100644 src/DSWaylandServer/DSWaylandTextInputPrivate.h diff --git a/src/DSWaylandServer/DSWaylandTextInput.cpp b/src/DSWaylandServer/DSWaylandTextInput.cpp new file mode 100644 index 0000000..37277fa --- /dev/null +++ b/src/DSWaylandServer/DSWaylandTextInput.cpp @@ -0,0 +1,153 @@ +#include "DSWaylandTextInputManager.h" +#include "DSWaylandTextInputManagerPrivate.h" +#include "DSWaylandTextInput.h" +#include "DSWaylandTextInputPrivate.h" + +namespace display_server { + +DSWaylandTextInputManagerPrivate::DSWaylandTextInputManagerPrivate(DSWaylandTextInputManager *p_ptr) + : DSObjectPrivate(p_ptr), + __p_ptr(p_ptr) +{ +} + +DSWaylandTextInputManagerPrivate::~DSWaylandTextInputManagerPrivate() +{ +} + +void DSWaylandTextInputManagerPrivate::text_input_manager_create_text_input(Resource *resource, uint32_t id) +{ +} + + +DSWaylandTextInputManager::DSWaylandTextInputManager() + : DSObject(), _d_ptr(std::make_unique(this)) +{ +} + +DSWaylandTextInputManager::~DSWaylandTextInputManager() +{ +} + + +DSWaylandTextInputPrivate::DSWaylandTextInputPrivate(DSWaylandTextInput *p_ptr) + : DSObjectPrivate(p_ptr), + __p_ptr(p_ptr) +{ +} + +DSWaylandTextInputPrivate::~DSWaylandTextInputPrivate() +{ +} + +void DSWaylandTextInputPrivate::text_input_destroy(Resource *resource) +{ +} + +void DSWaylandTextInputPrivate::text_input_activate(Resource *resource, struct ::wl_resource *seat, struct ::wl_resource *surface) +{ +} + +void DSWaylandTextInputPrivate::text_input_deactivate(Resource *resource, struct ::wl_resource *seat) +{ +} + +void DSWaylandTextInputPrivate::text_input_show_input_panel(Resource *resource) +{ +} + +void DSWaylandTextInputPrivate::text_input_hide_input_panel(Resource *resource) +{ +} + +void DSWaylandTextInputPrivate::text_input_reset(Resource *resource) +{ +} + +void DSWaylandTextInputPrivate::text_input_set_content_type(Resource *resource, uint32_t hint, uint32_t purpose) +{ +} + +void DSWaylandTextInputPrivate::text_input_set_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) +{ +} + +void DSWaylandTextInputPrivate::text_input_set_preferred_language(Resource *resource, const std::string &language) +{ +} + +void DSWaylandTextInputPrivate::text_input_commit_state(Resource *resource, uint32_t serial) +{ +} + +void DSWaylandTextInputPrivate::text_input_invoke_action(Resource *resource, uint32_t button, uint32_t index) +{ +} + +void DSWaylandTextInputPrivate::text_input_set_return_key_type(Resource *resource, uint32_t return_key_type) +{ +} + +void DSWaylandTextInputPrivate::text_input_set_return_key_disabled(Resource *resource, uint32_t return_key_disabled) +{ +} + +void DSWaylandTextInputPrivate::text_input_set_input_panel_data(Resource *resource, const std::string &input_panel_data, uint32_t input_panel_length) +{ +} + +void DSWaylandTextInputPrivate::text_input_bidi_direction(Resource *resource, uint32_t direction) +{ +} + +void DSWaylandTextInputPrivate::text_input_set_cursor_position(Resource *resource, uint32_t cursor_position) +{ +} + +void DSWaylandTextInputPrivate::text_input_process_input_device_event(Resource *resource, uint32_t event_type, const std::string &event_data, uint32_t event_length) +{ +} + +void DSWaylandTextInputPrivate::text_input_filter_key_event(Resource *resource, uint32_t serial, uint32_t time, const std::string &keyname, uint32_t state, uint32_t modifiers, const std::string &dev_name, uint32_t dev_class, uint32_t dev_subclass, uint32_t keycode) +{ +} + +void DSWaylandTextInputPrivate::text_input_get_hide_permission(Resource *resource) +{ +} + +void DSWaylandTextInputPrivate::text_input_set_capital_mode(Resource *resource, uint32_t mode) +{ +} + +void DSWaylandTextInputPrivate::text_input_prediction_hint(Resource *resource, const std::string &text) +{ +} + +void DSWaylandTextInputPrivate::text_input_set_mime_type(Resource *resource, const std::string &type) +{ +} + +void DSWaylandTextInputPrivate::text_input_set_input_panel_position(Resource *resource, uint32_t x, uint32_t y) +{ +} + +void DSWaylandTextInputPrivate::text_input_finalize_content(Resource *resource, const std::string &text, uint32_t cursor_position) +{ +} + +void DSWaylandTextInputPrivate::text_input_prediction_hint_data(Resource *resource, const std::string &key, const std::string &value) +{ +} + + +DSWaylandTextInput::DSWaylandTextInput() + : DSObject(), _d_ptr(std::make_unique(this)) +{ +} + +DSWaylandTextInput::~DSWaylandTextInput() +{ +} + +} \ No newline at end of file diff --git a/src/DSWaylandServer/DSWaylandTextInput.h b/src/DSWaylandServer/DSWaylandTextInput.h new file mode 100644 index 0000000..b446f68 --- /dev/null +++ b/src/DSWaylandServer/DSWaylandTextInput.h @@ -0,0 +1,27 @@ +#ifndef __DS_WAYLAND_TEXT_INPUT_H__ +#define __DS_WAYLAND_TEXT_INPUT_H__ + +#include "DSCore.h" +#include "DSObject.h" + +namespace display_server +{ + +class DSWaylandTextInputPrivate; + +class DS_DECL_EXPORT DSWaylandTextInput : public DSObject +{ +DS_PIMPL_USE_PRIVATE(DSWaylandTextInput); +public: + DSWaylandTextInput(); + ~DSWaylandTextInput() override; + +protected: + +private: + +}; + +} + +#endif //__DS_WAYLAND_TEXT_INPUT_H__ diff --git a/src/DSWaylandServer/DSWaylandTextInputManager.h b/src/DSWaylandServer/DSWaylandTextInputManager.h new file mode 100644 index 0000000..8278592 --- /dev/null +++ b/src/DSWaylandServer/DSWaylandTextInputManager.h @@ -0,0 +1,27 @@ +#ifndef __DS_WAYLAND_TEXT_INPUT_MANAGER_H__ +#define __DS_WAYLAND_TEXT_INPUT_MANAGER_H__ + +#include "DSCore.h" +#include "DSObject.h" + +namespace display_server +{ + +class DSWaylandTextInputManagerPrivate; + +class DS_DECL_EXPORT DSWaylandTextInputManager : public DSObject +{ +DS_PIMPL_USE_PRIVATE(DSWaylandTextInputManager); +public: + DSWaylandTextInputManager(); + ~DSWaylandTextInputManager() override; + +protected: + +private: + +}; + +} + +#endif //__DS_WAYLAND_TEXT_INPUT_MANAGER_H__ diff --git a/src/DSWaylandServer/DSWaylandTextInputManagerPrivate.h b/src/DSWaylandServer/DSWaylandTextInputManagerPrivate.h new file mode 100644 index 0000000..f9052fe --- /dev/null +++ b/src/DSWaylandServer/DSWaylandTextInputManagerPrivate.h @@ -0,0 +1,27 @@ +#ifndef __DS_WAYLAND_TEXT_INPUT_MANAGER_PRIVATE_H__ +#define __DS_WAYLAND_TEXT_INPUT_MANAGER_PRIVATE_H__ + +#include "dswayland-server-text.h" + +#include "DSCore.h" +#include "DSObjectPrivate.h" +#include "DSWaylandTextInputManager.h" + +namespace display_server +{ + +class DS_DECL_EXPORT DSWaylandTextInputManagerPrivate : public DSObjectPrivate, public DSWaylandServer::wl_text_input_manager +{ +DS_PIMPL_USE_PUBLIC(DSWaylandTextInputManager); +public: + DSWaylandTextInputManagerPrivate(DSWaylandTextInputManager *p_ptr); + ~DSWaylandTextInputManagerPrivate() override; + +protected: + void text_input_manager_create_text_input(Resource *resource, uint32_t id); +}; + +} + +#endif //__DS_WAYLAND_TEXT_INPUT_MANAGER_PRIVATE_H__ + diff --git a/src/DSWaylandServer/DSWaylandTextInputPrivate.h b/src/DSWaylandServer/DSWaylandTextInputPrivate.h new file mode 100644 index 0000000..ad246c0 --- /dev/null +++ b/src/DSWaylandServer/DSWaylandTextInputPrivate.h @@ -0,0 +1,51 @@ +#ifndef __DS_WAYLAND_TEXT_INPUT_PRIVATE_H__ +#define __DS_WAYLAND_TEXT_INPUT_PRIVATE_H__ + +#include "dswayland-server-text.h" + +#include "DSCore.h" +#include "DSObjectPrivate.h" +#include "DSWaylandTextInput.h" + +namespace display_server +{ + +class DS_DECL_EXPORT DSWaylandTextInputPrivate : public DSObjectPrivate, public DSWaylandServer::wl_text_input +{ +DS_PIMPL_USE_PUBLIC(DSWaylandTextInput); +public: + DSWaylandTextInputPrivate(DSWaylandTextInput *p_ptr); + ~DSWaylandTextInputPrivate() override; + +protected: + void text_input_destroy(Resource *resource); + void text_input_activate(Resource *resource, struct ::wl_resource *seat, struct ::wl_resource *surface); + void text_input_deactivate(Resource *resource, struct ::wl_resource *seat); + void text_input_show_input_panel(Resource *resource); + void text_input_hide_input_panel(Resource *resource); + void text_input_reset(Resource *resource); + void text_input_set_content_type(Resource *resource, uint32_t hint, uint32_t purpose); + void text_input_set_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height); + void text_input_set_preferred_language(Resource *resource, const std::string &language); + void text_input_commit_state(Resource *resource, uint32_t serial); + void text_input_invoke_action(Resource *resource, uint32_t button, uint32_t index); + void text_input_set_return_key_type(Resource *resource, uint32_t return_key_type); + void text_input_set_return_key_disabled(Resource *resource, uint32_t return_key_disabled); + void text_input_set_input_panel_data(Resource *resource, const std::string &input_panel_data, uint32_t input_panel_length); + void text_input_bidi_direction(Resource *resource, uint32_t direction); + void text_input_set_cursor_position(Resource *resource, uint32_t cursor_position); + void text_input_process_input_device_event(Resource *resource, uint32_t event_type, const std::string &event_data, uint32_t event_length); + void text_input_filter_key_event(Resource *resource, uint32_t serial, uint32_t time, const std::string &keyname, uint32_t state, uint32_t modifiers, const std::string &dev_name, uint32_t dev_class, uint32_t dev_subclass, uint32_t keycode); + void text_input_get_hide_permission(Resource *resource); + void text_input_set_capital_mode(Resource *resource, uint32_t mode); + void text_input_prediction_hint(Resource *resource, const std::string &text); + void text_input_set_mime_type(Resource *resource, const std::string &type); + void text_input_set_input_panel_position(Resource *resource, uint32_t x, uint32_t y); + void text_input_finalize_content(Resource *resource, const std::string &text, uint32_t cursor_position); + void text_input_prediction_hint_data(Resource *resource, const std::string &key, const std::string &value); +}; + +} + +#endif //__DS_WAYLAND_TEXT_INPUT_PRIVATE_H__ + diff --git a/src/meson.build b/src/meson.build index 7e5401b..039ee4f 100644 --- a/src/meson.build +++ b/src/meson.build @@ -125,6 +125,11 @@ libds_wayland_srcs = [ 'DSWaylandServer/DSWaylandInputMethodPrivate.h', 'DSWaylandServer/DSWaylandInputMethod.h', 'DSWaylandServer/DSWaylandInputMethod.cpp', + 'DSWaylandServer/DSWaylandTextInputManagerPrivate.h', + 'DSWaylandServer/DSWaylandTextInputManager.h', + 'DSWaylandServer/DSWaylandTextInputPrivate.h', + 'DSWaylandServer/DSWaylandTextInput.h', + 'DSWaylandServer/DSWaylandTextInput.cpp', ] libds_srcs += libds_wayland_srcs -- 2.7.4 From 341611b3acc9c431c192bf0a395f02e6f47d737e Mon Sep 17 00:00:00 2001 From: jeon Date: Tue, 28 Jul 2020 15:55:55 +0900 Subject: [PATCH 06/16] DSWaylandInputPanel: add skeleton codes for wl_input_panel and wl_input_panel_surface Change-Id: Ic435e3693f93e2b025d21a79ba4e0d10f8efcf57 --- src/DSWaylandServer/DSWaylandInputPanel.cpp | 73 ++++++++++++++++++++++ src/DSWaylandServer/DSWaylandInputPanel.h | 27 ++++++++ src/DSWaylandServer/DSWaylandInputPanelPrivate.h | 28 +++++++++ src/DSWaylandServer/DSWaylandInputPanelSurface.h | 27 ++++++++ .../DSWaylandInputPanelSurfacePrivate.h | 32 ++++++++++ src/meson.build | 5 ++ 6 files changed, 192 insertions(+) create mode 100644 src/DSWaylandServer/DSWaylandInputPanel.cpp create mode 100644 src/DSWaylandServer/DSWaylandInputPanel.h create mode 100644 src/DSWaylandServer/DSWaylandInputPanelPrivate.h create mode 100644 src/DSWaylandServer/DSWaylandInputPanelSurface.h create mode 100644 src/DSWaylandServer/DSWaylandInputPanelSurfacePrivate.h diff --git a/src/DSWaylandServer/DSWaylandInputPanel.cpp b/src/DSWaylandServer/DSWaylandInputPanel.cpp new file mode 100644 index 0000000..0e7af46 --- /dev/null +++ b/src/DSWaylandServer/DSWaylandInputPanel.cpp @@ -0,0 +1,73 @@ +#include "DSWaylandInputPanel.h" +#include "DSWaylandInputPanelPrivate.h" +#include "DSWaylandInputPanelSurface.h" +#include "DSWaylandInputPanelSurfacePrivate.h" + +namespace display_server { + +DSWaylandInputPanelPrivate::DSWaylandInputPanelPrivate(DSWaylandInputPanel *p_ptr) + : DSObjectPrivate(p_ptr), + __p_ptr(p_ptr) +{ +} + +DSWaylandInputPanelPrivate::~DSWaylandInputPanelPrivate() +{ +} + +void DSWaylandInputPanelPrivate::input_panel_get_input_panel_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface) +{ +} + + +DSWaylandInputPanel::DSWaylandInputPanel() + : DSObject(), _d_ptr(std::make_unique(this)) +{ +} + +DSWaylandInputPanel::~DSWaylandInputPanel() +{ +} + + +DSWaylandInputPanelSurfacePrivate::DSWaylandInputPanelSurfacePrivate(DSWaylandInputPanelSurface *p_ptr) + : DSObjectPrivate(p_ptr), + __p_ptr(p_ptr) +{ +} + +DSWaylandInputPanelSurfacePrivate::~DSWaylandInputPanelSurfacePrivate() +{ +} + +void DSWaylandInputPanelSurfacePrivate::input_panel_surface_set_toplevel(Resource *resource, struct ::wl_resource *output, uint32_t position) +{ +} + +void DSWaylandInputPanelSurfacePrivate::input_panel_surface_set_overlay_panel(Resource *resource) +{ +} + +void DSWaylandInputPanelSurfacePrivate::input_panel_surface_set_ready(Resource *resource, uint32_t state) +{ +} + +void DSWaylandInputPanelSurfacePrivate::input_panel_surface_set_floating_panel(Resource *resource, uint32_t state) +{ +} + +void DSWaylandInputPanelSurfacePrivate::input_panel_surface_set_floating_drag_enabled(Resource *resource, uint32_t enabled) +{ +} + + +DSWaylandInputPanelSurface::DSWaylandInputPanelSurface() + : DSObject(), _d_ptr(std::make_unique(this)) +{ +} + +DSWaylandInputPanelSurface::~DSWaylandInputPanelSurface() +{ +} + +} \ No newline at end of file diff --git a/src/DSWaylandServer/DSWaylandInputPanel.h b/src/DSWaylandServer/DSWaylandInputPanel.h new file mode 100644 index 0000000..66b6975 --- /dev/null +++ b/src/DSWaylandServer/DSWaylandInputPanel.h @@ -0,0 +1,27 @@ +#ifndef __DS_WAYLAND_INPUT_PANEL_H__ +#define __DS_WAYLAND_INPUT_PANEL_H__ + +#include "DSCore.h" +#include "DSObject.h" + +namespace display_server +{ + +class DSWaylandInputPanelPrivate; + +class DS_DECL_EXPORT DSWaylandInputPanel : public DSObject +{ +DS_PIMPL_USE_PRIVATE(DSWaylandInputPanel); +public: + DSWaylandInputPanel(); + ~DSWaylandInputPanel() override; + +protected: + +private: + +}; + +} + +#endif //__DS_WAYLAND_INPUT_PANEL_H__ diff --git a/src/DSWaylandServer/DSWaylandInputPanelPrivate.h b/src/DSWaylandServer/DSWaylandInputPanelPrivate.h new file mode 100644 index 0000000..2658839 --- /dev/null +++ b/src/DSWaylandServer/DSWaylandInputPanelPrivate.h @@ -0,0 +1,28 @@ +#ifndef __DS_WAYLAND_INPUT_PANEL_PRIVATE_H__ +#define __DS_WAYLAND_INPUT_PANEL_PRIVATE_H__ + +#include "dswayland-server-input-method.h" + +#include "DSCore.h" +#include "DSObjectPrivate.h" +#include "DSWaylandInputPanel.h" + +namespace display_server +{ + +class DS_DECL_EXPORT DSWaylandInputPanelPrivate : public DSObjectPrivate, public DSWaylandServer::wl_input_panel +{ +DS_PIMPL_USE_PUBLIC(DSWaylandInputPanel); +public: + DSWaylandInputPanelPrivate(DSWaylandInputPanel *p_ptr); + ~DSWaylandInputPanelPrivate() override; + +protected: + void input_panel_get_input_panel_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface); + +}; + +} + +#endif //__DS_WAYLAND_INPUT_PANEL_PRIVATE_H__ + diff --git a/src/DSWaylandServer/DSWaylandInputPanelSurface.h b/src/DSWaylandServer/DSWaylandInputPanelSurface.h new file mode 100644 index 0000000..62e85fb --- /dev/null +++ b/src/DSWaylandServer/DSWaylandInputPanelSurface.h @@ -0,0 +1,27 @@ +#ifndef __DS_WAYLAND_INPUT_PANEL_SURFACE_H__ +#define __DS_WAYLAND_INPUT_PANEL_SURFACE_H__ + +#include "DSCore.h" +#include "DSObject.h" + +namespace display_server +{ + +class DSWaylandInputPanelSurfacePrivate; + +class DS_DECL_EXPORT DSWaylandInputPanelSurface : public DSObject +{ +DS_PIMPL_USE_PRIVATE(DSWaylandInputPanelSurface); +public: + DSWaylandInputPanelSurface(); + ~DSWaylandInputPanelSurface() override; + +protected: + +private: + +}; + +} + +#endif //__DS_WAYLAND_INPUT_PANEL_SURFACE_H__ diff --git a/src/DSWaylandServer/DSWaylandInputPanelSurfacePrivate.h b/src/DSWaylandServer/DSWaylandInputPanelSurfacePrivate.h new file mode 100644 index 0000000..679c68b --- /dev/null +++ b/src/DSWaylandServer/DSWaylandInputPanelSurfacePrivate.h @@ -0,0 +1,32 @@ +#ifndef __DS_WAYLAND_INPUT_PANEL_SURFACE_PRIVATE_H__ +#define __DS_WAYLAND_INPUT_PANEL_SURFACE_PRIVATE_H__ + +#include "dswayland-server-input-method.h" + +#include "DSCore.h" +#include "DSObjectPrivate.h" +#include "DSWaylandInputPanelSurface.h" + +namespace display_server +{ + +class DS_DECL_EXPORT DSWaylandInputPanelSurfacePrivate : public DSObjectPrivate, public DSWaylandServer::wl_input_panel_surface +{ +DS_PIMPL_USE_PUBLIC(DSWaylandInputPanelSurface); +public: + DSWaylandInputPanelSurfacePrivate(DSWaylandInputPanelSurface *p_ptr); + ~DSWaylandInputPanelSurfacePrivate() override; + +protected: + void input_panel_surface_set_toplevel(Resource *resource, struct ::wl_resource *output, uint32_t position); + void input_panel_surface_set_overlay_panel(Resource *resource); + void input_panel_surface_set_ready(Resource *resource, uint32_t state); + void input_panel_surface_set_floating_panel(Resource *resource, uint32_t state); + void input_panel_surface_set_floating_drag_enabled(Resource *resource, uint32_t enabled); + +}; + +} + +#endif //__DS_WAYLAND_INPUT_PANEL_SURFACE_PRIVATE_H__ + diff --git a/src/meson.build b/src/meson.build index 039ee4f..30c6848 100644 --- a/src/meson.build +++ b/src/meson.build @@ -130,6 +130,11 @@ libds_wayland_srcs = [ 'DSWaylandServer/DSWaylandTextInputPrivate.h', 'DSWaylandServer/DSWaylandTextInput.h', 'DSWaylandServer/DSWaylandTextInput.cpp', + 'DSWaylandServer/DSWaylandInputPanelSurfacePrivate.h', + 'DSWaylandServer/DSWaylandInputPanelSurface.h', + 'DSWaylandServer/DSWaylandInputPanelPrivate.h', + 'DSWaylandServer/DSWaylandInputPanel.h', + 'DSWaylandServer/DSWaylandInputPanel.cpp', ] libds_srcs += libds_wayland_srcs -- 2.7.4 From 91eee91c01fb2325ed74192b9e2a6c5a949062b8 Mon Sep 17 00:00:00 2001 From: jeon Date: Tue, 28 Jul 2020 16:08:31 +0900 Subject: [PATCH 07/16] Test: add default tests for DSWaylandInputMethod and DSWaylandInputMethodContext Change-Id: I94f4c9c8a4c57002b1f4e0c0f4d50bb7d4e18042 --- tests/DSWaylandInputMethod-test.cpp | 28 ++++++++++++++++++++++++++++ tests/DSWaylandInputMethodContext-test.cpp | 28 ++++++++++++++++++++++++++++ tests/meson.build | 4 +++- 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 tests/DSWaylandInputMethod-test.cpp create mode 100644 tests/DSWaylandInputMethodContext-test.cpp diff --git a/tests/DSWaylandInputMethod-test.cpp b/tests/DSWaylandInputMethod-test.cpp new file mode 100644 index 0000000..2f4ad94 --- /dev/null +++ b/tests/DSWaylandInputMethod-test.cpp @@ -0,0 +1,28 @@ +#include "libds-tests.h" +#include "DSWaylandInputMethod.h" + +using namespace display_server; + +class DSWaylandInputMethodTest : public ::testing::Test +{ +public: + void SetUp(void) override + { + setenv("XDG_RUNTIME_DIR", "/run", 1); + } + void TearDown(void) override + { + unsetenv("XDG_RUNTIME_DIR"); + } +}; + +/* Test cases */ +TEST_F(DSWaylandInputMethodTest, NewDSWaylandInputMethod) +{ + DSWaylandInputMethod *inputMethod = new DSWaylandInputMethod(); + EXPECT_TRUE(inputMethod != nullptr); + + delete inputMethod; +} + + diff --git a/tests/DSWaylandInputMethodContext-test.cpp b/tests/DSWaylandInputMethodContext-test.cpp new file mode 100644 index 0000000..76d4732 --- /dev/null +++ b/tests/DSWaylandInputMethodContext-test.cpp @@ -0,0 +1,28 @@ +#include "libds-tests.h" +#include "DSWaylandInputMethodContext.h" + +using namespace display_server; + +class DSWaylandInputMethodContextTest : public ::testing::Test +{ +public: + void SetUp(void) override + { + setenv("XDG_RUNTIME_DIR", "/run", 1); + } + void TearDown(void) override + { + unsetenv("XDG_RUNTIME_DIR"); + } +}; + +/* Test cases */ +TEST_F(DSWaylandInputMethodContextTest, NewDSWaylandInputMethodContext) +{ + DSWaylandInputMethodContext *inputMethodContext = new DSWaylandInputMethodContext(); + EXPECT_TRUE(inputMethodContext != nullptr); + + delete inputMethodContext; +} + + diff --git a/tests/meson.build b/tests/meson.build index 4a741c1..09014d6 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -36,7 +36,9 @@ libds_tests_srcs = [ 'DSWaylandKeyboard-test.cpp', 'DSWaylandTouch-test.cpp', 'DSZone-test.cpp', - 'DSClient-test.cpp' + 'DSClient-test.cpp', + 'DSWaylandInputMethod-test.cpp', + 'DSWaylandInputMethodContext-test.cpp', ] gmock_dep = dependency('gmock', method : 'pkg-config') -- 2.7.4 From 2035bade4f2ff0ddde9ca35c6476236532d87ae9 Mon Sep 17 00:00:00 2001 From: jeon Date: Tue, 28 Jul 2020 16:16:00 +0900 Subject: [PATCH 08/16] Test: add default tests for DSWaylandTextInput and DSWaylandTextInputManager Change-Id: Iaf5f7308da90e20efb5390e0983864f43fce48f8 --- tests/DSWaylandTextInput-test.cpp | 27 +++++++++++++++++++++++++++ tests/DSWaylandTextInputManager-test.cpp | 27 +++++++++++++++++++++++++++ tests/meson.build | 2 ++ 3 files changed, 56 insertions(+) create mode 100644 tests/DSWaylandTextInput-test.cpp create mode 100644 tests/DSWaylandTextInputManager-test.cpp diff --git a/tests/DSWaylandTextInput-test.cpp b/tests/DSWaylandTextInput-test.cpp new file mode 100644 index 0000000..fa3d574 --- /dev/null +++ b/tests/DSWaylandTextInput-test.cpp @@ -0,0 +1,27 @@ +#include "libds-tests.h" +#include "DSWaylandTextInput.h" + +using namespace display_server; + +class DSWaylandTextInputTest : public ::testing::Test +{ +public: + void SetUp(void) override + { + setenv("XDG_RUNTIME_DIR", "/run", 1); + } + void TearDown(void) override + { + unsetenv("XDG_RUNTIME_DIR"); + } +}; + +/* Test cases */ +TEST_F(DSWaylandTextInputTest, NewDSWaylandTextInput) +{ + DSWaylandTextInput *textInput = new DSWaylandTextInput(); + EXPECT_TRUE(textInput != nullptr); + + delete textInput; +} + diff --git a/tests/DSWaylandTextInputManager-test.cpp b/tests/DSWaylandTextInputManager-test.cpp new file mode 100644 index 0000000..ea21938 --- /dev/null +++ b/tests/DSWaylandTextInputManager-test.cpp @@ -0,0 +1,27 @@ +#include "libds-tests.h" +#include "DSWaylandTextInputManager.h" + +using namespace display_server; + +class DSWaylandTextInputManagerTest : public ::testing::Test +{ +public: + void SetUp(void) override + { + setenv("XDG_RUNTIME_DIR", "/run", 1); + } + void TearDown(void) override + { + unsetenv("XDG_RUNTIME_DIR"); + } +}; + +/* Test cases */ +TEST_F(DSWaylandTextInputManagerTest, NewDSWaylandTextInputManager) +{ + DSWaylandTextInputManager *textInputManager = new DSWaylandTextInputManager(); + EXPECT_TRUE(textInputManager != nullptr); + + delete textInputManager; +} + diff --git a/tests/meson.build b/tests/meson.build index 09014d6..e7d60ab 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -39,6 +39,8 @@ libds_tests_srcs = [ 'DSClient-test.cpp', 'DSWaylandInputMethod-test.cpp', 'DSWaylandInputMethodContext-test.cpp', + 'DSWaylandTextInput-test.cpp', + 'DSWaylandTextInputManager-test.cpp', ] gmock_dep = dependency('gmock', method : 'pkg-config') -- 2.7.4 From 2ffb55b9524f12db0196bd882079a91c51440a9e Mon Sep 17 00:00:00 2001 From: jeon Date: Tue, 28 Jul 2020 16:19:55 +0900 Subject: [PATCH 09/16] Test: add default tests for DSWaylandInputPanel and DSWaylandInputPanelSurface Change-Id: Iaa24d891e27a608eede1702239d7fc1ee97c75e2 --- tests/DSWaylandInputPanel-test.cpp | 28 ++++++++++++++++++++++++++++ tests/DSWaylandInputPanelSurface-test.cpp | 28 ++++++++++++++++++++++++++++ tests/meson.build | 2 ++ 3 files changed, 58 insertions(+) create mode 100644 tests/DSWaylandInputPanel-test.cpp create mode 100644 tests/DSWaylandInputPanelSurface-test.cpp diff --git a/tests/DSWaylandInputPanel-test.cpp b/tests/DSWaylandInputPanel-test.cpp new file mode 100644 index 0000000..b8a6de9 --- /dev/null +++ b/tests/DSWaylandInputPanel-test.cpp @@ -0,0 +1,28 @@ +#include "libds-tests.h" +#include "DSWaylandInputPanel.h" + +using namespace display_server; + +class DSWaylandInputPanelTest : public ::testing::Test +{ +public: + void SetUp(void) override + { + setenv("XDG_RUNTIME_DIR", "/run", 1); + } + void TearDown(void) override + { + unsetenv("XDG_RUNTIME_DIR"); + } +}; + +/* Test cases */ +TEST_F(DSWaylandInputPanelTest, NewDSWaylandInputPanel) +{ + DSWaylandInputPanel *inputPanel = new DSWaylandInputPanel(); + EXPECT_TRUE(inputPanel != nullptr); + + delete inputPanel; +} + + diff --git a/tests/DSWaylandInputPanelSurface-test.cpp b/tests/DSWaylandInputPanelSurface-test.cpp new file mode 100644 index 0000000..cb0c82f --- /dev/null +++ b/tests/DSWaylandInputPanelSurface-test.cpp @@ -0,0 +1,28 @@ +#include "libds-tests.h" +#include "DSWaylandInputPanelSurface.h" + +using namespace display_server; + +class DSWaylandInputPanelSurfaceTest : public ::testing::Test +{ +public: + void SetUp(void) override + { + setenv("XDG_RUNTIME_DIR", "/run", 1); + } + void TearDown(void) override + { + unsetenv("XDG_RUNTIME_DIR"); + } +}; + +/* Test cases */ +TEST_F(DSWaylandInputPanelSurfaceTest, NewDSWaylandInputPanelSurface) +{ + DSWaylandInputPanelSurface *inputPanelSurface = new DSWaylandInputPanelSurface(); + EXPECT_TRUE(inputPanelSurface != nullptr); + + delete inputPanelSurface; +} + + diff --git a/tests/meson.build b/tests/meson.build index e7d60ab..fd461e5 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -41,6 +41,8 @@ libds_tests_srcs = [ 'DSWaylandInputMethodContext-test.cpp', 'DSWaylandTextInput-test.cpp', 'DSWaylandTextInputManager-test.cpp', + 'DSWaylandInputPanel-test.cpp', + 'DSWaylandInputPanelSurface-test.cpp', ] gmock_dep = dependency('gmock', method : 'pkg-config') -- 2.7.4 From b796043fa7fcbe224a0a0cf66880a0c266ab81d4 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 28 Jul 2020 14:23:14 +0900 Subject: [PATCH 10/16] DSZone : add registerCallbackWindowCreated method Change-Id: I08b43f97474ba7af8ddc0c083403eabf38fd3b82 --- src/DSZone/DSZone.cpp | 23 +++++++++++++++++++++-- src/DSZone/DSZone.h | 9 +++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index 044b003..0e83d01 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -47,10 +47,29 @@ int DSZone::getHeight() return policyAreaPriv->getHeight(); } +void DSZone::registerCallbackWindowCreated(DSObject *slot, std::function)> func) +{ + this->__windowCreatedSignal.connect(slot, func); +} + +void DSZone::callCallbackWindowCreated() +{ + __windowCreatedSignal.emit(nullptr); +} + void DSZone::onSurfaceCreated(std::shared_ptr waylandSurface) { - //TODO: create DSWindow - //TODO: create DSRenderView + // create DSWindow + std::shared_ptr window = std::make_shared(); + __windowList.push_front(window); + + //TODO: fix the vaules of (x, y, w, h) + // DSWindow does not need to provide the interface to set the (x, y, w, h). + // Those values have to be determined by the window manager policy (DSWindowShell). + window->create(0, 0, 720, 1280, NULL); + + // emit a signal of the surface committed + __windowCreatedSignal.emit(window); } } // namespace display_server \ No newline at end of file diff --git a/src/DSZone/DSZone.h b/src/DSZone/DSZone.h index 8fa834f..58bea43 100644 --- a/src/DSZone/DSZone.h +++ b/src/DSZone/DSZone.h @@ -20,12 +20,21 @@ public: int getWidth(); int getHeight(); + // Callback methods + void registerCallbackWindowCreated(DSObject *slot, std::function)> func); + + // emit functions for testing + void callCallbackWindowCreated(); + private: void onSurfaceCreated(std::shared_ptr waylandSurface); std::shared_ptr __policyArea; std::list> __windowList; DSWaylandCompositor *__waylandCompositor; + + // signals + DSSignal> __windowCreatedSignal; }; } -- 2.7.4 From bd859249e3295f06b66fe76a5f235faedf39bb4f Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 28 Jul 2020 14:23:42 +0900 Subject: [PATCH 11/16] Test: add DSZone::registerCallbackWindowCreated test Change-Id: I8be9afd92c693c17816ead059508885c14ea3f75 --- tests/DSZone-test.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/tests/DSZone-test.cpp b/tests/DSZone-test.cpp index 0e813ce..8ec6a53 100644 --- a/tests/DSZone-test.cpp +++ b/tests/DSZone-test.cpp @@ -14,6 +14,33 @@ public: {} }; +class TestZone : public DSObject +{ +public: + TestZone(std::shared_ptr zone) + : __boolOnWindowCreated(false), + __zone(nullptr) + { + __zone->registerCallbackWindowCreated(this, std::bind(&TestZone::onWindowCreated, this, std::placeholders::_1)); + } + ~TestZone() + {} + + void callOnWindowCreated() { + __zone->callCallbackWindowCreated(); + } + bool getResultOnWindowCreated() { + return __boolOnWindowCreated; + } + void onWindowCreated(std::shared_ptr) { + __boolOnWindowCreated = true; + } + +private: + bool __boolOnWindowCreated; + std::shared_ptr __zone; +}; + TEST_F(DSZoneTest, NewDSZone) { auto policyArea = std::make_shared(); @@ -35,3 +62,18 @@ TEST_F(DSZoneTest, BasicMethods) EXPECT_TRUE(zone->getWidth() == 100); EXPECT_TRUE(zone->getHeight() == 100); } + +TEST_F(DSZoneTest, registerCallbackWindowCreated) +{ + auto policyArea = std::make_shared(); + EXPECT_TRUE(policyArea->setPosition(10, 10) == true); + EXPECT_TRUE(policyArea->setSize(100, 100) == true); + auto zone = std::make_shared(policyArea); + EXPECT_TRUE(zone != nullptr); + + auto testZone = std::make_shared(zone); + EXPECT_TRUE(testZone != nullptr); + + testZone->callOnWindowCreated(); + EXPECT_TRUE(testZone->getResultOnWindowCreated()); +} -- 2.7.4 From 2f175f0a4e85bd89a7c7d6c704f847a5dec88c00 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Wed, 29 Jul 2020 12:53:09 +0900 Subject: [PATCH 12/16] Test: fix the crash at DSZoneTest.registerCallbackWindowCreated Change-Id: If7516376623a7c80bb6d6a787312a7e6245a3daf --- src/DSZone/DSZone.cpp | 2 +- tests/DSZone-test.cpp | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index 0e83d01..1dddd80 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -49,7 +49,7 @@ int DSZone::getHeight() void DSZone::registerCallbackWindowCreated(DSObject *slot, std::function)> func) { - this->__windowCreatedSignal.connect(slot, func); + __windowCreatedSignal.connect(slot, func); } void DSZone::callCallbackWindowCreated() diff --git a/tests/DSZone-test.cpp b/tests/DSZone-test.cpp index 8ec6a53..c6e32da 100644 --- a/tests/DSZone-test.cpp +++ b/tests/DSZone-test.cpp @@ -18,21 +18,24 @@ class TestZone : public DSObject { public: TestZone(std::shared_ptr zone) - : __boolOnWindowCreated(false), - __zone(nullptr) + : __boolOnWindowCreated(false) { - __zone->registerCallbackWindowCreated(this, std::bind(&TestZone::onWindowCreated, this, std::placeholders::_1)); + zone->registerCallbackWindowCreated(this, std::bind(&TestZone::onWindowCreated, this, std::placeholders::_1)); + __zone = zone; } + ~TestZone() {} void callOnWindowCreated() { __zone->callCallbackWindowCreated(); } + bool getResultOnWindowCreated() { return __boolOnWindowCreated; } - void onWindowCreated(std::shared_ptr) { + + void onWindowCreated(std::shared_ptr window) { __boolOnWindowCreated = true; } -- 2.7.4 From 726c59eaee282d0e69a15a69497167d7110390f9 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Wed, 29 Jul 2020 10:14:16 +0900 Subject: [PATCH 13/16] DSCanvas: add registerCallbackWindowCreated and make renderView DSCanvas makes DSRenderView when DSZone creates the DSWindow. Change-Id: Ia9e180b26b45457a8e6c0fd58bbee9353ec534ec --- src/DSCanvas/DSCanvas.cpp | 6 ++++++ src/DSCanvas/DSCanvasPrivate.h | 4 +++- src/DSRender/DSRenderEngineDaliImpl.cpp | 4 ++-- src/DSRender/DSRenderEngineDaliImpl.h | 2 +- src/DSRender/DSRenderEngineEcoreEvasImpl.cpp | 4 ++-- src/DSRender/DSRenderEngineEcoreEvasImpl.h | 2 +- src/DSRender/DSRenderView.h | 5 +++-- src/DSRender/DSRenderViewDaliImpl.cpp | 3 ++- src/DSRender/DSRenderViewDaliImpl.h | 4 ++-- src/DSRender/DSRenderViewEcoreEvasImpl.cpp | 3 ++- src/DSRender/DSRenderViewEcoreEvasImpl.h | 3 ++- src/DSRender/IDSRenderEngine.h | 3 ++- tests/DSRenderEngineDaliImpl-test.cpp | 28 +++++++++++------------- tests/DSRenderEngineEcoreEvasImpl-test.cpp | 32 +++++++++++++++++----------- 14 files changed, 60 insertions(+), 43 deletions(-) diff --git a/src/DSCanvas/DSCanvas.cpp b/src/DSCanvas/DSCanvas.cpp index c200df4..7be8291 100644 --- a/src/DSCanvas/DSCanvas.cpp +++ b/src/DSCanvas/DSCanvas.cpp @@ -53,6 +53,7 @@ bool DSCanvasPrivate::attachPolicyArea(std::shared_ptr policyArea) } __zone = std::make_shared(policyArea); + __zone->registerCallbackWindowCreated(this, std::bind(&DSCanvasPrivate::__onWindowCreated, this, std::placeholders::_1)); return true; } @@ -88,4 +89,9 @@ bool DSCanvasPrivate::attachDisplayArea(std::shared_ptr displayAr return true; } +void DSCanvasPrivate::__onWindowCreated(std::shared_ptr window) +{ + std::shared_ptr renderView = __RenderEngine->makeRenderView(window); +} + } // namespace display_server diff --git a/src/DSCanvas/DSCanvasPrivate.h b/src/DSCanvas/DSCanvasPrivate.h index 2688f0a..fb98032 100644 --- a/src/DSCanvas/DSCanvasPrivate.h +++ b/src/DSCanvas/DSCanvasPrivate.h @@ -8,7 +8,7 @@ namespace display_server { -class DSCanvasPrivate : public DSObjectPrivate +class DSCanvasPrivate : public DSObjectPrivate, public DSObject { DS_PIMPL_USE_PUBLIC(DSCanvas); public: @@ -21,6 +21,8 @@ public: bool attachDisplayArea(std::shared_ptr displayArea); private: + void __onWindowCreated(std::shared_ptr window); + std::shared_ptr __zone; std::shared_ptr __displayArea; std::shared_ptr __RenderEngine; diff --git a/src/DSRender/DSRenderEngineDaliImpl.cpp b/src/DSRender/DSRenderEngineDaliImpl.cpp index 3bf7990..02245a6 100644 --- a/src/DSRender/DSRenderEngineDaliImpl.cpp +++ b/src/DSRender/DSRenderEngineDaliImpl.cpp @@ -12,9 +12,9 @@ DSRenderEngineDaliImpl::DSRenderEngineDaliImpl(std::shared_ptr b DSRenderEngineDaliImpl::~DSRenderEngineDaliImpl() {} -std::shared_ptr DSRenderEngineDaliImpl::makeRenderView() +std::shared_ptr DSRenderEngineDaliImpl::makeRenderView(std::shared_ptr window) { - std::shared_ptr renderView = std::make_shared(); + std::shared_ptr renderView = std::make_shared(window); return renderView; } diff --git a/src/DSRender/DSRenderEngineDaliImpl.h b/src/DSRender/DSRenderEngineDaliImpl.h index d50ac49..2b101e1 100644 --- a/src/DSRender/DSRenderEngineDaliImpl.h +++ b/src/DSRender/DSRenderEngineDaliImpl.h @@ -13,7 +13,7 @@ public: DSRenderEngineDaliImpl(std::shared_ptr bufferQueue); ~DSRenderEngineDaliImpl(); - std::shared_ptr makeRenderView() override; + std::shared_ptr makeRenderView(std::shared_ptr window) override; bool renderFrame() override; private: diff --git a/src/DSRender/DSRenderEngineEcoreEvasImpl.cpp b/src/DSRender/DSRenderEngineEcoreEvasImpl.cpp index 82bf8d1..c211ad5 100644 --- a/src/DSRender/DSRenderEngineEcoreEvasImpl.cpp +++ b/src/DSRender/DSRenderEngineEcoreEvasImpl.cpp @@ -44,9 +44,9 @@ DSRenderEngineEcoreEvasImpl::~DSRenderEngineEcoreEvasImpl() evas_shutdown(); } -std::shared_ptr DSRenderEngineEcoreEvasImpl::makeRenderView() +std::shared_ptr DSRenderEngineEcoreEvasImpl::makeRenderView(std::shared_ptr window) { - std::shared_ptr renderView = std::make_shared(__ee); + std::shared_ptr renderView = std::make_shared(__ee, window); return renderView; } diff --git a/src/DSRender/DSRenderEngineEcoreEvasImpl.h b/src/DSRender/DSRenderEngineEcoreEvasImpl.h index 163c7f2..5e9e696 100644 --- a/src/DSRender/DSRenderEngineEcoreEvasImpl.h +++ b/src/DSRender/DSRenderEngineEcoreEvasImpl.h @@ -14,7 +14,7 @@ public: DSRenderEngineEcoreEvasImpl(std::shared_ptr bufferQueue); ~DSRenderEngineEcoreEvasImpl(); - std::shared_ptr makeRenderView() override; + std::shared_ptr makeRenderView(std::shared_ptr window) override; bool renderFrame() override; private: diff --git a/src/DSRender/DSRenderView.h b/src/DSRender/DSRenderView.h index a76eaa2..d7b2e88 100644 --- a/src/DSRender/DSRenderView.h +++ b/src/DSRender/DSRenderView.h @@ -1,7 +1,8 @@ -#ifndef __DS_RENDER_VIEW_H_ -#define __DS_RENDER_VIEW_H_ +#ifndef __DS_RENDER_VIEW_H__ +#define __DS_RENDER_VIEW_H__ #include "IDSBuffer.h" +#include "DSWindow.h" #include namespace display_server diff --git a/src/DSRender/DSRenderViewDaliImpl.cpp b/src/DSRender/DSRenderViewDaliImpl.cpp index 5b83e3a..685fd48 100644 --- a/src/DSRender/DSRenderViewDaliImpl.cpp +++ b/src/DSRender/DSRenderViewDaliImpl.cpp @@ -3,7 +3,8 @@ namespace display_server { -DSRenderViewDaliImpl::DSRenderViewDaliImpl() +DSRenderViewDaliImpl::DSRenderViewDaliImpl(std::shared_ptr window) + : __window(window) {} DSRenderViewDaliImpl::~DSRenderViewDaliImpl() diff --git a/src/DSRender/DSRenderViewDaliImpl.h b/src/DSRender/DSRenderViewDaliImpl.h index 36990f1..d66b59f 100644 --- a/src/DSRender/DSRenderViewDaliImpl.h +++ b/src/DSRender/DSRenderViewDaliImpl.h @@ -9,13 +9,13 @@ namespace display_server class DSRenderViewDaliImpl : public DSRenderView { public: - DSRenderViewDaliImpl(); + DSRenderViewDaliImpl(std::shared_ptr window); ~DSRenderViewDaliImpl(); bool setBuffer(std::shared_ptr buffer) override; private: - /* data */ + std::shared_ptr __window; }; } diff --git a/src/DSRender/DSRenderViewEcoreEvasImpl.cpp b/src/DSRender/DSRenderViewEcoreEvasImpl.cpp index 8ce49be..15147e2 100644 --- a/src/DSRender/DSRenderViewEcoreEvasImpl.cpp +++ b/src/DSRender/DSRenderViewEcoreEvasImpl.cpp @@ -4,7 +4,8 @@ namespace display_server { -DSRenderViewEcoreEvasImpl::DSRenderViewEcoreEvasImpl(Ecore_Evas *ee) +DSRenderViewEcoreEvasImpl::DSRenderViewEcoreEvasImpl(Ecore_Evas *ee, std::shared_ptr window) + : __window(window) { __evasView = evas_object_image_filled_add(ecore_evas_get(ee)); evas_object_image_border_center_fill_set(__evasView, EVAS_BORDER_FILL_SOLID); diff --git a/src/DSRender/DSRenderViewEcoreEvasImpl.h b/src/DSRender/DSRenderViewEcoreEvasImpl.h index eca50a7..e82f54c 100644 --- a/src/DSRender/DSRenderViewEcoreEvasImpl.h +++ b/src/DSRender/DSRenderViewEcoreEvasImpl.h @@ -10,13 +10,14 @@ namespace display_server class DSRenderViewEcoreEvasImpl : public DSRenderView { public: - DSRenderViewEcoreEvasImpl(Ecore_Evas *ee); + DSRenderViewEcoreEvasImpl(Ecore_Evas *ee, std::shared_ptr window); ~DSRenderViewEcoreEvasImpl(); bool setBuffer(std::shared_ptr buffer) override; private: Evas_Object *__evasView; + std::shared_ptr __window; }; diff --git a/src/DSRender/IDSRenderEngine.h b/src/DSRender/IDSRenderEngine.h index 17d32cc..02f906d 100644 --- a/src/DSRender/IDSRenderEngine.h +++ b/src/DSRender/IDSRenderEngine.h @@ -2,6 +2,7 @@ #define __I_DS_RENDER_ENGINE_H_ #include "DSRenderView.h" +#include "DSWindow.h" #include namespace display_server @@ -12,7 +13,7 @@ class IDSRenderEngine public: virtual ~IDSRenderEngine() = default; - virtual std::shared_ptr makeRenderView() = 0; + virtual std::shared_ptr makeRenderView(std::shared_ptr window) = 0; virtual bool renderFrame() = 0; }; diff --git a/tests/DSRenderEngineDaliImpl-test.cpp b/tests/DSRenderEngineDaliImpl-test.cpp index 2dca108..daca8a1 100644 --- a/tests/DSRenderEngineDaliImpl-test.cpp +++ b/tests/DSRenderEngineDaliImpl-test.cpp @@ -17,36 +17,34 @@ public: TEST_F(DSRenderEngineDaliTest, RenderEngine_Create) { - std::shared_ptr bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); + auto bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(bufferQueue != nullptr); - - std::unique_ptr renderEngine = std::make_unique(bufferQueue); + auto renderEngine = std::make_unique(bufferQueue); EXPECT_TRUE(renderEngine != nullptr); } TEST_F(DSRenderEngineDaliTest, RenderEngine_CreateRenderView) { - std::shared_ptr bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); + auto bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(bufferQueue != nullptr); - - std::unique_ptr renderEngine = std::make_unique(bufferQueue); + auto renderEngine = std::make_unique(bufferQueue); EXPECT_TRUE(renderEngine != nullptr); - - std::shared_ptr renderView = renderEngine->makeRenderView(); + auto window = std::make_shared(); + EXPECT_TRUE(window != nullptr); + auto renderView = renderEngine->makeRenderView(window); EXPECT_TRUE(renderView != nullptr); } TEST_F(DSRenderEngineDaliTest, RenderView_SetBuffer) { - std::shared_ptr bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); + auto bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(bufferQueue != nullptr); - - std::unique_ptr renderEngine = std::make_unique(bufferQueue); + auto renderEngine = std::make_unique(bufferQueue); EXPECT_TRUE(renderEngine != nullptr); - - std::shared_ptr renderView = renderEngine->makeRenderView(); + auto window = std::make_shared(); + EXPECT_TRUE(window != nullptr); + auto renderView = renderEngine->makeRenderView(window); EXPECT_TRUE(renderView != nullptr); - - std::shared_ptr buffer = std::make_shared(100, 100, IDSBuffer::FORMAT_ARGB8888); + auto buffer = std::make_shared(100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(renderView->setBuffer(buffer)); } \ No newline at end of file diff --git a/tests/DSRenderEngineEcoreEvasImpl-test.cpp b/tests/DSRenderEngineEcoreEvasImpl-test.cpp index 6f04055..27db52f 100644 --- a/tests/DSRenderEngineEcoreEvasImpl-test.cpp +++ b/tests/DSRenderEngineEcoreEvasImpl-test.cpp @@ -16,43 +16,49 @@ public: TEST_F(DSRenderEngineEcoreEvasTest, RenderEngine_Create) { - std::shared_ptr bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); + auto bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(bufferQueue != nullptr); - std::unique_ptr renderEngine = std::make_unique(bufferQueue); + auto renderEngine = std::make_unique(bufferQueue); EXPECT_TRUE(renderEngine != nullptr); } TEST_F(DSRenderEngineEcoreEvasTest, RenderEngine_MakeRenderView) { - std::shared_ptr bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); + auto bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(bufferQueue != nullptr); - std::unique_ptr renderEngine = std::make_unique(bufferQueue); + auto renderEngine = std::make_unique(bufferQueue); EXPECT_TRUE(renderEngine != nullptr); - std::shared_ptr renderView = renderEngine->makeRenderView(); + auto window = std::make_shared(); + EXPECT_TRUE(window != nullptr); + auto renderView = renderEngine->makeRenderView(window); EXPECT_TRUE(renderView != nullptr); } TEST_F(DSRenderEngineEcoreEvasTest, RenderView_SetBuffer) { - std::shared_ptr bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); + auto bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(bufferQueue != nullptr); - std::unique_ptr renderEngine = std::make_unique(bufferQueue); + auto renderEngine = std::make_unique(bufferQueue); EXPECT_TRUE(renderEngine != nullptr); - std::shared_ptr renderView = renderEngine->makeRenderView(); + auto window = std::make_shared(); + EXPECT_TRUE(window != nullptr); + auto renderView = renderEngine->makeRenderView(window); EXPECT_TRUE(renderView != nullptr); - std::shared_ptr buffer = std::make_shared (100, 100, IDSBuffer::FORMAT_ARGB8888); + auto buffer = std::make_shared (100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(renderView->setBuffer(buffer)); } TEST_F(DSRenderEngineEcoreEvasTest, RenderEngine_RenderFrame) { - std::shared_ptr bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); + auto bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(bufferQueue != nullptr); - std::unique_ptr renderEngine = std::make_unique(bufferQueue); + auto renderEngine = std::make_unique(bufferQueue); EXPECT_TRUE(renderEngine != nullptr); - std::shared_ptr renderView = renderEngine->makeRenderView(); + auto window = std::make_shared(); + EXPECT_TRUE(window != nullptr); + auto renderView = renderEngine->makeRenderView(window); EXPECT_TRUE(renderView != nullptr); - std::shared_ptr buffer = std::make_shared (100, 100, IDSBuffer::FORMAT_ARGB8888); + auto buffer = std::make_shared (100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(renderView->setBuffer(buffer)); EXPECT_TRUE(renderEngine->renderFrame()); } -- 2.7.4 From bb267e04adec2c4b722a4c51d2e8fc3402811317 Mon Sep 17 00:00:00 2001 From: "Junseok, Kim" Date: Tue, 28 Jul 2020 21:18:37 +0900 Subject: [PATCH 14/16] DSWaylandTizenIndicator: add implementation of visible state change Change-Id: I5239d116859d37a470836e1b7c5987795b179e00 Signed-off-by: Junseok, Kim --- src/DSWaylandServer/DSWaylandTizenIndicator.cpp | 34 +++++++++++++++++++++- src/DSWaylandServer/DSWaylandTizenIndicator.h | 10 +++++++ .../DSWaylandTizenIndicatorPrivate.h | 6 +++- tests/DSWaylandTizenIndicator-test.cpp | 12 ++++++++ 4 files changed, 60 insertions(+), 2 deletions(-) diff --git a/src/DSWaylandServer/DSWaylandTizenIndicator.cpp b/src/DSWaylandServer/DSWaylandTizenIndicator.cpp index 68b0ef5..6e583c0 100644 --- a/src/DSWaylandServer/DSWaylandTizenIndicator.cpp +++ b/src/DSWaylandServer/DSWaylandTizenIndicator.cpp @@ -14,10 +14,24 @@ DSWaylandTizenIndicator::~DSWaylandTizenIndicator() { } +void DSWaylandTizenIndicator::setVisibleType(visible_type type) +{ + DS_GET_PRIV(DSWaylandTizenIndicator); + + priv->setVisibleType(type); +} +DSWaylandTizenIndicator::visible_type DSWaylandTizenIndicator::getVisibleType() +{ + DS_GET_PRIV(DSWaylandTizenIndicator); + + return priv->getVisibleType(); +} + DSWaylandTizenIndicatorPrivate::DSWaylandTizenIndicatorPrivate(DSWaylandTizenIndicator *p_ptr) : DSObjectPrivate(p_ptr), - __p_ptr(p_ptr) + __p_ptr(p_ptr), + __vis_type(DSWaylandTizenIndicator::DS_INDICATOR_VISIBLE_TYPE_UNKNOWN) { } @@ -42,6 +56,24 @@ void DSWaylandTizenIndicatorPrivate::tizen_indicator_set_opacity_mode(Resource * } void DSWaylandTizenIndicatorPrivate::tizen_indicator_set_visible_type(Resource *resource, struct ::wl_resource *surface, int32_t type) { + DSWaylandTizenIndicator::visible_type vtype = DSWaylandTizenIndicator::DS_INDICATOR_VISIBLE_TYPE_UNKNOWN; + + if (type == DSWaylandServer::tizen_indicator::visible_type_hidden) + vtype = DSWaylandTizenIndicator::DS_INDICATOR_VISIBLE_TYPE_HIDDEN; + else + vtype = DSWaylandTizenIndicator::DS_INDICATOR_VISIBLE_TYPE_SHOWN; + + this->setVisibleType(vtype); +} + +void DSWaylandTizenIndicatorPrivate::setVisibleType(DSWaylandTizenIndicator::visible_type type) +{ + this->__vis_type = type; +} + +DSWaylandTizenIndicator::visible_type DSWaylandTizenIndicatorPrivate::getVisibleType() +{ + return this->__vis_type; } diff --git a/src/DSWaylandServer/DSWaylandTizenIndicator.h b/src/DSWaylandServer/DSWaylandTizenIndicator.h index 7707134..b40eb91 100644 --- a/src/DSWaylandServer/DSWaylandTizenIndicator.h +++ b/src/DSWaylandServer/DSWaylandTizenIndicator.h @@ -14,8 +14,18 @@ class DSWaylandTizenIndicator : public DSObject DS_PIMPL_USE_PRIVATE(DSWaylandTizenIndicator); public: + + enum visible_type { + DS_INDICATOR_VISIBLE_TYPE_UNKNOWN = -1, + DS_INDICATOR_VISIBLE_TYPE_SHOWN, + DS_INDICATOR_VISIBLE_TYPE_HIDDEN, + }; + DSWaylandTizenIndicator(); virtual ~DSWaylandTizenIndicator(); + + void setVisibleType(visible_type type); + visible_type getVisibleType(); }; } diff --git a/src/DSWaylandServer/DSWaylandTizenIndicatorPrivate.h b/src/DSWaylandServer/DSWaylandTizenIndicatorPrivate.h index ae1a9df..28dc676 100644 --- a/src/DSWaylandServer/DSWaylandTizenIndicatorPrivate.h +++ b/src/DSWaylandServer/DSWaylandTizenIndicatorPrivate.h @@ -24,8 +24,12 @@ protected: void tizen_indicator_set_state(Resource *resource, struct ::wl_resource *surface, int32_t state) override; void tizen_indicator_set_opacity_mode(Resource *resource, struct ::wl_resource *surface, int32_t mode) override; void tizen_indicator_set_visible_type(Resource *resource, struct ::wl_resource *surface, int32_t type) override; -private: + void setVisibleType(DSWaylandTizenIndicator::visible_type type); + DSWaylandTizenIndicator::visible_type getVisibleType(); + +private: + DSWaylandTizenIndicator::visible_type __vis_type; }; } diff --git a/tests/DSWaylandTizenIndicator-test.cpp b/tests/DSWaylandTizenIndicator-test.cpp index d05c99e..61e8d63 100644 --- a/tests/DSWaylandTizenIndicator-test.cpp +++ b/tests/DSWaylandTizenIndicator-test.cpp @@ -20,3 +20,15 @@ TEST_F(DSWaylandTizenIndicatorTest, NewDSWaylandTizenIndicator) if (tzInd) delete tzInd; } + +TEST_F(DSWaylandTizenIndicatorTest, VisibleTypeSetGet) +{ + DSWaylandTizenIndicator *tzInd = new DSWaylandTizenIndicator; + EXPECT_TRUE(tzInd != nullptr); + + tzInd->setVisibleType(DSWaylandTizenIndicator::DS_INDICATOR_VISIBLE_TYPE_SHOWN); + EXPECT_TRUE(tzInd->getVisibleType() == DSWaylandTizenIndicator::DS_INDICATOR_VISIBLE_TYPE_SHOWN); + + if (tzInd) + delete tzInd; +} \ No newline at end of file -- 2.7.4 From 9d5b0ee162f6c0724f6679e174f9129201f85922 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Wed, 29 Jul 2020 11:18:01 +0900 Subject: [PATCH 15/16] DSDisplayArea: move the DSRenderEngine from DSCanvasPrivate to DSDisplayAreaPrivate Change-Id: If02a695d24518155f921687a53f1a800312558b3 --- src/DSCanvas/DSCanvas.cpp | 46 +++++++++++++------------------- src/DSCanvas/DSCanvasPrivate.h | 5 +--- src/DSDisplayArea/DSDisplayArea.cpp | 27 +++++++++++++++++-- src/DSDisplayArea/DSDisplayAreaPrivate.h | 10 ++++++- tests/DSCanvas-test.cpp | 26 ++++++++++-------- tests/DSDisplayArea-test.cpp | 41 ++++++++++++++-------------- 6 files changed, 89 insertions(+), 66 deletions(-) diff --git a/src/DSCanvas/DSCanvas.cpp b/src/DSCanvas/DSCanvas.cpp index 7be8291..e05c643 100644 --- a/src/DSCanvas/DSCanvas.cpp +++ b/src/DSCanvas/DSCanvas.cpp @@ -1,8 +1,7 @@ #include "DSCanvas.h" #include "DSCanvasPrivate.h" -#include "DSOutputImpl.h" -#include "DSRenderEngineEcoreEvasImpl.h" -#include "DSDebugLog.h" +#include "DSPolicyAreaPrivate.h" +#include "DSDisplayAreaPrivate.h" namespace display_server { @@ -38,8 +37,8 @@ DSCanvasPrivate::DSCanvasPrivate(DSCanvas *p_ptr) : DSObjectPrivate(p_ptr), __p_ptr(p_ptr), __zone(nullptr), - __displayArea(nullptr), - __RenderEngine(nullptr) + __policyArea(nullptr), + __displayArea(nullptr) {} DSCanvasPrivate::~DSCanvasPrivate() @@ -53,7 +52,15 @@ bool DSCanvasPrivate::attachPolicyArea(std::shared_ptr policyArea) } __zone = std::make_shared(policyArea); - __zone->registerCallbackWindowCreated(this, std::bind(&DSCanvasPrivate::__onWindowCreated, this, std::placeholders::_1)); + + // add zone to DSDisplayAreaPrivate + if (__displayArea) { + DSDisplayAreaPrivate *displayAreaPriv = DSDisplayAreaPrivate::getPrivate(__displayArea.get()); + if (displayAreaPriv) + displayAreaPriv->addZone(__zone); + } + + __policyArea = policyArea; return true; } @@ -65,23 +72,11 @@ bool DSCanvasPrivate::attachDisplayArea(std::shared_ptr displayAr return false; } - auto output = displayArea->getOutput(); - if (!output) { - DSLOG_ERR("DSCanvasPrivate", "output is null."); - return false; - } - - auto outputImpl = std::dynamic_pointer_cast(output); // down-casting of std::shared_ptr - auto bufferQueue = outputImpl->getDisplayBufferQueue(); - if (!bufferQueue) { - DSLOG_ERR("DSCanvasPrivate", "bufferQueue is null."); - return false; - } - - __RenderEngine = std::make_shared(bufferQueue); - if (!__RenderEngine) { - DSLOG_ERR("DSCanvasPrivate", "__RenderEngine is null."); - return false; + // add zone to DSDisplayAreaPrivate + if (__policyArea) { + DSDisplayAreaPrivate *displayAreaPriv = DSDisplayAreaPrivate::getPrivate(__displayArea.get()); + if (displayAreaPriv) + displayAreaPriv->addZone(__zone); } __displayArea = displayArea; @@ -89,9 +84,4 @@ bool DSCanvasPrivate::attachDisplayArea(std::shared_ptr displayAr return true; } -void DSCanvasPrivate::__onWindowCreated(std::shared_ptr window) -{ - std::shared_ptr renderView = __RenderEngine->makeRenderView(window); -} - } // namespace display_server diff --git a/src/DSCanvas/DSCanvasPrivate.h b/src/DSCanvas/DSCanvasPrivate.h index fb98032..ce34d63 100644 --- a/src/DSCanvas/DSCanvasPrivate.h +++ b/src/DSCanvas/DSCanvasPrivate.h @@ -3,7 +3,6 @@ #include "DSCanvas.h" #include "DSZone.h" -#include "IDSRenderEngine.h" namespace display_server { @@ -21,11 +20,9 @@ public: bool attachDisplayArea(std::shared_ptr displayArea); private: - void __onWindowCreated(std::shared_ptr window); - std::shared_ptr __zone; + std::shared_ptr __policyArea; std::shared_ptr __displayArea; - std::shared_ptr __RenderEngine; }; } diff --git a/src/DSDisplayArea/DSDisplayArea.cpp b/src/DSDisplayArea/DSDisplayArea.cpp index 32c931f..a716dbf 100644 --- a/src/DSDisplayArea/DSDisplayArea.cpp +++ b/src/DSDisplayArea/DSDisplayArea.cpp @@ -1,6 +1,7 @@ #include "DSDisplayArea.h" #include "DSDisplayAreaPrivate.h" -#include "DSDebugLog.h" +#include "DSOutputImpl.h" +#include "DSRenderEngineEcoreEvasImpl.h" namespace display_server { @@ -57,11 +58,22 @@ DSDisplayAreaPrivate::DSDisplayAreaPrivate(DSDisplayArea *p_ptr, std::shared_ptr : DSObjectPrivate(p_ptr), __p_ptr(p_ptr), __output(output), + __zone(nullptr), + __renderEngine(nullptr), __x(0), __y(0), __width(0), __height(0) -{} +{ + auto outputImpl = std::dynamic_pointer_cast(output); // down-casting of std::shared_ptr + auto bufferQueue = outputImpl->getDisplayBufferQueue(); + if (!bufferQueue) + DSLOG_ERR("DSDisplayAreaPrivate", "bufferQueue is null."); + + __renderEngine = std::make_shared(bufferQueue); + if (!__renderEngine) + DSLOG_ERR("DSCanvasPrivate", "__RenderEngine is null."); +} DSDisplayAreaPrivate::~DSDisplayAreaPrivate() {} @@ -103,5 +115,16 @@ std::shared_ptr DSDisplayAreaPrivate::getOutput() return __output; } +bool DSDisplayAreaPrivate::addZone(std::shared_ptr zone) +{ + __zone->registerCallbackWindowCreated(this, std::bind(&DSDisplayAreaPrivate::__onWindowCreated, this, std::placeholders::_1)); + + return true; +} + +void DSDisplayAreaPrivate::__onWindowCreated(std::shared_ptr window) +{ + std::shared_ptr renderView = __renderEngine->makeRenderView(window); +} } // namespace display_server diff --git a/src/DSDisplayArea/DSDisplayAreaPrivate.h b/src/DSDisplayArea/DSDisplayAreaPrivate.h index 3b8351a..b112f03 100644 --- a/src/DSDisplayArea/DSDisplayAreaPrivate.h +++ b/src/DSDisplayArea/DSDisplayAreaPrivate.h @@ -2,13 +2,16 @@ #define __DS_DISPLAY_AREA_PRIVATE_H__ #include "DSDisplayArea.h" +#include "DSWindow.h" +#include "DSZone.h" +#include "IDSRenderEngine.h" #include #include namespace display_server { -class DSDisplayAreaPrivate : public DSObjectPrivate +class DSDisplayAreaPrivate : public DSObjectPrivate, public DSObject { DS_PIMPL_USE_PUBLIC(DSDisplayArea); public: @@ -24,9 +27,14 @@ public: bool setOutput(std::shared_ptr output); std::shared_ptr getOutput(); + bool addZone(std::shared_ptr zone); private: + void __onWindowCreated(std::shared_ptr window); + std::shared_ptr __output; + std::shared_ptr __zone; + std::shared_ptr __renderEngine; int __x, __y; int __width, __height; }; diff --git a/tests/DSCanvas-test.cpp b/tests/DSCanvas-test.cpp index 5256163..4c88399 100644 --- a/tests/DSCanvas-test.cpp +++ b/tests/DSCanvas-test.cpp @@ -3,7 +3,7 @@ #include "IDSOutput.h" #include "DSOutputImpl.h" #include "IDSDisplayDeviceOutput.h" -#include "DSDisplayDeviceOutputTDMImpl.h" +#include "DSDisplayDeviceTDMImpl.h" using namespace display_server; @@ -18,13 +18,13 @@ public: TEST_F(DSCanvasTest, NewDSCanvas) { - std::unique_ptr canvas = std::make_unique(); + auto canvas = std::make_unique(); EXPECT_TRUE(canvas != nullptr); } TEST_F(DSCanvasTest, attachPolicyArea) { - std::unique_ptr canvas = std::make_unique(); + auto canvas = std::make_unique(); EXPECT_TRUE(canvas != nullptr); auto policyArea = std::make_shared(); EXPECT_TRUE(policyArea != nullptr); @@ -33,13 +33,17 @@ TEST_F(DSCanvasTest, attachPolicyArea) TEST_F(DSCanvasTest, displayArea_Negetive1) { - std::unique_ptr canvas = std::make_unique(); + auto canvas = std::make_unique(); EXPECT_TRUE(canvas != nullptr); - auto displayDeviceOutput = std::make_shared(); - EXPECT_TRUE(displayDeviceOutput != nullptr); - auto output = std::make_shared(displayDeviceOutput); - EXPECT_TRUE(output != nullptr); - auto displayArea = std::make_shared(output); - EXPECT_TRUE(displayArea != nullptr); - EXPECT_TRUE(canvas->attachDisplayArea(displayArea) == false); + + auto displayDevice = std::make_unique(); + auto outputList = displayDevice->getOutputList(); + for (auto displayDeviceOutput : outputList) { + auto output = std::make_shared(displayDeviceOutput); + EXPECT_TRUE(output != nullptr); + EXPECT_TRUE(output->applyResolutionAuto() == true); + auto displayArea = std::make_shared(output); + EXPECT_TRUE(displayArea != nullptr); + EXPECT_TRUE(canvas->attachDisplayArea(displayArea) == false); + } } diff --git a/tests/DSDisplayArea-test.cpp b/tests/DSDisplayArea-test.cpp index 2cbc48c..7fda1a5 100644 --- a/tests/DSDisplayArea-test.cpp +++ b/tests/DSDisplayArea-test.cpp @@ -3,7 +3,7 @@ #include "IDSOutput.h" #include "DSOutputImpl.h" #include "IDSDisplayDeviceOutput.h" -#include "DSDisplayDeviceOutputTDMImpl.h" +#include "DSDisplayDeviceTDMImpl.h" using namespace display_server; @@ -23,27 +23,28 @@ public: TEST_F(DSDisplayAreaTest, NewDSDisplayArea) { - auto displayDeviceOutput = std::make_shared(); - EXPECT_TRUE(displayDeviceOutput != nullptr); - auto output = std::make_shared(displayDeviceOutput); - EXPECT_TRUE(output != nullptr); - - auto displayArea = std::make_unique(output); - EXPECT_TRUE(displayArea != nullptr); + auto displayDevice = std::make_unique(); + auto outputList = displayDevice->getOutputList(); + for (auto displayDeviceOutput : outputList) { + auto output = std::make_shared(displayDeviceOutput); + EXPECT_TRUE(output != nullptr); + EXPECT_TRUE(output->applyResolutionAuto() == true); + auto displayArea = std::make_shared(output); + } } TEST_F(DSDisplayAreaTest, BasicMethods) { - auto displayDeviceOutput = std::make_shared(); - EXPECT_TRUE(displayDeviceOutput != nullptr); - auto output = std::make_shared(displayDeviceOutput); - EXPECT_TRUE(output != nullptr); - - auto displayArea = std::make_unique(output); - EXPECT_TRUE(displayArea != nullptr); - - EXPECT_TRUE(displayArea->setPosition(0, 0) != 0); - EXPECT_TRUE(displayArea->setSize(100, 100) != 0); - EXPECT_TRUE(displayArea->getHeight() != 0); - EXPECT_TRUE(displayArea->getWidth() != 0); + auto displayDevice = std::make_unique(); + auto outputList = displayDevice->getOutputList(); + for (auto displayDeviceOutput : outputList) { + auto output = std::make_shared(displayDeviceOutput); + EXPECT_TRUE(output != nullptr); + EXPECT_TRUE(output->applyResolutionAuto() == true); + auto displayArea = std::make_shared(output); + EXPECT_TRUE(displayArea->setPosition(0, 0) != 0); + EXPECT_TRUE(displayArea->setSize(100, 100) != 0); + EXPECT_TRUE(displayArea->getHeight() != 0); + EXPECT_TRUE(displayArea->getWidth() != 0); + } } -- 2.7.4 From 2383727985ce8c6a84780122eda386a2b44ca739 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Thu, 30 Jul 2020 08:26:08 +0900 Subject: [PATCH 16/16] DSStruct: add stSize structure Change-Id: Ieaea009eac15b923540ce7d13a349dfdc72b428e --- src/DSCore/DSStruct.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/DSCore/DSStruct.h b/src/DSCore/DSStruct.h index fb9aa51..01c997c 100644 --- a/src/DSCore/DSStruct.h +++ b/src/DSCore/DSStruct.h @@ -7,6 +7,7 @@ namespace display_server { using stPosition = struct _stPosition; +using stSize = struct _stSize; using stRect = struct _stRect; using stGeometry = struct _stGeometry; @@ -16,6 +17,12 @@ struct _stPosition int y; }; +struct _stSize +{ + unsigned int w; + unsigned int h; +}; + struct _stRect { int x; -- 2.7.4