summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-01-02 14:19:05 +0100
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-01-02 14:19:05 +0100
commitdf59e7200e7597d43ac8dba08978e1f7498a297d (patch)
treee5a28ce49622d31652e2baecd554800817c8fdb7
parent0cb61d99c6a4850baa767db7173a5f12e0a25198 (diff)
downloadefl-devs/bu5hm4n/focus_for_raster.tar.gz
-rw-r--r--src/Makefile_Elementary.am1
-rw-r--r--src/lib/elementary/elm_gen_common.c57
-rw-r--r--src/lib/elementary/elm_gen_common.h7
-rw-r--r--src/lib/elementary/elm_gengrid.c112
-rw-r--r--src/lib/elementary/elm_gengrid.eo1
-rw-r--r--src/lib/elementary/elm_gengrid_item.eo1
-rw-r--r--src/lib/elementary/elm_widget_gengrid.h1
7 files changed, 176 insertions, 4 deletions
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index d9bb7c7488..0c928d54f5 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -672,6 +672,7 @@ lib_elementary_libelementary_la_SOURCES = \
lib/elementary/efl_ui_focus_manager.c \
lib/elementary/efl_ui_focus_manager_sub.c \
lib/elementary/efl_ui_focus_object.c \
+ lib/elementary/elm_gen_common.c \
$(NULL)
diff --git a/src/lib/elementary/elm_gen_common.c b/src/lib/elementary/elm_gen_common.c
new file mode 100644
index 0000000000..1e9ef922d0
--- /dev/null
+++ b/src/lib/elementary/elm_gen_common.c
@@ -0,0 +1,57 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+
+#include <Elementary.h>
+#include "elm_priv.h"
+#include "elm_gen_common.h"
+
+void
+elm_gen_item_eval(Elm_Gen_Item *item, Eina_Inlist *items)
+{
+ Eina_Bool real = EINA_TRUE;
+ Efl_Ui_Focus_Object *parent;
+ Elm_Gen_Item *it;
+ Eina_List *item_objs = NULL;
+
+ if (eina_list_count(item->focus_content) > 0)
+ real = EINA_FALSE;
+
+ if (!item->realized && !item->pre_realized)
+ real = EINA_FALSE;
+
+ if (item->group)
+ real = EINA_FALSE;
+
+ parent = EO_OBJ(item->parent);
+ if (!parent)
+ parent = WIDGET(item);
+
+ if (real != item->registered)
+ {
+ efl_ui_focus_manager_unregister(WIDGET(item), EO_OBJ(item));
+ if (real)
+ efl_ui_focus_manager_register(WIDGET(item), EO_OBJ(item), parent, NULL);
+ else
+ efl_ui_focus_manager_register_logical(WIDGET(item), EO_OBJ(item), parent, NULL);
+ item->registered = real;
+ }
+ EINA_INLIST_FOREACH(items, it)
+ {
+ item_objs = eina_list_append(item_objs, EO_OBJ(it));
+ }
+
+ efl_ui_focus_manager_update_order(WIDGET(item), WIDGET(item), item_objs);
+}
+
+void
+elm_gen_item_init(Elm_Gen_Item *item)
+{
+ efl_ui_focus_manager_register_logical(WIDGET(item), EO_OBJ(item), WIDGET(item), NULL);
+}
+
+void
+elm_gen_item_del(Elm_Gen_Item *item)
+{
+ efl_ui_focus_manager_unregister(WIDGET(item), EO_OBJ(item));
+} \ No newline at end of file
diff --git a/src/lib/elementary/elm_gen_common.h b/src/lib/elementary/elm_gen_common.h
index c980819e24..645629f3d8 100644
--- a/src/lib/elementary/elm_gen_common.h
+++ b/src/lib/elementary/elm_gen_common.h
@@ -52,11 +52,13 @@ struct Elm_Gen_Item
Ecore_Cb highlight_cb, unhighlight_cb;
int position;
+ Eina_List *focus_content;
Elm_Object_Select_Mode select_mode;
Eina_Bool position_update : 1;
Eina_Bool want_unrealize : 1;
Eina_Bool realized : 1;
+ Eina_Bool pre_realized : 1; /** flag which indicates that currently content realizing is going on */
Eina_Bool selected : 1;
Eina_Bool highlighted : 1;
Eina_Bool dragging : 1; /**< this is set true when an item is being dragged. this is set false on multidown/mouseup/mousedown. when this is true, the item should not be unrealized. or evas mouse down/up event will be corrupted. */
@@ -69,6 +71,11 @@ struct Elm_Gen_Item
Eina_Bool cursor_engine_only : 1;
Eina_Bool hide : 1; /**< flag used for hiding the items which do not match filter text */
Eina_Bool filtered: 1; /**<flag used to indicate whether or not item has been filtered */
+ Eina_Bool registered : 1; /**<flag indicates if this is registered or not */
};
+void elm_gen_item_eval(Elm_Gen_Item *item, Eina_Inlist *items);
+void elm_gen_item_init(Elm_Gen_Item *item);
+void elm_gen_item_del(Elm_Gen_Item *item);
+
#endif
diff --git a/src/lib/elementary/elm_gengrid.c b/src/lib/elementary/elm_gengrid.c
index 4329685320..e5405c7fb2 100644
--- a/src/lib/elementary/elm_gengrid.c
+++ b/src/lib/elementary/elm_gengrid.c
@@ -1014,6 +1014,7 @@ _item_content_realize(Elm_Gen_Item *it,
const char *parts)
{
Evas_Object *content;
+ ELM_GENGRID_DATA_GET_FROM_ITEM(it, sd);
if (!parts)
{
@@ -1051,6 +1052,9 @@ _item_content_realize(Elm_Gen_Item *it,
evas_object_hide(content);
continue;
}
+ eina_hash_add(sd->content_item_map, &content, it);
+ elm_gen_item_eval(it, sd->items);
+ elm_widget_sub_object_del(WIDGET(it), content);
elm_widget_sub_object_add(WIDGET(it), content);
if (elm_wdg_item_disabled_get(EO_OBJ(it)))
elm_widget_disabled_set(content, EINA_TRUE);
@@ -1511,6 +1515,8 @@ _item_realize(Elm_Gen_Item *it)
(it->generation < sd->generation))
return;
+ it->pre_realized = EINA_TRUE;
+
if (!_item_cache_find(it))
{
VIEW(it) = _view_create(it, it->itc->item_style);
@@ -1595,6 +1601,7 @@ _item_realize(Elm_Gen_Item *it)
it->realized = EINA_TRUE;
it->want_unrealize = EINA_FALSE;
+ it->pre_realized = EINA_FALSE;
}
static Eina_Bool
@@ -3810,11 +3817,12 @@ _elm_gengrid_elm_widget_event(Eo *obj, Elm_Gengrid_Data *sd, Evas_Object *src, E
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
if (!sd->items) return EINA_FALSE;
- if (!_elm_config_key_binding_call(obj, MY_CLASS_NAME, ev, key_actions))
+ /* if (!_elm_config_key_binding_call(obj, MY_CLASS_NAME, ev, key_actions))
return EINA_FALSE;
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
- return EINA_TRUE;
+ return EINA_TRUE;*/
+ return EINA_FALSE;
}
/*
@@ -4442,7 +4450,7 @@ _elm_gengrid_item_efl_object_constructor(Eo *eo_it, Elm_Gen_Item *it)
eo_it = efl_constructor(efl_super(eo_it, ELM_GENGRID_ITEM_CLASS));
it->base = efl_data_scope_get(eo_it, ELM_WIDGET_ITEM_CLASS);
elm_interface_atspi_accessible_role_set(eo_it, ELM_ATSPI_ROLE_LIST_ITEM);
-
+ elm_gen_item_init(it);
return eo_it;
}
@@ -4652,6 +4660,8 @@ _elm_gengrid_efl_object_constructor(Eo *obj, Elm_Gengrid_Data *sd)
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_ROLE_TREE_TABLE);
+ sd->content_item_map = eina_hash_pointer_new(NULL);
+
return obj;
}
@@ -6082,5 +6092,99 @@ _elm_gengrid_elm_interface_atspi_selection_child_deselect(Eo *obj EINA_UNUSED, E
return EINA_FALSE;
}
+static Elm_Gen_Item*
+_item_get(Eo *obj, Elm_Gengrid_Data *pd, Efl_Ui_Focus_Object *child)
+{
+ Elm_Widget *parent_child = child;
+ Elm_Widget *parent = elm_widget_parent_widget_get(child);
+ Elm_Gen_Item* it;
+
+ //the following code is walking up the parent relations that long that a parent gets the value obj.
+ //if the value is obj then the child of it is the content which is realized in a item
+ while (parent && parent != obj)
+ {
+ parent_child = parent;
+ parent = elm_widget_parent_widget_get(parent_child);
+ }
+
+ it = eina_hash_find(pd->content_item_map, &parent_child);
+ return it;
+}
+
+EOLIAN static Eina_Bool
+_elm_gengrid_efl_ui_focus_manager_register(Eo *obj, Elm_Gengrid_Data *pd, Efl_Ui_Focus_Object *child, Efl_Ui_Focus_Object *parent, Efl_Ui_Focus_Manager *redirect)
+{
+ if (efl_isa(child, ELM_WIDGET_CLASS))
+ {
+ Elm_Gen_Item *it;
+
+ it = _item_get(obj, pd, child);
+
+ if (it)
+ {
+ it->focus_content = eina_list_append(it->focus_content, child);
+ elm_gen_item_eval(it, pd->items);
+ //direct
+ if (elm_widget_parent_widget_get(child) == obj)
+ parent = EO_OBJ(it);
+ }
+ }
+
+ return efl_ui_focus_manager_register(efl_super(obj, MY_CLASS), child, parent, redirect);
+}
+
+EOLIAN static void
+_elm_gengrid_efl_ui_focus_manager_unregister(Eo *obj, Elm_Gengrid_Data *pd, Efl_Ui_Focus_Object *child)
+{
+ Elm_Gen_Item *it;
+
+ efl_ui_focus_manager_unregister(efl_super(obj, MY_CLASS), child);
+
+ if (efl_isa(child, ELM_WIDGET_CLASS))
+ {
+ it = _item_get(obj, pd, child);
+
+ if (!it) return;
+
+ it->focus_content = eina_list_remove(it->focus_content, child);
+ elm_gen_item_eval(it, pd->items);
+ }
+}
+
+EOLIAN static void
+_elm_gengrid_item_efl_ui_focus_object_geometry_get(Eo *obj EINA_UNUSED, Elm_Gen_Item *pd, Eina_Rectangle *rect)
+{
+ evas_object_geometry_get(VIEW(pd), &rect->x, &rect->y, &rect->w, &rect->h);
+}
+
+EOLIAN static void
+_elm_gengrid_item_efl_gfx_geometry_get(Eo *obj EINA_UNUSED, Elm_Gen_Item *pd, int *x, int *y, int *w, int *h)
+{
+ evas_object_geometry_get(VIEW(pd), x, y, w, h);
+}
+
+EOLIAN static void
+_elm_gengrid_item_efl_object_destructor(Eo *obj, Elm_Gen_Item *pd)
+{
+ efl_ui_focus_manager_unregister(WIDGET(pd), obj);
+
+ efl_destructor(efl_super(obj, ELM_GENGRID_ITEM_CLASS));
+}
+
+EOLIAN static void
+_elm_gengrid_item_efl_ui_focus_object_focus_set(Eo *obj, Elm_Gen_Item *pd EINA_UNUSED, Eina_Bool focus)
+{
+ efl_ui_focus_object_focus_set(efl_super(obj, ELM_GENGRID_ITEM_CLASS), EINA_TRUE);
+ elm_object_item_focus_set(obj, focus);
+}
+
+EOLIAN static Eina_Bool
+_elm_gengrid_elm_widget_focus_register(Eo *obj, Elm_Gengrid_Data *pd EINA_UNUSED, Efl_Ui_Focus_Manager *manager, Efl_Ui_Focus_Object *logical, Eina_Bool full EINA_UNUSED)
+{
+ efl_ui_focus_manager_register_logical(manager, obj, logical, obj);
+ return EINA_FALSE;
+}
+
+
#include "elm_gengrid.eo.c"
-#include "elm_gengrid_item.eo.c"
+#include "elm_gengrid_item.eo.c" \ No newline at end of file
diff --git a/src/lib/elementary/elm_gengrid.eo b/src/lib/elementary/elm_gengrid.eo
index 0dea095930..e49fa0efab 100644
--- a/src/lib/elementary/elm_gengrid.eo
+++ b/src/lib/elementary/elm_gengrid.eo
@@ -559,6 +559,7 @@ class Elm.Gengrid (Elm.Layout, Elm.Interface_Scrollable,
Elm.Widget.focus_highlight_geometry_get;
Elm.Widget.focused_item { get; }
Elm.Widget.item_loop_enabled { get; set; }
+ Elm.Widget.focus_register;
Elm.Layout.sizing_eval;
Elm.Interface_Scrollable.bounce_allow { set; }
Elm.Interface_Scrollable.policy;
diff --git a/src/lib/elementary/elm_gengrid_item.eo b/src/lib/elementary/elm_gengrid_item.eo
index 99095ef04a..11a046f7a6 100644
--- a/src/lib/elementary/elm_gengrid_item.eo
+++ b/src/lib/elementary/elm_gengrid_item.eo
@@ -255,6 +255,7 @@ class Elm.Gengrid.Item(Elm.Widget.Item, Efl.Ui.Focus.Object, Efl.Gfx)
Elm.Interface.Atspi_Accessible.name { get; }
Elm.Interface.Atspi_Accessible.state_set { get; }
Efl.Ui.Focus.Object.geometry_get;
+ Efl.Ui.Focus.Object.focus { set; }
Efl.Gfx.geometry { get; }
}
}
diff --git a/src/lib/elementary/elm_widget_gengrid.h b/src/lib/elementary/elm_widget_gengrid.h
index 6f28c38dcc..c4d5b5d365 100644
--- a/src/lib/elementary/elm_widget_gengrid.h
+++ b/src/lib/elementary/elm_widget_gengrid.h
@@ -32,6 +32,7 @@ struct _Elm_Gengrid_Data
Evas_Object *pan_obj;
Evas_Object *obj; // the object itself
Evas_Object *stack; // stacking markers in pan for selectraise feature
+ Eina_Hash *content_item_map;
Eina_List *selected; /* a list of
* selected