From: RAJEEV RANJAN Date: Thu, 7 Oct 2010 07:31:24 +0000 (+0000) Subject: From: RAJEEV RANJAN X-Git-Tag: v1.0.0~4142 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a3355cee7a0ff5d0b63fb31d8f3dceffd3146bca;p=platform%2Fupstream%2Felementary.git From: RAJEEV RANJAN Subject: Patch to address some focus and disabling issue in elementary widgets We have observed some generic issues in Elementary widgets. 1. Widgets not getting disabled if we call elm_object_disabled_set(ob, EINA_TRUE) followed by elm_object_style_set(obj, ); This works fine if we disable the widget after changing the style(call to theme_hook happens here). It happens because we are not sending the edje signal in theme_hook of the widgets, if the widget is already in disabled state. I have added this code in theme_hook of elm_button as an example and we will need to apply the similar stuff in all other widgets if needed. 2. The widget gets focused in a particular scenario even though we call elm_object_focus_allow_set(obj, EINA_FALSE). The code snippet to explain the scenario which we observed was like this: Evas_Object *button = NULL, *icon = NULL; button = elm_button_add(parent); elm_object_focus_allow_set(button, EINA_FALSE); icon = elm_icon_add(button); elm_icon_file_set(icon, EDJE_PATH, "test.icon"); elm_button_icon_set(button, icon); An icon object does not take focus by default. But still whenever the focus returned to the parent(layout in this case) after closing some popup, the button gets focused though we had disabled it explicitly. The reason is in this case, when we call elm_icon_add(button), icon gets added to button as a sub-object and in this call, we set sd->child_can_focus for button(the parent) as true because till now, the focus property for icon has not been set to false which by default is true. This was set later in the function elm_icon_add() as follows: elm_widget_can_focus_set(obj, EINA_FALSE); Actually this should be set before adding icon as sub-object of the parent which in this case is a button. I have done the required modification in the function elm_icon_add(). Attached to this mail is the patch file for these two issues.The revision from which I have created this patch file is 53129. We may need to do similar changes in other widgets if required. SVN revision: 53137 --- diff --git a/src/lib/elm_button.c b/src/lib/elm_button.c index 7213a2e..3b2998c 100644 --- a/src/lib/elm_button.c +++ b/src/lib/elm_button.c @@ -109,6 +109,8 @@ _theme_hook(Evas_Object *obj) edje_object_part_text_set(wd->btn, "elm.text", wd->label); edje_object_message_signal_process(wd->btn); edje_object_scale_set(wd->btn, elm_widget_scale_get(obj) * _elm_config->scale); + if (elm_object_disabled_get(obj)) + edje_object_signal_emit(wd->btn, "elm,state,disabled", "elm"); _sizing_eval(obj); } diff --git a/src/lib/elm_icon.c b/src/lib/elm_icon.c index 351c2cf..dde8168 100644 --- a/src/lib/elm_icon.c +++ b/src/lib/elm_icon.c @@ -115,11 +115,11 @@ elm_icon_add(Evas_Object *parent) obj = elm_widget_add(e); ELM_SET_WIDTYPE(widtype, "icon"); elm_widget_type_set(obj, "icon"); + elm_widget_can_focus_set(obj, EINA_FALSE); elm_widget_sub_object_add(parent, obj); elm_widget_data_set(obj, wd); elm_widget_del_hook_set(obj, _del_hook); elm_widget_theme_hook_set(obj, _theme_hook); - elm_widget_can_focus_set(obj, EINA_FALSE); wd->img = _els_smart_icon_add(e); evas_object_event_callback_add(wd->img, EVAS_CALLBACK_MOUSE_UP,