aux hint: fixed bug for handling aux hints when it is deleted 31/67231/1 accepted/tizen/ivi/20160426.103438 accepted/tizen/mobile/20160426.103600 accepted/tizen/tv/20160426.103349 accepted/tizen/wearable/20160426.103449 submit/tizen/20160426.074916
authorDoyoun Kang <doyoun.kang@samsung.com>
Tue, 26 Apr 2016 02:44:21 +0000 (11:44 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Tue, 26 Apr 2016 02:44:21 +0000 (11:44 +0900)
Change-Id: I0c8809ea5d9759054c1b79c1f979a86c8389f08a

src/bin/e_client.c
src/bin/e_comp_wl.h
src/bin/e_hints.c

index 6355356..7d180c4 100644 (file)
@@ -1968,6 +1968,36 @@ _e_client_maximize(E_Client *ec, E_Maximize max)
 }
 
 ////////////////////////////////////////////////
+static void
+_e_client_aux_hint_eval(E_Client *ec)
+{
+   if (!ec) return;
+
+#ifdef HAVE_WAYLAND_ONLY
+   E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data;
+   Eina_List *l, *ll;
+   E_Comp_Wl_Aux_Hint *hint;
+
+   if (cdata && cdata->aux_hint.changed)
+     {
+        _e_client_hook_call(E_CLIENT_HOOK_AUX_HINT_CHANGE, ec);
+
+        EINA_LIST_FOREACH_SAFE(cdata->aux_hint.hints, l, ll, hint)
+          {
+             hint->changed = EINA_FALSE;
+             if (hint->deleted)
+               {
+                  ELOGF("COMP", "AUX_HINT |Del [%d:%s:%s]", ec->pixmap, ec, hint->id, hint->hint, hint->val);
+                  if (hint->hint) eina_stringshare_del(hint->hint);
+                  if (hint->val) eina_stringshare_del(hint->val);
+                  cdata->aux_hint.hints = eina_list_remove_list(cdata->aux_hint.hints, l);
+                  E_FREE(hint);
+               }
+          }
+        cdata->aux_hint.changed = 0;
+     }
+#endif
+}
 
 static void
 _e_client_eval(E_Client *ec)
@@ -2446,17 +2476,7 @@ _e_client_eval(E_Client *ec)
         _e_client_event_property(ec, prop);
      }
 
-#ifdef HAVE_WAYLAND_ONLY
-     {
-        E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data;
-
-        if (cdata && cdata->aux_hint.changed)
-          {
-             _e_client_hook_call(E_CLIENT_HOOK_AUX_HINT_CHANGE, ec);
-             cdata->aux_hint.changed = 0;
-          }
-     }
-#endif
+   _e_client_aux_hint_eval(ec);
 
    e_client_transform_core_update(ec);
    _e_client_hook_call(E_CLIENT_HOOK_EVAL_END, ec);
@@ -3241,17 +3261,7 @@ e_client_new(E_Pixmap *cp, int first_map, int internal)
         return NULL;
      }
 
-#ifdef HAVE_WAYLAND_ONLY
-     {
-        E_Comp_Wl_Client_Data *cdata = (E_Comp_Wl_Client_Data*)ec->comp_data;
-
-        if (cdata && cdata->aux_hint.changed)
-          {
-             _e_client_hook_call(E_CLIENT_HOOK_AUX_HINT_CHANGE, ec);
-             cdata->aux_hint.changed = 0;
-          }
-     }
-#endif
+   _e_client_aux_hint_eval(ec);
 
    if (ec->override)
      _e_client_zone_update(ec);
index 07ab55e..1c3d116 100644 (file)
@@ -61,9 +61,11 @@ typedef enum _E_Comp_Wl_Buffer_Type
 
 struct _E_Comp_Wl_Aux_Hint
 {
-   unsigned int id;
-   const char *hint;
-   const char *val;
+   int           id;
+   const char   *hint;
+   const char   *val;
+   Eina_Bool     changed;
+   Eina_Bool     deleted;
 };
 
 struct _E_Comp_Wl_Buffer
index 72e3c67..94f6ac6 100644 (file)
@@ -283,6 +283,9 @@ e_hints_aux_hint_add_with_pixmap(E_Pixmap *cp, int32_t id, const char *name, con
                          id, hint->hint, hint->val, val);
                   eina_stringshare_del(hint->val);
                   hint->val = eina_stringshare_add(val);
+                  hint->changed = EINA_TRUE;
+                  if (hint->deleted)
+                    hint->deleted = EINA_FALSE;
                   cdata->aux_hint.changed = 1;
                }
              found = EINA_TRUE;
@@ -299,6 +302,8 @@ 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->changed = EINA_TRUE;
+             hint->deleted = EINA_FALSE;
              cdata->aux_hint.hints = eina_list_append(cdata->aux_hint.hints, hint);
              cdata->aux_hint.changed = 1;
              ELOGF("COMP", "AUX_HINT |Add [%d:%s:%s]", cp, e_pixmap_client_get(cp),
@@ -337,8 +342,13 @@ e_hints_aux_hint_change_with_pixmap(E_Pixmap *cp, int32_t id, const char *val)
                         id, hint->hint, hint->val, val);
                   eina_stringshare_del(hint->val);
                   hint->val = eina_stringshare_add(val);
+                  hint->changed = EINA_TRUE;
                   cdata->aux_hint.changed = 1;
                }
+
+             if (hint->deleted)
+               hint->deleted = EINA_FALSE;
+
              found = EINA_TRUE;
              break;
           }
@@ -358,7 +368,7 @@ e_hints_aux_hint_del_with_pixmap(E_Pixmap *cp, int32_t id)
    E_Comp_Wl_Client_Data *cdata;
    Eina_List *l, *ll;
    E_Comp_Wl_Aux_Hint *hint;
-   unsigned int res = -1;
+   int res = -1;
 
    if (!cp) return EINA_FALSE;
    cdata = (E_Comp_Wl_Client_Data*)e_pixmap_cdata_get(cp);
@@ -368,18 +378,19 @@ e_hints_aux_hint_del_with_pixmap(E_Pixmap *cp, int32_t id)
      {
         if (hint->id == id)
           {
-             ELOGF("COMP", "AUX_HINT |Del [%d:%s:%s]", cp, e_pixmap_client_get(cp), id, hint->hint, hint->val);
-             if (hint->hint) eina_stringshare_del(hint->hint);
-             if (hint->val) eina_stringshare_del(hint->val);
-             cdata->aux_hint.hints = eina_list_remove_list(cdata->aux_hint.hints, l);
+             ELOGF("COMP", "AUX_HINT |Del (pending) [%d:%s:%s]", cp, e_pixmap_client_get(cp), id, hint->hint, hint->val);
+             hint->changed = EINA_TRUE;
+             hint->deleted = EINA_TRUE;
              cdata->aux_hint.changed = 1;
              res = hint->id;
-             E_FREE(hint);
              break;
           }
      }
 
-   return !!res;
+   if (res == -1)
+     return EINA_FALSE;
+   else
+     return EINA_TRUE;
 #endif
 
    return EINA_FALSE;
@@ -400,7 +411,8 @@ e_hints_aux_hint_value_get_with_pixmap(E_Pixmap *cp, const char *name)
 
    EINA_LIST_FOREACH(cdata->aux_hint.hints, l, hint)
      {
-        if (!strcmp(hint->hint, name))
+        if ((!hint->deleted) &&
+            (!strcmp(hint->hint, name)))
           {
              res =  hint->val;
              break;