bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=357715f091ddc085f4264fe2ec96d27f38c5bf49

commit 357715f091ddc085f4264fe2ec96d27f38c5bf49
Author: Marcel Hollerbach <[email protected]>
Date:   Mon Oct 24 12:58:30 2016 +0200

    focus: update object definition
    
    the event is now a bit better, since you only need to subscribe to one
    event instead of two, the new state is passed in the event.
---
 src/lib/elementary/efl_ui_focus_object.c  | 14 +++++---------
 src/lib/elementary/efl_ui_focus_object.eo | 12 +++++++-----
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/src/lib/elementary/efl_ui_focus_object.c 
b/src/lib/elementary/efl_ui_focus_object.c
index 16d6c3b..220f146 100644
--- a/src/lib/elementary/efl_ui_focus_object.c
+++ b/src/lib/elementary/efl_ui_focus_object.c
@@ -6,20 +6,16 @@
 #include "elm_priv.h"
 
 typedef struct {
-
+  Eina_Bool old_focus;
 } Efl_Ui_Focus_Object_Data;
 
 EOLIAN static void
-_efl_ui_focus_object_focus_set(Eo *obj, Efl_Ui_Focus_Object_Data *pd 
EINA_UNUSED, Eina_Bool focus)
+_efl_ui_focus_object_focus_set(Eo *obj, Efl_Ui_Focus_Object_Data *pd, 
Eina_Bool focus)
 {
-   const Efl_Event_Description *desc;
-
-   if (focus)
-     desc = EFL_UI_FOCUS_OBJECT_EVENT_FOCUS;
-   else
-     desc = EFL_UI_FOCUS_OBJECT_EVENT_UNFOCUS;
+   if (pd->old_focus == focus) return;
 
-   efl_event_callback_call(obj, desc, NULL);
+   efl_event_callback_call(obj, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED , 
(void*) (uintptr_t) focus);
+   pd->old_focus = focus;
 }
 
 
diff --git a/src/lib/elementary/efl_ui_focus_object.eo 
b/src/lib/elementary/efl_ui_focus_object.eo
index 9db36b2..4bbfb0b 100644
--- a/src/lib/elementary/efl_ui_focus_object.eo
+++ b/src/lib/elementary/efl_ui_focus_object.eo
@@ -3,17 +3,20 @@ mixin Efl.Ui.Focus.Object
     [[Functions of focusable objects]]
     methods {
         geometry_get {
+            [[The geometry which should be used to calculate the relations to 
others]]
             params {
-                @out rect : Eina.Rectangle;
+                @out rect : Eina.Rectangle; [[the geometry to use]]
             }
         }
         @property focus {
             [[This gets called by the manager and should never be called by 
someone else
 
-             It can be used by a implementation of a focus object to adapt to 
changes which are needed
+             It can be used by a implementation of a focus object to adapt to 
changes which are needed.
+
+             The function is emitting the focus state events, if focus is 
different to the state before.
             ]]
             values {
-                focus : bool;
+                focus : bool; [[The state in which the object should be put]]
             }
         }
     }
@@ -22,7 +25,6 @@ mixin Efl.Ui.Focus.Object
         @empty .focus.get;
     }
     events {
-        focus;
-        unfocus;
+        focus,changed : bool; [[Emitted if the focus state has changed]]
     }
 }
\ No newline at end of file

-- 


Reply via email to