add fd passing to aux hints protocol

devs/bu5hm4n/sandbox_fix
Mike Blumenkrantz 5 years ago
parent 5694d7af96
commit 4d0ceeb02c
  1. 1
      src/bin/e_comp_wl.h
  2. 45
      src/bin/e_comp_wl_extensions_tizen.c
  3. 25
      src/bin/e_hints.c
  4. 6
      src/bin/e_hints.h
  5. 13
      src/protocol/efl-aux-hints.xml

@ -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;
};

@ -180,6 +180,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)
{
@ -199,6 +219,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)
{
@ -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);

@ -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;
}

@ -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

@ -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>

Loading…
Cancel
Save