Evas: Use events to set canvas focus in/out.
authorGuilherme Iscaro <iscaro@profusion.mobi>
Thu, 17 Nov 2016 20:22:50 +0000 (18:22 -0200)
committerBruno Dilly <bdilly@profusion.mobi>
Thu, 24 Nov 2016 21:18:47 +0000 (19:18 -0200)
src/lib/efl/interfaces/efl_canvas.eo
src/lib/evas/canvas/evas_callbacks.c
src/lib/evas/canvas/evas_events.c

index bd05337..0393465 100644 (file)
@@ -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]]
index d529399..394eef7 100644 (file)
@@ -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
index 10782b6..5bccd61 100644 (file)
@@ -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);
      }
 }