DSWaylandTizenPolicyExt: Add skeleton codes to get tizen_rotation 50/242750/1
authorjeon <jhyuni.kang@samsung.com>
Fri, 28 Aug 2020 02:15:51 +0000 (11:15 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Tue, 1 Sep 2020 01:29:13 +0000 (10:29 +0900)
Change-Id: I81c7b38aa548dde8997954794ea6134a4e575e94

src/DSWaylandServer/DSWaylandTizenPolicyExt.cpp [new file with mode: 0644]
src/DSWaylandServer/DSWaylandTizenPolicyExt.h [new file with mode: 0644]
src/DSWaylandServer/DSWaylandTizenPolicyExtPrivate.h [new file with mode: 0644]
src/meson.build

diff --git a/src/DSWaylandServer/DSWaylandTizenPolicyExt.cpp b/src/DSWaylandServer/DSWaylandTizenPolicyExt.cpp
new file mode 100644 (file)
index 0000000..2ffff5b
--- /dev/null
@@ -0,0 +1,162 @@
+/*
+* 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 "DSWaylandTizenPolicyExt.h"
+#include "DSWaylandTizenPolicyExtPrivate.h"
+
+namespace display_server
+{
+
+/* DSWaylandTizenPolicyExt */
+DSWaylandTizenPolicyExtPrivate::DSWaylandTizenPolicyExtPrivate(DSWaylandTizenPolicyExt *p_ptr, DSWaylandCompositor *compositor)
+       : DSObjectPrivate(p_ptr),
+         __p_ptr(p_ptr),
+         __resource_id_cnt(0)
+{
+       if (!compositor)
+               return;
+
+       init(compositor->display(), 3);
+}
+
+DSWaylandTizenPolicyExtPrivate::~DSWaylandTizenPolicyExtPrivate()
+{
+}
+
+void DSWaylandTizenPolicyExtPrivate::tizen_policy_ext_bind_resource(Resource *resource)
+{
+}
+
+void DSWaylandTizenPolicyExtPrivate::tizen_policy_ext_destroy_resource(Resource *resource)
+{
+}
+
+void DSWaylandTizenPolicyExtPrivate::tizen_policy_ext_get_rotation(Resource *resource, uint32_t id, struct ::wl_resource *surface)
+{
+       DSWaylandTizenRotation *tizenRotation = nullptr;
+
+       for (DSWaylandTizenRotation *temp : __rotationList)
+               if (temp->getRotationSurface() == surface) return;
+
+       tizenRotation = new DSWaylandTizenRotation(resource->client(), id, surface);
+       if (tizenRotation == nullptr)
+       {
+               DSLOG_ERR("DSWaylandTizenPolicyExt", "fail get tizen resource");
+               return;
+       }
+
+       __rotationList.push_back(tizenRotation);
+}
+
+DSWaylandTizenRotation *DSWaylandTizenPolicyExtPrivate::getTizenRotation(struct ::wl_resource *surface)
+{
+       DSWaylandTizenRotation *tizenRotation = nullptr;
+
+       for (DSWaylandTizenRotation *temp : __rotationList)
+       {
+               if (temp->getRotationSurface() == surface)
+               {
+                       tizenRotation = temp;
+                       break;
+               }
+       }
+
+       return tizenRotation;
+}
+
+void DSWaylandTizenPolicyExtPrivate::delTizenRotation(DSWaylandTizenRotation *tizenRotation)
+{
+       __rotationList.remove(tizenRotation);
+}
+
+DSWaylandTizenPolicyExt::DSWaylandTizenPolicyExt(DSWaylandCompositor *compositor)
+       : _d_ptr(std::make_unique<DSWaylandTizenPolicyExtPrivate>(this, compositor))
+{
+}
+
+DSWaylandTizenPolicyExt::~DSWaylandTizenPolicyExt()
+{
+}
+
+DSWaylandTizenRotation *DSWaylandTizenPolicyExt::getTizenRotation(struct ::wl_resource *surface)
+{
+       DS_GET_PRIV(DSWaylandTizenPolicyExt);
+
+       return priv->getTizenRotation(surface);
+}
+
+void DSWaylandTizenPolicyExt::delTizenRotation(DSWaylandTizenRotation *tizenRotation)
+{
+       DS_GET_PRIV(DSWaylandTizenPolicyExt);
+
+       priv->delTizenRotation(tizenRotation);
+}
+
+/* DSWaylandTizenRotation */
+DSWaylandTizenRotationPrivate::DSWaylandTizenRotationPrivate(DSWaylandTizenRotation *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, 3);
+}
+
+DSWaylandTizenRotationPrivate::~DSWaylandTizenRotationPrivate()
+{
+}
+
+void DSWaylandTizenRotationPrivate::tizen_rotation_bind_resource(Resource *resource)
+{
+}
+
+void DSWaylandTizenRotationPrivate::tizen_rotation_destroy_resource(Resource *resource)
+{
+}
+
+void DSWaylandTizenRotationPrivate::tizen_rotation_destroy(Resource *resource)
+{
+}
+
+struct ::wl_resource *DSWaylandTizenRotationPrivate::getRotationSurface(void)
+{
+       return __surface;
+}
+
+DSWaylandTizenRotation::DSWaylandTizenRotation(struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface)
+       : _d_ptr(std::make_unique<DSWaylandTizenRotationPrivate>(this, client, id, surface))
+{
+}
+
+DSWaylandTizenRotation::~DSWaylandTizenRotation()
+{
+}
+
+struct ::wl_resource *DSWaylandTizenRotation::getRotationSurface(void)
+{
+       DS_GET_PRIV(DSWaylandTizenRotation);
+
+       return priv->getRotationSurface();
+}
+
+} // namespace display_server
diff --git a/src/DSWaylandServer/DSWaylandTizenPolicyExt.h b/src/DSWaylandServer/DSWaylandTizenPolicyExt.h
new file mode 100644 (file)
index 0000000..eef13dc
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+* 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_POLICY_EXT_H_
+#define _DS_WAYLAND_TIZEN_POLICY_EXT_H_
+
+#include <DSObject.h>
+#include <DSCore.h>
+#include <DSWaylandCompositor.h>
+#include <wayland-server-core.h>
+
+namespace display_server
+{
+
+class DSWaylandTizenPolicyExtPrivate;
+class DSWaylandTizenRotationPrivate;
+
+class DS_DECL_EXPORT DSWaylandTizenRotation : public DSObject
+{
+DS_PIMPL_USE_PRIVATE(DSWaylandTizenRotation);
+
+public:
+       DSWaylandTizenRotation(struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface);
+       virtual ~DSWaylandTizenRotation();
+
+       struct ::wl_resource *getRotationSurface(void);
+       void sendResourceId(void);
+       void setResourceId(uint32_t tizenResourceId);
+       uint32_t getResourceId(void);
+};
+
+class DS_DECL_EXPORT DSWaylandTizenPolicyExt : public DSObject
+{
+DS_PIMPL_USE_PRIVATE(DSWaylandTizenPolicyExt);
+
+public:
+       DSWaylandTizenPolicyExt(DSWaylandCompositor *compositor);
+       virtual ~DSWaylandTizenPolicyExt();
+
+       DSWaylandTizenRotation *getTizenRotation(struct ::wl_resource *surface);
+       void delTizenRotation(DSWaylandTizenRotation *resource);
+};
+
+}
+
+#endif
diff --git a/src/DSWaylandServer/DSWaylandTizenPolicyExtPrivate.h b/src/DSWaylandServer/DSWaylandTizenPolicyExtPrivate.h
new file mode 100644 (file)
index 0000000..cfa4e79
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+* 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_POLICY_EXT_PRIVATE_H_
+#define _DS_WAYLAND_TIZEN_POLICY_EXT_PRIVATE_H_
+
+#include "dswayland-server-tizen_policy_ext.h"
+#include "DSWaylandTizenPolicyExt.h"
+
+namespace display_server
+{
+
+class DS_DECL_EXPORT DSWaylandTizenRotationPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_rotation
+{
+DS_PIMPL_USE_PUBLIC(DSWaylandTizenRotation);
+
+public:
+       DSWaylandTizenRotationPrivate() = delete;
+       DSWaylandTizenRotationPrivate(DSWaylandTizenRotation *p_ptr, struct ::wl_client *client, uint32_t id, struct ::wl_resource *surface);
+       ~DSWaylandTizenRotationPrivate() override;
+
+       struct ::wl_resource *getRotationSurface(void);
+
+protected:
+       void tizen_rotation_bind_resource(Resource *resource) override;
+       void tizen_rotation_destroy_resource(Resource *resource) override;
+       void tizen_rotation_destroy(Resource *resource) override;
+private:
+       struct ::wl_resource *__surface;
+       uint32_t __resource_id;
+};
+
+class DS_DECL_EXPORT DSWaylandTizenPolicyExtPrivate : public DSObjectPrivate, public DSWaylandServer::tizen_policy_ext
+{
+DS_PIMPL_USE_PUBLIC(DSWaylandTizenPolicyExt);
+
+public:
+       DSWaylandTizenPolicyExtPrivate() = delete;
+       DSWaylandTizenPolicyExtPrivate(DSWaylandTizenPolicyExt *p_ptr, DSWaylandCompositor *compositor);
+       ~DSWaylandTizenPolicyExtPrivate() override;
+
+       DSWaylandTizenRotation *getTizenRotation(struct ::wl_resource *surface);
+       void delTizenRotation(DSWaylandTizenRotation *resource);
+
+protected:
+       void tizen_policy_ext_bind_resource(Resource *resource) override;
+       void tizen_policy_ext_destroy_resource(Resource *resource) override;
+       void tizen_policy_ext_get_rotation(Resource *resource, uint32_t id, struct ::wl_resource *surface) override;
+
+private:
+       std::list<DSWaylandTizenRotation *> __rotationList;
+       uint32_t __resource_id_cnt; //TO DO : have to manage more proper class
+};
+
+}
+
+#endif
index 48b1a58..ea39c2c 100644 (file)
@@ -179,6 +179,9 @@ libds_wayland_srcs = [
        'DSWaylandServer/DSWaylandProtocolTracePrivate.h',
        'DSWaylandServer/DSWaylandProtocolTrace.h',
        'DSWaylandServer/DSWaylandProtocolTrace.cpp',
+       'DSWaylandServer/DSWaylandTizenPolicyExt.h',
+       'DSWaylandServer/DSWaylandTizenPolicyExtPrivate.h',
+       'DSWaylandServer/DSWaylandTizenPolicyExt.cpp',
        'DSWaylandServer/tizen_policy_ext-server-protocol.h',
        'DSWaylandServer/tizen_policy_ext-protocol.c',
        ]