remove place_below_parent from tizen_surface_extension 44/39544/1
authorBoram Park <boram1288.park@samsung.com>
Mon, 18 May 2015 12:17:00 +0000 (21:17 +0900)
committerBoram Park <boram1288.park@samsung.com>
Mon, 18 May 2015 12:17:26 +0000 (21:17 +0900)
Change-Id: Ia41f0c44a4a0395cfac23acfd9b256bf41d7a7b4

src/modules/Makefile_wl_desktop_shell.mk
src/modules/wl_desktop_shell/e_mod_main.c
src/modules/wl_desktop_shell/tizen_extension.xml
src/modules/wl_desktop_shell/tizen_extension_protocol.c
src/modules/wl_desktop_shell/tizen_extension_server_protocol.h
src/modules/wl_desktop_shell/tizen_subsurface.xml [new file with mode: 0644]
src/modules/wl_desktop_shell/tizen_subsurface_protocol.c [new file with mode: 0644]
src/modules/wl_desktop_shell/tizen_subsurface_server_protocol.h [new file with mode: 0644]

index efbad103366a9c94128c8ad8a07d0fb41a6e65a0..0ca0184e245cfa3e3504280b61639cb983acd251 100644 (file)
@@ -25,7 +25,9 @@ src_modules_wl_desktop_shell_module_la_SOURCES = \
   src/modules/wl_desktop_shell/e_scaler_protocol.c \
   src/modules/wl_desktop_shell/e_scaler_protocol.h \
   src/modules/wl_desktop_shell/tizen_extension_server_protocol.h \
-  src/modules/wl_desktop_shell/tizen_extension_protocol.c
+  src/modules/wl_desktop_shell/tizen_extension_protocol.c \
+  src/modules/wl_desktop_shell/tizen_subsurface_server_protocol.h \
+  src/modules/wl_desktop_shell/tizen_subsurface_protocol.c
 
 PHONIES += wl_desktop_shell install-wl_desktop_shell
 wl_desktop_shell: $(wl_desktop_shellpkg_LTLIBRARIES) $(wl_desktop_shell_DATA)
index 54d8ba13313bb7a5028c076a32aec9024fbc1103..87aaec9732cae30daf3e4cb9dc7a5e0f5881697f 100644 (file)
@@ -4,6 +4,7 @@
 #include "e_desktop_shell_protocol.h"
 #include "e_scaler.h"
 #include "tizen_extension_server_protocol.h"
+#include "tizen_subsurface_server_protocol.h"
 
 #define XDG_SERVER_VERSION 4
 
@@ -1423,45 +1424,9 @@ _e_tz_transient_for_cb_set(struct wl_client *client, struct wl_resource *resourc
    EC_CHANGED(ec);
 }
 
-static void
-_e_tz_surf_ext_cb_place_below_parent(struct wl_client *client, struct wl_resource *resource, struct wl_resource *subsurface)
-{
-   E_Client *ec;
-   E_Client *epc;
-   E_Comp_Wl_Subsurf_Data *sdata;
-
-   /* try to get the client from resource data */
-   if (!(ec = wl_resource_get_user_data(subsurface)))
-     {
-        wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
-                               "Invalid subsurface");
-        return;
-     }
-
-   sdata = ec->comp_data->sub.data;
-   if (!sdata)
-     {
-        wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
-                               "Not subsurface");
-        return;
-     }
-
-   epc = sdata->parent;
-   EINA_SAFETY_ON_NULL_RETURN(epc);
-
-   /* check if a subsurface has already placed below a parent */
-   if (eina_list_data_find(epc->comp_data->sub.below_list, ec)) return;
-
-   epc->comp_data->sub.list = eina_list_remove(epc->comp_data->sub.list, ec);
-   epc->comp_data->sub.list_pending = eina_list_remove(epc->comp_data->sub.list_pending, ec);
-   epc->comp_data->sub.below_list_pending = eina_list_append(epc->comp_data->sub.below_list_pending, ec);
-   epc->comp_data->sub.list_changed = EINA_TRUE;
-}
-
 static const struct tizen_surface_extension_interface  _e_tz_surf_ext_interface =
 {
    _e_tz_surf_ext_cb_tz_res_get,
-   _e_tz_surf_ext_cb_place_below_parent,
 };
 
 static const struct tizen_transient_for_interface _e_tz_transient_for_interface =
