This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository echart.

View the commit online.

commit c7a6549e493ee3983aa0b082dbbb205c9d9e87f2
Author: Carsten Haitzler (Rasterman) <[email protected]>
AuthorDate: Thu Jun 18 17:26:31 2026 +0100

    lets fix stuff
    
    1. enough strings for types so it doenst segv in the gengrid
    2. excess widgets like box - not neded
    3. dont need button really...
    4. be pedantic about pass and repeat events - we dont handle them
    5. add memebers to smart objects.. without that it just doesnt work.
    objects are out of treee and causing event issues
---
 src/bin/echart_grid.c     | 210 ++++++++++++++++++----------------------------
 src/lib/echart_bar.c      |   2 +-
 src/lib/echart_chart.c    |   2 +
 src/lib/echart_grid.c     |   3 +-
 src/lib/echart_grid_ord.c |   3 +-
 src/lib/echart_line.c     |   2 +-
 src/lib/echart_pie.c      |   2 +-
 7 files changed, 90 insertions(+), 134 deletions(-)

diff --git a/src/bin/echart_grid.c b/src/bin/echart_grid.c
index 68f0870..657252a 100644
--- a/src/bin/echart_grid.c
+++ b/src/bin/echart_grid.c
@@ -43,7 +43,9 @@ typedef enum Chart_Type
 const char *labels[CHART_TYPE_LAST] =
 {
    "line",
+   "line area",
    "curved line",
+   "curved line area",
    "vertical bar",
    "horizontal bar",
    "pie"
@@ -85,110 +87,101 @@ _grid_content_get(void        *data,
                   Evas_Object *obj,
                   const char  *part)
 {
-   const Chart_Item *it = data;
+  const Chart_Item *it = data;
 
-   if (!strcmp(part, "elm.swallow.icon"))
-   {
-      Evas_Object *o;
+  if (!strcmp(part, "elm.swallow.icon"))
+    {
+      Evas_Object *o = NULL;
 
       switch (it->type)
-      {
+        {
          case CHART_TYPE_LINE:
-         {
-            double d1[6] = { 3.5, 2.5, 4.3, 7.9, 1.2, 8.4 };
-            double d2[6] = { 9.5, 6.7, 2.3, 7.9, 10.2, 1.4 };
+            {
+              double d1[6] = { 3.5, 2.5, 4.3, 7.9, 1.2, 8.4 };
+              double d2[6] = { 9.5, 6.7, 2.3, 7.9, 10.2, 1.4 };
 
-            o = echart_line_add(evas_object_evas_get(obj));
-            echart_line_data_append(o, d1, 6);
-            echart_line_data_append(o, d2, 6);
-            echart_line_width_set(o, 3);
-            evas_object_show(o);
-
-            return o;
-         }
+              o = echart_line_add(evas_object_evas_get(obj));
+              echart_line_data_append(o, d1, 6);
+              echart_line_data_append(o, d2, 6);
+              echart_line_width_set(o, 3);
+            }
+          break;
          case CHART_TYPE_LINE_AREA:
-         {
-            double d1[6] = { 3.5, 2.5, 4.3, 7.9, 1.2, 8.4 };
-            double d2[6] = { 9.5, 6.7, 2.3, 7.9, 10.2, 1.4 };
+            {
+              double d1[6] = { 3.5, 2.5, 4.3, 7.9, 1.2, 8.4 };
+              double d2[6] = { 9.5, 6.7, 2.3, 7.9, 10.2, 1.4 };
 
-            o = echart_line_add(evas_object_evas_get(obj));
-            echart_line_data_append(o, d1, 6);
-            echart_line_data_append(o, d2, 6);
-            echart_line_width_set(o, 3);
-            echart_line_area_set(o, EINA_TRUE);
-            evas_object_show(o);
-
-            return o;
-         }
+              o = echart_line_add(evas_object_evas_get(obj));
+              echart_line_data_append(o, d1, 6);
+              echart_line_data_append(o, d2, 6);
+              echart_line_width_set(o, 3);
+              echart_line_area_set(o, EINA_TRUE);
+            }
+          break;
          case CHART_TYPE_LINE_CURVED:
-         {
-            double d1[6] = { 3.5, 2.5, 4.3, 7.9, 1.2, 8.4 };
-            double d2[6] = { 9.5, 6.7, 2.3, 7.9, 10.2, 1.4 };
+            {
+              double d1[6] = { 3.5, 2.5, 4.3, 7.9, 1.2, 8.4 };
+              double d2[6] = { 9.5, 6.7, 2.3, 7.9, 10.2, 1.4 };
 
-            o = echart_line_add(evas_object_evas_get(obj));
-            echart_line_data_append(o, d1, 6);
-            echart_line_data_append(o, d2, 6);
-            echart_line_width_set(o, 3);
-            echart_line_curved_set(o, EINA_TRUE);
-            evas_object_show(o);
-
-            return o;
-         }
+              o = echart_line_add(evas_object_evas_get(obj));
+              echart_line_data_append(o, d1, 6);
+              echart_line_data_append(o, d2, 6);
+              echart_line_width_set(o, 3);
+              echart_line_curved_set(o, EINA_TRUE);
+            }
+          break;
          case CHART_TYPE_LINE_CURVED_AREA:
-         {
-            double d1[6] = { 3.5, 2.5, 4.3, 7.9, 1.2, 8.4 };
-            double d2[6] = { 9.5, 6.7, 2.3, 7.9, 10.2, 1.4 };
+            {
+              double d1[6] = { 3.5, 2.5, 4.3, 7.9, 1.2, 8.4 };
+              double d2[6] = { 9.5, 6.7, 2.3, 7.9, 10.2, 1.4 };
 
-            o = echart_line_add(evas_object_evas_get(obj));
-            echart_line_data_append(o, d1, 6);
-            echart_line_data_append(o, d2, 6);
-            echart_line_width_set(o, 3);
-            echart_line_curved_set(o, EINA_TRUE);
-            echart_line_area_set(o, EINA_TRUE);
-            evas_object_show(o);
-
-            return o;
-         }
+              o = echart_line_add(evas_object_evas_get(obj));
+              echart_line_data_append(o, d1, 6);
+              echart_line_data_append(o, d2, 6);
+              echart_line_width_set(o, 3);
+              echart_line_curved_set(o, EINA_TRUE);
+              echart_line_area_set(o, EINA_TRUE);
+            }
+          break;
          case CHART_TYPE_VBAR:
-         {
-            double d1[3] = { 3, 6, 4 };
-            double d2[3] = { 6, 4, 3 };
+            {
+              double d1[3] = { 3, 6, 4 };
+              double d2[3] = { 6, 4, 3 };
 
-            o = echart_bar_add(evas_object_evas_get(obj));
-            echart_bar_data_append(o, d1, 3);
-            echart_bar_data_append(o, d2, 3);
-            evas_object_show(o);
-
-            return o;
-         }
+              o = echart_bar_add(evas_object_evas_get(obj));
+              echart_bar_data_append(o, d1, 3);
+              echart_bar_data_append(o, d2, 3);
+            }
+          break;
          case CHART_TYPE_HBAR:
-         {
-            double d1[3] = { 3, 6, 4 };
-            double d2[3] = { 6, 4, 3 };
+            {
+              double d1[3] = { 3, 6, 4 };
+              double d2[3] = { 6, 4, 3 };
 
-            o = echart_bar_add(evas_object_evas_get(obj));
-            echart_bar_data_append(o, d1, 3);
-            echart_bar_data_append(o, d2, 3);
-            echart_bar_horizontal_set(o, 1);
-            evas_object_show(o);
-
-            return o;
-         }
+              o = echart_bar_add(evas_object_evas_get(obj));
+              echart_bar_data_append(o, d1, 3);
+              echart_bar_data_append(o, d2, 3);
+              echart_bar_horizontal_set(o, 1);
+            }
+          break;
          case CHART_TYPE_PIE:
-         {
-            double d[5] = { 11, 4, 2, 9, 7 };
+            {
+              double d[5] = { 11, 4, 2, 9, 7 };
 
-            o = echart_pie_add(evas_object_evas_get(obj));
-            echart_pie_data_set(o, d, 5);
-            evas_object_show(o);
-
-            return o;
-         }
+              o = echart_pie_add(evas_object_evas_get(obj));
+              echart_pie_data_set(o, d, 5);
+            }
+          break;
          default:
-            return NULL;
-      }
-   }
-
+          break;
+        }
+      if (o)
+        {
+          evas_object_repeat_events_set(o, EINA_TRUE);
+          evas_object_pass_events_set(o, EINA_TRUE);
+          return o;
+        }
+    }
    return NULL;
 }
 
@@ -224,35 +217,10 @@ _grid_sel(void        *data,
    fflush(stdout);
 }
 
-static void
-_cb_key_down(void *data,
-             Evas *evas EINA_UNUSED,
-             Evas_Object *obj EINA_UNUSED,
-             void *event_info)
-{
-   Evas_Object *win = data;
-   Evas_Event_Key_Down *ev = event_info;
-   Eina_Bool ctrl, alt, shift, winm, meta, hyper; /* modifiers */
-
-   EINA_SAFETY_ON_NULL_RETURN(event_info);
-
-   ENTICE_MODIFIERS_GET(ev->modifiers);
-
-   /* No modifier */
-   if (!ctrl && !alt && !shift && !winm && !meta && !hyper)
-   {
-      if (!strcmp(ev->keyname, "q"))
-         evas_object_del(win);
-      else if (!strcmp(ev->key, "Escape"))
-         evas_object_del(win);
-   }
-}
-
 EAPI_MAIN int
 elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
 {
    Evas_Object *win;
-   Evas_Object *box;
    Evas_Object *grid;
    Evas_Object *o;
    Chart_Item *it;
@@ -288,18 +256,11 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
    elm_win_resize_object_add(win, o);
    evas_object_show(o);
 
-
-   o = elm_box_add(win);
-   evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-   elm_win_resize_object_add(win, o);
-   evas_object_show(o);
-   box = o;
-
    o = elm_gengrid_add(win);
    elm_gengrid_item_size_set(o, 320, 200);
    evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
-   elm_box_pack_end(box, o);
+   elm_win_resize_object_add(win, o);
    evas_object_show(o);
    grid = o;
 
@@ -312,7 +273,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
       gic->func.state_get = _grid_state_get;
       gic->func.del = _grid_del;
    }
-
+ 
    it = _item_new(CHART_TYPE_LINE);
    elm_gengrid_item_append(grid, gic, it, _grid_sel, NULL);
 
@@ -339,15 +300,6 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
                       600 * elm_config_scale_get());
    evas_object_show(win);
 
