dont grab focus if widget cant focus.

SVN revision: 43197
This commit is contained in:
Carsten Haitzler 2009-10-22 12:04:55 +00:00
parent 0f07a18010
commit 07dee04e84
2 changed files with 21 additions and 3 deletions

View File

@ -93,6 +93,7 @@ test_entry(void *data, Evas_Object *obj, void *event_info)
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
elm_box_pack_end(bx2, bt);
elm_object_focus_allow_set(bt, 0);
evas_object_show(bt);
bt = elm_button_add(win);
@ -101,6 +102,7 @@ test_entry(void *data, Evas_Object *obj, void *event_info)
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
elm_box_pack_end(bx2, bt);
elm_object_focus_allow_set(bt, 0);
evas_object_show(bt);
bt = elm_button_add(win);
@ -109,6 +111,8 @@ test_entry(void *data, Evas_Object *obj, void *event_info)
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
elm_box_pack_end(bx2, bt);
elm_object_focus_allow_set(bt, 0);
printf("selection: %p\n", bt);
evas_object_show(bt);
bt = elm_button_add(win);
@ -117,6 +121,7 @@ test_entry(void *data, Evas_Object *obj, void *event_info)
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
elm_box_pack_end(bx2, bt);
elm_object_focus_allow_set(bt, 0);
evas_object_show(bt);
elm_box_pack_end(bx, bx2);

View File

@ -80,8 +80,19 @@ static void
_sub_obj_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Smart_Data *sd = data;
elm_widget_focus_steal(sd->obj);
Evas_Object *o;
const char *s;
o = obj;
do {
s = evas_object_type_get(o);
if (!s) return;
if (!strcmp(s, "elm_widget")) break;
o = evas_object_smart_parent_get(o);
} while (o);
if (!o) return;
if (!elm_widget_can_focus_get(o)) return;
elm_widget_focus_steal(o);
}
/* externally accessible functions */
@ -616,7 +627,9 @@ elm_widget_focus_steal(Evas_Object *obj)
parent = elm_widget_parent_get(parent);
sd = evas_object_smart_data_get(parent);
if (elm_widget_focus_get(sd->resize_obj))
elm_widget_focused_object_clear(sd->resize_obj);
{
elm_widget_focused_object_clear(sd->resize_obj);
}
else
{
const Eina_List *l;