bdilly pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=75619fc290963e1061e5f8be10e4bc965292ce21

commit 75619fc290963e1061e5f8be10e4bc965292ce21
Author: Guilherme Iscaro <[email protected]>
Date:   Wed Nov 9 17:54:55 2016 -0200

    Ecore Evas: Add multi seat support for mouse in/out.
---
 src/lib/ecore_evas/Ecore_Evas.h                    | 30 ++++++++
 src/lib/ecore_evas/Ecore_Evas_Types.h              |  1 +
 src/lib/ecore_evas/ecore_evas.c                    | 87 +++++++++++++++++++++-
 src/lib/ecore_evas/ecore_evas_buffer.c             |  2 +
 src/lib/ecore_evas/ecore_evas_ews.c                |  2 +
 src/lib/ecore_evas/ecore_evas_private.h            | 10 ++-
 .../ecore_evas/engines/cocoa/ecore_evas_cocoa.c    |  2 +
 .../ecore_evas/engines/extn/ecore_evas_extn.c      |  2 +
 src/modules/ecore_evas/engines/fb/ecore_evas_fb.c  |  2 +
 .../engines/psl1ght/ecore_evas_psl1ght.c           |  2 +
 .../ecore_evas/engines/sdl/ecore_evas_sdl.c        |  2 +
 .../engines/wayland/ecore_evas_wayland_common.c    | 22 +++---
 .../ecore_evas/engines/win32/ecore_evas_win32.c    |  8 +-
 src/modules/ecore_evas/engines/x/ecore_evas_x.c    | 20 +++--
 14 files changed, 162 insertions(+), 30 deletions(-)

diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h
index 096cb90..c2295f8 100644
--- a/src/lib/ecore_evas/Ecore_Evas.h
+++ b/src/lib/ecore_evas/Ecore_Evas.h
@@ -1861,6 +1861,34 @@ EAPI void        
ecore_evas_callback_unsticky_set(Ecore_Evas *ee, Ecore_Evas_Eve
  *
  * @warning If and when this function is called depends on the underlying
  * windowing system.
+ * @since 1.19
+ */
+EAPI void        ecore_evas_callback_device_mouse_in_set(Ecore_Evas *ee, 
Ecore_Evas_Mouse_IO_Cb func);
+/**
+ * @brief Set a callback for Ecore_Evas mouse out events.
+ * @param ee The Ecore_Evas to set callbacks on
+ * @param func The function to call
+
+ * A call to this function will set a callback on an Ecore_Evas, causing
+ * @p func to be called whenever the mouse leaves @p ee.
+ *
+ * @warning If and when this function is called depends on the underlying
+ * windowing system.
+ * @since 1.19
+ */
+EAPI void        ecore_evas_callback_device_mouse_out_set(Ecore_Evas *ee, 
Ecore_Evas_Mouse_IO_Cb func);
+/**
+ * @brief Set a callback for Ecore_Evas mouse in events.
+ * @param ee The Ecore_Evas to set callbacks on
+ * @param func The function to call
+
+ * A call to this function will set a callback on an Ecore_Evas, causing
+ * @p func to be called whenever the mouse enters @p ee.
+ *
+ * @note the @p func will only report events for the default mouse.
+ * @warning If and when this function is called depends on the underlying
+ * windowing system.
+ * @see ecore_evas_callback_device_mouse_in_set
  */
 EAPI void        ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, 
Ecore_Evas_Event_Cb func);
 /**
@@ -1871,8 +1899,10 @@ EAPI void        
ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, Ecore_Evas_Eve
  * A call to this function will set a callback on an Ecore_Evas, causing
  * @p func to be called whenever the mouse leaves @p ee.
  *
+ * @note the @p func will only report events for the default mouse.
  * @warning If and when this function is called depends on the underlying
  * windowing system.
+ * @see ecore_evas_callback_device_mouse_out_set
  */
 EAPI void        ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, 
Ecore_Evas_Event_Cb func);
 /**
diff --git a/src/lib/ecore_evas/Ecore_Evas_Types.h 
b/src/lib/ecore_evas/Ecore_Evas_Types.h
index e84a674..442e07b 100644
--- a/src/lib/ecore_evas/Ecore_Evas_Types.h
+++ b/src/lib/ecore_evas/Ecore_Evas_Types.h
@@ -42,6 +42,7 @@ typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window;
 typedef struct _Ecore_Evas Ecore_Evas;
 typedef void   (*Ecore_Evas_Event_Cb) (Ecore_Evas *ee); /**< Callback used for 
several ecore evas events @since 1.2 */
 typedef void   (*Ecore_Evas_Focus_Device_Event_Cb) (Ecore_Evas *ee, Eo *seat); 
/** Callback used to report an focus in/out event originated from a seat. 
@since 1.19*/
+typedef void   (*Ecore_Evas_Mouse_IO_Cb) (Ecore_Evas *ee, Eo *mouse); /**< 
Callback used to report mouse in/out events. @since 1.19 */
 #endif
 
 #ifndef _ECORE_WAYLAND_H_
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c
index ae3fed8..293b1e3 100644
--- a/src/lib/ecore_evas/ecore_evas.c
+++ b/src/lib/ecore_evas/ecore_evas.c
@@ -83,6 +83,22 @@ _ecore_evas_device_del_cb(void *data, const Efl_Event *ev)
 }
 
 static void
+_ecore_evas_mouse_out_dispatch(Ecore_Evas *ee, Efl_Input_Device *mouse)
+{
+   if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
+   if (ee->func.fn_device_mouse_out) ee->func.fn_device_mouse_out(ee, mouse);
+}
+
+static void
+_ecore_evas_mouse_del_cb(void *data, const Efl_Event *ev)
+{
+   Ecore_Evas *ee = data;
+
+   ee->mice_in = eina_list_remove(ee->mice_in, ev->object);
+   _ecore_evas_mouse_out_dispatch(ee, ev->object);
+}
+
+static void
 _ecore_evas_animator(void *data, const Efl_Event *ev EINA_UNUSED)
 {
    Ecore_Evas *ee = data;
@@ -2754,7 +2770,7 @@ _ecore_evas_vnc_stop(Ecore_Evas *ee)
 EAPI void
 _ecore_evas_free(Ecore_Evas *ee)
 {
-   Efl_Input_Device *seat;
+   Efl_Input_Device *dev;
    Ecore_Evas_Interface *iface;
 
    ee->deleted = EINA_TRUE;
@@ -2778,11 +2794,16 @@ _ecore_evas_free(Ecore_Evas *ee)
      {
         _ecore_evas_free(ee->sub_ecore_evas->data);
      }
-   EINA_LIST_FREE(ee->prop.focused_by, seat)
+   EINA_LIST_FREE(ee->prop.focused_by, dev)
      {
-        efl_event_callback_del(seat, EFL_EVENT_DEL,
+        efl_event_callback_del(dev, EFL_EVENT_DEL,
                                _ecore_evas_device_del_cb, ee);
      }
+   EINA_LIST_FREE(ee->mice_in, dev)
+     {
+        efl_event_callback_del(dev, EFL_EVENT_DEL,
+                               _ecore_evas_mouse_del_cb, ee);
+     }
    if (ee->data) eina_hash_free(ee->data);
    ee->data = NULL;
    if (ee->name) free(ee->name);
@@ -4243,3 +4264,63 @@ _ecore_evas_input_direct_cb(void *window, int type, 
const void *info)
         return EINA_FALSE;
      }
 }
+
+EAPI void
+_ecore_evas_mouse_inout_set(Ecore_Evas *ee, Efl_Input_Device *mouse,
+                            Eina_Bool in, Eina_Bool force_out)
+{
+   Efl_Input_Device *present;
+
+   if (!mouse)
+     mouse = evas_default_device_get(ee->evas,
+                                     EFL_INPUT_DEVICE_CLASS_MOUSE);;
+
+   EINA_SAFETY_ON_NULL_RETURN(mouse);
+   present = eina_list_data_find(ee->mice_in, mouse);
+
+   if (in)
+     {
+        if (present) return;
+        ee->mice_in = eina_list_append(ee->mice_in, mouse);
+        efl_event_callback_add(mouse, EFL_EVENT_DEL,
+                               _ecore_evas_mouse_del_cb, ee);
+        if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
+     }
+   else
+     {
+        if (present) ee->mice_in = eina_list_remove(ee->mice_in, mouse);
+        else if (!present && !force_out) return;
+        efl_event_callback_del(mouse, EFL_EVENT_DEL,
+                               _ecore_evas_mouse_del_cb, ee);
+        _ecore_evas_mouse_out_dispatch(ee, mouse);
+     }
+}
+
+EAPI Eina_Bool
+_ecore_evas_mouse_in_check(Ecore_Evas *ee, Efl_Input_Device *mouse)
+{
+   if (!mouse)
+     mouse = evas_default_device_get(ee->evas, EFL_INPUT_DEVICE_CLASS_MOUSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(mouse, EINA_FALSE);
+   return eina_list_data_find(ee->mice_in, mouse) ? EINA_TRUE : EINA_FALSE;
+}
+
+EAPI void
+ecore_evas_callback_device_mouse_out_set(Ecore_Evas *ee,
+                                         Ecore_Evas_Mouse_IO_Cb func)
+{
+   ECORE_EVAS_CHECK(ee);
+   IFC(ee, fn_callback_device_mouse_out_set) (ee, func);
+   IFE;
+   ee->func.fn_device_mouse_out = func;
+}
+
+EAPI void
+ecore_evas_callback_device_mouse_in_set(Ecore_Evas *ee,
+                                        Ecore_Evas_Mouse_IO_Cb func)
+{
+   ECORE_EVAS_CHECK(ee);
+   IFC(ee, fn_callback_device_mouse_in_set) (ee, func);
+   IFE;
+   ee->func.fn_device_mouse_in = func;
+}
diff --git a/src/lib/ecore_evas/ecore_evas_buffer.c 
b/src/lib/ecore_evas/ecore_evas_buffer.c
index ae9fb62..0d1643c 100644
--- a/src/lib/ecore_evas/ecore_evas_buffer.c
+++ b/src/lib/ecore_evas/ecore_evas_buffer.c
@@ -605,6 +605,8 @@ static Ecore_Evas_Engine_Func _ecore_buffer_engine_func =
      NULL, //fn_focus_device_set
      NULL, //fn_callback_focus_device_in_set
      NULL, //fn_callback_focus_device_out_set
+     NULL, //fn_callback_device_mouse_in_set
+     NULL, //fn_callback_device_mouse_out_set
 };
 
 static void *
diff --git a/src/lib/ecore_evas/ecore_evas_ews.c 
b/src/lib/ecore_evas/ecore_evas_ews.c
index c7dcb70..693e9db 100644
--- a/src/lib/ecore_evas/ecore_evas_ews.c
+++ b/src/lib/ecore_evas/ecore_evas_ews.c
@@ -717,6 +717,8 @@ static const Ecore_Evas_Engine_Func _ecore_ews_engine_func =
      NULL, //fn_focus_device_set
      NULL, //fn_callback_focus_device_in_set
      NULL, //fn_callback_focus_device_out_set
+     NULL, //fn_callback_device_mouse_in_set
+     NULL, //fn_callback_device_mouse_out_set
 };
 
 void
diff --git a/src/lib/ecore_evas/ecore_evas_private.h 
b/src/lib/ecore_evas/ecore_evas_private.h
index af1c531..f9c66fe 100644
--- a/src/lib/ecore_evas/ecore_evas_private.h
+++ b/src/lib/ecore_evas/ecore_evas_private.h
@@ -162,6 +162,9 @@ struct _Ecore_Evas_Engine_Func
    void (*fn_focus_device_set) (Ecore_Evas *ee, Efl_Input_Device *seat, 
Eina_Bool on);
    void (*fn_callback_focus_device_in_set) (Ecore_Evas *ee, 
Ecore_Evas_Focus_Device_Event_Cb func);
    void (*fn_callback_focus_device_out_set) (Ecore_Evas *ee, 
Ecore_Evas_Focus_Device_Event_Cb func);
+
+   void (*fn_callback_device_mouse_in_set) (Ecore_Evas *ee, 
Ecore_Evas_Mouse_IO_Cb func);
+   void (*fn_callback_device_mouse_out_set) (Ecore_Evas *ee, 
Ecore_Evas_Mouse_IO_Cb func);
 };
 
 struct _Ecore_Evas_Interface
@@ -198,10 +201,10 @@ struct _Ecore_Evas
    Eina_Bool   should_be_visible : 1;
    Eina_Bool   alpha  : 1;
    Eina_Bool   transparent  : 1;
-   Eina_Bool   in  : 1;
    Eina_Bool   events_block  : 1; /* @since 1.14 */
 
    Eina_Hash  *data;
+   Eina_List  *mice_in;
 
    void *vnc_server; /* @since 1.19 */
 
@@ -306,6 +309,8 @@ struct _Ecore_Evas
       Eina_Bool     (*fn_pointer_warp) (const Ecore_Evas *ee, Evas_Coord x, 
Evas_Coord y);
       void          (*fn_focus_device_in) (Ecore_Evas *ee, Efl_Input_Device 
*seat);
       void          (*fn_focus_device_out) (Ecore_Evas *ee, Efl_Input_Device 
*seat);
+      void          (*fn_device_mouse_in) (Ecore_Evas *ee, Efl_Input_Device 
*mouse);
+      void          (*fn_device_mouse_out) (Ecore_Evas *ee, Efl_Input_Device 
*mouse);
    } func;
 
    Ecore_Evas_Engine engine;
@@ -455,6 +460,9 @@ Eina_Module *_ecore_evas_vnc_server_module_load(void);
 EAPI void _ecore_evas_focus_device_set(Ecore_Evas *ee, Efl_Input_Device *seat,
                                        Eina_Bool on);
 
+EAPI Eina_Bool _ecore_evas_mouse_in_check(Ecore_Evas *ee, Efl_Input_Device 
*mouse);
+EAPI void _ecore_evas_mouse_inout_set(Ecore_Evas *ee, Efl_Input_Device *mouse,
+                                      Eina_Bool in, Eina_Bool force_out);
 #undef EAPI
 #define EAPI
 
diff --git a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c 
b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
index 9271d5b..a2afc3d 100644
--- a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
+++ b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
@@ -673,6 +673,8 @@ static Ecore_Evas_Engine_Func _ecore_cocoa_engine_func =
     NULL, //fn_focus_device_set
     NULL, //fn_callback_focus_device_in_set
     NULL, //fn_callback_focus_device_out_set
+    NULL, //fn_callback_device_mouse_in_set
+    NULL, //fn_callback_device_mouse_out_set
   };
 
 static Ecore_Cocoa_Window *
diff --git a/src/modules/ecore_evas/engines/extn/ecore_evas_extn.c 
b/src/modules/ecore_evas/engines/extn/ecore_evas_extn.c
index ff392bf..3b364d8 100644
--- a/src/modules/ecore_evas/engines/extn/ecore_evas_extn.c
+++ b/src/modules/ecore_evas/engines/extn/ecore_evas_extn.c
@@ -923,6 +923,8 @@ static const Ecore_Evas_Engine_Func 
_ecore_extn_plug_engine_func =
    NULL, //fn_focus_device_set
    NULL, //fn_callback_focus_device_in_set
    NULL, //fn_callback_focus_device_out_set
+   NULL, //fn_callback_device_mouse_in_set
+   NULL, //fn_callback_device_mouse_out_set
 };
 
 static Eina_Bool
diff --git a/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c 
b/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c
index adc74b1..f5d84bd 100644
--- a/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c
+++ b/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c
@@ -640,6 +640,8 @@ static Ecore_Evas_Engine_Func _ecore_fb_engine_func =
      NULL, //fn_focus_device_set
      NULL, //fn_callback_focus_device_in_set
      NULL, //fn_callback_focus_device_out_set
+     NULL, //fn_callback_device_mouse_in_set
+     NULL, //fn_callback_device_mouse_out_set
 };
 
 EAPI Ecore_Evas *
diff --git a/src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c 
b/src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c
index 7eaf88e..fc8c6ce 100644
--- a/src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c
+++ b/src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c
@@ -461,6 +461,8 @@ static Ecore_Evas_Engine_Func _ecore_psl1ght_engine_func =
    NULL, //fn_focus_device_set
    NULL, //fn_callback_focus_device_in_set
    NULL, //fn_callback_focus_device_out_set
+   NULL, //fn_callback_device_mouse_in_set
+   NULL, //fn_callback_device_mouse_out_set
 };
 
 EAPI Ecore_Evas *
diff --git a/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c 
b/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c
index e45dd0f..440185e 100644
--- a/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c
+++ b/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c
@@ -553,6 +553,8 @@ static Ecore_Evas_Engine_Func _ecore_sdl_engine_func =
    NULL, //fn_focus_device_set
    NULL, //fn_callback_focus_device_in_set
    NULL, //fn_callback_focus_device_out_set
+   NULL, //fn_callback_device_mouse_in_set
+   NULL, //fn_callback_device_mouse_out_set
 };
 
 static Ecore_Evas*
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c 
b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
index 0ebff5b..0bea2c4 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
@@ -88,6 +88,8 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
    NULL, //fn_focus_device_set
    NULL, //fn_callback_focus_device_in_set
    NULL, //fn_callback_focus_device_out_set
+   NULL, //fn_callback_device_mouse_in_set
+   NULL, //fn_callback_device_mouse_out_set
 };
 
 #define _smart_frame_type "ecore_evas_wl_frame"
@@ -163,13 +165,12 @@ _ecore_evas_wl_common_cb_mouse_in(void *data EINA_UNUSED, 
int type EINA_UNUSED,
    ee = ecore_event_window_match(ev->window);
    if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
    if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
-   if (ee->in) return ECORE_CALLBACK_PASS_ON;
+   if (_ecore_evas_mouse_in_check(ee, ev->dev)) return ECORE_CALLBACK_PASS_ON;
 
-   if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
+   _ecore_evas_mouse_inout_set(ee, ev->dev, EINA_TRUE, EINA_FALSE);
    ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
    evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL);
    _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
-   ee->in = EINA_TRUE;
    return ECORE_CALLBACK_PASS_ON;
 }
 
@@ -185,16 +186,13 @@ _ecore_evas_wl_common_cb_mouse_out(void *data 
EINA_UNUSED, int type EINA_UNUSED,
    ee = ecore_event_window_match(ev->window);
    if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
    if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+   if (!_ecore_evas_mouse_in_check(ee, ev->dev)) return ECORE_CALLBACK_PASS_ON;
 
-   if (ee->in)
-     {
-        ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
-        _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
-        evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL);
-        if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
-        if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
-        ee->in = EINA_FALSE;
-     }
+   ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers);
+   _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp);
+   evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL);
+   _ecore_evas_mouse_inout_set(ee, ev->dev, EINA_FALSE, EINA_FALSE);
+   if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
    return ECORE_CALLBACK_PASS_ON;
 }
 
diff --git a/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c 
b/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c
index d5107a0..27b4160 100644
--- a/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c
+++ b/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c
@@ -190,7 +190,7 @@ _ecore_evas_win32_event_mouse_in(void *data EINA_UNUSED, 
int type EINA_UNUSED, v
    if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */
    if ((Ecore_Window)e->window != ee->prop.window) return 1;
 
-   if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
+   _ecore_evas_mouse_inout_set(ee, NULL, EINA_TRUE, EINA_FALSE);
    /* FIXME to do */
 /*    _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */
    evas_event_feed_mouse_in(ee->evas, e->timestamp, NULL);
@@ -215,11 +215,11 @@ _ecore_evas_win32_event_mouse_out(void *data EINA_UNUSED, 
int type EINA_UNUSED,
 /*    _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */
    _ecore_evas_mouse_move_process(ee, e->x, e->y, e->timestamp);
 
-   if (ee->in)
+   if (_ecore_evas_mouse_in_check(ee, NULL))
      {
         if (evas_event_down_count_get(ee->evas) > 0) return 
ECORE_CALLBACK_PASS_ON;
         evas_event_feed_mouse_out(ee->evas, e->timestamp, NULL);
-        if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
+        _ecore_evas_mouse_inout_set(ee, NULL, EINA_FALSE, EINA_FALSE);
         if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
      }
 
@@ -1205,6 +1205,8 @@ static Ecore_Evas_Engine_Func _ecore_win32_engine_func =
      NULL, //fn_focus_device_set
      NULL, //fn_callback_focus_device_in_set
      NULL, //fn_callback_focus_device_out_set
+     NULL, //fn_callback_device_mouse_in_set
+     NULL, //fn_callback_device_mouse_out_set
 };
 
 #endif /* BUILD_ECORE_EVAS_WIN32 */
diff --git a/src/modules/ecore_evas/engines/x/ecore_evas_x.c 
b/src/modules/ecore_evas/engines/x/ecore_evas_x.c
index b86fca8..e1eb9f7 100644
--- a/src/modules/ecore_evas/engines/x/ecore_evas_x.c
+++ b/src/modules/ecore_evas/engines/x/ecore_evas_x.c
@@ -1314,9 +1314,8 @@ _fake_out(void *data)
    _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
    _feed_cancel_out(e, (e->mode == ECORE_X_EVENT_MODE_GRAB));
 
-   if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
+   _ecore_evas_mouse_inout_set(ee, NULL, EINA_FALSE, EINA_TRUE);
    if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
-   ee->in = EINA_FALSE;
    return EINA_FALSE;
 }
 