-    /* dummy button to catch keyboard events */
-    o = elm_button_add(win);
-    elm_object_focus_highlight_style_set(o, "blank");
-    evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-    elm_win_resize_object_add(win, o);
-    evas_object_show(o);
-    elm_object_focus_set(o, EINA_TRUE);
-    evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN,
-                                   _cb_key_down, win);
 
    elm_run();
 
diff --git a/src/lib/echart_bar.c b/src/lib/echart_bar.c
index 6aeb0cf..07c9dfe 100644
--- a/src/lib/echart_bar.c
+++ b/src/lib/echart_bar.c
@@ -61,7 +61,7 @@ _bar_smart_add(Evas_Object *obj)
    EINA_SAFETY_ON_NULL_RETURN(sd);
 
    sd->o_vg = evas_object_vg_add(evas_object_evas_get(obj));
-
+   evas_object_smart_member_add(sd->o_vg, obj); // this is a member
    /* evas_vg */
    sd->container = evas_vg_container_add(sd->o_vg);
    evas_object_vg_root_node_set(sd->o_vg, sd->container);
diff --git a/src/lib/echart_chart.c b/src/lib/echart_chart.c
index edc6814..483e4f8 100644
--- a/src/lib/echart_chart.c
+++ b/src/lib/echart_chart.c
@@ -45,6 +45,7 @@ _chart_smart_add(Evas_Object *obj)
    EINA_SAFETY_ON_NULL_RETURN(sd);
 
    sd->o_bg = evas_object_rectangle_add(evas_object_evas_get(obj));
