discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=4d0ceeb02c7d8d52b8b13ae7667dccbbf81af506

commit 4d0ceeb02c7d8d52b8b13ae7667dccbbf81af506
Author: Mike Blumenkrantz <zm...@osg.samsung.com>
Date:   Thu Sep 21 13:31:04 2017 -0400

    add fd passing to aux hints protocol
---
 src/bin/e_comp_wl.h                  |  1 +
 src/bin/e_comp_wl_extensions_tizen.c | 45 ++++++++++++++++++++++++++++++++++--
 src/bin/e_hints.c                    | 25 ++++++++++++++++----
 src/bin/e_hints.h                    |  6 +++--
 src/protocol/efl-aux-hints.xml       | 13 ++++++++++-
 5 files changed, 81 insertions(+), 9 deletions(-)

diff --git a/src/bin/e_comp_wl.h b/src/bin/e_comp_wl.h
index 2aa12f2c0..d2c300c12 100644
--- a/src/bin/e_comp_wl.h
+++ b/src/bin/e_comp_wl.h
@@ -53,6 +53,7 @@ struct _E_Comp_Wl_Aux_Hint
    int           id;
    const char   *hint;
    const char   *val;
+   int32_t       fd;
    Eina_Bool     changed;
    Eina_Bool     deleted;
 };
diff --git a/src/bin/e_comp_wl_extensions_tizen.c 
b/src/bin/e_comp_wl_extensions_tizen.c
index 1aca7bc9f..5e9d8d9af 100644
--- a/src/bin/e_comp_wl_extensions_tizen.c
+++ b/src/bin/e_comp_wl_extensions_tizen.c
@@ -181,6 +181,26 @@ _tzpol_iface_cb_aux_hint_add(struct wl_client *client 
EINA_UNUSED, struct wl_res
 }
 
 static void
+_tzpol_iface_cb_aux_hint_add_fd(struct wl_client *client EINA_UNUSED, struct 
wl_resource *res_tzpol, struct wl_resource *surf, int32_t id, const char *name, 
int32_t fd)
+{
+   E_Client *ec;
+   Eina_Bool res = EINA_FALSE;
+
+
+   ec = wl_resource_get_user_data(surf);
+   EINA_SAFETY_ON_NULL_RETURN(ec);
+
+   res = e_hints_aux_hint_add_fd(ec, id, name, fd);
+
+   if (res)
+     {
+        _e_policy_wl_aux_hint_apply(ec);
+        efl_aux_hints_send_allowed_aux_hint(res_tzpol, surf, id);
+        EC_CHANGED(ec);
+     }
+}
+
+static void
 _tzpol_iface_cb_aux_hint_change(struct wl_client *client EINA_UNUSED, struct 
wl_resource *res_tzpol, struct wl_resource *surf, int32_t id, const char *value)
 {
    E_Client *ec;
@@ -200,6 +220,25 @@ _tzpol_iface_cb_aux_hint_change(struct wl_client *client 
EINA_UNUSED, struct wl_
 }
 
 static void
+_tzpol_iface_cb_aux_hint_change_fd(struct wl_client *client EINA_UNUSED, 
struct wl_resource *res_tzpol, struct wl_resource *surf, int32_t id, int32_t fd)
+{
+   E_Client *ec;
+   Eina_Bool res = EINA_FALSE;
+
+   ec = wl_resource_get_user_data(surf);
+   EINA_SAFETY_ON_NULL_RETURN(ec);
+
+   res = e_hints_aux_hint_change_fd(ec, id, fd);
+
+   if (res)
+     {
+        _e_policy_wl_aux_hint_apply(ec);
+        efl_aux_hints_send_allowed_aux_hint(res_tzpol, surf, id);
+        EC_CHANGED(ec);
+     }
+}
+
+static void
 _tzpol_iface_cb_aux_hint_del(struct wl_client *client EINA_UNUSED, struct 
wl_resource *res_tzpol EINA_UNUSED, struct wl_resource *surf, int32_t id)
 {
    E_Client *ec;
@@ -330,6 +369,8 @@ static const struct efl_aux_hints_interface 
_e_efl_aux_hints_interface =
    _tzpol_iface_cb_aux_hint_change,
    _tzpol_iface_cb_aux_hint_del,
    _tzpol_iface_cb_supported_aux_hints_get,
+   _tzpol_iface_cb_aux_hint_add_fd,
+   _tzpol_iface_cb_aux_hint_change_fd,
 };
 
 static void
@@ -339,11 +380,11 @@ _efl_aux_hints_destroy(struct wl_resource *res)
 }
 
 static void
