DSOutput: create DSWaylandOutput object after IDSDisplayDeviceOutput sets the mode. 68/241768/1
authorSooChan Lim <sc1.lim@samsung.com>
Sun, 9 Aug 2020 04:33:20 +0000 (13:33 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Thu, 20 Aug 2020 10:10:25 +0000 (19:10 +0900)
Change-Id: I742344d68185a87ea5b88cde483e17cb9149e408

src/DSOutput/DSOutputImpl.cpp
src/DSOutput/DSOutputImpl.h

index b51dbd4..60dfbd8 100644 (file)
@@ -5,9 +5,7 @@ namespace display_server
 {
 
 DSOutputImpl::DSOutputImpl(std::shared_ptr<IDSDisplayDeviceOutput> displayDeviceOutput)
-       : __resolutionWidth{0},
-         __resolutionHeight{0},
-         __displayDeviceOutput{displayDeviceOutput}
+       : __displayDeviceOutput{displayDeviceOutput}
 {}
 
 DSOutputImpl::~DSOutputImpl()
@@ -15,12 +13,12 @@ DSOutputImpl::~DSOutputImpl()
 
 int DSOutputImpl::getResolutionWidth()
 {
-       return __resolutionWidth;
+       return __displayDeviceOutput->getResolutionWidth();
 }
 
 int DSOutputImpl::getResolutionHeight()
 {
-       return __resolutionHeight;
+       return __displayDeviceOutput->getResolutionHeight();
 }
 
 bool DSOutputImpl::applyResolutionAuto()
@@ -47,6 +45,17 @@ bool DSOutputImpl::applyResolutionAuto()
                return false;
        }
 
+       // TODO: get more information from DSOutputImpl to set them toDSWaylandOutput.
+       __waylandOutput = std::make_shared<DSWaylandOutput>(DSWaylandCompositor::getInstance(),
+                       __displayDeviceOutput->getName(), "tm1", "tm1",
+                       0, 0, __displayDeviceOutput->getResolutionWidth(), __displayDeviceOutput->getResolutionHeight(),
+                       __displayDeviceOutput->getPhysicalMMWidth(), __displayDeviceOutput->getPhysicalMMHeight(),
+                       __displayDeviceOutput->getRefreshRate(), 0, 0);
+       DSWaylandCompositor::releaseInstance();
+
+       // send output information
+       __waylandOutput->sendWaylandOutputInfo();
+
        return true;
 }
 
index de0eb85..528ce63 100644 (file)
@@ -3,6 +3,7 @@
 
 #include "IDSOutput.h"
 #include "IDSDisplayDeviceOutput.h"
+#include "DSWaylandOutput.h"
 
 namespace display_server
 {
@@ -20,9 +21,8 @@ public:
        std::shared_ptr<IDSDisplayDeviceOutput> getDisplayDeviceOutput();
 
 private:
-       int __resolutionWidth;
-       int __resolutionHeight;
        std::shared_ptr<IDSDisplayDeviceOutput> __displayDeviceOutput;
+       std::shared_ptr<DSWaylandOutput> __waylandOutput;
 };
 
 }