--- /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 "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
--- /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_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
--- /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_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
'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',
]