__p_ptr(p_ptr),
__displayDevice(nullptr),
__canvas(nullptr),
- __dsAppinfoMgr(nullptr)
+ __dsAppinfoMgr(nullptr),
+ __dsWindowMgr(nullptr)
{
__eventLoop = DSEventLoop::getInstance();
DSCompositorPrivate::~DSCompositorPrivate()
{
+ DSWindowManager::releaseInstance();
DSWaylandCompositor::releaseInstance();
DSBufferManager::releaseInstance();
DSEventLoop::releaseInstance();
__initializeOutputs();
__initializeBufferManager();
__initializeTizenAppinfoMgr();
+ __initializeWindowManager();
__canvas = pub->_onInitialized();
if (!__canvas) {
DSLOG_ERR("Compositor", "_onInitialized() fails.");
__dsAppinfoMgr = DSTizenAppinfoMgr::getInstance();
}
+void DSCompositorPrivate::__initializeWindowManager()
+{
+ __dsWindowMgr = DSWindowManager::getInstance();
+}
+
} // namespace display_server
#include "IDSDisplayDevice.h"
#include "DSBufferManager.h"
#include "DSTizenAppinfoMgr.h"
+#include "DSWindowManager.h"
namespace display_server
{
std::shared_ptr<DSCanvas> __canvas;
DSBufferManager *__dsBufferManager;
DSTizenAppinfoMgr * __dsAppinfoMgr;
+ DSWindowManager *__dsWindowMgr;
void __initializeWlDisplay();
void __initializeOutputs();
void __initializeBufferManager();
void __initializeTizenAppinfoMgr();
+ void __initializeWindowManager();
};
}
--- /dev/null
+/*
+* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice (including the next
+* paragraph) shall be included in all copies or substantial portions of the
+* Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+* DEALINGS IN THE SOFTWARE.
+*/
+
+#include "DSWindowManager.h"
+#include "DSWindowManagerPrivate.h"
+#include "DSDebugLog.h"
+
+namespace display_server
+{
+
+/* reference count, mutex and compositor pointer for DSWindowManager singleton */
+int DSWindowManager::__refCount { 0 };
+std::mutex DSWindowManager::__mutex;
+DSWindowManager* DSWindowManager::__windowMgr { nullptr };
+
+DSWindowManagerPrivate::DSWindowManagerPrivate(DSWindowManager *p_ptr)
+ : DSObjectPrivate(p_ptr),
+ __p_ptr(p_ptr)
+{
+}
+
+DSWindowManagerPrivate::~DSWindowManagerPrivate()
+{
+}
+
+DSWindowManager::DSWindowManager(DSObject *parent)
+ : DS_INIT_PRIVATE_PTR(DSWindowManager)
+{
+}
+
+DSWindowManager::~DSWindowManager()
+{
+}
+
+/* getInstance for DSWindowManager singleton */
+DSWindowManager *DSWindowManager::getInstance()
+{
+ std::lock_guard<std::mutex> tLock(__mutex);
+
+ DSLOG_INF("DSWindowManager",
+ "[Get] instance __refCount=%d !", __refCount);
+
+ if (!__windowMgr && (__refCount == 0))
+ {
+ __windowMgr = new DSWindowManager(new DSObject);
+ DSLOG_INF("DSWindowManager",
+ "DSWindowManager instance has been created !");
+ }
+
+ ++__refCount;
+ return __windowMgr;
+}
+
+/* releaseInstance for DSWindowManager singleton */
+void DSWindowManager::releaseInstance()
+{
+ std::lock_guard<std::mutex> tLock(__mutex);
+
+ --__refCount;
+ if (__refCount < 0)
+ __refCount = 0;
+ DSLOG_INF("DSWindowManager",
+ "[Release] instance __refCount=%d !", __refCount);
+
+ if ((0 == __refCount) && __windowMgr)
+ {
+ delete __windowMgr;
+ __windowMgr = nullptr;
+ DSLOG_INF("DSWindowManager",
+ "DSWindowManager instance has been removed !");
+ }
+}
+
+
+} // namespace display_server
\ No newline at end of file
--- /dev/null
+/*
+* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice (including the next
+* paragraph) shall be included in all copies or substantial portions of the
+* Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+* DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef __DS_WINDOW_MANAGER_H__
+#define __DS_WINDOW_MANAGER_H__
+
+#include "DSCore.h"
+#include "DSObject.h"
+
+namespace display_server
+{
+
+class DSWindowManagerPrivate;
+
+class DSWindowManager : public DSObject
+{
+DS_PIMPL_USE_PRIVATE(DSWindowManager)
+
+public:
+ static DSWindowManager *getInstance();
+ static void releaseInstance();
+
+protected:
+
+private:
+ DSWindowManager() = delete;
+ ~DSWindowManager();
+ DSWindowManager(DSObject *parent);
+ DSWindowManager& operator=(const DSWindowManager&) = delete;
+
+private:
+ static std::mutex __mutex;
+ static DSWindowManager *__windowMgr;
+ static int __refCount;
+};
+
+}
+
+#endif // __DS_WINDOW_MANAGER_H__
--- /dev/null
+/*
+* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice (including the next
+* paragraph) shall be included in all copies or substantial portions of the
+* Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+* DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef __DS_WINDOW_MANAGER_PRIVATE__
+#define __DS_WINDOW_MANAGER_PRIVATE__
+
+#include "DSWindowManager.h"
+
+namespace display_server
+{
+
+class DSWindowManagerPrivate : public DSObjectPrivate
+{
+ DS_PIMPL_USE_PUBLIC(DSWindowManager);
+
+public:
+ DSWindowManagerPrivate() = delete;
+ DSWindowManagerPrivate(DSWindowManager *p_ptr);
+ ~DSWindowManagerPrivate();
+
+private:
+};
+
+} // namespace display_server
+
+#endif
\ No newline at end of file
'DSWindow/DSWindow.h',
'DSWindow/DSWindowPrivate.h',
'DSWindow/DSWindow.cpp',
+ 'DSWindowManager/DSWindowManager.cpp',
'DSWindowShell/DSWindowShell.cpp',
'DSWindowShell/DSWindowShellPrivate.cpp',
'DSZone/DSZone.cpp',
'./DSWaylandExtension',
'./DSWaylandServer',
'./DSWindow',
+ './DSWindowManager',
'./DSWindowShell',
'./DSZone',
'./DSClient',
--- /dev/null
+/*
+* Copyright © 2020 Samsung Electronics co., Ltd. All Rights Reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice (including the next
+* paragraph) shall be included in all copies or substantial portions of the
+* Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+* DEALINGS IN THE SOFTWARE.
+*/
+
+#include "libds-tests.h"
+#include "DSWaylandCompositor.h"
+#include "DSWindowManager.h"
+
+using namespace display_server;
+
+class DSWindowManagerTest : public ::testing::Test
+{
+public:
+ void SetUp(void) override
+ {
+ setenv("XDG_RUNTIME_DIR", "/run", 1);
+ }
+ void TearDown(void) override
+ {
+ unsetenv("XDG_RUNTIME_DIR");
+ }
+};
+
+TEST_F(DSWindowManagerTest, GetWindowManager)
+{
+ DSWindowManager* winMgr = DSWindowManager::getInstance();
+ EXPECT_TRUE(winMgr != nullptr);
+}
'DSDebugLog-test.cpp',
'DSDisplayDeviceTDMImpl-test.cpp',
'DSSignal-test.cpp',
+ 'DSWindowManager-test.cpp',
'DSWindow-test.cpp',
'DSWindowShell-test.cpp',
'DSWaylandCallback-test.cpp',