@@ -1628,6 +1593,71 @@ _e_tz_transient_for_cb_bind(struct wl_client *client, void *data, uint32_t versi
    wl_resource_set_implementation(res, &_e_tz_transient_for_interface, cdata, NULL);
 }
 
+static void
+_e_tz_subsurface_cb_place_below_parent(struct wl_client *client, struct wl_resource *resource, struct wl_resource *subsurface)
+{
+   E_Client *ec;
+   E_Client *epc;
+   E_Comp_Wl_Subsurf_Data *sdata;
+
+   /* try to get the client from resource data */
+   if (!(ec = wl_resource_get_user_data(subsurface)))
+     {
+        wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
+                               "Invalid subsurface");
+        return;
+     }
+
+   sdata = ec->comp_data->sub.data;
+   if (!sdata)
+     {
+        wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
+                               "Not subsurface");
+        return;
+     }
+
+   epc = sdata->parent;
+   EINA_SAFETY_ON_NULL_RETURN(epc);
+
+   /* check if a subsurface has already placed below a parent */
+   if (eina_list_data_find(epc->comp_data->sub.below_list, ec)) return;
+
+   epc->comp_data->sub.list = eina_list_remove(epc->comp_data->sub.list, ec);
+   epc->comp_data->sub.list_pending = eina_list_remove(epc->comp_data->sub.list_pending, ec);
+   epc->comp_data->sub.below_list_pending = eina_list_append(epc->comp_data->sub.below_list_pending, ec);
+   epc->comp_data->sub.list_changed = EINA_TRUE;
+}
+
+static const struct tizen_subsurface_interface  _e_tz_subsurface_interface =
+{
+   _e_tz_subsurface_cb_place_below_parent,
+};
+
+static void
+_e_tz_subsurface_cb_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id)
+{
+   E_Comp_Data *cdata;
+   struct wl_resource *res;
+
+   if (!(cdata = data))
+     {
+        wl_client_post_no_memory(client);
+        return;
+     }
+
+   if (!(res = wl_resource_create(client,
+                                  &tizen_subsurface_interface,
+                                  MIN(version, 1),
+                                  id)))
+     {
+        ERR("Could not create tizen_subsurface resource: %m");
+        wl_client_post_no_memory(client);
+        return;
+     }
+
+   wl_resource_set_implementation(res, &_e_tz_subsurface_interface, cdata, NULL);
+}
+
 EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Desktop_Shell" };
 
 EAPI void *
@@ -1684,6 +1714,17 @@ e_modapi_init(E_Module *m)
         return NULL;
      }
 
+   /* try to create global tizen subsurface interface */
+   if (!wl_global_create(cdata->wl.disp,
+                         &tizen_subsurface_interface,
+                         1,
+                         cdata,
+                         _e_tz_subsurface_cb_bind))
+     {
+        ERR("Could not create tizen_surface_extension to wayland globals: %m");
+        return NULL;
+     }
+
    return m;
 }
 
index c533fd4480d03dd76e44c1fd6f115515f2c8cb7f..beaf45001cbf8d7a9c34a52f926170ebaf3d60ea 100644 (file)
@@ -10,9 +10,6 @@
          <arg name="id" type="new_id" interface="tizen_resource" /> 
          <arg name="surface" type="object" interface="wl_surface" /> 
       </request>
-      <request name="place_below_parent">
-         <arg name="subsurface" type="object" interface="wl_subsurface"/>
-      </request>
    </interface>
    <interface name="tizen_transient_for" version="1">
       <request name="set">
index 3de79ba197b9019e57523ee71965ea1f9d6594d4..54587768094ad43f4e9867bdd3df199a5036d58e 100644 (file)
@@ -4,14 +4,12 @@
 
 extern const struct wl_interface tizen_resource_interface;
 extern const struct wl_interface wl_surface_interface;
-extern const struct wl_interface wl_subsurface_interface;
 
 static const struct wl_interface *types[] = {
        NULL,
        NULL,
        &tizen_resource_interface,
        &wl_surface_interface,
-       &wl_subsurface_interface,
 };
 
 static const struct wl_message tizen_resource_requests[] = {
@@ -30,12 +28,11 @@ WL_EXPORT const struct wl_interface tizen_resource_interface = {
 
 static const struct wl_message tizen_surface_extension_requests[] = {
        { "get_tizen_resource", "no", types + 2 },
-       { "place_below_parent", "o", types + 4 },
 };
 
 WL_EXPORT const struct wl_interface tizen_surface_extension_interface = {
        "tizen_surface_extension", 1,
-       2, tizen_surface_extension_requests,
+       1, tizen_surface_extension_requests,
        0, NULL,
 };
 
index ab288438b0f1fedffbee762f4c68dbae9ea58394..11a048585fd9b6bc949fb98305f1b0f69934dd32 100644 (file)
@@ -48,15 +48,9 @@ struct tizen_surface_extension_interface {
                                   struct wl_resource *resource,
                                   uint32_t id,
                                   struct wl_resource *surface);
-       /**
-        * place_below_parent - (none)
-        * @subsurface: (none)
-        */
-       void (*place_below_parent)(struct wl_client *client,
-                                  struct wl_resource *resource,
-                                  struct wl_resource *subsurface);
 };
 
+
 struct tizen_transient_for_interface {
        /**
         * set - (none)
@@ -71,6 +65,8 @@ struct tizen_transient_for_interface {
 
 #define TIZEN_TRANSIENT_FOR_DONE       0
 
+#define TIZEN_TRANSIENT_FOR_DONE_SINCE_VERSION 1
+
 static inline void
 tizen_transient_for_send_done(struct wl_resource *resource_, uint32_t child_id)
 {
diff --git a/src/modules/wl_desktop_shell/tizen_subsurface.xml b/src/modules/wl_desktop_shell/tizen_subsurface.xml
new file mode 100644 (file)
index 0000000..16bd5f2
--- /dev/null
@@ -0,0 +1,7 @@
+<protocol name="tizen_subsurface">
+   <interface name="tizen_subsurface" version="1">
+      <request name="place_below_parent">
+         <arg name="subsurface" type="object" interface="wl_subsurface"/>
+      </request>
+   </interface>
+</protocol>
diff --git a/src/modules/wl_desktop_shell/tizen_subsurface_protocol.c b/src/modules/wl_desktop_shell/tizen_subsurface_protocol.c
new file mode 100644 (file)
index 0000000..b3950da
--- /dev/null
@@ -0,0 +1,20 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include "wayland-util.h"
+
+extern const struct wl_interface wl_subsurface_interface;
+
+static const struct wl_interface *types[] = {
+       &wl_subsurface_interface,
+};
+
+static const struct wl_message tizen_subsurface_requests[] = {
+       { "place_below_parent", "o", types + 0 },
+};
+
+WL_EXPORT const struct wl_interface tizen_subsurface_interface = {
+       "tizen_subsurface", 1,
+       1, tizen_subsurface_requests,
+       0, NULL,
+};
+
diff --git a/src/modules/wl_desktop_shell/tizen_subsurface_server_protocol.h b/src/modules/wl_desktop_shell/tizen_subsurface_server_protocol.h
new file mode 100644 (file)
index 0000000..c283c84
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef TIZEN_SUBSURFACE_SERVER_PROTOCOL_H
+#define TIZEN_SUBSURFACE_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_subsurface;
+
+extern const struct wl_interface tizen_subsurface_interface;
+
+struct tizen_subsurface_interface {
+       /**
+        * place_below_parent - (none)
+        * @subsurface: (none)
+        */
+       void (*place_below_parent)(struct wl_client *client,
+                                  struct wl_resource *resource,
+                                  struct wl_resource *subsurface);
+};
+
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif