bdilly pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=6b95c4c2eccff5976992b9a4d557e586d90511d1

commit 6b95c4c2eccff5976992b9a4d557e586d90511d1
Author: Guilherme Iscaro <[email protected]>
Date:   Thu Nov 3 12:04:34 2016 -0200

    Ecore Wl2 Input: Canvas focus IN/OUT events should contain the seat.
    
    This provides the information about which seat originated the event.
---
 src/lib/ecore_wl2/Ecore_Wl2.h       |  2 ++
 src/lib/ecore_wl2/ecore_wl2_input.c | 25 +++++++++++++++++++++++--
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h
index 9dcae3a..37a0ed1 100644
--- a/src/lib/ecore_wl2/Ecore_Wl2.h
+++ b/src/lib/ecore_wl2/Ecore_Wl2.h
@@ -86,12 +86,14 @@ typedef struct _Ecore_Wl2_Event_Focus_In
 {
    unsigned int window;
    unsigned int timestamp;
+   Eo *dev; //The seat device
 } Ecore_Wl2_Event_Focus_In;
 
 typedef struct _Ecore_Wl2_Event_Focus_Out
 {
    unsigned int window;
    unsigned int timestamp;
+   Eo *dev; //The seat device
 } Ecore_Wl2_Event_Focus_Out;
 
 typedef struct _Ecore_Wl2_Event_Dnd_Enter
diff --git a/src/lib/ecore_wl2/ecore_wl2_input.c 
b/src/lib/ecore_wl2/ecore_wl2_input.c
index 3df8f46..d272dc4 100644
--- a/src/lib/ecore_wl2/ecore_wl2_input.c
+++ b/src/lib/ecore_wl2/ecore_wl2_input.c
@@ -23,6 +23,7 @@ typedef struct _Ecore_Wl2_Input_Devices
    Eo *pointer_dev;
    Eo *keyboard_dev;
    Eo *touch_dev;
+   Eo *seat_dev;
    int window_id;
 } Ecore_Wl2_Input_Devices;
 
@@ -92,6 +93,18 @@ _ecore_wl2_mouse_dev_get(Ecore_Wl2_Input *input, int 
window_id)
    return NULL;
 }
 
+static Eo *
+_ecore_wl2_seat_dev_get(Ecore_Wl2_Input *input, int window_id)
+{
+   Ecore_Wl2_Input_Devices *devices;
+
+   devices = _ecore_wl2_devices_get(input, window_id);
+   if (devices)
+     return efl_ref(devices->seat_dev);
+
+   return NULL;
+}
+
 static void
 _input_event_cb_free(void *data, void *event)
 {
@@ -389,7 +402,9 @@ _ecore_wl2_input_focus_in_send(Ecore_Wl2_Input *input, 
Ecore_Wl2_Window *window)
 
    ev->timestamp = input->timestamp;
    ev->window = window->id;
-   ecore_event_add(ECORE_WL2_EVENT_FOCUS_IN, ev, NULL, NULL);
+   ev->dev = _ecore_wl2_seat_dev_get(input, window->id);
+   ecore_event_add(ECORE_WL2_EVENT_FOCUS_IN, ev, _input_event_cb_free,
+                   ev->dev);
 }
 
 static void
@@ -402,7 +417,9 @@ _ecore_wl2_input_focus_out_send(Ecore_Wl2_Input *input, 
Ecore_Wl2_Window *window
 
    ev->timestamp = input->timestamp;
    ev->window = window->id;
-   ecore_event_add(ECORE_WL2_EVENT_FOCUS_OUT, ev, NULL, NULL);
+   ev->dev = _ecore_wl2_seat_dev_get(input, window->id);
+   ecore_event_add(ECORE_WL2_EVENT_FOCUS_OUT, ev, _input_event_cb_free,
+                   ev->dev);
 }
 
 static int
@@ -1331,6 +1348,8 @@ _ecore_wl2_input_cursor_update(void *data)
 static void
 _ecore_wl2_devices_free(Ecore_Wl2_Input_Devices *devices)
 {
+   if (devices->seat_dev)
+     efl_unref(devices->seat_dev);
    if (devices->pointer_dev)
      efl_unref(devices->pointer_dev);
    if (devices->keyboard_dev)
@@ -1378,6 +1397,8 @@ _ecore_evas_wl_common_cb_device_event(void *data, int 
type, void *event)
           devices->keyboard_dev = efl_ref(ev->dev);
         else if (ev->type == ECORE_WL2_DEVICE_TYPE_TOUCH)
           devices->touch_dev = efl_ref(ev->dev);
+        else if (ev->type == ECORE_WL2_DEVICE_TYPE_SEAT)
+          devices->seat_dev = efl_ref(ev->dev);
 
         return ECORE_CALLBACK_PASS_ON;
      }

-- 


Reply via email to