bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=53052abaa69de163066ab506f26fe32ba744abf0

commit 53052abaa69de163066ab506f26fe32ba744abf0
Author: Marcel Hollerbach <mar...@osg.samsung.com>
Date:   Fri Nov 10 15:26:33 2017 +0100

    elm_widget_item: refactor logic from gengrid into seperated class
---
 src/Makefile_Elementary.am                         |  2 ++
 src/lib/elementary/elm_gengrid_item.eo             |  2 +-
 src/lib/elementary/elm_priv.h                      |  1 +
 src/lib/elementary/elm_widget_item_static_focus.c  | 39 ++++++++++++++++++++++
 src/lib/elementary/elm_widget_item_static_focus.eo |  7 ++++
 5 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index 1c41f580f7..4c79dc8007 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -148,6 +148,7 @@ elm_legacy_eolian_files = \
        lib/elementary/elm_menu_item.eo \
        lib/elementary/elm_ctxpopup_item.eo \
        lib/elementary/elm_index_item.eo \
+       lib/elementary/elm_widget_item_static_focus.eo \
        lib/elementary/elm_genlist_item.eo \
        lib/elementary/elm_gengrid_item.eo \
        lib/elementary/elm_list_item.eo \
@@ -700,6 +701,7 @@ lib_elementary_libelementary_la_SOURCES = \
        lib/elementary/efl_ui_focus_parent_provider.c \
        lib/elementary/efl_ui_focus_parent_provider_standard.c \
        lib/elementary/efl_ui_focus_parent_provider_gen.c \
+       lib/elementary/elm_widget_item_static_focus.c \
        $(NULL)
 
 
diff --git a/src/lib/elementary/elm_gengrid_item.eo 
b/src/lib/elementary/elm_gengrid_item.eo
index 3f0e73663c..8a0cb65220 100644
--- a/src/lib/elementary/elm_gengrid_item.eo
+++ b/src/lib/elementary/elm_gengrid_item.eo
@@ -25,7 +25,7 @@ enum Elm.Gengrid.Item.Field_Type
 }
 
 
-class Elm.Gengrid.Item(Elm.Widget.Item, Efl.Ui.Focus.Object)
+class Elm.Gengrid.Item(Elm.Widget.Item.Static_Focus, Efl.Ui.Focus.Object)
 {
       [[Elementary gengrid item class]]
       legacy_prefix: elm_gengrid_item;
diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h
index c5a631f4d9..802938458b 100644
--- a/src/lib/elementary/elm_priv.h
+++ b/src/lib/elementary/elm_priv.h
@@ -55,6 +55,7 @@
 #include "elm_code_private.h"
 #include "efl_ui_focus_parent_provider.eo.h"
 #include "efl_ui_focus_parent_provider_standard.eo.h"
+#include "elm_widget_item_static_focus.eo.h"
 
 #ifdef HAVE_LANGINFO_H
 # include <langinfo.h>
diff --git a/src/lib/elementary/elm_widget_item_static_focus.c 
b/src/lib/elementary/elm_widget_item_static_focus.c
new file mode 100644
index 0000000000..905bc264ec
--- /dev/null
+++ b/src/lib/elementary/elm_widget_item_static_focus.c
@@ -0,0 +1,39 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+
+#define ELM_WIDGET_ITEM_PROTECTED
+
+#include <Elementary.h>
+#include "elm_priv.h"
+#include "efl_ui_focus_composition_adapter.eo.h"
+
+typedef struct {
+   Eo *adapter;
+} Elm_Widget_Item_Static_Focus_Data;
+
+EOLIAN static void
+_elm_widget_item_static_focus_efl_ui_focus_object_prepare_logical(Eo *obj, 
Elm_Widget_Item_Static_Focus_Data *pd EINA_UNUSED)
+{
+   Elm_Widget_Item_Data *wpd = efl_data_scope_get(obj, ELM_WIDGET_ITEM_CLASS);
+
+   efl_ui_focus_object_prepare_logical(efl_super(obj, 
ELM_WIDGET_ITEM_STATIC_FOCUS_CLASS));
+
+   if (!efl_ui_focus_manager_request_subchild(wpd->widget, obj))
+     {
+        if (!pd->adapter)
+          {
+             pd->adapter = efl_add(EFL_UI_FOCUS_COMPOSITION_ADAPTER_CLASS, 
obj, efl_ui_focus_composition_adapter_canvas_object_set(efl_added,  wpd->view));
+             efl_wref_add(pd->adapter, &pd->adapter);
+             efl_ui_focus_manager_calc_register(wpd->widget, pd->adapter, obj, 
NULL);
+          }
+     }
+   else if (pd->adapter)
+     {
+        efl_ui_focus_manager_calc_unregister(wpd->widget, pd->adapter);
+        efl_del(pd->adapter);
+        pd->adapter = NULL;
+     }
+}
+
+#include "elm_widget_item_static_focus.eo.c"
diff --git a/src/lib/elementary/elm_widget_item_static_focus.eo 
b/src/lib/elementary/elm_widget_item_static_focus.eo
new file mode 100644
index 0000000000..874466c99e
--- /dev/null
+++ b/src/lib/elementary/elm_widget_item_static_focus.eo
@@ -0,0 +1,7 @@
+class Elm.Widget.Item.Static_Focus (Elm.Widget.Item, Efl.Ui.Focus.Object)
+{
+   [[A class that ensures that at least ONE focusable target is behind this 
widget item. If there is none registered to it after a prepare call it will 
register the view of the item as item.]]
+   implements {
+           Efl.Ui.Focus.Object.prepare_logical;
+   }
+}

-- 


Reply via email to