exampleCompositor: create a seat and an input on _onInitialized 47/241647/1
authorSung-Jin Park <sj76.park@samsung.com>
Mon, 20 Jul 2020 11:47:12 +0000 (20:47 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Thu, 20 Aug 2020 09:54:16 +0000 (18:54 +0900)
Change-Id: If7a86465bd4579fbc9858b05f78649a4aa913cf3
Signed-off-by: Sung-Jin Park <sj76.park@samsung.com>
samples/exampleCompositor.cpp

index ada981f..5f7a047 100644 (file)
@@ -5,6 +5,7 @@
 #include <DSSeat.h>
 #include <DSPolicyArea.h>
 #include <DSDisplayArea.h>
+#include "DSDebugLog.h"
 
 using namespace display_server;
 
@@ -58,6 +59,15 @@ public:
                int width = __displayArea->getWidth();
                int height = __displayArea->getHeight();
 
+               __seat = std::make_shared<DSSeat>(this, "default");
+               DSLOG_INF("MyCompositor", "DSSeat has been created. (%p)", __seat.get());
+
+               __input = std::make_shared<DSInput>(__seat);
+               DSLOG_INF("MyCompositor", "DSInput has been created. (%p)", __input.get());
+
+               __seat->addInput(__input);
+               __input->init();
+
                __policyArea = std::make_shared<DSPolicyArea>();
                __policyArea->setPosition(0, 0);
                __policyArea->setSize(width, height);
@@ -89,19 +99,16 @@ public:
 
        void _onInputAdded(std::shared_ptr<DSInput> input) override
        {
-               __seat = std::make_shared<DSSeat>();
-               __seat->addInput(input); // add an input device to a seat
        }
 
        void _onInputRemoved(std::shared_ptr<DSInput> input) override
        {
-               __seat->removeInput(input); // remove an input device from a seat
-               __seat.reset(); // delete shared_ptr
        }
 
 private:
        std::shared_ptr<DSCanvas> __canvas;
        std::shared_ptr<DSSeat> __seat;
+       std::shared_ptr<DSInput> __input;
        std::shared_ptr<DSPolicyArea> __policyArea;
        std::shared_ptr<DSDisplayArea> __displayArea;
 };