-_e_comp_wl_efl_aux_hints_cb_bind(struct wl_client *client, void *data 
EINA_UNUSED, uint32_t version EINA_UNUSED, uint32_t id)
+_e_comp_wl_efl_aux_hints_cb_bind(struct wl_client *client, void *data 
EINA_UNUSED, uint32_t version, uint32_t id)
 {
    struct wl_resource *res;
 
-   if (!(res = wl_resource_create(client, &efl_aux_hints_interface, 1, id)))
+   if (!(res = wl_resource_create(client, &efl_aux_hints_interface, 
MIN(version, 2), id)))
      {
         ERR("Could not create %s interface", "efl-aux-hints");
         wl_client_post_no_memory(client);
diff --git a/src/bin/e_hints.c b/src/bin/e_hints.c
index 69e6e118a..067dc0b9a 100644
--- a/src/bin/e_hints.c
+++ b/src/bin/e_hints.c
@@ -1736,14 +1736,28 @@ E_API Eina_Bool
 e_hints_aux_hint_add(E_Client *ec, int32_t id, const char *name, const char 
*val)
 {
    if (!ec) return EINA_FALSE;
-   return e_hints_aux_hint_add_with_pixmap(ec->pixmap, id, name, val);
+   return e_hints_aux_hint_add_with_pixmap(ec->pixmap, id, name, val, -1);
+}
+
+E_API Eina_Bool
+e_hints_aux_hint_add_fd(E_Client *ec, int32_t id, const char *name, int32_t fd)
+{
+   if (!ec) return EINA_FALSE;
+   return e_hints_aux_hint_add_with_pixmap(ec->pixmap, id, name, NULL, fd);
 }
 
 E_API Eina_Bool
 e_hints_aux_hint_change(E_Client *ec, int32_t id, const char *val)
 {
    if (!ec) return EINA_FALSE;
-   return e_hints_aux_hint_change_with_pixmap(ec->pixmap, id, val);
+   return e_hints_aux_hint_change_with_pixmap(ec->pixmap, id, val, -1);
+}
+
+E_API Eina_Bool
+e_hints_aux_hint_change_fd(E_Client *ec, int32_t id, int32_t fd)
+{
+   if (!ec) return EINA_FALSE;
+   return e_hints_aux_hint_change_with_pixmap(ec->pixmap, id, NULL, fd);
 }
 
 E_API Eina_Bool
@@ -1761,7 +1775,7 @@ e_hints_aux_hint_value_get(E_Client *ec, const char *name)
 }
 
 E_API Eina_Bool
-e_hints_aux_hint_add_with_pixmap(E_Pixmap *cp, int32_t id, const char *name, 
const char *val)
+e_hints_aux_hint_add_with_pixmap(E_Pixmap *cp, int32_t id, const char *name, 
const char *val, int32_t fd)
 {
    E_Comp_Wl_Client_Data *cdata;
    Eina_Bool found = EINA_FALSE;
@@ -1780,6 +1794,7 @@ e_hints_aux_hint_add_with_pixmap(E_Pixmap *cp, int32_t 
id, const char *name, con
                {
                   eina_stringshare_del(hint->val);
                   hint->val = eina_stringshare_add(val);
+                  hint->fd = fd;
                   hint->changed = EINA_TRUE;
                   if (hint->deleted)
                     hint->deleted = EINA_FALSE;
@@ -1800,6 +1815,7 @@ e_hints_aux_hint_add_with_pixmap(E_Pixmap *cp, int32_t 
id, const char *name, con
         hint->id = id;
         hint->hint = eina_stringshare_add(name);
         hint->val = eina_stringshare_add(val);
+        hint->fd = fd;
         hint->changed = EINA_TRUE;
         hint->deleted = EINA_FALSE;
         cdata->aux_hint.hints = eina_list_append(cdata->aux_hint.hints, hint);
@@ -1813,7 +1829,7 @@ e_hints_aux_hint_add_with_pixmap(E_Pixmap *cp, int32_t 
id, const char *name, con
 }
 
 E_API Eina_Bool
-e_hints_aux_hint_change_with_pixmap(E_Pixmap *cp, int32_t id, const char *val)
+e_hints_aux_hint_change_with_pixmap(E_Pixmap *cp, int32_t id, const char *val, 
int32_t fd)
 {
    E_Comp_Wl_Client_Data *cdata;
    Eina_List *l;
@@ -1832,6 +1848,7 @@ e_hints_aux_hint_change_with_pixmap(E_Pixmap *cp, int32_t 
id, const char *val)
                {
                   eina_stringshare_del(hint->val);
                   hint->val = eina_stringshare_add(val);
+                  hint->fd = fd;
                   hint->changed = EINA_TRUE;
                   cdata->aux_hint.changed = 1;
                }
diff --git a/src/bin/e_hints.h b/src/bin/e_hints.h
index 006fc9c26..5fa1f3fc2 100644
--- a/src/bin/e_hints.h
+++ b/src/bin/e_hints.h
@@ -67,11 +67,13 @@ E_API const Eina_List * 
e_hints_aux_hint_supported_get(void);
 
 E_API Eina_Bool e_hints_aux_hint_add(E_Client *ec, int32_t id, const char 
*name, const char *val);
 E_API Eina_Bool e_hints_aux_hint_change(E_Client *ec, int32_t id, const char 
*val);
+E_API Eina_Bool e_hints_aux_hint_add_fd(E_Client *ec, int32_t id, const char 
*name, int32_t fd);
+E_API Eina_Bool e_hints_aux_hint_change_fd(E_Client *ec, int32_t id, int32_t 
fd);
 E_API Eina_Bool e_hints_aux_hint_del(E_Client *ec, int32_t id);
 E_API const char * e_hints_aux_hint_value_get(E_Client *ec, const char *name);
 
-E_API Eina_Bool e_hints_aux_hint_add_with_pixmap(E_Pixmap *cp, int32_t id, 
const char *name, const char *val);
-E_API Eina_Bool e_hints_aux_hint_change_with_pixmap(E_Pixmap *cp, int32_t id, 
const char *val);
+E_API Eina_Bool e_hints_aux_hint_add_with_pixmap(E_Pixmap *cp, int32_t id, 
const char *name, const char *val, int32_t fd);
+E_API Eina_Bool e_hints_aux_hint_change_with_pixmap(E_Pixmap *cp, int32_t id, 
const char *val, int32_t fd);
 E_API Eina_Bool e_hints_aux_hint_del_with_pixmap(E_Pixmap *cp, int32_t id);
 E_API const char * e_hints_aux_hint_value_get_with_pixmap(E_Pixmap *cp, const 
char *name);
 #endif
diff --git a/src/protocol/efl-aux-hints.xml b/src/protocol/efl-aux-hints.xml
index 442285a13..9fa6e4dbf 100644
--- a/src/protocol/efl-aux-hints.xml
+++ b/src/protocol/efl-aux-hints.xml
@@ -1,6 +1,6 @@
 <protocol name="efl_aux_hints">
 
-  <interface name="efl_aux_hints" version="1">
+  <interface name="efl_aux_hints" version="2">
     <request name="add_aux_hint">
       <arg name="surface" type="object" interface="wl_surface"/>
       <arg name="id" type="int"/>
@@ -34,6 +34,17 @@
       <arg name="val" type="string"/>
       <arg name="options" type="array"/>
     </event>
+    <request name="add_aux_hint_fd">
+      <arg name="surface" type="object" interface="wl_surface"/>
+      <arg name="id" type="int"/>
+      <arg name="hint" type="string"/>
+      <arg name="val" type="fd"/>
+    </request>
+    <request name="change_aux_hint_fd">
+      <arg name="surface" type="object" interface="wl_surface"/>
+      <arg name="id" type="int"/>
+      <arg name="val" type="fd"/>
+    </request>
   </interface>
 
 </protocol>

-- 


Reply via email to