ecore-evas: Added support for setting/getting window auxiliary hints
authorDoyoun Kang <doyoun.kang@samsung.com>
Tue, 12 May 2015 08:58:09 +0000 (17:58 +0900)
committerChunEon Park <chuneon.park@samsung.com>
Thu, 14 May 2015 10:36:11 +0000 (19:36 +0900)
Summary:
There are no APIs for getting window auxiliary hint value which was set by a user.
Below APIs can get the window auxiliary hint value.
- ecore_evas_aux_hint_val_get
- ecore_evas_aux_hint_string_val_get

And below API can set the window auxiliary hint value by using string not id.
- ecore_evas_aux_hint_string_val_set

Test Plan: N/A

Reviewers: raster, cedric, seoz, Hermet

Reviewed By: Hermet

Subscribers: c, cedric

Differential Revision: https://phab.enlightenment.org/D2493

src/lib/ecore_evas/Ecore_Evas.h
src/lib/ecore_evas/ecore_evas.c

index 464c470..db7e8cc 100644 (file)
@@ -836,6 +836,41 @@ EAPI Eina_Bool        ecore_evas_aux_hint_del(Ecore_Evas *ee, const int id);
  */
 EAPI Eina_Bool        ecore_evas_aux_hint_val_set(Ecore_Evas *ee, const int id, const char *val);
 /**
+ * @brief Get a value of the auxiliary hint.
+ *
+ * @param ee The Ecore_Evas
+ * @param id The auxiliary hint ID.
+ * @return The string value of the auxiliary hint ID, or NULL if none exists
+ * @warning Support for this depends on the underlying windowing system.
+ *
+ * @since 1.15
+ */
+EAPI const char      *ecore_evas_aux_hint_val_get(const Ecore_Evas *ee, const int id);
+/**
+ * @brief Change a value of the auxiliary hint by using hit string.
+ *
+ * @param ee The Ecore_Evas to set
+ * @param hint The auxiliary hint string.
+ * @param val The value string to be set.
+ * @return @c EINA_TRUE if no error occurred, @c EINA_FALSE otherwise.
+ * @warning Support for this depends on the underlying windowing system.
+ *
+ * @since 1.15
+ */
+EAPI Eina_Bool        ecore_evas_aux_hint_string_val_set(Ecore_Evas *ee, const char *hint, const char *val);
+/**
+ * @brief Get a value of the auxiliary hint by using hit string.
+ *
+ * @param ee The Ecore_Evas
+ * @param hint The auxiliary hint string.
+ * @return The string value of the auxiliary hint string, or NULL if none exists
+ * @warning Support for this depends on the underlying windowing system.
+ *
+ * @since 1.15
+ */
+EAPI const char      *ecore_evas_aux_hint_string_val_get(const Ecore_Evas *ee, const char *hint);
+
+/**
  * @brief Send message to parent ecore
  *
  * @param ee The Ecore_Evas to set
index c65ae97..d9260e0 100644 (file)
@@ -2324,6 +2324,83 @@ ecore_evas_aux_hint_val_set(Ecore_Evas *ee, const int id, const char *val)
    return EINA_TRUE;
 }
 
+EAPI const char *
+ecore_evas_aux_hint_val_get(const Ecore_Evas *ee, const int id)
+{
+   if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
+     {
+        ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
+                         "ecore_evas_aux_hint_val_get");
+        return NULL;
+     }
+
+   Eina_List *ll;
+   Ecore_Evas_Aux_Hint *aux;
+   EINA_LIST_FOREACH(ee->prop.aux_hint.hints, ll, aux)
+     {
+        if (id == aux->id) return aux->val;
+     }
+
+   return NULL;
+}
+
+EAPI Eina_Bool
+ecore_evas_aux_hint_string_val_set(Ecore_Evas *ee, const char *hint, const char *val)
+{
+   if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
+     {
+        ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
+                         "ecore_evas_aux_hint_string_val_set");
+        return EINA_FALSE;
+     }
+
+   Eina_List *ll;
+   Ecore_Evas_Aux_Hint *aux;
+   EINA_LIST_FOREACH(ee->prop.aux_hint.hints, ll, aux)
+     {
+        if (!strcmp(hint,aux->hint))
+          {
+             eina_stringshare_del(aux->val);
+             aux->val = eina_stringshare_add(val);
+             aux->allowed = 0;
+             aux->notified = 0;
+
+             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;
+               }
+          }
+     }
+
+   return EINA_FALSE;
+}
+
+EAPI const char *
+ecore_evas_aux_hint_string_val_get(const Ecore_Evas *ee, const char *hint)
+{
+   if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
+     {
+        ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
+                         "ecore_evas_aux_hint_string_val_get");
+        return NULL;
+     }
+
+   Eina_List *ll;
+   Ecore_Evas_Aux_Hint *aux;
+   EINA_LIST_FOREACH(ee->prop.aux_hint.hints, ll, aux)
+     {
+        if (!strcmp(hint,aux->hint)) return aux->val;
+     }
+
+   return NULL;
+}
+
 EAPI void
 ecore_evas_fullscreen_set(Ecore_Evas *ee, Eina_Bool on)
 {