+   evas_object_smart_member_add(sd->o_bg, obj); // this is a member
 
    evas_object_smart_data_set(obj, sd);
 
@@ -233,6 +234,7 @@ echart_title_set(Evas_Object *obj, const char *title)
    if (!sd->o_title)
    {
       sd->o_title = evas_object_text_add(evas_object_evas_get(obj));
+      evas_object_smart_member_add(sd->o_title, obj); // this is a member
       evas_object_text_style_set(sd->o_title, EVAS_TEXT_STYLE_PLAIN);
       evas_object_color_set(sd->o_title, 0, 0, 0, 255);
       evas_object_text_font_set(sd->o_title, "Sans:style=Bold", 13*3);
diff --git a/src/lib/echart_grid.c b/src/lib/echart_grid.c
index 27b207a..65b6a6e 100644
--- a/src/lib/echart_grid.c
+++ b/src/lib/echart_grid.c
@@ -49,9 +49,10 @@ _grid_smart_add(Evas_Object *obj)
    EINA_SAFETY_ON_NULL_RETURN(sd);
 
    sd->o_bg = evas_object_rectangle_add(evas_object_evas_get(obj));
-   evas_object_move(sd->o_bg, 0, 0);
+   evas_object_smart_member_add(sd->o_bg, obj); // this is a member
    evas_object_color_set(sd->o_bg, 0, 0, 0, 0);
    sd->o_vg = evas_object_vg_add(evas_object_evas_get(obj));
+   evas_object_smart_member_add(sd->o_vg, obj); // this is a member
 
    /* evas_vg */
    sd->grid = evas_vg_shape_add(sd->o_vg);
diff --git a/src/lib/echart_grid_ord.c b/src/lib/echart_grid_ord.c
index 0d63fdb..8af2621 100644
--- a/src/lib/echart_grid_ord.c
+++ b/src/lib/echart_grid_ord.c
@@ -49,9 +49,10 @@ _grid_ord_smart_add(Evas_Object *obj)
    EINA_SAFETY_ON_NULL_RETURN(sd);
 
    sd->o_bg = evas_object_rectangle_add(evas_object_evas_get(obj));
-   evas_object_move(sd->o_bg, 0, 0);
+   evas_object_smart_member_add(sd->o_bg, obj); // this is a member
    evas_object_color_set(sd->o_bg, 0, 0, 0, 0);
    sd->o_vg = evas_object_vg_add(evas_object_evas_get(obj));
+   evas_object_smart_member_add(sd->o_vg, obj); // this is a member
 
    /* evas_vg */
    sd->grid_ord = evas_vg_shape_add(sd->o_vg);
diff --git a/src/lib/echart_line.c b/src/lib/echart_line.c
index a4a374f..c0fbfe0 100644
--- a/src/lib/echart_line.c
+++ b/src/lib/echart_line.c
@@ -65,7 +65,7 @@ _line_smart_add(Evas_Object *obj)
    EINA_SAFETY_ON_NULL_RETURN(sd);
 
    sd->o_vg = evas_object_vg_add(evas_object_evas_get(obj));
-
+   evas_object_smart_member_add(sd->o_vg, obj); // this is a member
    /* evas_vg */
    sd->container = evas_vg_container_add(sd->o_vg);
    evas_object_vg_root_node_set(sd->o_vg, sd->container);
diff --git a/src/lib/echart_pie.c b/src/lib/echart_pie.c
index e7aa361..619d983 100644
--- a/src/lib/echart_pie.c
+++ b/src/lib/echart_pie.c
@@ -59,7 +59,7 @@ _pie_smart_add(Evas_Object *obj)
    EINA_SAFETY_ON_NULL_RETURN(sd);
 
    sd->o_vg = evas_object_vg_add(evas_object_evas_get(obj));
-
+   evas_object_smart_member_add(sd->o_vg, obj); // this is a member
    /* evas_vg */
    sd->container = evas_vg_container_add(sd->o_vg);
    evas_object_vg_root_node_set(sd->o_vg, sd->container);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to