forked from enlightenment/efl
Evas: Use events to set canvas focus in/out.
This commit is contained in:
parent
ded24d80ed
commit
fd6f6c14c1
|
@ -160,8 +160,8 @@ interface Efl.Canvas ()
|
|||
}
|
||||
}
|
||||
events {
|
||||
focus,in; [[Called when canvas got focus]]
|
||||
focus,out; [[Called when canvas lost focus]]
|
||||
focus,in: Efl.Input.Focus; [[Called when canvas got focus]]
|
||||
focus,out: Efl.Input.Focus; [[Called when canvas lost focus]]
|
||||
object,focus,in: Efl.Canvas.Object; [[Called when object got focus]]
|
||||
object,focus,out: Efl.Canvas.Object; [[Called when object lost focus]]
|
||||
render,pre; [[Called when pre render happens]]
|
||||
|
|
|
@ -197,8 +197,17 @@ _eo_evas_object_cb(void *data, const Efl_Event *event)
|
|||
static void
|
||||
_eo_evas_cb(void *data, const Efl_Event *event)
|
||||
{
|
||||
void *event_info;
|
||||
_eo_evas_cb_info *info = data;
|
||||
if (info->func) info->func(info->data, event->object, event->info);
|
||||
|
||||
//Keep the legacy behaviour for focus events.
|
||||
if (event->desc == EFL_CANVAS_EVENT_FOCUS_IN ||
|
||||
event->desc == EFL_CANVAS_EVENT_FOCUS_OUT)
|
||||
event_info = NULL;
|
||||
else
|
||||
event_info = event->info;
|
||||
|
||||
if (info->func) info->func(info->data, event->object, event_info);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -3537,13 +3537,15 @@ _evas_canvas_event_focus_cb(void *data, const Efl_Event *event)
|
|||
{
|
||||
if (e->focus) return;
|
||||
e->focus = 1;
|
||||
evas_event_callback_call(e->evas, EVAS_CALLBACK_CANVAS_FOCUS_IN, NULL);
|
||||
evas_event_callback_call(e->evas, EVAS_CALLBACK_CANVAS_FOCUS_IN,
|
||||
event->info);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!e->focus) return;
|
||||
e->focus = 0;
|
||||
evas_event_callback_call(e->evas, EVAS_CALLBACK_CANVAS_FOCUS_OUT, NULL);
|
||||
evas_event_callback_call(e->evas, EVAS_CALLBACK_CANVAS_FOCUS_OUT,
|
||||
event->info);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue