ecore-evas: Support auxiliary hints for ecore-evas-wayland
authorChris Michael <cp.michael@samsung.com>
Tue, 13 Jun 2017 16:54:05 +0000 (12:54 -0400)
committerChris Michael <cp.michael@samsung.com>
Tue, 13 Jun 2017 16:57:29 +0000 (12:57 -0400)
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>
src/lib/ecore_evas/ecore_evas.c

index b5c9f35..f375559 100644 (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->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 (buf)
+                  if (!strncmp(ee->driver, "wayland", 7))
                     {
-                       if (ee->engine.func->fn_aux_hints_set)
-                         ee->engine.func->fn_aux_hints_set(ee, eina_strbuf_string_get(buf));
+                       Ecore_Evas_Interface_Wayland *iface;
 
-                       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++;
 
                        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->val);
@@ -2341,22 +2359,39 @@ ecore_evas_aux_hint_del(Ecore_Evas *ee, const int 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->val);
              free(aux);
 
-             Eina_Strbuf *buf = _ecore_evas_aux_hints_string_get(ee);
-             if (buf)
+             if (!strncmp(ee->driver, "wayland", 7))
                {
-                  if (ee->engine.func->fn_aux_hints_set)
-                    ee->engine.func->fn_aux_hints_set(ee, eina_strbuf_string_get(buf));
+                  Ecore_Evas_Interface_Wayland *iface;
+
+                  iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get(ee, "wayland");
+                  EINA_SAFETY_ON_NULL_RETURN_VAL(iface, EINA_FALSE);
 
-                  eina_strbuf_free(buf);
+                  if (iface->aux_hint_del)
+                    iface->aux_hint_del(ee, id);
 
                   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;
           }
      }
@@ -2377,19 +2412,35 @@ ecore_evas_aux_hint_val_set(Ecore_Evas *ee, const int id, const char *val)
           {
              eina_stringshare_del(aux->val);
              aux->val = eina_stringshare_add(val);
-                        aux->allowed = 0;
-                        aux->notified = 0;
+             aux->allowed = 0;
+             aux->notified = 0;
 
-             Eina_Strbuf *buf = _ecore_evas_aux_hints_string_get(ee);
-             if (buf)
+             if (!strncmp(ee->driver, "wayland", 7))
                {
-                  if (ee->engine.func->fn_aux_hints_set)
-                    ee->engine.func->fn_aux_hints_set(ee, eina_strbuf_string_get(buf));
+                  Ecore_Evas_Interface_Wayland *iface;
+
+                  iface = (Ecore_Evas_Interface_Wayland *)_ecore_evas_interface_get(ee, "wayland");
+                  EINA_SAFETY_ON_NULL_RETURN_VAL(iface, EINA_FALSE);
 
-                  eina_strbuf_free(buf);
+                  if (iface->aux_hint_change)
+                    iface->aux_hint_change(ee, id, val);
 
                   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;
           }
      }