tizen_policy_ext: add header for tizen_policy_ext protocol 48/242748/1
authorjeon <jhyuni.kang@samsung.com>
Fri, 28 Aug 2020 02:13:31 +0000 (11:13 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Tue, 1 Sep 2020 01:29:11 +0000 (10:29 +0900)
Change-Id: I10c4937f038955082300404d258ad4360e8bab06

src/DSWaylandServer/tizen_policy_ext-protocol.c [new file with mode: 0644]
src/DSWaylandServer/tizen_policy_ext-server-protocol.h [new file with mode: 0644]
src/meson.build

diff --git a/src/DSWaylandServer/tizen_policy_ext-protocol.c b/src/DSWaylandServer/tizen_policy_ext-protocol.c
new file mode 100644 (file)
index 0000000..6b49f50
--- /dev/null
@@ -0,0 +1,54 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include "wayland-util.h"
+
+extern const struct wl_interface tizen_rotation_interface;
+extern const struct wl_interface wl_surface_interface;
+
+static const struct wl_interface *types[] = {
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       &tizen_rotation_interface,
+       &wl_surface_interface,
+       &wl_surface_interface,
+};
+
+static const struct wl_message tizen_policy_ext_requests[] = {
+       { "get_rotation", "no", types + 5 },
+       { "get_active_angle", "?o", types + 7 },
+};
+
+static const struct wl_message tizen_policy_ext_events[] = {
+       { "active_angle", "u", types + 0 },
+};
+
+WL_EXPORT const struct wl_interface tizen_policy_ext_interface3 = {
+       "tizen_policy_ext", 3,
+       2, tizen_policy_ext_requests,
+       1, tizen_policy_ext_events,
+};
+
+static const struct wl_message tizen_rotation_requests[] = {
+       { "destroy", "", types + 0 },
+       { "set_available_angles", "u", types + 0 },
+       { "set_preferred_angle", "u", types + 0 },
+       { "ack_angle_change", "u", types + 0 },
+       { "set_geometry_hint", "3uuuuu", types + 0 },
+};
+
+static const struct wl_message tizen_rotation_events[] = {
+       { "available_angles_done", "u", types + 0 },
+       { "preferred_angle_done", "u", types + 0 },
+       { "angle_change", "uu", types + 0 },
+       { "angle_change_with_resize", "2uuuu", types + 0 },
+};
+
+WL_EXPORT const struct wl_interface tizen_rotation_interface = {
+       "tizen_rotation", 3,
+       5, tizen_rotation_requests,
+       4, tizen_rotation_events,
+};
+
diff --git a/src/DSWaylandServer/tizen_policy_ext-server-protocol.h b/src/DSWaylandServer/tizen_policy_ext-server-protocol.h
new file mode 100644 (file)
index 0000000..4a08b79
--- /dev/null
@@ -0,0 +1,151 @@
+#ifndef TIZEN_POLICY_EXT_SERVER_PROTOCOL_H
+#define TIZEN_POLICY_EXT_SERVER_PROTOCOL_H
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stddef.h>
+#include "wayland-server.h"
+
+struct wl_client;
+struct wl_resource;
+
+struct tizen_policy_ext;
+struct tizen_rotation;
+struct wl_surface;
+
+extern const struct wl_interface tizen_policy_ext_interface3;
+extern const struct wl_interface tizen_rotation_interface;
+
+struct tizen_policy_ext_interface {
+       /**
+        * get_rotation - (none)
+        * @id: new rotation object
+        * @surface: surface object
+        */
+       void (*get_rotation)(struct wl_client *client,
+                            struct wl_resource *resource,
+                            uint32_t id,
+                            struct wl_resource *surface);
+       /**
+        * get_active_angle - get a current active angle
+        * @surface: (none)
+        *
+        * 
+        */
+       void (*get_active_angle)(struct wl_client *client,
+                                struct wl_resource *resource,
+                                struct wl_resource *surface);
+};
+
+#define TIZEN_POLICY_EXT_ACTIVE_ANGLE  0
+
+#define TIZEN_POLICY_EXT_ACTIVE_ANGLE_SINCE_VERSION    1
+
+static inline void
+tizen_policy_ext_send_active_angle(struct wl_resource *resource_, uint32_t angle)
+{
+       wl_resource_post_event(resource_, TIZEN_POLICY_EXT_ACTIVE_ANGLE, angle);
+}
+
+#ifndef TIZEN_ROTATION_ANGLE_ENUM
+#define TIZEN_ROTATION_ANGLE_ENUM
+enum tizen_rotation_angle {
+       TIZEN_ROTATION_ANGLE_NONE = 0,
+       TIZEN_ROTATION_ANGLE_0 = 1,
+       TIZEN_ROTATION_ANGLE_90 = 2,
+       TIZEN_ROTATION_ANGLE_180 = 4,
+       TIZEN_ROTATION_ANGLE_270 = 8,
+};
+#endif /* TIZEN_ROTATION_ANGLE_ENUM */
+
+struct tizen_rotation_interface {
+       /**
+        * destroy - destroy tizen_rotation
+        *
+        * 
+        */
+       void (*destroy)(struct wl_client *client,
+                       struct wl_resource *resource);
+       /**
+        * set_available_angles - (none)
+        * @angles: (none)
+        */
+       void (*set_available_angles)(struct wl_client *client,
+                                    struct wl_resource *resource,
+                                    uint32_t angles);
+       /**
+        * set_preferred_angle - (none)
+        * @angle: (none)
+        */
+       void (*set_preferred_angle)(struct wl_client *client,
+                                   struct wl_resource *resource,
+                                   uint32_t angle);
+       /**
+        * ack_angle_change - ack a angle_change
+        * @serial: a serial to angle_change for
+        *
+        * 
+        */
+       void (*ack_angle_change)(struct wl_client *client,
+                                struct wl_resource *resource,
+                                uint32_t serial);
+       /**
+        * set_geometry_hint - (none)
+        * @angle: (none)
+        * @x: (none)
+        * @y: (none)
+        * @width: (none)
+        * @height: (none)
+        * @since: 3
+        */
+       void (*set_geometry_hint)(struct wl_client *client,
+                                 struct wl_resource *resource,
+                                 uint32_t angle,
+                                 uint32_t x,
+                                 uint32_t y,
+                                 uint32_t w,
+                                 uint32_t h);
+};
+
+#define TIZEN_ROTATION_AVAILABLE_ANGLES_DONE   0
+#define TIZEN_ROTATION_PREFERRED_ANGLE_DONE    1
+#define TIZEN_ROTATION_ANGLE_CHANGE    2
+#define TIZEN_ROTATION_ANGLE_CHANGE_WITH_RESIZE        3
+
+#define TIZEN_ROTATION_AVAILABLE_ANGLES_DONE_SINCE_VERSION     1
+#define TIZEN_ROTATION_PREFERRED_ANGLE_DONE_SINCE_VERSION      1
+#define TIZEN_ROTATION_ANGLE_CHANGE_SINCE_VERSION      1
+#define TIZEN_ROTATION_ANGLE_CHANGE_WITH_RESIZE_SINCE_VERSION  2
+
+static inline void
+tizen_rotation_send_available_angles_done(struct wl_resource *resource_, uint32_t angles)
+{
+       wl_resource_post_event(resource_, TIZEN_ROTATION_AVAILABLE_ANGLES_DONE, angles);
+}
+
+static inline void
+tizen_rotation_send_preferred_angle_done(struct wl_resource *resource_, uint32_t angle)
+{
+       wl_resource_post_event(resource_, TIZEN_ROTATION_PREFERRED_ANGLE_DONE, angle);
+}
+
+static inline void
+tizen_rotation_send_angle_change(struct wl_resource *resource_, uint32_t angle, uint32_t serial)
+{
+       wl_resource_post_event(resource_, TIZEN_ROTATION_ANGLE_CHANGE, angle, serial);
+}
+
+static inline void
+tizen_rotation_send_angle_change_with_resize(struct wl_resource *resource_, uint32_t angle, uint32_t serial, uint32_t width, uint32_t height)
+{
+       wl_resource_post_event(resource_, TIZEN_ROTATION_ANGLE_CHANGE_WITH_RESIZE, angle, serial, width, height);
+}
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif
index 7042c46..7691d3b 100644 (file)
@@ -177,6 +177,8 @@ libds_wayland_srcs = [
        'DSWaylandServer/DSWaylandProtocolTracePrivate.h',
        'DSWaylandServer/DSWaylandProtocolTrace.h',
        'DSWaylandServer/DSWaylandProtocolTrace.cpp',
+       'DSWaylandServer/tizen_policy_ext-server-protocol.h',
+       'DSWaylandServer/tizen_policy_ext-protocol.c',
        ]
 
 libds_srcs += libds_wayland_srcs