send output id instead of wl_output 64/65364/2
authorRoman Peresipkyn <r.peresipkyn@samsung.com>
Fri, 8 Apr 2016 16:16:37 +0000 (19:16 +0300)
committerRoman Peresipkyn <r.peresipkyn@samsung.com>
Fri, 8 Apr 2016 16:33:39 +0000 (19:33 +0300)
Change-Id: Ib1a8ad8bb2a12aaad995ced7aaaacdc9032a12d4
Signed-off-by: Roman Peresipkyn <r.peresipkyn@samsung.com>
src/wayland/eom-wayland.c
src/wayland/protocol/eom-client-protocol.h
src/wayland/protocol/eom-protocol.c
src/wayland/protocol/eom.xml

index 1a97ca6..3c3aff8 100644 (file)
@@ -342,28 +342,26 @@ _eom_wayland_client_call_notify(EomWaylandOutput *eom_wl_output,
        array = g_array_append_val(array, v);
        g_value_unset(&v);
 
-       if (eom_wl_output->client_info->func)
+       if (eom_wl_output->client_info && eom_wl_output->client_info->func)
                eom_wl_output->client_info->func(NULL, array);
 
        if (array)
                g_array_free(array, FALSE);
-
 }
 
 
 static EomWaylandOutput *
 _eom_wayland_client_find_output_from_wl_output(
-               struct wl_list *eom_wl_output_list, struct wl_output *output)
+               struct wl_list *eom_wl_output_list, int output_id)
 {
        EomWaylandOutput *eom_wl_output = NULL;
        EomWaylandOutput *tmp = NULL;
        EomWaylandOutput *ret = NULL;
 
-       /* remove all eom_wl_outputs */
        if (!wl_list_empty(eom_wl_output_list)) {
                wl_list_for_each_safe(eom_wl_output,
                        tmp, eom_wl_output_list, link) {
-                       if (eom_wl_output->output == output) {
+                       if (eom_wl_output->id == output_id) {
                                ret = eom_wl_output;
                                break;
                        }
@@ -381,7 +379,6 @@ _eom_wayland_client_find_output_from_eom_output(
        EomWaylandOutput *tmp = NULL;
        EomWaylandOutput *ret = NULL;
 
-       /* remove all eom_wl_outputs */
        if (!wl_list_empty(eom_wl_output_list)) {
                wl_list_for_each_safe(eom_wl_output,
                        tmp, eom_wl_output_list, link) {
@@ -486,15 +483,17 @@ static const struct wl_output_listener eom_wl_output_listener = {
 static void
 _eom_wl_eom_output_type(void *data,
                        struct wl_eom *wl_eom,
-                       struct wl_output *output,
+                       uint32_t output_id,
                        uint32_t type,
                        uint32_t status)
 {
        EomWaylandClientInfo *eom_client_info = (EomWaylandClientInfo *) data;
        EomWaylandOutput *eom_wl_output = NULL;
 
+       INFO("TYPE");
+
        eom_wl_output = _eom_wayland_client_find_output_from_wl_output(
-               &eom_client_info->eom_wl_output_list, output);
+               &eom_client_info->eom_wl_output_list, output_id);
        RET_IF_FAIL(eom_wl_output != NULL);
 
        /* save the output type */
@@ -517,14 +516,16 @@ _eom_wl_eom_output_type(void *data,
 static void
 _eom_wl_eom_output_mode(void *data,
                        struct wl_eom *wl_eom,
-                       struct wl_output *output,
+                       uint32_t output_id,
                        uint32_t mode)
 {
        EomWaylandClientInfo *eom_client_info = (EomWaylandClientInfo *) data;
        EomWaylandOutput *eom_wl_output = NULL;
 
+       INFO("MODE");
+
        eom_wl_output = _eom_wayland_client_find_output_from_wl_output(
-               &eom_client_info->eom_wl_output_list, output);
+               &eom_client_info->eom_wl_output_list, output_id);
        RET_IF_FAIL(eom_wl_output != NULL);
 
        /* check the eom mode and call the notify */
@@ -539,7 +540,7 @@ _eom_wl_eom_output_mode(void *data,
 static void
 _eom_wl_eom_output_attribute(void *data,
                         struct wl_eom *wl_eom,
-                        struct wl_output *output,
+                        uint32_t output_id,
                         uint32_t attribute,
                         uint32_t attribute_state,
                         uint32_t error)
@@ -547,8 +548,10 @@ _eom_wl_eom_output_attribute(void *data,
        EomWaylandClientInfo *eom_client_info = (EomWaylandClientInfo *) data;
        EomWaylandOutput *eom_wl_output = NULL;
 
+       INFO("ATTRIBUTE");
+
        eom_wl_output = _eom_wayland_client_find_output_from_wl_output(
-               &eom_client_info->eom_wl_output_list, output);
+               &eom_client_info->eom_wl_output_list, output_id);
        RET_IF_FAIL(eom_wl_output != NULL);
 
        /* check the eom attribute and call the notify */
@@ -663,7 +666,8 @@ _eom_wayland_client_initialize()
                wl_list_for_each_safe(eom_wl_output, tmp,
                        &wl_client_info.eom_wl_output_list, link) {
                        if (eom_wl_output->eom_type == WL_EOM_TYPE_NONE) {
-                               WARN("[EOM_CLIENT] eom_type is NONE. remove.\n");
+                               WARN("[EOM_CLIENT] eom_type is NONE. remove output:%d\n",
+                                       eom_wl_output->id);
                                wl_output_destroy(eom_wl_output->output);
                                wl_list_remove(&eom_wl_output->link);
                                free(eom_wl_output);
@@ -753,7 +757,6 @@ eom_wayland_client_get_output_ids(void)
 
        array = g_array_new(FALSE, FALSE, sizeof(GValue));
 
-       /* remove all eom_wl_outputs */
        wl_list_for_each_safe(eom_wl_output, tmp,
                &wl_client_info.eom_wl_output_list, link) {
                if (eom_wl_output->output) {
@@ -840,7 +843,7 @@ eom_wayland_client_set_attribute(eom_output_id output_id,
                &wl_client_info.eom_wl_output_list, output_id);
        GOTO_IF_FAIL(eom_wl_output != NULL, fail);
 
-       wl_eom_set_attribute(wl_client_info.eom, eom_wl_output->output,
+       wl_eom_set_attribute(wl_client_info.eom, eom_wl_output->id,
                _convert_to_wl_eom_attribute(attr));
 
        /* TODO:
index 147ac77..8b295fe 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef WL_EOM_CLIENT_PROTOCOL_H
 #define WL_EOM_CLIENT_PROTOCOL_H
 
-#ifdef __cplusplus
+#ifdef  __cplusplus
 extern "C" {
 #endif
 
@@ -154,34 +154,34 @@ enum wl_eom_attribute_state {
 struct wl_eom_listener {
        /**
         * output_type - (none)
-        * @output: (none)
+        * @output_id: (none)
         * @type: (none)
         * @status: (none)
         */
        void (*output_type)(void *data,
                            struct wl_eom *wl_eom,
-                           struct wl_output *output,
+                           uint32_t output_id,
                            uint32_t type,
                            uint32_t status);
        /**
         * output_mode - (none)
-        * @output: (none)
+        * @output_id: (none)
         * @mode: (none)
         */
        void (*output_mode)(void *data,
                            struct wl_eom *wl_eom,
-                           struct wl_output *output,
+                           uint32_t output_id,
                            uint32_t mode);
        /**
         * output_attribute - (none)
-        * @output: (none)
+        * @output_id: (none)
         * @attribute: (none)
         * @attribute_state: (none)
         * @error: (none)
         */
        void (*output_attribute)(void *data,
                                 struct wl_eom *wl_eom,
-                                struct wl_output *output,
+                                uint32_t output_id,
                                 uint32_t attribute,
                                 uint32_t attribute_state,
                                 uint32_t error);
@@ -197,6 +197,8 @@ wl_eom_add_listener(struct wl_eom *wl_eom,
 
 #define WL_EOM_SET_ATTRIBUTE   0
 
+#define WL_EOM_SET_ATTRIBUTE_SINCE_VERSION     1
+
 static inline void
 wl_eom_set_user_data(struct wl_eom *wl_eom, void *user_data)
 {
@@ -209,6 +211,12 @@ wl_eom_get_user_data(struct wl_eom *wl_eom)
        return wl_proxy_get_user_data((struct wl_proxy *) wl_eom);
 }
 
+static inline uint32_t
+wl_eom_get_version(struct wl_eom *wl_eom)
+{
+       return wl_proxy_get_version((struct wl_proxy *) wl_eom);
+}
+
 static inline void
 wl_eom_destroy(struct wl_eom *wl_eom)
 {
@@ -216,14 +224,13 @@ wl_eom_destroy(struct wl_eom *wl_eom)
 }
 
 static inline void
-wl_eom_set_attribute(struct wl_eom *wl_eom, struct wl_output *output,
-               uint32_t attribute)
+wl_eom_set_attribute(struct wl_eom *wl_eom, uint32_t output_id, uint32_t attribute)
 {
        wl_proxy_marshal((struct wl_proxy *) wl_eom,
-                        WL_EOM_SET_ATTRIBUTE, output, attribute);
+                        WL_EOM_SET_ATTRIBUTE, output_id, attribute);
 }
 
-#ifdef __cplusplus
+#ifdef  __cplusplus
 }
 #endif
 
index fc7ccc7..265c780 100644 (file)
@@ -2,30 +2,22 @@
 #include <stdint.h>
 #include "wayland-util.h"
 
-extern const struct wl_interface wl_output_interface;
 
 static const struct wl_interface *types[] = {
-       &wl_output_interface,
        NULL,
-       &wl_output_interface,
-       NULL,
-       NULL,
-       &wl_output_interface,
-       NULL,
-       &wl_output_interface,
        NULL,
        NULL,
        NULL,
 };
 
 static const struct wl_message wl_eom_requests[] = {
-       { "set_attribute", "ou", types + 0 },
+       { "set_attribute", "uu", types + 0 },
 };
 
 static const struct wl_message wl_eom_events[] = {
-       { "output_type", "ouu", types + 2 },
-       { "output_mode", "ou", types + 5 },
-       { "output_attribute", "ouuu", types + 7 },
+       { "output_type", "uuu", types + 0 },
+       { "output_mode", "uu", types + 0 },
+       { "output_attribute", "uuuu", types + 0 },
 };
 
 WL_EXPORT const struct wl_interface wl_eom_interface = {
index 94d5ce6..b84cf7c 100644 (file)
     </enum>
 
     <request name="set_attribute">
-      <arg name="output" type="object" interface="wl_output"/>
+      <arg name="output_id" type="uint"/>
       <arg name="attribute" type="uint"/>
     </request>
 
     <event name="output_type">
-      <arg name="output" type="object" interface="wl_output"/>
+      <arg name="output_id" type="uint"/>
       <arg name="type" type="uint"/>
       <arg name="status" type="uint"/>
     </event>
 
     <event name="output_mode">
-      <arg name="output" type="object" interface="wl_output"/>
+      <arg name="output_id" type="uint"/>
       <arg name="mode" type="uint"/>
     </event>
 
     <event name="output_attribute">
-      <arg name="output" type="object" interface="wl_output"/>
+      <arg name="output_id" type="uint"/>
       <arg name="attribute" type="uint"/>
       <arg name="attribute_state" type="uint"/>
       <arg name="error" type="uint"/>