DSWaylandCompositor: add code to initialze DSWaylandExtension 28/241728/1
authorDoyoun Kang <doyoun.kang@samsung.com>
Tue, 4 Aug 2020 12:56:50 +0000 (21:56 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Thu, 20 Aug 2020 10:05:41 +0000 (19:05 +0900)
Change-Id: I9645b4d465b85904cfd58a4aa3bae7986f253cb3

src/DSWaylandServer/DSWaylandCompositor.cpp
src/DSWaylandServer/DSWaylandCompositor.h
src/DSWaylandServer/DSWaylandCompositorPrivate.h

index 7951ca4..e0c126f 100644 (file)
@@ -1,5 +1,6 @@
 #include "DSWaylandCompositor.h"
 #include "DSWaylandCompositorPrivate.h"
+#include "DSWaylandExtension.h"
 #include "DSWaylandClient.h"
 #include "DSWaylandSeat.h"
 #include "DSWaylandSurface.h"
@@ -23,7 +24,8 @@ DSWaylandCompositorPrivate::DSWaylandCompositorPrivate(DSWaylandCompositor *comp
       _display(nullptr),
       _loop(nullptr),
       _socket_fd_handler(nullptr),
-      _compositor(compositor)
+      _compositor(compositor),
+      __wlExtension(nullptr)
 {
        if (!ecore_init())
        {
@@ -168,6 +170,20 @@ bool DSWaylandCompositorPrivate::initCompositor()
        return true;
 }
 
+bool DSWaylandCompositorPrivate::initExtension()
+{
+       if (__wlExtension)
+       {
+               DSLOG_INF("DSWaylandCompositor", "Already initialize Extension");
+               return true;
+       }
+
+       __wlExtension = std::make_unique<DSWaylandExtension>(_compositor);
+       if (!__wlExtension) return false;
+
+       return true;
+}
+
 Eina_Bool DSWaylandCompositorPrivate::__readEvents(void *data, Ecore_Fd_Handler *hdlr)
 {
        DSWaylandCompositorPrivate *compPrivate = (DSWaylandCompositorPrivate *) data;
@@ -299,6 +315,13 @@ bool DSWaylandCompositor::create()
                return false;
        }
 
+       res = priv->initExtension();
+       if (!res)
+       {
+               DSLOG_ERR("DSWaylandCompositor", "Failed on initExtension ! (res=%d)\n", res);
+               return false;
+       }
+
        priv->_created = true;
        return true;
 }
index e160a46..e7f1b43 100644 (file)
@@ -14,6 +14,7 @@ namespace display_server
 class DSWaylandClient;
 class DSWaylandSeat;
 class DSWaylandSurface;
+class DSWaylandExtension;
 
 class DSWaylandCompositorPrivate;
 
index 0e33b3e..af99b70 100644 (file)
@@ -17,6 +17,8 @@ namespace display_server
 class DSWaylandClient;
 class DSWaylandSeat;
 class DSWaylandCompositor;
+class DSWaylendExtension;
+
 class DS_DECL_EXPORT DSWaylandCompositorPrivate : public DSObjectPrivate, public DSWaylandServer::wl_compositor
 {
        DS_PIMPL_USE_PUBLIC(DSWaylandCompositor);
@@ -25,6 +27,7 @@ public:
        ~DSWaylandCompositorPrivate() override;
 
     bool initCompositor();
+    bool initExtension();
     void initSocket(std::string sName, std::string sDir);
     inline void addClient(DSWaylandClient *client);
     inline void removeClient(DSWaylandClient *client);
@@ -61,6 +64,8 @@ protected:
 private:
        static Eina_Bool __readEvents(void *data, Ecore_Fd_Handler *hdlr);
        static void __prepareFunc(void *data, Ecore_Fd_Handler *hdlr);
+
+       std::unique_ptr<DSWaylandExtension> __wlExtension;
 };
 
 void DSWaylandCompositorPrivate::addClient(DSWaylandClient *client)
@@ -83,4 +88,4 @@ void DSWaylandCompositorPrivate::removeClient(DSWaylandClient *client)
 
 }
 
-#endif //__DS_WAYLAND_COMPOSITOR_PRIVATE_H__
\ No newline at end of file
+#endif //__DS_WAYLAND_COMPOSITOR_PRIVATE_H__