ecore-evas: Support auxiliary hints for ecore-evas-wayland

Small patch to support using Ecore_Evas_Interface_Wayland in order to
add support for setting auxiliary hints on a surface

@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2017-06-13 12:54:05 -04:00
parent 1d453eece4
commit 0d5d157559
1 changed files with 70 additions and 19 deletions

View File

@ -2304,20 +2304,38 @@ ecore_evas_aux_hint_add(Ecore_Evas *ee, const char *hint, const char *val)
aux->hint = eina_stringshare_add(hint); aux->hint = eina_stringshare_add(hint);
aux->val = eina_stringshare_add(val); aux->val = eina_stringshare_add(val);
ee->prop.aux_hint.hints = eina_list_append(ee->prop.aux_hint.hints, aux); ee->prop.aux_hint.hints =
eina_list_append(ee->prop.aux_hint.hints, aux);
Eina_Strbuf *buf = _ecore_evas_aux_hints_string_get(ee); if (!strncmp(ee->driver, "wayland", 7))
if (buf)
{ {
if (ee->engine.func->fn_aux_hints_set) Ecore_Evas_Interface_Wayland *iface;
ee->engine.func->fn_aux_hints_set(ee, eina_strbuf_string_get(buf));
eina_strbuf_free(buf); iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get(ee, "wayland");
EINA_SAFETY_ON_NULL_RETURN_VAL(iface, -1);
if (iface->aux_hint_add)
iface->aux_hint_add(ee, aux->id, hint, val);
ee->prop.aux_hint.id++; ee->prop.aux_hint.id++;
return aux->id; return aux->id;
} }
else
{
Eina_Strbuf *buf = _ecore_evas_aux_hints_string_get(ee);
if (buf)
{
if (ee->engine.func->fn_aux_hints_set)
ee->engine.func->fn_aux_hints_set(ee, eina_strbuf_string_get(buf));
eina_strbuf_free(buf);
ee->prop.aux_hint.id++;
return aux->id;
}
}
eina_stringshare_del(aux->hint); eina_stringshare_del(aux->hint);
eina_stringshare_del(aux->val); eina_stringshare_del(aux->val);
@ -2341,22 +2359,39 @@ ecore_evas_aux_hint_del(Ecore_Evas *ee, const int id)
{ {
if (id == aux->id) if (id == aux->id)
{ {
ee->prop.aux_hint.hints = eina_list_remove(ee->prop.aux_hint.hints, aux); ee->prop.aux_hint.hints =
eina_list_remove(ee->prop.aux_hint.hints, aux);
eina_stringshare_del(aux->hint); eina_stringshare_del(aux->hint);
eina_stringshare_del(aux->val); eina_stringshare_del(aux->val);
free(aux); free(aux);
Eina_Strbuf *buf = _ecore_evas_aux_hints_string_get(ee); if (!strncmp(ee->driver, "wayland", 7))
if (buf)
{ {
if (ee->engine.func->fn_aux_hints_set) Ecore_Evas_Interface_Wayland *iface;
ee->engine.func->fn_aux_hints_set(ee, eina_strbuf_string_get(buf));
eina_strbuf_free(buf); iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get(ee, "wayland");
EINA_SAFETY_ON_NULL_RETURN_VAL(iface, EINA_FALSE);
if (iface->aux_hint_del)
iface->aux_hint_del(ee, id);
return EINA_TRUE; return EINA_TRUE;
} }
else
{
Eina_Strbuf *buf = _ecore_evas_aux_hints_string_get(ee);
if (buf)
{
if (ee->engine.func->fn_aux_hints_set)
ee->engine.func->fn_aux_hints_set(ee, eina_strbuf_string_get(buf));
eina_strbuf_free(buf);
return EINA_TRUE;
}
}
break; break;
} }
} }
@ -2377,19 +2412,35 @@ ecore_evas_aux_hint_val_set(Ecore_Evas *ee, const int id, const char *val)
{ {
eina_stringshare_del(aux->val); eina_stringshare_del(aux->val);
aux->val = eina_stringshare_add(val); aux->val = eina_stringshare_add(val);
aux->allowed = 0; aux->allowed = 0;
aux->notified = 0; aux->notified = 0;
Eina_Strbuf *buf = _ecore_evas_aux_hints_string_get(ee); if (!strncmp(ee->driver, "wayland", 7))
if (buf)
{ {
if (ee->engine.func->fn_aux_hints_set) Ecore_Evas_Interface_Wayland *iface;
ee->engine.func->fn_aux_hints_set(ee, eina_strbuf_string_get(buf));
eina_strbuf_free(buf); iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get(ee, "wayland");
EINA_SAFETY_ON_NULL_RETURN_VAL(iface, EINA_FALSE);
if (iface->aux_hint_change)
iface->aux_hint_change(ee, id, val);
return EINA_TRUE; return EINA_TRUE;
} }
else
{
Eina_Strbuf *buf = _ecore_evas_aux_hints_string_get(ee);
if (buf)
{
if (ee->engine.func->fn_aux_hints_set)
ee->engine.func->fn_aux_hints_set(ee, eina_strbuf_string_get(buf));
eina_strbuf_free(buf);
return EINA_TRUE;
}
}
break; break;
} }
} }