Evas: Rename object focus to key_focus

The evas focus concept is valid and applies only to the
keyboard inputs.
This commit is contained in:
Jean-Philippe Andre 2016-06-16 17:19:23 +09:00
parent ab4e15e9c3
commit e2eebc1221
5 changed files with 20 additions and 41 deletions

View File

@ -185,7 +185,7 @@ main(void)
efl_gfx_size_set(d.bg, WIDTH, HEIGHT);
/* covers full canvas */
efl_gfx_visible_set(d.bg, EINA_TRUE);
evas_obj_focus_set(d.bg, EINA_TRUE);
evas_object_focus_set(d.bg, EINA_TRUE);
evas_object_event_callback_add(
d.bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL);

View File

@ -8,7 +8,7 @@
/* public calls */
EOLIAN void
_evas_object_focus_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Eina_Bool focus)
_evas_object_key_focus_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Eina_Bool focus)
{
int event_id = 0;
@ -24,7 +24,7 @@ _evas_object_focus_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Eina_Bool fo
if (focus)
{
if (obj->layer->evas->focused)
evas_obj_focus_set(obj->layer->evas->focused, 0);
evas_object_focus_set(obj->layer->evas->focused, 0);
if (obj->layer->evas->focused) goto end;
obj->focused = 1;
@ -47,7 +47,7 @@ _evas_object_focus_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Eina_Bool fo
}
EOLIAN Eina_Bool
_evas_object_focus_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj)
_evas_object_key_focus_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj)
{
return obj->focused;
}

View File

@ -296,42 +296,21 @@ abstract Evas.Object (Eo.Base, Evas.Common_Interface, Efl.Gfx, Efl.Gfx.Stack,
default size.]]
}
}
@property focus {
@property key_focus {
[[Indicates that this object is the keyboard event receiver on
its canvas.
Changing focus only affects where (key) input events go.
There can be only one object focused at any time. If $focus
is $true, $obj will be set as the currently focused object
and it will receive all keyboard events that are not
exclusive key grabs on other objects.
]]
set {
[[Sets or unsets a given object as the currently focused one on
its canvas.
Changing focus only affects where (key) input events go.
There can be only one object focused at any time. If $focus
is $true, $obj will be set as the currently focused object
and it will receive all keyboard events that are not
exclusive key grabs on other objects.
See also @.key_grab, @.key_ungrab.
]]
/* FIXME-doc
Example:
@dontinclude evas-events.c
@skip evas_object_focus_set
@until evas_object_focus_set
See the full example @ref Example_Evas_Events "here".
*/
legacy: evas_object_focus_set;
}
get {
[[Retrieve whether an object has the focus.
If the passed object is the currently focused one, $true is
returned. $false is returned, otherwise.
]]
/* FIXME-doc
Example:
@dontinclude evas-events.c
@skip And again
@until something is bad
See the full example @ref Example_Evas_Events "here".
*/
legacy: evas_object_focus_get;
}
values {
focus: bool; [[$true when set as focused or $false otherwise.]]
@ -628,7 +607,7 @@ abstract Evas.Object (Eo.Base, Evas.Common_Interface, Efl.Gfx, Efl.Gfx.Stack,
Warning: Providing impossible modifier sets creates undefined
behavior.
See also @.key_ungrab, @.focus.get, @.focus.set,
See also @.key_ungrab, @.key_focus.get, @.key_focus.set,
\@ref evas_focus_get, \@ref evas_key_modifier_add.
]]
/* FIXME-doc
@ -678,7 +657,7 @@ abstract Evas.Object (Eo.Base, Evas.Common_Interface, Efl.Gfx, Efl.Gfx.Stack,
Removes a key grab on $obj if $keyname, $modifiers, and
$not_modifiers match.
See also @.key_grab, @.focus.get, @.focus.set,
See also @.key_grab, @.key_focus.get, @.key_focus.set,
\@ref evas_focus_get.
]]
/* FIXME-doc

View File

@ -1788,7 +1788,7 @@ _evas_object_eo_base_dbg_info_get(Eo *eo_obj, Evas_Object_Protected_Data *obj EI
efl_gfx_size_hint_align_get(eo_obj, &dblx, &dbly);
efl_gfx_size_hint_weight_get(eo_obj, &dblw, &dblh);
efl_gfx_color_get(eo_obj, &r, &g, &b, &a);
focus = evas_obj_focus_get(eo_obj);
focus = evas_object_focus_get(eo_obj);
m = evas_obj_pointer_mode_get(eo_obj);
pass_event = evas_obj_pass_events_get(eo_obj);
repeat_event = evas_obj_repeat_events_get(eo_obj);

View File

@ -117,7 +117,7 @@ bg_setup(void)
efl_gfx_size_set(o_bg, startw, starth);
efl_gfx_stack_layer_set(o_bg, -999);
efl_gfx_visible_set(o_bg, EINA_TRUE);
evas_obj_focus_set(o_bg, EINA_TRUE);
evas_object_focus_set(o_bg, EINA_TRUE);
eo_event_callback_add(o_bg, EFL_EVENT_KEY_DOWN, bg_key_down, NULL);
}