--- /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 "DSWaylandTizenSurface.h"
+#include "DSWaylandTizenSurfacePrivate.h"
+
+namespace display_server
+{
+
+/* DSWaylandTizenSurface */
+DSWaylandTizenSurfacePrivate::DSWaylandTizenSurfacePrivate(DSWaylandTizenSurface *p_ptr, DSWaylandCompositor *compositor)
+ : DSObjectPrivate(p_ptr),
+ __p_ptr(p_ptr),
+ __resource_id_cnt(0)
+{
+ if (!compositor)
+ return;
+
+ init(compositor->display(), 1);
+}
+
+DSWaylandTizenSurfacePrivate::~DSWaylandTizenSurfacePrivate()
+{
+}
+
+void DSWaylandTizenSurfacePrivate::tizen_surface_bind_resource(Resource *resource)
+{
+}
+
+void DSWaylandTizenSurfacePrivate::tizen_surface_destroy_resource(Resource *resource)
+{
+}
+
+void DSWaylandTizenSurfacePrivate::tizen_surface_get_tizen_resource(Resource *resource, uint32_t id, struct ::wl_resource *surface)
+{
+ DSWaylandTizenResource *tizenResource = nullptr;
+
+ for (DSWaylandTizenResource *temp : __resourceList)
+ if (temp->getResourceSurface() == surface) return;
+
+ tizenResource = new DSWaylandTizenResource(resource->client(), id, surface);
+ if (tizenResource == nullptr)
+ {
+ DSLOG_ERR("DSWaylandTizenSurface", "fail get tizen resource");
+ return;
+ }
+
+ __resource_id_cnt++;
+ tizenResource->setResourceId(__resource_id_cnt);
+
+ __resourceList.push_back(tizenResource);
+
+ tizenResource->sendResourceId();
+}
+
+void DSWaylandTizenSurfacePrivate::tizen_surface_destroy(Resource *resource)
+{
+}
+
+DSWaylandTizenResource *DSWaylandTizenSurfacePrivate::getTizenResource(struct ::wl_resource *surface)
+{
+ DSWaylandTizenResource *tizenResource = nullptr;
+
+ for (DSWaylandTizenResource *temp : __resourceList)
+ {
+ if (temp->getResourceSurface() == surface)
+ {
+ tizenResource = temp;
+ break;
+ }
+ }
+
+ return tizenResource;
+}
+
+void DSWaylandTizenSurfacePrivate::delTizenResource(DSWaylandTizenResource *tizenResource)
+{
+ __resourceList.remove(tizenResource);
+}
+
+DSWaylandTizenSurface::DSWaylandTizenSurface(DSWaylandCompositor *compositor)
+ : _d_ptr(std::make_unique<DSWaylandTizenSurfacePrivate>(this, compositor))
+{
+}
+
+DSWaylandTizenSurface::~DSWaylandTizenSurface()
+{
+}
+
+DSWaylandTizenResource *DSWaylandTizenSurface::getTizenResource(struct ::wl_resource *surface)
+{
+ DS_GET_PRIV(DSWaylandTizenSurface);
+
+ return priv->getTizenResource(surface);
+}
+
+void DSWaylandTizenSurface::delTizenResource(DSWaylandTizenResource *tizenResource)
+{
+ DS_GET_PRIV(DSWaylandTizenSurface);
+
+ priv->delTizenResource(tizenResource);
+}
+
+/* DSWaylandTizenResource */
+DSWaylandTizenResourcePrivate::DSWaylandTizenResourcePrivate(DSWaylandTizenResource *p_ptr, struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface)
+ : DSObjectPrivate(p_ptr),
+ __p_ptr(p_ptr),
+ __surface(surface),
+ __resource_id(0)
+{
+ init(client, id, 1);
+}
+
+DSWaylandTizenResourcePrivate::~DSWaylandTizenResourcePrivate()
+{
+}
+
+void DSWaylandTizenResourcePrivate::tizen_resource_bind_resource(Resource *resource)
+{
+}
+
+void DSWaylandTizenResourcePrivate::tizen_resource_destroy_resource(Resource *resource)
+{
+}
+
+void DSWaylandTizenResourcePrivate::tizen_resource_destroy(Resource *resource)
+{
+}
+
+struct ::wl_resource *DSWaylandTizenResourcePrivate::getResourceSurface(void)
+{
+ return __surface;
+}
+
+void DSWaylandTizenResourcePrivate::sendResourceId(void)
+{
+ send_resource_id(__resource_id);
+}
+
+void DSWaylandTizenResourcePrivate::setResourceId(uint32_t tizenResourceId)
+{
+ __resource_id = tizenResourceId;
+}
+
+uint32_t DSWaylandTizenResourcePrivate::getResourceId(void)
+{
+ return __resource_id;
+}
+
+DSWaylandTizenResource::DSWaylandTizenResource(struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface)
+ : _d_ptr(std::make_unique<DSWaylandTizenResourcePrivate>(this, client, id, surface))
+{
+}
+
+DSWaylandTizenResource::~DSWaylandTizenResource()
+{
+}
+
+struct ::wl_resource *DSWaylandTizenResource::getResourceSurface(void)
+{
+ DS_GET_PRIV(DSWaylandTizenResource);
+
+ return priv->getResourceSurface();
+}
+
+void DSWaylandTizenResource::sendResourceId(void)
+{
+ DS_GET_PRIV(DSWaylandTizenResource);
+
+ DSLOG_INF("DSWaylandTizenResource", "send Resource Id");
+
+ priv->sendResourceId();
+}
+
+void DSWaylandTizenResource::setResourceId(uint32_t tizenResourceId)
+{
+ DS_GET_PRIV(DSWaylandTizenResource);
+
+ DSLOG_INF("DSWaylandTizenResource", "send Resource Id");
+
+ priv->setResourceId(tizenResourceId);
+}
+
+uint32_t DSWaylandTizenResource::getResourceId(void)
+{
+ DS_GET_PRIV(DSWaylandTizenResource);
+
+ DSLOG_INF("DSWaylandTizenResource", "send Resource Id");
+
+ return priv->getResourceId();
+}
+
+} // namespace display_server
--- /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_WAYLAND_TIZEN_SURFACE_H_
+#define _DS_WAYLAND_TIZEN_SURFACE_H_
+
+#include <DSObject.h>
+#include <DSCore.h>
+#include <DSWaylandCompositor.h>
+#include <wayland-server-core.h>
+
+namespace display_server
+{
+
+class DSWaylandTizenSurfacePrivate;
+class DSWaylandTizenResourcePrivate;
+
+class DS_DECL_EXPORT DSWaylandTizenResource : public DSObject
+{
+DS_PIMPL_USE_PRIVATE(DSWaylandTizenResource);
+
+public:
+ DSWaylandTizenResource(struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface);
+ virtual ~DSWaylandTizenResource();
+
+ struct ::wl_resource *getResourceSurface(void);
+ void sendResourceId(void);
+ void setResourceId(uint32_t tizenResourceId);
+ uint32_t getResourceId(void);
+};
+
+class DS_DECL_EXPORT DSWaylandTizenSurface : public DSObject
+{
+DS_PIMPL_USE_PRIVATE(DSWaylandTizenSurface);
+
+public:
+ DSWaylandTizenSurface(DSWaylandCompositor *compositor);
+ virtual ~DSWaylandTizenSurface();
+
+ DSWaylandTizenResource *getTizenResource(struct ::wl_resource *surface);
+ void delTizenResource(DSWaylandTizenResource *resource);
+};
+
+}
+
+#endif
--- /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_WAYLAND_TIZEN_SURFACE_PRIVATE_H_
+#define _DS_WAYLAND_TIZEN_SURFACE_PRIVATE_H_
+
+#include "dswayland-server-tizen-extension.h"
+#include "DSWaylandTizenSurface.h"
+
+namespace display_server
+{
+
+class DS_DECL_EXPORT DSWaylandTizenResourcePrivate : public DSObjectPrivate, public DSWaylandServer::tizen_resource
+{
+DS_PIMPL_USE_PUBLIC(DSWaylandTizenResource);
+
+public:
+ DSWaylandTizenResourcePrivate() = delete;
+ DSWaylandTizenResourcePrivate(DSWaylandTizenResource *p_ptr, struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface);
+ ~DSWaylandTizenResourcePrivate() override;
+
+ struct ::wl_resource *getResourceSurface(void);
+ void sendResourceId(void);
+ void setResourceId(uint32_t tizenResourceId);
+ uint32_t getResourceId(void);
+
+protected:
+ void tizen_resource_bind_resource(Resource *resource) override;
+ void tizen_resource_destroy_resource(Resource *resource) override;
+ void tizen_resource_destroy(Resource *resource) override;
+private:
+ struct ::wl_resource *__surface;
+ uint32_t __resource_id;
+};
+
+class DS_DECL_EXPORT DSWaylandTizenSurfacePrivate : public DSObjectPrivate, public DSWaylandServer::tizen_surface
+{
+DS_PIMPL_USE_PUBLIC(DSWaylandTizenSurface);
+
+public:
+ DSWaylandTizenSurfacePrivate() = delete;
+ DSWaylandTizenSurfacePrivate(DSWaylandTizenSurface *p_ptr, DSWaylandCompositor *compositor);
+ ~DSWaylandTizenSurfacePrivate() override;
+
+ DSWaylandTizenResource *getTizenResource(struct ::wl_resource *surface);
+ void delTizenResource(DSWaylandTizenResource *resource);
+
+protected:
+ void tizen_surface_bind_resource(Resource *resource) override;
+ void tizen_surface_destroy_resource(Resource *resource) override;
+ void tizen_surface_get_tizen_resource(Resource *resource, uint32_t id, struct ::wl_resource *surface) override;
+ void tizen_surface_destroy(Resource *resource) override;
+
+private:
+ std::list<DSWaylandTizenResource *> __resourceList;
+ uint32_t __resource_id_cnt; //TO DO : have to manage more proper class
+};
+
+}
+
+#endif
'DSWaylandServer/DSWaylandTizenPolicy.cpp',
'DSWaylandServer/DSWaylandTizenPosition.cpp',
'DSWaylandServer/DSWaylandTizenVisibility.cpp',
+ 'DSWaylandServer/DSWaylandTizenSurface.cpp',
+ 'DSWaylandServer/DSWaylandTizenSurface.h',
+ 'DSWaylandServer/DSWaylandTizenSurfacePrivate.h',
'DSWaylandServer/DSWaylandTizenSurfaceShm.cpp',
'DSWaylandServer/DSWaylandTizenSurfaceShm.h',
'DSWaylandServer/DSWaylandTizenSurfaceShmPrivate.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.
+*/
+
+#include "libds-tests.h"
+#include "DSWaylandTizenSurface.h"
+
+using namespace display_server;
+
+class DSWaylandTizenSurfaceTest : public ::testing::Test
+{
+public:
+ void SetUp(void) override
+ {}
+ void TearDown(void) override
+ {}
+};
+
+TEST_F(DSWaylandTizenSurfaceTest, NewDSWaylandTizenSurface)
+{
+ DSWaylandCompositor *comp = DSWaylandCompositor::getInstance();
+ DSWaylandTizenSurface *tizenSurface = new DSWaylandTizenSurface(comp);
+ EXPECT_TRUE(tizenSurface != nullptr);
+
+ if (tizenSurface)
+ delete tizenSurface;
+ DSWaylandCompositor::releaseInstance();
+}
'DSWaylandTizenInputDeviceManager-test.cpp',
'DSWaylandTizenInputDevice-test.cpp',
'DSWaylandTizenPolicy-test.cpp',
+ 'DSWaylandTizenSurface-test.cpp',
'DSWaylandTizenSurfaceShm-test.cpp',
'DSWaylandTizenIndicator-test.cpp',
'DSWaylandTizenAppinfo-test.cpp',