From 6a41d0968ad98aaed1d9a40116db9e6773ebe9b4 Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 25 Aug 2020 11:56:13 +0900 Subject: [PATCH 01/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 02/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 03/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 04/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 05/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 06/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 07/16] DSWindowShell: implement raise/lower/activate Change-Id: I97afb6786594587791c37499ed874ee6364794d8 --- src/DSWindowShell/DSWindowShellPrivate.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/DSWindowShell/DSWindowShellPrivate.cpp b/src/DSWindowShell/DSWindowShellPrivate.cpp index f70ebf0..20eeff5 100644 --- a/src/DSWindowShell/DSWindowShellPrivate.cpp +++ b/src/DSWindowShell/DSWindowShellPrivate.cpp @@ -495,12 +495,18 @@ int DSWindowShellPrivate::getLayer(void) bool DSWindowShellPrivate::raise(void) { - return true; + if (__window) + return __window->raise(); + + return false; } bool DSWindowShellPrivate::lower(void) { - return true; + if (__window) + return __window->lower(); + + return false; } bool DSWindowShellPrivate::unsetFocus(void) @@ -527,7 +533,10 @@ bool DSWindowShellPrivate::isFocused(void) bool DSWindowShellPrivate::activate(void) { - return true; + if (__window) + return __window->raiseToTop(); + + return false; } bool DSWindowShellPrivate::isActivated(void) -- 2.7.4 From fa80de055a2cd186eccf44c42b5bc907cd1d8a2f Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 25 Aug 2020 14:38:42 +0900 Subject: [PATCH 08/16] DSZone: send stackChanged Signal when there is a window on the list. Change-Id: I1001aa81c92b4dbc0b2d5041e02fe0450aab46ea --- src/DSZone/DSZone.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index c1027be..3973120 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -304,9 +304,11 @@ void DSZone::__destroyWindow(std::shared_ptr window) __stackChanged = true; __updateWindowOrder(); - std::shared_ptr wTop(__windowList.front()); - wTop->raiseToTop(); - __windowStackChangedSignal.emit(wTop); + if (!__windowList.empty()) { + std::shared_ptr wTop(__windowList.front()); + wTop->raiseToTop(); + __windowStackChangedSignal.emit(wTop); + } } void DSZone::__updateWindowOrder(void) -- 2.7.4 From d74f12b0cb6155dddf71db43c20ca678b3d4086e Mon Sep 17 00:00:00 2001 From: jeon Date: Tue, 25 Aug 2020 16:09:15 +0900 Subject: [PATCH 09/16] DSWaylandServer: set temporary size to BaseOutputResolution Change-Id: I3df77c32564de2e0e8131d33ab75c65e1b998412 --- src/DSWaylandServer/DSWaylandTizenAppinfo.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/DSWaylandServer/DSWaylandTizenAppinfo.cpp b/src/DSWaylandServer/DSWaylandTizenAppinfo.cpp index 44d5416..8f4a684 100644 --- a/src/DSWaylandServer/DSWaylandTizenAppinfo.cpp +++ b/src/DSWaylandServer/DSWaylandTizenAppinfo.cpp @@ -87,6 +87,9 @@ void DSWaylandTizenAppinfoPrivate::tizen_launch_appinfo_get_base_output_resoluti result = pub->__dsAppinfoMgr->getBaseOutputResolution(pid, &res_w, &res_h); if (!result) { /* TODO: Read configured resolution values */ + /* FIXME : get base resolution from the correct way */ + res_w = 720; + res_h = 1280; } send_base_output_resolution_done(resource->handle, pid, res_w, res_h); DSLOG_DBG("TizenAppinfoPriv", "SEND base_output_resolution_done event with width(%d), height(%d)", res_w, res_h); -- 2.7.4 From 8e815fa90c0586a2110de0f1e4bb4d5e7058c2e1 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Tue, 25 Aug 2020 14:38:17 +0900 Subject: [PATCH 10/16] DSRenderViewDaliImpl: Move the emit updatedSignal to setBuffer. - setBuffer is clearer than the __onWindowBufferChanged callback. - This modification is required to properly verify the function of setBuffer in libds-test. Change-Id: I29c565ad5bc4cd19a926d6a8e418325c4ff3bad6 Signed-off-by: Joonbum Ko --- src/DSRender/DSRenderViewDaliImpl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DSRender/DSRenderViewDaliImpl.cpp b/src/DSRender/DSRenderViewDaliImpl.cpp index 5182934..d1aac16 100644 --- a/src/DSRender/DSRenderViewDaliImpl.cpp +++ b/src/DSRender/DSRenderViewDaliImpl.cpp @@ -139,6 +139,8 @@ bool DSRenderViewDaliImpl::setBuffer(std::shared_ptr buffer) __textureViewActor.SetProperty(Actor::Property::VISIBLE, false); } + __updatedSignal.emit(nullptr); + return true; } @@ -165,8 +167,6 @@ void DSRenderViewDaliImpl::__onWindowBufferChanged(std::shared_ptr bu DSLOG_ERR("DSRenderViewDaliImpl", "setBuffer fails."); return; } - - __updatedSignal.emit(nullptr); } void DSRenderViewDaliImpl::__onWindowRaiseToTopChanged(void *data) -- 2.7.4 From 235ed23cfd02afc85bc194f9ca786c961cc88b3a Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 25 Aug 2020 16:22:11 +0900 Subject: [PATCH 11/16] test: enqueue buffer Change-Id: I410b5f3b1fbab0616ccd20a2e28dc418e1db1484 --- tests/DSDisplayDeviceTDMImpl-test.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/DSDisplayDeviceTDMImpl-test.cpp b/tests/DSDisplayDeviceTDMImpl-test.cpp index a366e19..7f9f47c 100644 --- a/tests/DSDisplayDeviceTDMImpl-test.cpp +++ b/tests/DSDisplayDeviceTDMImpl-test.cpp @@ -295,8 +295,7 @@ TEST_F(DSDisplayDeviceTDMImplTest, DeviceHWC_commit) auto buffer = bufferQueue->dequeueBuffer(); EXPECT_TRUE(buffer != nullptr); - - EXPECT_TRUE(deviceHWC->setTargetBuffer(buffer)); + EXPECT_TRUE(bufferQueue->enqueueBuffer(buffer)); // commit EXPECT_TRUE(deviceHWC->commit()); -- 2.7.4 From 53468212c2e2a3afc1e56942c376458502e2a92b Mon Sep 17 00:00:00 2001 From: Doyoun Kang Date: Tue, 25 Aug 2020 15:35:41 +0900 Subject: [PATCH 12/16] DSWindow: send positionChanged signal when window's position is changed Change-Id: Iab9cca37ffcf22c48e9380078c38dca22c616c0d --- src/DSWindow/DSWindow.cpp | 7 +++++++ src/DSWindow/DSWindow.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/DSWindow/DSWindow.cpp b/src/DSWindow/DSWindow.cpp index 41e5288..5854b0d 100644 --- a/src/DSWindow/DSWindow.cpp +++ b/src/DSWindow/DSWindow.cpp @@ -391,6 +391,8 @@ void DSWindow::setPosition(int x, int y) priv->__y = y; priv->__changedGeometry = true; + + __windowPositionChangedSignal.emit(nullptr); } stPosition DSWindow::getPosition(void) @@ -503,4 +505,9 @@ void DSWindow::registerCallbackWindowRaiseToTop(DSObject *slot, std::function func) +{ + __windowPositionChangedSignal.connect(slot, func); +} + } // namespace display_server diff --git a/src/DSWindow/DSWindow.h b/src/DSWindow/DSWindow.h index 21ef2b0..627065e 100644 --- a/src/DSWindow/DSWindow.h +++ b/src/DSWindow/DSWindow.h @@ -96,6 +96,7 @@ public: void registerCallbackBufferChanged(DSObject *slot, std::function)> func); void registerCallbackWindowDestroyed(DSObject *slot, std::function func); void registerCallbackWindowRaiseToTop(DSObject *slot, std::function func); + void registerCallbackWindowPositionChanged(DSObject *slot, std::function func); protected: //virtual bool _onFocus(void); @@ -107,6 +108,7 @@ private: DSSignal> __bufferChangedSignal; DSSignal __windowDestroySignal; DSSignal __windowRaiseToTopSignal; + DSSignal __windowPositionChangedSignal; }; } -- 2.7.4 From 9f69b1204869a602c66ae5f6b51da730e207281b Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 25 Aug 2020 16:57:52 +0900 Subject: [PATCH 13/16] DSZone: donot check if window list is empty when zone sends stackChanged signal. Change-Id: Iabadf761ef4fdc4b9ad8bbf8771f4921e16aff95 --- src/DSZone/DSZone.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/DSZone/DSZone.cpp b/src/DSZone/DSZone.cpp index 3973120..6c9a31e 100644 --- a/src/DSZone/DSZone.cpp +++ b/src/DSZone/DSZone.cpp @@ -235,8 +235,9 @@ void DSZone::__prependWindowList(std::shared_ptr window) __updateWindowOrder(); std::shared_ptr wTop(__windowList.front()); - wTop->raiseToTop(); __windowStackChangedSignal.emit(wTop); + + wTop->raiseToTop(); } void DSZone::__appendWindowList(std::shared_ptr window) @@ -248,8 +249,9 @@ void DSZone::__appendWindowList(std::shared_ptr window) __updateWindowOrder(); std::shared_ptr wTop(__windowList.front()); - wTop->raiseToTop(); __windowStackChangedSignal.emit(wTop); + + wTop->raiseToTop(); } std::shared_ptr DSZone::__findWindow(DSWaylandSurface *dswlSurface) @@ -304,11 +306,11 @@ void DSZone::__destroyWindow(std::shared_ptr window) __stackChanged = true; __updateWindowOrder(); - if (!__windowList.empty()) { - std::shared_ptr wTop(__windowList.front()); + std::shared_ptr wTop(__windowList.front()); + __windowStackChangedSignal.emit(wTop); + + if (!__windowList.empty()) wTop->raiseToTop(); - __windowStackChangedSignal.emit(wTop); - } } void DSZone::__updateWindowOrder(void) -- 2.7.4 From 82d887f55f117a83c1b2f24499e4096d9161c3c0 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Tue, 25 Aug 2020 18:58:32 +0900 Subject: [PATCH 14/16] DSDisplayDeviceHWCWindowTDMTargetImpl: set target buffer in updateFrame Change-Id: I744ec61de0f180f8d11ce2e34aa645525661ab2e --- src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMTargetImpl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMTargetImpl.cpp b/src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMTargetImpl.cpp index 81b9f5d..abc3893 100644 --- a/src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMTargetImpl.cpp +++ b/src/DSDisplayDevice/DSDisplayDeviceHWCWindowTDMTargetImpl.cpp @@ -70,7 +70,8 @@ bool DSDisplayDeviceHWCWindowTDMTargetImpl::updateFrame() __buffer = nullptr; } - __buffer= dsBuffer; + __buffer = dsBuffer; + __deviceHWC->setTargetBuffer(__buffer); return true; } @@ -79,7 +80,6 @@ void DSDisplayDeviceHWCWindowTDMTargetImpl::presentFrame() { if (__buffer) { __presentBuffer = std::move(__buffer); - __deviceHWC->setTargetBuffer(__presentBuffer); } } -- 2.7.4 From 73a7e7580b70d69770c7101dd35a46edce1e985c Mon Sep 17 00:00:00 2001 From: Sung-Jin Park Date: Tue, 25 Aug 2020 18:35:58 +0900 Subject: [PATCH 15/16] DSWaylandSurface: add getClient() Change-Id: I625fe50c72cb2224fb2d2a7712075c0f69a4b6a0 Signed-off-by: Sung-Jin Park --- src/DSWaylandServer/DSWaylandSurface.cpp | 10 ++++++++++ src/DSWaylandServer/DSWaylandSurface.h | 1 + src/DSWaylandServer/DSWaylandSurfacePrivate.h | 1 + 3 files changed, 12 insertions(+) diff --git a/src/DSWaylandServer/DSWaylandSurface.cpp b/src/DSWaylandServer/DSWaylandSurface.cpp index 26afa18..4d4ce31 100644 --- a/src/DSWaylandServer/DSWaylandSurface.cpp +++ b/src/DSWaylandServer/DSWaylandSurface.cpp @@ -23,6 +23,7 @@ #include "DSWaylandSurface.h" #include "DSWaylandSurfacePrivate.h" +#include "DSWaylandClient.h" namespace display_server { @@ -77,6 +78,7 @@ DSWaylandSurfacePrivate::DSWaylandSurfacePrivate(DSWaylandSurface *p_ptr) __p_ptr(p_ptr), __commitInfoPending{std::make_unique()}, __commitInfo{std::make_shared()}, + __waylandClient(nullptr), __bufferManager{DSBufferManager::getInstance()}, __resId(0) {} @@ -86,6 +88,7 @@ DSWaylandSurfacePrivate::DSWaylandSurfacePrivate(DSWaylandSurface *p_ptr, DSWayl __p_ptr(p_ptr), __commitInfoPending{std::make_unique()}, __commitInfo{std::make_shared()}, + __waylandClient(waylandClient), __bufferManager{DSBufferManager::getInstance()}, __resId(0) { @@ -242,6 +245,13 @@ struct ::wl_resource *DSWaylandSurface::getWlResource() return priv->resource()->handle; } +DSWaylandClient *DSWaylandSurface::getClient() +{ + DS_GET_PRIV(DSWaylandSurface); + + return priv->__waylandClient; +} + bool DSWaylandSurface::hasResource() { DS_GET_PRIV(DSWaylandSurface); diff --git a/src/DSWaylandServer/DSWaylandSurface.h b/src/DSWaylandServer/DSWaylandSurface.h index d9cac4a..f6cf2ca 100644 --- a/src/DSWaylandServer/DSWaylandSurface.h +++ b/src/DSWaylandServer/DSWaylandSurface.h @@ -64,6 +64,7 @@ public: void registerCallbackSurfaceCommitted(DSObject *slot, std::function commitInfo)> func); struct ::wl_resource *getWlResource(); + DSWaylandClient *getClient(); bool hasResource(); uint32_t getResourceId(); diff --git a/src/DSWaylandServer/DSWaylandSurfacePrivate.h b/src/DSWaylandServer/DSWaylandSurfacePrivate.h index 4b37613..0ed0577 100644 --- a/src/DSWaylandServer/DSWaylandSurfacePrivate.h +++ b/src/DSWaylandServer/DSWaylandSurfacePrivate.h @@ -111,6 +111,7 @@ protected: private: std::unique_ptr __commitInfoPending; std::shared_ptr __commitInfo; + DSWaylandClient *__waylandClient; DSBufferManager *__bufferManager; uint32_t __resId; }; -- 2.7.4 From 500c21a70b4b72fb2c090a8dc60341c6f9048106 Mon Sep 17 00:00:00 2001 From: Sung-Jin Park Date: Tue, 25 Aug 2020 18:36:54 +0900 Subject: [PATCH 16/16] DSWaylandKeyboard: sendEnter when the focused client get wl_keyboard Change-Id: I2f36a87bfbe34bda11ed91b0c197de958f09c11e Signed-off-by: Sung-Jin Park --- src/DSWaylandServer/DSWaylandKeyboard.cpp | 17 ++++++++++++++++- src/DSWaylandServer/DSWaylandKeyboardPrivate.h | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/DSWaylandServer/DSWaylandKeyboard.cpp b/src/DSWaylandServer/DSWaylandKeyboard.cpp index 3ca2388..8002088 100644 --- a/src/DSWaylandServer/DSWaylandKeyboard.cpp +++ b/src/DSWaylandServer/DSWaylandKeyboard.cpp @@ -211,6 +211,21 @@ void DSWaylandKeyboardPrivate::sendKey(uint32_t key, uint32_t state) std::for_each(resMap.begin(), resMap.end(), func); } +void DSWaylandKeyboardPrivate::__addClient(struct ::wl_client *wlClient, uint32_t id, int version) +{ + wl_keyboard::add(wlClient, id, version); + + if (__focusSurface && __focusSurface->hasResource()) + { + DSWaylandClient *waylandClient = __focusSurface->getClient(); + if (waylandClient && (waylandClient->wlClient() == wlClient)) + { + DSLOG_INF("DSWaylandKeyboardPrivate", "Send enter to focusSurface(%p)", __focusSurface); + sendEnter(__focusSurface->getWlResource()); + } + } +} + /* Begin Public Class Implementation */ DSWaylandKeyboard::DSWaylandKeyboard(DSWaylandSeat *seat) : DSObject(), _d_ptr(std::make_unique(seat, this)) @@ -264,7 +279,7 @@ void DSWaylandKeyboard::addClient(DSWaylandClient *client, uint32_t id, int vers DSLOG_INF("DSWaylandKeyboard", "addClient(dswlClient=%p, id=%u, version=%d", client, id, version); - priv->add(client->wlClient(), id, version); + priv->__addClient(client->wlClient(), id, version); } void DSWaylandKeyboard::setFocus(DSWaylandSurface *waylandSurface) diff --git a/src/DSWaylandServer/DSWaylandKeyboardPrivate.h b/src/DSWaylandServer/DSWaylandKeyboardPrivate.h index f3be21d..48f4665 100644 --- a/src/DSWaylandServer/DSWaylandKeyboardPrivate.h +++ b/src/DSWaylandServer/DSWaylandKeyboardPrivate.h @@ -64,6 +64,8 @@ protected: void sendModifiers(struct ::wl_resource *surface); private: + void __addClient(struct ::wl_client *wlClient, uint32_t id, int version); + DSWaylandSeat *__seat; DSXkb *__xkb; DSWaylandCompositor *__compositor; -- 2.7.4