seoz pushed a commit to branch master.
commit 4f05b8e9d783b2f4fc2ad9f430d3de125ddb8fb1
Author: Ryuan Choi <[email protected]>
Date: Thu May 23 18:47:07 2013 +0900
elm_colorselector: Can't receive "changed" signal when clicked color
palette.
As document mentioned, "changed" should be emitted when the color value is
changed.
So, this patch emits "changed" signal when color value is really changed.
In addition, fixed some formatting issue of test_colorselector.
---
ChangeLog | 4 ++++
NEWS | 1 +
src/bin/test_colorselector.c | 4 ++--
src/lib/elm_colorselector.c | 16 ++++++++--------
4 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 182bd4e..676c460 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1360,3 +1360,7 @@
2013-05-23 Daniel Juyung Seo (SeoZ)
* Fix colorselector color change but when palette item is selected.
+
+2013-05-23 Ryuan Choi (ryuan)
+
+ * Fix elm_colorselector does not emit "changed" when clicked color
palatte.
diff --git a/NEWS b/NEWS
index 1dba3b8..0ff4e8e 100644
--- a/NEWS
+++ b/NEWS
@@ -231,6 +231,7 @@ Fixes:
* Fix remained ecore timer issue when gesture layer was deleted.
* Fix ctxpopup can't be called again in the mobile mode entry.
* Fix colorselector color change but when palette item is selected.
+ * Fix elm_colorselector does not emit "changed" when clicked color palatte.
Removals:
diff --git a/src/bin/test_colorselector.c b/src/bin/test_colorselector.c
index 6af446f..fe26cc6 100644
--- a/src/bin/test_colorselector.c
+++ b/src/bin/test_colorselector.c
@@ -23,13 +23,13 @@ _colorselector_clicked_cb(void *data, Evas_Object *obj,
}
static void
-_colorpalette_clicked_cb(void *data, Evas_Object *obj __UNUSED__,
+_colorpalette_clicked_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__,
void *event_info)
{
int r = 0, g = 0, b = 0 ,a = 0;
Elm_Object_Item *color_it = (Elm_Object_Item *) event_info;
elm_colorselector_palette_item_color_get(color_it, &r, &g, &b, &a);
- evas_object_color_set((Evas_Object *) data, r, g, b , a);
+ printf("Selected Color Palette [r=%d g=%d b=%d a=%d]\n", r, g, b, a);
}
static void
diff --git a/src/lib/elm_colorselector.c b/src/lib/elm_colorselector.c
index aec645b..6c8551b 100644
--- a/src/lib/elm_colorselector.c
+++ b/src/lib/elm_colorselector.c
@@ -383,6 +383,9 @@ _colors_set(Evas_Object *obj,
ELM_COLORSELECTOR_DATA_GET(obj, sd);
+ if ((sd->r == r) && (sd->g == g) && (sd->b == b) && (sd->a == a))
+ return;
+
sd->r = r;
sd->g = g;
sd->b = b;
@@ -417,6 +420,7 @@ _colors_set(Evas_Object *obj,
(sd->cb_data[3]->colorbar, "elm.arrow", x, y);
_rectangles_redraw(sd->cb_data[3], x);
+ evas_object_smart_callback_call(obj, SIG_CHANGED, NULL);
}
static void
@@ -442,20 +446,16 @@ _entry_changed_cb(void *data,
switch (i)
{
case 0:
- if (v != sd->r)
- _colors_set(parent, v, sd->g, sd->b, sd->a);
+ _colors_set(parent, v, sd->g, sd->b, sd->a);
break;
case 1:
- if (v != sd->g)
- _colors_set(parent, sd->r, v, sd->b, sd->a);
+ _colors_set(parent, sd->r, v, sd->b, sd->a);
break;
case 2:
- if (v != sd->b)
- _colors_set(parent, sd->r, sd->g, v, sd->a);
+ _colors_set(parent, sd->r, sd->g, v, sd->a);
break;
case 3:
- if (v != sd->a)
- _colors_set(parent, sd->r, sd->g, sd->b, v);
+ _colors_set(parent, sd->r, sd->g, sd->b, v);
break;
}
}
--
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may