From 30808f5ed6638559d61f5479cf142b8a7772f807 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Mon, 24 Aug 2020 19:49:08 +0900 Subject: [PATCH 01/16] DSWindow: add APIs for allow user geometry Change-Id: I2fe296819d10c3a3ee5ba6c65c298335c5d5dd74 --- src/DSWindow/DSWindow.cpp | 23 +++++++++++++++++++++++ src/DSWindow/DSWindow.h | 3 +++ src/DSWindow/DSWindowPrivate.h | 4 ++++ tests/DSWindow-test.cpp | 11 +++++++++++ 4 files changed, 41 insertions(+) diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index acf1e07..3e5597f 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -47,6 +47,7 @@ DSWindowPrivate::DSWindowPrivate(DSWindow *p_ptr) __firstCommit(true), __changedGeometry(false), __acceptsFocus(true), + __allowUserGeometry(false), __title(""), __vkbd_floating(false) { @@ -120,6 +121,16 @@ bool DSWindowPrivate::getSkipFocus(void) return true; } +void DSWindowPrivate::allowUserGeometry(bool set) +{ + __allowUserGeometry = set; +} + +bool DSWindowPrivate::isAllowUserGeometry(void) +{ + return __allowUserGeometry; +} + bool DSWindowPrivate::setLayer(int layer) { return true; @@ -311,6 +322,18 @@ bool DSWindow::getSkipFocus(void) return priv->getSkipFocus(); } +void DSWindow::allowUserGeometry(bool set) +{ + DS_GET_PRIV(DSWindow); + priv->allowUserGeometry(set); +} + +bool DSWindow::isAllowUserGeometry(void) +{ + DS_GET_PRIV(DSWindow); + return priv->isAllowUserGeometry(); +} + bool DSWindow::setLayer(int layer) { DS_GET_PRIV(DSWindow); diff --git a/src/DSWindow/DSWindow.h b/src/DSWindow/DSWindow.h index 4f1922a..4426809 100644 --- a/src/DSWindow/DSWindow.h +++ b/src/DSWindow/DSWindow.h @@ -62,6 +62,9 @@ public: bool setSkipFocus(bool set); bool getSkipFocus(void); + void allowUserGeometry(bool set); + bool isAllowUserGeometry(void); + bool setLayer(int layer); bool raise(void); bool lower(void); diff --git a/src/DSWindow/DSWindowPrivate.h b/src/DSWindow/DSWindowPrivate.h index f250484..2e6e642 100644 --- a/src/DSWindow/DSWindowPrivate.h +++ b/src/DSWindow/DSWindowPrivate.h @@ -59,6 +59,9 @@ public: bool setSkipFocus(bool set); bool getSkipFocus(void); + void allowUserGeometry(bool set); + bool isAllowUserGeometry(void); + bool setLayer(int layer); bool raise(void); bool lower(void); @@ -92,6 +95,7 @@ private: bool __firstCommit; bool __changedGeometry; bool __acceptsFocus; + bool __allowUserGeometry; std::string __title; bool __vkbd_floating; diff --git a/tests/DSWindow-test.cpp b/tests/DSWindow-test.cpp index d591563..88f8b48 100644 --- a/tests/DSWindow-test.cpp +++ b/tests/DSWindow-test.cpp @@ -184,3 +184,14 @@ TEST_F(DSWindowTest, ParentTest) EXPECT_TRUE(child->getParent() == nullptr); } +TEST_F(DSWindowTest, UserGeometryTest) +{ + auto win = std::make_shared(); + EXPECT_TRUE(win != nullptr); + + EXPECT_FALSE(win->isAllowUserGeometry()); + + win->allowUserGeometry(true); + EXPECT_TRUE(win->isAllowUserGeometry()); +} + -- 2.7.4 From bd7b0a3008bc29903df21d93def72b945ff6e3b1 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Mon, 24 Aug 2020 19:59:21 +0900 Subject: [PATCH 02/16] DSWindowShell: add APIs for handle aux hint Change-Id: I40eb0294e63c70f44b44f3f5d1e745f508b1604e --- src/DSWindowShell/DSWindowShell.cpp | 18 +++++ src/DSWindowShell/DSWindowShell.h | 4 ++ src/DSWindowShell/DSWindowShellPrivate.cpp | 112 ++++++++++++++++++++++++++++- src/DSWindowShell/DSWindowShellPrivate.h | 17 +++++ 4 files changed, 148 insertions(+), 3 deletions(-) diff --git a/src/DSWindowShell/DSWindowShell.cpp b/src/DSWindowShell/DSWindowShell.cpp index c6a0e7c..6863736 100644 --- a/src/DSWindowShell/DSWindowShell.cpp +++ b/src/DSWindowShell/DSWindowShell.cpp @@ -146,6 +146,24 @@ stGeometry DSWindowShell::getGeometry(void) return priv->getGeometry(); } +void DSWindowShell::addAuxHint(int32_t id, const std::string &name, const std::string &value) +{ + DS_GET_PRIV(DSWindowShell); + priv->addAuxHint(id, name, value); +} + +void DSWindowShell::changeAuxHint(int32_t id, const std::string &value) +{ + DS_GET_PRIV(DSWindowShell); + priv->changeAuxHint(id, value); +} + +void DSWindowShell::removeAuxHint(int32_t id) +{ + DS_GET_PRIV(DSWindowShell); + priv->removeAuxHint(id); +} + bool DSWindowShell::show(void) { DS_GET_PRIV(DSWindowShell); diff --git a/src/DSWindowShell/DSWindowShell.h b/src/DSWindowShell/DSWindowShell.h index 0fe1f6d..f5a76f2 100644 --- a/src/DSWindowShell/DSWindowShell.h +++ b/src/DSWindowShell/DSWindowShell.h @@ -70,6 +70,10 @@ public: bool setGeometry(int x, int y, unsigned int w, unsigned int h); stGeometry getGeometry(void); + void addAuxHint(int32_t id, const std::string &name, const std::string &value); + void changeAuxHint(int32_t id, const std::string &value); + void removeAuxHint(int32_t id); + bool show(void); bool hide(bool autoFocus = true); int showState(void); diff --git a/src/DSWindowShell/DSWindowShellPrivate.cpp b/src/DSWindowShell/DSWindowShellPrivate.cpp index 5119f90..928bee4 100644 --- a/src/DSWindowShell/DSWindowShellPrivate.cpp +++ b/src/DSWindowShell/DSWindowShellPrivate.cpp @@ -27,8 +27,36 @@ namespace display_server { -struct DTWindowShell -{ +enum _Hint_Type +{ + DS_WINDOW_HINT_USER_GEOMETRY = 0, + DS_WINDOW_HINT_FIXED_RESIZE = 1, + DS_WINDOW_HINT_DEICONIFY_UPDATE = 2, + DS_WINDOW_HINT_ICONIFY = 3, + DS_WINDOW_HINT_ABOVE_LOCKSCREEN = 4, + DS_WINDOW_HINT_GESTURE_DISABLE = 5, + DS_WINDOW_HINT_EFFECT_DISABLE = 6, + DS_WINDOW_HINT_MSG_USE = 7, + DS_WINDOW_HINT_ALWAYS_SELECTIVE = 8, + DS_WINDOW_HINT_DEPENDENT_ROTATION = 9, + DS_WINDOW_HINT_ROT_RENDER_NOPENDING = 10, + DS_WINDOW_HINT_ICONIFY_BUFFER_FLUSH = 11, +}; + +static const char *sHintNames[] = +{ + "wm.policy.win.user.geometry", + "wm.policy.win.fixed.resize", + "wm.policy.win.deiconify.update", + "wm.policy.win.iconify", + "wm.policy.win.above.lock", + "wm.policy.win.gesture.disable", + "wm.policy.win.effect.disable", + "wm.policy.win.msg.use", + "wm.comp.win.always.selective.mode", + "wm.policy.win.rot.dependent", + "wm.policy.win.rot.render.nopending", + "wm.policy.win.iconify.buffer.flush", }; DSWindowShellPrivate::DSWindowShellPrivate(DSWindowShell *p_ptr, DSWindow *window) @@ -46,7 +74,10 @@ DSWindowShellPrivate::DSWindowShellPrivate(DSWindowShell *p_ptr, DSWindow *windo DSWindowShellPrivate::~DSWindowShellPrivate() { - + for (stWindowAuxHint *hint : __auxHintsList) + { + delete hint; + } } bool DSWindowShellPrivate::__findInChildList(DSWindowShell *parentWinShell) @@ -99,6 +130,34 @@ bool DSWindowShellPrivate::__setParent(DSWindowShell *parentWinShell) return true; } +struct stWindowAuxHint *DSWindowShellPrivate::__findAuxHint(int32_t id) +{ + for (stWindowAuxHint* hint : __auxHintsList) + { + if (hint->id == id) + return hint; + } + + return nullptr; +} + +void DSWindowShellPrivate::__handleAuxHint(stWindowAuxHint *hint) +{ + if (!__window) return; + + // do something for each hints + if (hint->name == sHintNames[DS_WINDOW_HINT_USER_GEOMETRY]) // user geometry + { + bool set; + + if (hint->value == "1") + set = true; + else + set = false; + + __window->allowUserGeometry(set); + } +} bool DSWindowShellPrivate::create(DSWindowShell *pParent) { @@ -244,6 +303,53 @@ stGeometry DSWindowShellPrivate::getGeometry(void) return geo; } +void DSWindowShellPrivate::addAuxHint(int32_t id, const std::string &name, const std::string &value) +{ + stWindowAuxHint *hint; + hint = __findAuxHint(id); + if (!hint) + { + hint = new stWindowAuxHint(); + if (!hint) return; + + __auxHintsList.push_back(hint); + } + + hint->id = id; + hint->name = name; + hint->value = value; + hint->changed = true; + hint->deleted = false; + + DSLOG_DBG("DSWindowShell", "Add aux hint... id:%d, name:%s, value:%s", id, name.c_str(), value.c_str()); + + __handleAuxHint(hint); +} + +void DSWindowShellPrivate::changeAuxHint(int32_t id, const std::string &value) +{ + stWindowAuxHint *hint; + hint = __findAuxHint(id); + if (!hint) return; + + hint->value = value; + hint->changed = true; + + __handleAuxHint(hint); +} + +void DSWindowShellPrivate::removeAuxHint(int32_t id) +{ + stWindowAuxHint *hint; + hint = __findAuxHint(id); + if (!hint) return; + + hint->changed = true; + hint->deleted = true; + + __auxHintsList.remove(hint); +} + bool DSWindowShellPrivate::show(void) { return true; diff --git a/src/DSWindowShell/DSWindowShellPrivate.h b/src/DSWindowShell/DSWindowShellPrivate.h index 454f23d..df1e9c8 100644 --- a/src/DSWindowShell/DSWindowShellPrivate.h +++ b/src/DSWindowShell/DSWindowShellPrivate.h @@ -29,6 +29,15 @@ namespace display_server { +struct stWindowAuxHint +{ + int32_t id; + std::string name; + std::string value; + bool changed; + bool deleted; +}; + class DSWindowShellPrivate { DS_PIMPL_USE_PUBLIC(DSWindowShell) @@ -66,6 +75,10 @@ public: bool setGeometry(int x, int y, unsigned int w, unsigned int h); stGeometry getGeometry(void); + void addAuxHint(int32_t id, const std::string &name, const std::string &value); + void changeAuxHint(int32_t id, const std::string &value); + void removeAuxHint(int32_t id); + bool show(void); bool hide(bool autoFocus = true); int showState(void); @@ -111,6 +124,9 @@ private: bool __findInChildList(DSWindowShell *parentWinShell); bool __setParent(DSWindowShell *parentWinShell); + struct stWindowAuxHint* __findAuxHint(int32_t id); + void __handleAuxHint(stWindowAuxHint *hint); + private: DSWindow *__window; IDSWaylandShellSurface *__shellSurface; @@ -121,6 +137,7 @@ private: DSWindowShell *__parent; int __layer; std::list __childList; + std::list __auxHintsList; }; } -- 2.7.4 From 75705d9146c8854226401a9771e660f711046a8e Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Mon, 24 Aug 2020 20:00:19 +0900 Subject: [PATCH 03/16] DSZone: add APIs for handling window's aux hint Change-Id: Idc4e1173fe05b767a487e3d0600b196ce5d63027 --- src/DSZone/DSZone.cpp | 37 +++++++++++++++++++++++++++++++++++++ src/DSZone/DSZone.h | 8 ++++++++ 2 files changed, 45 insertions(+) diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index bf2700f..ebbdae4 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -59,6 +59,8 @@ DSZone::DSZone() if (__waylandShell) __waylandShell->registerCallbackShellSurfaceCreated(this, std::bind(&DSZone::__onShellSurfaceCreated, this, std::placeholders::_1)); } + + __setSupportAuxHints(); } DSZone::~DSZone() @@ -73,6 +75,11 @@ DSZone::~DSZone() DSWaylandCompositor::releaseInstance(); } +void DSZone::__setSupportAuxHints(void) +{ + __supportedAuxHints.push_back("wm.policy.win.user.geometry"); +} + void DSZone::setPosition(stPosition &position) { __position.x = position.x; @@ -413,6 +420,36 @@ bool DSZone::setWindowPosition(DSWaylandSurface *dswSurface, int x, int y) */ } +void DSZone::addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value) +{ + DSWindowShell *wShell = __findWindowShell(dswlSurface); + if (!wShell) return; + + wShell->addAuxHint(id, name, value); +} + +void DSZone::changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value) +{ + DSWindowShell *wShell = __findWindowShell(dswlSurface); + if (!wShell) return; + + wShell->changeAuxHint(id, value); +} + +void DSZone::removeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id) +{ + DSWindowShell *wShell = __findWindowShell(dswlSurface); + if (!wShell) return; + + wShell->removeAuxHint(id); +} + +std::list DSZone::getWindowSupportedAuxHints(DSWaylandSurface *dswlSurface) +{ + // TODO: we have to change code to use DSPolicy instead of DSZone + return __supportedAuxHints; +} + void DSZone::activateWindow(DSWaylandSurface *dswlSurface) { if (!dswlSurface) return; diff --git a/src/DSZone/DSZone.h b/src/DSZone/DSZone.h index acb3a61..96068bc 100644 --- a/src/DSZone/DSZone.h +++ b/src/DSZone/DSZone.h @@ -70,6 +70,11 @@ public: bool setWindowGeometry(DSWaylandSurface *dswSurface, int x, int y, unsigned int w, unsigned h); bool setWindowPosition(DSWaylandSurface *dswSurface, int x, int y); + void addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value); + void changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value); + void removeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id); + std::list getWindowSupportedAuxHints(DSWaylandSurface *dswlSurface); + void activateWindow(DSWaylandSurface *dswlSurface); void raiseWindow(DSWaylandSurface* dswlSurface); void lowerWindow(DSWaylandSurface* dswlSurface); @@ -103,6 +108,8 @@ private: std::shared_ptr __findWindow(DSWaylandSurface *dswlSurface); DSWindowShell* __findWindowShell(DSWaylandSurface *dswlSurface); + void __setSupportAuxHints(void); + stPosition __position; stSize __size; std::list> __windowList; @@ -114,6 +121,7 @@ private: bool __stackChanged; std::map __windowShellMap; + std::list __supportedAuxHints; // signals DSSignal> __windowCreatedSignal; -- 2.7.4 From 6179da647a7f0e825f5421028d2c125475fe63ef Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Mon, 24 Aug 2020 20:10:11 +0900 Subject: [PATCH 04/16] DSWindowManager: add APIs for handling window's aux hint Change-Id: I0f80f64f0ce068a2a19693e3512c987bdd195858 --- src/DSWindowManager/DSWindowManager.cpp | 64 ++++++++++++++++++++++++++++ src/DSWindowManager/DSWindowManager.h | 5 +++ src/DSWindowManager/DSWindowManagerPrivate.h | 5 +++ 3 files changed, 74 insertions(+) diff --git a/src/DSWindowManager/DSWindowManager.cpp b/src/DSWindowManager/DSWindowManager.cpp index 3fc3e44..1364b87 100644 --- a/src/DSWindowManager/DSWindowManager.cpp +++ b/src/DSWindowManager/DSWindowManager.cpp @@ -269,6 +269,46 @@ void DSWindowManagerPrivate::setWindowPosition(DSWaylandSurface *dsSurface, int } } +void DSWindowManagerPrivate::addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value) +{ + // find dsSurface's window + DSZone *zone = __getZone(dswlSurface); + if (!zone) return; + + zone->addWindowAuxHint(dswlSurface, id, name, value); +} + +void DSWindowManagerPrivate::changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value) +{ + // find dsSurface's window + DSZone *zone = __getZone(dswlSurface); + if (!zone) return; + + zone->changeWindowAuxHint(dswlSurface, id, value); +} + +void DSWindowManagerPrivate::removeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id) +{ + // find dsSurface's window + DSZone *zone = __getZone(dswlSurface); + if (!zone) return; + + zone->removeWindowAuxHint(dswlSurface, id); +} + +std::list DSWindowManagerPrivate::getWindowSupportedAuxHints(DSWaylandSurface *dswlSurface) +{ + // find dsSurface's window + DSZone *zone = __getZone(dswlSurface); + if (!zone) + { + std::list nullList; + return nullList; + } + + return zone->getWindowSupportedAuxHints(dswlSurface); +} + void DSWindowManagerPrivate::activateWindow(DSWaylandSurface *dswlSurface) { // find dswlSurface's window @@ -462,6 +502,30 @@ void DSWindowManager::setWindowPosition(DSWaylandSurface *dsSurface, int x, int priv->setWindowPosition(dsSurface, x, y); } +void DSWindowManager::addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value) +{ + DS_GET_PRIV(DSWindowManager); + priv->addWindowAuxHint(dswlSurface, id, name, value); +} + +void DSWindowManager::changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value) +{ + DS_GET_PRIV(DSWindowManager); + priv->changeWindowAuxHint(dswlSurface, id, value); +} + +void DSWindowManager::removeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id) +{ + DS_GET_PRIV(DSWindowManager); + priv->removeWindowAuxHint(dswlSurface, id); +} + +std::list DSWindowManager::getWindowSupportedAuxHints(DSWaylandSurface *dswlSurface) +{ + DS_GET_PRIV(DSWindowManager); + return priv->getWindowSupportedAuxHints(dswlSurface); +} + void DSWindowManager::activateWindow(DSWaylandSurface *dswlSurface) { DS_GET_PRIV(DSWindowManager); diff --git a/src/DSWindowManager/DSWindowManager.h b/src/DSWindowManager/DSWindowManager.h index c11a495..79d7893 100644 --- a/src/DSWindowManager/DSWindowManager.h +++ b/src/DSWindowManager/DSWindowManager.h @@ -61,6 +61,11 @@ public: void setWindowGeometry(DSWaylandSurface *dsSurface, int x, int y, unsigned int w, unsigned h); void setWindowPosition(DSWaylandSurface *dsSurface, int x, int y); + void addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value); + void changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value); + void removeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id); + std::list getWindowSupportedAuxHints(DSWaylandSurface *dswlSurface); + void activateWindow(DSWaylandSurface *dswlSurface); void raiseWindow(DSWaylandSurface *dswlSurface); void lowerWindow(DSWaylandSurface *dswlSurface); diff --git a/src/DSWindowManager/DSWindowManagerPrivate.h b/src/DSWindowManager/DSWindowManagerPrivate.h index 28f6ec2..6b80037 100644 --- a/src/DSWindowManager/DSWindowManagerPrivate.h +++ b/src/DSWindowManager/DSWindowManagerPrivate.h @@ -56,6 +56,11 @@ public: void setWindowGeometry(DSWaylandSurface *dsSurface, int x, int y, unsigned int w, unsigned h); void setWindowPosition(DSWaylandSurface *dsSurface, int x, int y); + void addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value); + void changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value); + void removeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id); + std::list getWindowSupportedAuxHints(DSWaylandSurface *dswlSurface); + void activateWindow(DSWaylandSurface *dswlSurface); void raiseWindow(DSWaylandSurface *dswlSurface); void lowerWindow(DSWaylandSurface *dswlSurface); -- 2.7.4 From 6a81ee750f1624d1f1ab59d6e97cfd5dbbbbf542 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Mon, 24 Aug 2020 20:10:54 +0900 Subject: [PATCH 05/16] DSWaylandTizenPolicy: implements functions for handling aux hint Change-Id: Ia848f749763b4c26b8645c824f7221e8005129f4 --- src/DSWaylandServer/DSWaylandTizenPolicy.cpp | 53 +++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/src/DSWaylandServer/DSWaylandTizenPolicy.cpp b/src/DSWaylandServer/DSWaylandTizenPolicy.cpp index 2ccef52..6b0f1fa 100644 --- a/src/DSWaylandServer/DSWaylandTizenPolicy.cpp +++ b/src/DSWaylandServer/DSWaylandTizenPolicy.cpp @@ -239,22 +239,67 @@ void DSWaylandTizenPolicyPrivate::tizen_policy_uniconify(Resource *resource, str void DSWaylandTizenPolicyPrivate::tizen_policy_add_aux_hint(Resource *resource, struct ::wl_resource *surface, int32_t id, const std::string &name, const std::string &value) { - DSLOG_DBG("TizenPolicyPriv", ""); + DSLOG_DBG("TizenPolicyPriv", "Add aux hint (id:%d, key:%s, value:%s)", id, name.c_str(), value.c_str()); + + DSWaylandSurface *dswlSurface = DSWaylandSurface::fromWlResource(surface); + if (!dswlSurface) return; + if (!__wm) return; + + __wm->addWindowAuxHint(dswlSurface, id, name, value); } void DSWaylandTizenPolicyPrivate::tizen_policy_change_aux_hint(Resource *resource, struct ::wl_resource *surface, int32_t id, const std::string &value) { - DSLOG_DBG("TizenPolicyPriv", ""); + DSLOG_DBG("TizenPolicyPriv", "Change aux hint (id:%d, value:%s)", id, value.c_str()); + + DSWaylandSurface *dswlSurface = DSWaylandSurface::fromWlResource(surface); + if (!dswlSurface) return; + if (!__wm) return; + + __wm->changeWindowAuxHint(dswlSurface, id, value); } void DSWaylandTizenPolicyPrivate::tizen_policy_del_aux_hint(Resource *resource, struct ::wl_resource *surface, int32_t id) { - DSLOG_DBG("TizenPolicyPriv", ""); + DSLOG_DBG("TizenPolicyPriv", "Delete aux hint (id:%d)", id); + + DSWaylandSurface *dswlSurface = DSWaylandSurface::fromWlResource(surface); + if (!dswlSurface) return; + if (!__wm) return; + + __wm->removeWindowAuxHint(dswlSurface, id); } void DSWaylandTizenPolicyPrivate::tizen_policy_get_supported_aux_hints(Resource *resource, struct ::wl_resource *surface) { - DSLOG_DBG("TizenPolicyPriv", ""); + DSLOG_DBG("TizenPolicyPriv", "resource:%p, surface:%p", resource, surface); + + DSWaylandSurface *dswlSurface = DSWaylandSurface::fromWlResource(surface); + if (!dswlSurface) return; + if (!__wm) return; + + struct wl_array hints; + int len; + int numOfHints = 0; + char *p; + std::list hints_list; + + hints_list = __wm->getWindowSupportedAuxHints(dswlSurface); + numOfHints = hints_list.size(); + + wl_array_init(&hints); + for (std::string hintName : hints_list) + { + len = hintName.length() + 1; + p = (char*)wl_array_add(&hints, len); + + if (p == NULL) + break; + hintName.copy(p, len); + } + + send_supported_aux_hints(resource->handle, surface, &hints, numOfHints); + wl_array_release(&hints); } void DSWaylandTizenPolicyPrivate::tizen_policy_set_background_state(Resource *resource, uint32_t pid) -- 2.7.4 From 49059dd16f4f87528a703604070568dd40b0b3dc Mon Sep 17 00:00:00 2001 From: jeon Date: Tue, 25 Aug 2020 07:56:44 +0900 Subject: [PATCH 06/16] DSWindowManager: add a API to get window geometry Change-Id: Ide5af8ae79888c2ddcea65d6c7c74fe0b5c6677f --- src/DSWindowManager/DSWindowManager.cpp | 17 +++++++++++++++++ src/DSWindowManager/DSWindowManager.h | 2 ++ src/DSWindowManager/DSWindowManagerPrivate.h | 1 + src/DSZone/DSZone.cpp | 9 +++++++++ src/DSZone/DSZone.h | 1 + 5 files changed, 30 insertions(+) diff --git a/src/DSWindowManager/DSWindowManager.cpp b/src/DSWindowManager/DSWindowManager.cpp index 1364b87..4e8e32c 100644 --- a/src/DSWindowManager/DSWindowManager.cpp +++ b/src/DSWindowManager/DSWindowManager.cpp @@ -269,6 +269,17 @@ void DSWindowManagerPrivate::setWindowPosition(DSWaylandSurface *dsSurface, int } } +stGeometry DSWindowManagerPrivate::getWindowGeometry(DSWaylandSurface *dsSurface) +{ + DSZone *zone = __getZone(dsSurface); + stGeometry geometry = {0, }; + if (zone) + { + return zone->getWindowGeometry(dsSurface); + } + return geometry; +} + void DSWindowManagerPrivate::addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value) { // find dsSurface's window @@ -502,6 +513,12 @@ void DSWindowManager::setWindowPosition(DSWaylandSurface *dsSurface, int x, int priv->setWindowPosition(dsSurface, x, y); } +stGeometry DSWindowManager::getWindowGeometry(DSWaylandSurface *dsSurface) +{ + DS_GET_PRIV(DSWindowManager); + return priv->getWindowGeometry(dsSurface); +} + void DSWindowManager::addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value) { DS_GET_PRIV(DSWindowManager); diff --git a/src/DSWindowManager/DSWindowManager.h b/src/DSWindowManager/DSWindowManager.h index 79d7893..838b821 100644 --- a/src/DSWindowManager/DSWindowManager.h +++ b/src/DSWindowManager/DSWindowManager.h @@ -26,6 +26,7 @@ #include "DSCore.h" #include "DSObject.h" +#include "DSStruct.h" namespace display_server { @@ -60,6 +61,7 @@ public: void setWindowType(DSWaylandSurface *dsSurface, int type); void setWindowGeometry(DSWaylandSurface *dsSurface, int x, int y, unsigned int w, unsigned h); void setWindowPosition(DSWaylandSurface *dsSurface, int x, int y); + stGeometry getWindowGeometry(DSWaylandSurface *dsSurface); void addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value); void changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value); diff --git a/src/DSWindowManager/DSWindowManagerPrivate.h b/src/DSWindowManager/DSWindowManagerPrivate.h index 6b80037..e40eadc 100644 --- a/src/DSWindowManager/DSWindowManagerPrivate.h +++ b/src/DSWindowManager/DSWindowManagerPrivate.h @@ -55,6 +55,7 @@ public: void setWindowType(DSWaylandSurface *dsSurface, int type); void setWindowGeometry(DSWaylandSurface *dsSurface, int x, int y, unsigned int w, unsigned h); void setWindowPosition(DSWaylandSurface *dsSurface, int x, int y); + stGeometry getWindowGeometry(DSWaylandSurface *dsSurface); void addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value); void changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value); diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index ebbdae4..9174851 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -420,6 +420,15 @@ bool DSZone::setWindowPosition(DSWaylandSurface *dswSurface, int x, int y) */ } +stGeometry DSZone::getWindowGeometry(DSWaylandSurface *dswSurface) +{ + stGeometry geometry = {0, }; + DSWindowShell *wShell = __findWindowShell(dswSurface); + if (!wShell) return geometry; + + return wShell->getGeometry(); +} + void DSZone::addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value) { DSWindowShell *wShell = __findWindowShell(dswlSurface); diff --git a/src/DSZone/DSZone.h b/src/DSZone/DSZone.h index 96068bc..48df95a 100644 --- a/src/DSZone/DSZone.h +++ b/src/DSZone/DSZone.h @@ -69,6 +69,7 @@ public: bool setWindowType(DSWaylandSurface *dswSurface, int type); bool setWindowGeometry(DSWaylandSurface *dswSurface, int x, int y, unsigned int w, unsigned h); bool setWindowPosition(DSWaylandSurface *dswSurface, int x, int y); + stGeometry getWindowGeometry(DSWaylandSurface *dswSurface); void addWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &name, const std::string &value); void changeWindowAuxHint(DSWaylandSurface *dswlSurface, int32_t id, const std::string &value); -- 2.7.4 From 4d82076cda2163cee3414198438b517d44807910 Mon Sep 17 00:00:00 2001 From: jeon Date: Tue, 25 Aug 2020 10:47:27 +0900 Subject: [PATCH 07/16] DSDebug: null check after getenv and strdup Change-Id: I9f82aa12b71c95b930958be6d30d04d1e9bfa232 --- src/DSDebug/DSDebugLog.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/DSDebug/DSDebugLog.cpp b/src/DSDebug/DSDebugLog.cpp index 3966335..bd579df 100644 --- a/src/DSDebug/DSDebugLog.cpp +++ b/src/DSDebug/DSDebugLog.cpp @@ -33,18 +33,20 @@ namespace display_server { -DSDebugLog::DSDebugLog() : mLogLevel(LOG_LEVEL_DEBUG) +DSDebugLog::DSDebugLog() : mLogLevel(LOG_LEVEL_DEBUG), __enableDlog(false) { char *tmp = getenv("DSLOG_DLOG_ENABLE"); + if (!tmp) return; + char *env = strdup(tmp); + if (!env) return; + int value = atoi(env); free(env); if (value == 1) __enableDlog = true; - else - __enableDlog = false; } DSDebugLog::~DSDebugLog() -- 2.7.4 From 74a1aaebfc04a67bec100f71265ee04b7f3b4b17 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 25 Aug 2020 11:45:56 +0900 Subject: [PATCH 08/16] DSWindow: make raiseToTop method and registerCallback method of it. Change-Id: Ife39d0b26c24e244f7da242b9b6a1004b51e9dc0 --- src/DSWindow/DSWindow.cpp | 12 ++++++++++++ src/DSWindow/DSWindow.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index 3e5597f..41e5288 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -355,6 +355,13 @@ bool DSWindow::lower(void) return priv->lower(); } +bool DSWindow::raiseToTop() +{ + __windowRaiseToTopSignal.emit(nullptr); + + return true; +} + bool DSWindow::unsetFocus(void) { DS_GET_PRIV(DSWindow); @@ -491,4 +498,9 @@ void DSWindow::registerCallbackWindowDestroyed(DSObject *slot, std::function func) +{ + __windowRaiseToTopSignal.connect(slot, func); +} + } // namespace display_server diff --git a/src/DSWindow/DSWindow.h b/src/DSWindow/DSWindow.h index 4426809..21ef2b0 100644 --- a/src/DSWindow/DSWindow.h +++ b/src/DSWindow/DSWindow.h @@ -68,6 +68,7 @@ public: bool setLayer(int layer); bool raise(void); bool lower(void); + bool raiseToTop(); bool unsetFocus(void); bool setFocus(void); @@ -94,6 +95,7 @@ public: void registerCallbackSizeChanged(DSObject *slot, std::function)> func); void registerCallbackBufferChanged(DSObject *slot, std::function)> func); void registerCallbackWindowDestroyed(DSObject *slot, std::function func); + void registerCallbackWindowRaiseToTop(DSObject *slot, std::function func); protected: //virtual bool _onFocus(void); @@ -104,6 +106,7 @@ private: DSSignal> __sizeChangedSignal; DSSignal> __bufferChangedSignal; DSSignal __windowDestroySignal; + DSSignal __windowRaiseToTopSignal; }; } -- 2.7.4 From c9aa079a6e2e56bb871e2fa3848f6677ee031cd6 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 25 Aug 2020 11:48:38 +0900 Subject: [PATCH 09/16] DSZone: call raiseToTop of the top window on the window list. when the window list is updated. Change-Id: I1f68de7ab6ff2002e45bb2736fb7cfdfbbdb84b4 --- src/DSZone/DSZone.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index 9174851..3af703e 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -235,6 +235,7 @@ void DSZone::__prependWindowList(std::shared_ptr window) __updateWindowOrder(); std::shared_ptr wTop(__windowList.front()); + wTop->raiseToTop(); __windowStackChangedSignal.emit(wTop); } @@ -247,6 +248,7 @@ void DSZone::__appendWindowList(std::shared_ptr window) __updateWindowOrder(); std::shared_ptr wTop(__windowList.front()); + wTop->raiseToTop(); __windowStackChangedSignal.emit(wTop); } @@ -303,6 +305,7 @@ void DSZone::__destroyWindow(std::shared_ptr window) __updateWindowOrder(); std::shared_ptr wTop(__windowList.front()); + wTop->raiseToTop(); __windowStackChangedSignal.emit(wTop); } -- 2.7.4 From 6a41d0968ad98aaed1d9a40116db9e6773ebe9b4 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 25 Aug 2020 11:56:13 +0900 Subject: [PATCH 10/16] DSRenderView: add registerCallbackUpdated method Change-Id: I49f1d68a3da95d7f6b5a9459db47b55cc3b141e9 --- src/DSRender/DSRenderView.h | 3 +++ src/DSRender/DSRenderViewDaliImpl.cpp | 7 +++++++ src/DSRender/DSRenderViewDaliImpl.h | 4 ++++ src/DSRender/DSRenderViewEcoreEvasImpl.cpp | 6 ++++++ src/DSRender/DSRenderViewEcoreEvasImpl.h | 4 ++++ 5 files changed, 24 insertions(+) diff --git a/src/DSRender/DSRenderView.h b/src/DSRender/DSRenderView.h index 74a4a2c..e5c85b4 100644 --- a/src/DSRender/DSRenderView.h +++ b/src/DSRender/DSRenderView.h @@ -26,6 +26,8 @@ #include "IDSBuffer.h" #include "DSWindow.h" +#include "DSObject.h" +#include "DSSignal.h" namespace display_server { @@ -38,6 +40,7 @@ public: virtual bool setBuffer(std::shared_ptr buffer) = 0; virtual std::shared_ptr getWindow() = 0; + virtual void registerCallbackUpdated(DSObject *slot, std::function func) = 0; private: /* data */ diff --git a/src/DSRender/DSRenderViewDaliImpl.cpp b/src/DSRender/DSRenderViewDaliImpl.cpp index 1b64d5b..d860d64 100644 --- a/src/DSRender/DSRenderViewDaliImpl.cpp +++ b/src/DSRender/DSRenderViewDaliImpl.cpp @@ -146,6 +146,11 @@ std::shared_ptr DSRenderViewDaliImpl::getWindow() return __window; } +void DSRenderViewDaliImpl::registerCallbackUpdated(DSObject *slot, std::function func) +{ + __updatedSignal.connect(slot, func); +} + void DSRenderViewDaliImpl::__onWindowBufferChanged(std::shared_ptr buffer) { if (buffer) { @@ -159,6 +164,8 @@ void DSRenderViewDaliImpl::__onWindowBufferChanged(std::shared_ptr bu DSLOG_ERR("DSRenderViewDaliImpl", "setBuffer fails."); return; } + + __updatedSignal.emit(nullptr); } } // namespace display_server diff --git a/src/DSRender/DSRenderViewDaliImpl.h b/src/DSRender/DSRenderViewDaliImpl.h index 47c72ff..356b787 100644 --- a/src/DSRender/DSRenderViewDaliImpl.h +++ b/src/DSRender/DSRenderViewDaliImpl.h @@ -43,6 +43,8 @@ public: bool setBuffer(std::shared_ptr buffer) override; std::shared_ptr getWindow() override; + void registerCallbackUpdated(DSObject *slot, std::function func) override; + Dali::Geometry CreateTexturedQuad(); private: @@ -52,6 +54,8 @@ private: Dali::OffscreenWindow __offscreenWindow; Dali::Renderer __renderer; Dali::Actor __textureViewActor; + + DSSignal __updatedSignal; }; } diff --git a/src/DSRender/DSRenderViewEcoreEvasImpl.cpp b/src/DSRender/DSRenderViewEcoreEvasImpl.cpp index e66845c..9fe237d 100644 --- a/src/DSRender/DSRenderViewEcoreEvasImpl.cpp +++ b/src/DSRender/DSRenderViewEcoreEvasImpl.cpp @@ -78,4 +78,10 @@ std::shared_ptr DSRenderViewEcoreEvasImpl::getWindow() return __window; } +void DSRenderViewEcoreEvasImpl::registerCallbackUpdated(DSObject *slot, std::function func) +{ + // No updated signal at ecore evas implementation yet. + //__updatedSignal.connect(slot, func); +} + } // namespace display_server diff --git a/src/DSRender/DSRenderViewEcoreEvasImpl.h b/src/DSRender/DSRenderViewEcoreEvasImpl.h index 11ab261..0572a19 100644 --- a/src/DSRender/DSRenderViewEcoreEvasImpl.h +++ b/src/DSRender/DSRenderViewEcoreEvasImpl.h @@ -40,11 +40,15 @@ public: bool setBuffer(std::shared_ptr buffer) override; std::shared_ptr getWindow() override; + void registerCallbackUpdated(DSObject *slot, std::function func) override; + private: void __onWindowBufferChanged(std::shared_ptr buffer); Evas_Object *__evasView; std::shared_ptr __window; + + DSSignal __updatedSignal; }; -- 2.7.4 From 50b55800437f7f88fedadfe43c79757e98f1a64e Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 25 Aug 2020 11:59:20 +0900 Subject: [PATCH 11/16] DSRenderEngineDaliImpl: register renderViewUpdate callback intead of window callbacks Change-Id: I7b7ea777c59746650ce1d715ca0711b55d4c059c --- src/DSRender/DSRenderEngineDaliImpl.cpp | 19 +++---------------- src/DSRender/DSRenderEngineDaliImpl.h | 3 +-- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/DSRender/DSRenderEngineDaliImpl.cpp b/src/DSRender/DSRenderEngineDaliImpl.cpp index a76fc95..d18784f 100644 --- a/src/DSRender/DSRenderEngineDaliImpl.cpp +++ b/src/DSRender/DSRenderEngineDaliImpl.cpp @@ -61,8 +61,7 @@ std::shared_ptr DSRenderEngineDaliImpl::makeRenderView(std::shared std::shared_ptr renderView = std::make_shared(window, __offscreenApplication.GetWindow()); // callbacks - window->registerCallbackBufferChanged(this, std::bind(&DSRenderEngineDaliImpl::__onWindowUpdated, this, std::placeholders::_1)); - window->registerCallbackWindowDestroyed(this, std::bind(&DSRenderEngineDaliImpl::__onWindowDestroyed, this, std::placeholders::_1)); + renderView->registerCallbackUpdated(this, std::bind(&DSRenderEngineDaliImpl::__onRenderViewUpdated, this, std::placeholders::_1)); return renderView; } @@ -82,22 +81,10 @@ bool DSRenderEngineDaliImpl::renderFrame() return true; } -void DSRenderEngineDaliImpl::__onWindowUpdated(std::shared_ptr buffer) +void DSRenderEngineDaliImpl::__onRenderViewUpdated(void *data) { if (!__needToRender) { - DSLOG_DBG("DSRenderEngineDaliImpl", "Something updated!! with buffer(%p)", buffer.get()); - __needToRender = true; - } -} - -void DSRenderEngineDaliImpl::__onWindowDestroyed(void *data) -{ - if (!__needToRender) { - DSLOG_DBG("DSRenderEngineDaliImpl", "Window destroyed!!"); - // TODO: update twice, at this time and at idle handler. - // do not update a frame only once.. - // NEED to check why dali does not update a frame at this time by execute one RenderOnce call. - Adaptor::Get().RenderOnce(); + DSLOG_DBG("DSRenderEngineDaliImpl", "Something updated on RenderView!! with buffer(%p)"); __needToRender = true; } } diff --git a/src/DSRender/DSRenderEngineDaliImpl.h b/src/DSRender/DSRenderEngineDaliImpl.h index 2cbdc7b..977c580 100644 --- a/src/DSRender/DSRenderEngineDaliImpl.h +++ b/src/DSRender/DSRenderEngineDaliImpl.h @@ -47,8 +47,7 @@ public: void onInitialize(); private: - void __onWindowUpdated(std::shared_ptr buffer); - void __onWindowDestroyed(void *data); + void __onRenderViewUpdated(void *data); std::shared_ptr __bufferQueue; Dali::OffscreenApplication __offscreenApplication; -- 2.7.4 From 5a8d37203a9ee6a128db15f203320566480b3840 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 25 Aug 2020 12:00:33 +0900 Subject: [PATCH 12/16] DSRenderViewDaliImpl: register raiseToTop callback of window Change-Id: I2fd8c02e7cc740039d73fef62a09d9a62522df51 --- src/DSRender/DSRenderViewDaliImpl.cpp | 11 +++++++++++ src/DSRender/DSRenderViewDaliImpl.h | 1 + 2 files changed, 12 insertions(+) diff --git a/src/DSRender/DSRenderViewDaliImpl.cpp b/src/DSRender/DSRenderViewDaliImpl.cpp index d860d64..5182934 100644 --- a/src/DSRender/DSRenderViewDaliImpl.cpp +++ b/src/DSRender/DSRenderViewDaliImpl.cpp @@ -105,6 +105,7 @@ DSRenderViewDaliImpl::DSRenderViewDaliImpl(std::shared_ptr window, Dal // callbacks window->registerCallbackBufferChanged(this, std::bind(&DSRenderViewDaliImpl::__onWindowBufferChanged, this, std::placeholders::_1)); + window->registerCallbackWindowRaiseToTop(this, std::bind(&DSRenderViewDaliImpl::__onWindowRaiseToTopChanged, this, std::placeholders::_1)); } DSRenderViewDaliImpl::~DSRenderViewDaliImpl() @@ -168,4 +169,14 @@ void DSRenderViewDaliImpl::__onWindowBufferChanged(std::shared_ptr bu __updatedSignal.emit(nullptr); } +void DSRenderViewDaliImpl::__onWindowRaiseToTopChanged(void *data) +{ + DSLOG_INF("DSRenderViewDaliImpl", "__onWindowRaiseToTopChanged."); + + __textureViewActor.SetProperty(Actor::Property::VISIBLE, true); + __textureViewActor.RaiseToTop(); + + __updatedSignal.emit(nullptr); +} + } // namespace display_server diff --git a/src/DSRender/DSRenderViewDaliImpl.h b/src/DSRender/DSRenderViewDaliImpl.h index 356b787..d6fe3f6 100644 --- a/src/DSRender/DSRenderViewDaliImpl.h +++ b/src/DSRender/DSRenderViewDaliImpl.h @@ -49,6 +49,7 @@ public: private: void __onWindowBufferChanged(std::shared_ptr buffer); + void __onWindowRaiseToTopChanged(void *data); std::shared_ptr __window; Dali::OffscreenWindow __offscreenWindow; -- 2.7.4 From f6ee6341c6265fff5223c900241f8c1a9b41df96 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 25 Aug 2020 12:01:28 +0900 Subject: [PATCH 13/16] DSDisplayArea: remove logs at idle enterer Change-Id: I2bb1ce8e244d8a9022073e6368eaba0dec57f992 --- src/DSDisplayArea/DSDisplayArea.cpp | 9 +++------ src/DSDisplayDevice/DSDisplayDeviceHWCTDMImpl.cpp | 2 +- src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMTargetImpl.cpp | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/DSDisplayArea/DSDisplayArea.cpp b/src/DSDisplayArea/DSDisplayArea.cpp index ecfd519..0fee756 100644 --- a/src/DSDisplayArea/DSDisplayArea.cpp +++ b/src/DSDisplayArea/DSDisplayArea.cpp @@ -166,13 +166,10 @@ void DSDisplayAreaPrivate::__onWindowDestroy(std::shared_ptr window) void DSDisplayAreaPrivate::__onEventIdleEnterer(void *data) { - DSLOG_INF("DSDisplayAreaPrivate", "__onEventIdleEnterer"); + //DSLOG_INF("DSDisplayAreaPrivate", "__onEventIdleEnterer"); - if (!__displayDeviceHWC->commit()) - DSLOG_INF("DSDisplayAreaPrivate", "No commit at this time."); - - if (!__renderEngine->renderFrame()) - DSLOG_INF("DSDisplayAreaPrivate", "No renderFrame at this time."); + __displayDeviceHWC->commit(); + __renderEngine->renderFrame(); } } // namespace display_server diff --git a/src/DSDisplayDevice/DSDisplayDeviceHWCTDMImpl.cpp b/src/DSDisplayDevice/DSDisplayDeviceHWCTDMImpl.cpp index f26f02a..9a3b3a0 100644 --- a/src/DSDisplayDevice/DSDisplayDeviceHWCTDMImpl.cpp +++ b/src/DSDisplayDevice/DSDisplayDeviceHWCTDMImpl.cpp @@ -123,7 +123,7 @@ bool DSDisplayDeviceHWCTDMImpl::commit() uint32_t numChanges; if (!__updateFrameWindows()) { - DSLOG_INF("HWCTDM", "no update windows."); + //DSLOG_INF("HWCTDM", "no update windows."); return false; } diff --git a/src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMTargetImpl.cpp b/src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMTargetImpl.cpp index 5377c3b..81b9f5d 100644 --- a/src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMTargetImpl.cpp +++ b/src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMTargetImpl.cpp @@ -55,7 +55,7 @@ bool DSDisplayDeviceHWCWindowTDMTargetImpl::updateFrame() std::shared_ptr dsBuffer; if (!__bufferQueue->canAcquireBuffer(false)) { - DSLOG_INF("TDM_HWC", "no acquirable buffer."); + //DSLOG_INF("TDM_HWC", "no acquirable buffer."); return false; } -- 2.7.4 From 68c25f612800bf71ca0bb5f15c6555c87d9713e8 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Tue, 25 Aug 2020 13:57:44 +0900 Subject: [PATCH 14/16] DSRenderEngineDaliImpl: Fix a problem with 1 frame latency. Change-Id: I247b77569a247378154bf74b86358abcdf06be52 Signed-off-by: Joonbum Ko --- src/DSRender/DSRenderEngineDaliImpl.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/DSRender/DSRenderEngineDaliImpl.cpp b/src/DSRender/DSRenderEngineDaliImpl.cpp index d18784f..5314d7f 100644 --- a/src/DSRender/DSRenderEngineDaliImpl.cpp +++ b/src/DSRender/DSRenderEngineDaliImpl.cpp @@ -36,7 +36,7 @@ namespace display_server DSRenderEngineDaliImpl::DSRenderEngineDaliImpl(std::shared_ptr bufferQueue) : __bufferQueue(bufferQueue), - __needToRender(true) + __needToRender(false) { tbm_surface_queue_h nativeBufferQueue = (tbm_surface_queue_h)bufferQueue->getNativeBufferQueue(); __offscreenApplication = OffscreenApplication::New(nativeBufferQueue, true, OffscreenApplication::RenderMode::MANUAL); @@ -69,9 +69,6 @@ std::shared_ptr DSRenderEngineDaliImpl::makeRenderView(std::shared bool DSRenderEngineDaliImpl::renderFrame() { if (__needToRender) { - // TODO: do not get the acquired buffer with only one call of Adaptor::Get().RenderOnce(); - // NEED do check it. - Adaptor::Get().RenderOnce(); Adaptor::Get().RenderOnce(); DSLOG_DBG("DSRenderEngineDaliImpl", "RENDER RENDER RENDER~!!!!"); } -- 2.7.4 From 93e84b8eb7b1fff03906772686d5072ffb9637b9 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Tue, 25 Aug 2020 13:18:11 +0900 Subject: [PATCH 15/16] DSWindowShell: add code to handle geometry we add code to check DSWindow's allowUserGeometry property before applying geometry Change-Id: Id0bbe05e229eac683b7592f714ce138275697354 --- src/DSWindowShell/DSWindowShell.cpp | 12 +++ src/DSWindowShell/DSWindowShell.h | 4 + src/DSWindowShell/DSWindowShellPrivate.cpp | 141 ++++++++++++++++++++++++++--- src/DSWindowShell/DSWindowShellPrivate.h | 13 ++- src/DSZone/DSZone.cpp | 4 + tests/DSWindowShell-test.cpp | 38 +++++++- 6 files changed, 193 insertions(+), 19 deletions(-) diff --git a/src/DSWindowShell/DSWindowShell.cpp b/src/DSWindowShell/DSWindowShell.cpp index 6863736..8b9a78b 100644 --- a/src/DSWindowShell/DSWindowShell.cpp +++ b/src/DSWindowShell/DSWindowShell.cpp @@ -55,6 +55,18 @@ void DSWindowShell::destroy(void) } +bool DSWindowShell::setZone(DSZone *zone) +{ + DS_GET_PRIV(DSWindowShell); + return priv->setZone(zone); +} + +DSZone *DSWindowShell::getZone(void) +{ + DS_GET_PRIV(DSWindowShell); + return priv->getZone(); +} + void DSWindowShell::setShellSurface(IDSWaylandShellSurface *shellSurface) { DS_GET_PRIV(DSWindowShell); diff --git a/src/DSWindowShell/DSWindowShell.h b/src/DSWindowShell/DSWindowShell.h index f5a76f2..7690094 100644 --- a/src/DSWindowShell/DSWindowShell.h +++ b/src/DSWindowShell/DSWindowShell.h @@ -33,6 +33,7 @@ namespace display_server class DSWindow; class DSWindowShellPrivate; +class DSZone; class DSWindowShell { @@ -47,6 +48,9 @@ public: void destroy(void); + bool setZone(DSZone *zone); + DSZone *getZone(void); + void setShellSurface(IDSWaylandShellSurface *zxdgSurface); IDSWaylandShellSurface *getShellSurface(void); diff --git a/src/DSWindowShell/DSWindowShellPrivate.cpp b/src/DSWindowShell/DSWindowShellPrivate.cpp index 928bee4..f70ebf0 100644 --- a/src/DSWindowShell/DSWindowShellPrivate.cpp +++ b/src/DSWindowShell/DSWindowShellPrivate.cpp @@ -21,6 +21,7 @@ * DEALINGS IN THE SOFTWARE. */ +#include "DSZone.h" #include "DSWindowShell.h" #include "DSWindowShellPrivate.h" @@ -63,6 +64,7 @@ DSWindowShellPrivate::DSWindowShellPrivate(DSWindowShell *p_ptr, DSWindow *windo : __p_ptr(p_ptr), __window(window), __shellSurface(nullptr), + __zone(nullptr), __x(0), __y(0), __w(0), __h(0), __reqX(0), __reqY(0), @@ -155,10 +157,42 @@ void DSWindowShellPrivate::__handleAuxHint(stWindowAuxHint *hint) else set = false; - __window->allowUserGeometry(set); + __handleUserGeometryHint(set); } } +bool DSWindowShellPrivate::__handleUserGeometryHint(bool setUserGeometry) +{ + if (!__window) return false; + + __window->allowUserGeometry(setUserGeometry); + if (setUserGeometry) + { + // reset windows geometry + __x = __y = __w = __h = 0; + __window->setPosition(__x, __y); + __window->setSize(__w, __h); + } + else + { + // apply zone's geometry + if (__zone) + { + stPosition zPos = __zone->getPosition(); + stSize zSize = __zone->getSize(); + __x = zPos.x; + __y = zPos.y; + __w = zSize.w; + __h = zSize.h; + + __window->setPosition(__x, __y); + __window->setSize(__w, __h); + } + } + + return true; +} + bool DSWindowShellPrivate::create(DSWindowShell *pParent) { return true; @@ -186,6 +220,49 @@ void DSWindowShellPrivate::destroy(void) } +bool DSWindowShellPrivate::setZone(DSZone *zone) +{ + if (__zone) + { + // unset information for old zone + } + + __zone = zone; + if (__zone) + { + stPosition zPos = __zone->getPosition(); + stSize zSize = __zone->getSize(); + + // check whether DSWindowShell's geometry has to change or not + if (__window) + { + if (!__window->isAllowUserGeometry()) + { + __x = zPos.x; + __y = zPos.y; + __w = zSize.w; + __h = zSize.h; + + __window->setPosition(__x, __y); + __window->setSize(__w, __h); + } + } + else + { + __x = zPos.x; + __y = zPos.y; + __w = zSize.w; + __h = zSize.h; + } + } + + return true; +} + +DSZone *DSWindowShellPrivate::getZone(void) +{ + return __zone; +} void DSWindowShellPrivate::setShellSurface(IDSWaylandShellSurface *shellSurface) { @@ -247,11 +324,23 @@ bool DSWindowShellPrivate::setSkipFocus(bool set) bool DSWindowShellPrivate::setPosition(int x, int y) { - __x = x; - __y = y; + __reqX = x; + __reqY = y; if (__window) - __window->setPosition(__x, __y); + { + if (__window->isAllowUserGeometry()) + { + __x = x; + __y = y; + __window->setPosition(__x, __y); + } + } + else + { + __x = x; + __y = y; + } return true; } @@ -268,26 +357,52 @@ stPosition DSWindowShellPrivate::getPosition(void) bool DSWindowShellPrivate::setSize(unsigned int w, unsigned int h) { - __w = w; - __h = h; + __reqW = w; + __reqH = h; if (__window) - __window->setSize(__w, __h); + { + if (__window->isAllowUserGeometry()) + { + __w = w; + __h = h; + __window->setSize(__w, __h); + } + } + else + { + __w = w; + __h = h; + } return true; } bool DSWindowShellPrivate::setGeometry(int x, int y, unsigned int w, unsigned int h) { - __x = x; - __y = y; - __w = w; - __h = h; + __reqX = x; + __reqY = y; + __reqW = w; + __reqH = h; if (__window) { - __window->setPosition(__x, __y); - __window->setSize(__w, __h); + if (__window->isAllowUserGeometry()) + { + __x = x; + __y = y; + __w = w; + __h = h; + __window->setPosition(__x, __y); + __window->setSize(__w, __h); + } + } + else + { + __x = x; + __y = y; + __w = w; + __h = h; } return true; diff --git a/src/DSWindowShell/DSWindowShellPrivate.h b/src/DSWindowShell/DSWindowShellPrivate.h index df1e9c8..25e27ae 100644 --- a/src/DSWindowShell/DSWindowShellPrivate.h +++ b/src/DSWindowShell/DSWindowShellPrivate.h @@ -52,6 +52,9 @@ public: void destroy(void); + bool setZone(DSZone *zone); + DSZone *getZone(void); + void setShellSurface(IDSWaylandShellSurface *shellSurface); IDSWaylandShellSurface *getShellSurface(void); @@ -126,14 +129,16 @@ private: struct stWindowAuxHint* __findAuxHint(int32_t id); void __handleAuxHint(stWindowAuxHint *hint); + bool __handleUserGeometryHint(bool setUserGeometry); private: DSWindow *__window; IDSWaylandShellSurface *__shellSurface; - int __x, __y; - unsigned int __w, __h; - int __reqX, __reqY; - unsigned int __reqW, __reqH; + DSZone *__zone; + int __x, __y; // real (applied) position + unsigned int __w, __h; // real (applied) size + int __reqX, __reqY; // requested position by client + unsigned int __reqW, __reqH; // requested size by client DSWindowShell *__parent; int __layer; std::list __childList; diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index 3af703e..c1027be 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -325,6 +325,10 @@ std::shared_ptr DSZone::__createWindowShell(std::shared_ptr shell = std::make_shared(ptrWindow); + if (!shell) return nullptr; + + shell->setZone(this); + __windowShellList.push_front(shell); __windowShellMap.insert(std::make_pair(ptrWindow->surface(), shell.get())); diff --git a/tests/DSWindowShell-test.cpp b/tests/DSWindowShell-test.cpp index 01fba49..0ac8b4d 100644 --- a/tests/DSWindowShell-test.cpp +++ b/tests/DSWindowShell-test.cpp @@ -104,7 +104,23 @@ TEST_F(DSWindowShellTest, getPosition_P1) std::unique_ptr shell = std::make_unique(window.get()); EXPECT_TRUE(shell != nullptr); - EXPECT_TRUE(shell->create(0, 0, 720, 1280, nullptr) == true); + EXPECT_TRUE(shell->setPosition(100, 150) == true); + pos = shell->getPosition(); + + EXPECT_TRUE(pos.x == 0); + EXPECT_TRUE(pos.y == 0); +} + +TEST_F(DSWindowShellTest, getPosition_P2) +{ + stPosition pos; + auto window = std::make_shared(); + std::unique_ptr shell = std::make_unique(window.get()); + EXPECT_TRUE(shell != nullptr); + + // set user geometry + shell->addAuxHint(1, "wm.policy.win.user.geometry", "1"); + EXPECT_TRUE(shell->setPosition(100, 150) == true); pos = shell->getPosition(); @@ -131,7 +147,25 @@ TEST_F(DSWindowShellTest, Geometry_P1) std::unique_ptr shell = std::make_unique(window.get()); EXPECT_TRUE(shell != nullptr); - EXPECT_TRUE(shell->create(0, 0, 720, 1280, nullptr) == true); + shell->setGeometry(100, 150, 480, 800); + geo = shell->getGeometry(); + + EXPECT_TRUE(geo.x == 0); + EXPECT_TRUE(geo.y == 0); + EXPECT_TRUE(geo.w == 0); + EXPECT_TRUE(geo.h == 0); +} + +TEST_F(DSWindowShellTest, Geometry_P2) +{ + stGeometry geo; + + auto window = std::make_shared(); + std::unique_ptr shell = std::make_unique(window.get()); + EXPECT_TRUE(shell != nullptr); + + // set user geometry + shell->addAuxHint(1, "wm.policy.win.user.geometry", "1"); shell->setGeometry(100, 150, 480, 800); geo = shell->getGeometry(); -- 2.7.4 From 393989d84c128ec003cf1de144ef3658c14ee572 Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Tue, 25 Aug 2020 14:50:18 +0900 Subject: [PATCH 16/16] DSWindowShell: implement raise/lower/activate Change-Id: I97afb6786594587791c37499ed874ee6364794d8 --- src/DSWindowShell/DSWindowShellPrivate.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/DSWindowShell/DSWindowShellPrivate.cpp b/src/DSWindowShell/DSWindowShellPrivate.cpp index f70ebf0..20eeff5 100644 --- a/src/DSWindowShell/DSWindowShellPrivate.cpp +++ b/src/DSWindowShell/DSWindowShellPrivate.cpp @@ -495,12 +495,18 @@ int DSWindowShellPrivate::getLayer(void) bool DSWindowShellPrivate::raise(void) { - return true; + if (__window) + return __window->raise(); + + return false; } bool DSWindowShellPrivate::lower(void) { - return true; + if (__window) + return __window->lower(); + + return false; } bool DSWindowShellPrivate::unsetFocus(void) @@ -527,7 +533,10 @@ bool DSWindowShellPrivate::isFocused(void) bool DSWindowShellPrivate::activate(void) { - return true; + if (__window) + return __window->raiseToTop(); + + return false; } bool DSWindowShellPrivate::isActivated(void) -- 2.7.4