DSZone: modify code to create DSWindowShell on surfaceCreate callback 50/241750/1
authorDoyoun Kang <doyoun.kang@samsung.com>
Thu, 6 Aug 2020 07:11:16 +0000 (16:11 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Thu, 20 Aug 2020 10:10:08 +0000 (19:10 +0900)
Change-Id: I84dffe95a49deb251c0bf5cce58a685c7e62a9c3

src/DSZone/DSZone.cpp
src/DSZone/DSZone.h

index 4b41491..b268f95 100644 (file)
@@ -13,7 +13,7 @@ DSZone::DSZone()
          __waylandCompositor(nullptr)
 {
        __waylandCompositor = DSWaylandCompositor::getInstance();
-       __waylandCompositor->registerCallbackSurfaceCreated(this, std::bind(&DSZone::onSurfaceCreated, this, std::placeholders::_1));
+       __waylandCompositor->registerCallbackSurfaceCreated(this, std::bind(&DSZone::__onSurfaceCreated, this, std::placeholders::_1));
 }
 
 DSZone::~DSZone()
@@ -66,14 +66,15 @@ void DSZone::callCallbackWindowCreated()
        __windowCreatedSignal.emit(nullptr);
 }
 
-void DSZone::onSurfaceCreated(std::shared_ptr<DSWaylandSurface> waylandSurface)
+void DSZone::__onSurfaceCreated(std::shared_ptr<DSWaylandSurface> waylandSurface)
 {
+       DSLOG_DBG("DSZone", "waylandSurface:(shared:%p, pure:%p)", waylandSurface, waylandSurface.get());
+
        // create DSWindow
-       std::shared_ptr<DSWindow> window = std::make_shared<DSWindow>(waylandSurface);
-       __windowList.push_front(window);
+       std::shared_ptr<DSWindow> window = __createWindow(waylandSurface);
 
-       // emit a signal of the surface committed
-       __windowCreatedSignal.emit(window);
+       // create DSWindowShell
+       std::shared_ptr<DSWindowShell> shell = __createWindowShell(window);
 }
 
 // for Test
@@ -102,18 +103,27 @@ std::shared_ptr<DSWindow> DSZone::__findWindow(DSWaylandSurface *dswlSurface)
        return nullptr;
 }
 
-void DSZone::__onShellSurfaceCreated(std::shared_ptr<DSWaylandZxdgSurfaceV6> shellSurface)
+std::shared_ptr<DSWindow> DSZone::__createWindow(std::shared_ptr<DSWaylandSurface> waylandSurface)
 {
-       struct ::wl_resource *surface = shellSurface->getWlSurface();
-       DSWaylandSurface *dswlSurface = DSWaylandSurface::fromWlResource(surface);
+       std::shared_ptr<DSWindow> window = std::make_shared<DSWindow>(waylandSurface);
+       __windowList.push_front(window);
 
-       std::shared_ptr<DSWindow> window = __findWindow(dswlSurface);
+       // emit a signal of the surface committed
+       __windowCreatedSignal.emit(window);
+
+       return window;
+}
 
+std::shared_ptr<DSWindowShell> DSZone::__createWindowShell(std::shared_ptr<DSWindow> window)
+{
        std::shared_ptr<DSWindowShell> shell = std::make_shared<DSWindowShell>(window.get());
        __windowShellList.push_front(shell);
 
        // emit a signal of the shell created
        __windowShellCreatedSignal.emit(shell);
+
+       return shell;
 }
 
+
 } //  namespace display_server
index 4de5a00..fb72088 100644 (file)
@@ -35,8 +35,9 @@ public:
        std::list<std::shared_ptr<DSWindow>> getWindowList();
 
 private:
-       void onSurfaceCreated(std::shared_ptr<DSWaylandSurface> waylandSurface);
-       void __onShellSurfaceCreated(std::shared_ptr<DSWaylandZxdgSurfaceV6> shellSurface);
+       void __onSurfaceCreated(std::shared_ptr<DSWaylandSurface> waylandSurface);
+       std::shared_ptr<DSWindow> __createWindow(std::shared_ptr<DSWaylandSurface> waylandSurface);
+       std::shared_ptr<DSWindowShell> __createWindowShell(std::shared_ptr<DSWindow> window);
        std::shared_ptr<DSWindow> __findWindow(DSWaylandSurface *dswlSurface);
 
        stPosition __position;