@@ -1385,7 +1384,7 @@ _ecore_evas_x_event_mouse_in(void *data EINA_UNUSED, int 
type EINA_UNUSED, void
      }
    
    /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */
-   if (!ee->in)
+   if (!_ecore_evas_mouse_in_check(ee, NULL))
      {
         Ecore_Event_Mouse_IO io = {
            .event_window = (Ecore_Window) e->win, /* not event_win! */
@@ -1396,9 +1395,8 @@ _ecore_evas_x_event_mouse_in(void *data EINA_UNUSED, int 
type EINA_UNUSED, void
            .y = e->y
         };
 
-        if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
+        _ecore_evas_mouse_inout_set(ee, NULL, EINA_TRUE, EINA_FALSE);
         ecore_event_evas_mouse_in(NULL, ECORE_EVENT_MOUSE_IN, &io);
-        ee->in = EINA_TRUE;
      }
    return ECORE_CALLBACK_PASS_ON;
 }
@@ -1472,7 +1470,7 @@ _ecore_evas_x_event_mouse_out(void *data EINA_UNUSED, int 
type EINA_UNUSED, void
 //   if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0;
 //   printf("OUT: ee->in=%i, e->mode=%i, e->detail=%i, dount_count=%i\n",
 //          ee->in, e->mode, e->detail, evas_event_down_count_get(ee->evas));
-   if (ee->in)
+   if (_ecore_evas_mouse_in_check(ee, NULL))
      {
         if ((evas_event_down_count_get(ee->evas) > 0) &&
             (!((e->mode == ECORE_X_EVENT_MODE_GRAB) &&
@@ -1480,10 +1478,9 @@ _ecore_evas_x_event_mouse_out(void *data EINA_UNUSED, 
int type EINA_UNUSED, void
           return ECORE_CALLBACK_PASS_ON;
         ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
         _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
+        _ecore_evas_mouse_inout_set(ee, NULL, EINA_FALSE, EINA_FALSE);
         _feed_cancel_out(e, (e->mode == ECORE_X_EVENT_MODE_GRAB));
-        if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
         if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
-        ee->in = EINA_FALSE;
      }
    return ECORE_CALLBACK_PASS_ON;
 }
@@ -1791,7 +1788,7 @@ _ecore_evas_x_event_window_hide(void *data EINA_UNUSED, 
int type EINA_UNUSED, vo
    ee = ecore_event_window_match(e->win);
    if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
    if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
-   if (ee->in)
+   if (_ecore_evas_mouse_in_check(ee, NULL))
      {
         Ecore_X_Event_Mouse_Out out = {
            .event_win = e->event_win,
@@ -1802,9 +1799,8 @@ _ecore_evas_x_event_window_hide(void *data EINA_UNUSED, 
int type EINA_UNUSED, vo
            .y = 0,
         };
         _feed_cancel_out(&out, EINA_TRUE);
-        if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
+        _ecore_evas_mouse_inout_set(ee, NULL, EINA_FALSE, EINA_FALSE);
         if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
-        ee->in = EINA_FALSE;
      }
    if (ee->prop.override)
      {
@@ -3787,6 +3783,8 @@ static Ecore_Evas_Engine_Func _ecore_x_engine_func =
    NULL, //fn_focus_device_set
    NULL, //fn_callback_focus_device_in_set
    NULL, //fn_callback_focus_device_out_set
+   NULL, //fn_callback_device_mouse_in_set
+   NULL, //fn_callback_device_mouse_out_set
 };
 
 /*

-- 


Reply via email to