summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuilherme Iscaro <iscaro@profusion.mobi>2016-11-03 12:07:40 -0200
committerBruno Dilly <bdilly@profusion.mobi>2016-11-28 13:57:55 -0200
commitbe609118c6a23a80e5a3271a6294621baa3e480a (patch)
tree20ef9378b6cbf69d1f4fea2b4ca5e67cdb209a01
parent6b95c4c2eccff5976992b9a4d557e586d90511d1 (diff)
Ecore_Evas: Add support for per-seat focus.
-rw-r--r--src/lib/ecore_evas/Ecore_Evas.h66
-rw-r--r--src/lib/ecore_evas/Ecore_Evas_Types.h1
-rw-r--r--src/lib/ecore_evas/ecore_evas.c108
-rw-r--r--src/lib/ecore_evas/ecore_evas_buffer.c22
-rw-r--r--src/lib/ecore_evas/ecore_evas_ews.c20
-rw-r--r--src/lib/ecore_evas/ecore_evas_private.h12
-rw-r--r--src/lib/evas/canvas/evas_canvas.eo14
-rw-r--r--src/lib/evas/canvas/evas_main.c27
-rw-r--r--src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c13
-rw-r--r--src/modules/ecore_evas/engines/drm/ecore_evas_drm.c3
-rw-r--r--src/modules/ecore_evas/engines/extn/ecore_evas_extn.c27
-rw-r--r--src/modules/ecore_evas/engines/fb/ecore_evas_fb.c17
-rw-r--r--src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c21
-rw-r--r--src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c20
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c13
-rw-r--r--src/modules/ecore_evas/engines/win32/ecore_evas_win32.c15
-rw-r--r--src/modules/ecore_evas/engines/x/ecore_evas_x.c17
17 files changed, 290 insertions, 126 deletions
diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h
index 45dd047ca3..096cb9002f 100644
--- a/src/lib/ecore_evas/Ecore_Evas.h
+++ b/src/lib/ecore_evas/Ecore_Evas.h
@@ -314,7 +314,7 @@ EAPI void ecore_evas_geometry_get(const Ecore_Evas *ee, int *x, int *y, i
314 */ 314 */
315EAPI void ecore_evas_request_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h); 315EAPI void ecore_evas_request_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h);
316/** 316/**
317 * @brief Set the focus of an Ecore_Evas' window. 317 * @brief Set the Ecore_Evas window focus for the default seat.
318 * 318 *
319 * @param ee The Ecore_Evas 319 * @param ee The Ecore_Evas
320 * @param on @c EINA_TRUE for focus, @c EINA_FALSE to defocus. 320 * @param on @c EINA_TRUE for focus, @c EINA_FALSE to defocus.
@@ -323,17 +323,47 @@ EAPI void ecore_evas_request_geometry_get(const Ecore_Evas *ee, int *x, i
323 * @p on is @c EINA_FALSE. 323 * @p on is @c EINA_FALSE.
324 * 324 *
325 * @warning Support for this depends on the underlying windowing system. 325 * @warning Support for this depends on the underlying windowing system.
326 * @see ecore_evas_focus_device_set()
326 */ 327 */
327EAPI void ecore_evas_focus_set(Ecore_Evas *ee, Eina_Bool on); 328EAPI void ecore_evas_focus_set(Ecore_Evas *ee, Eina_Bool on);
328/** 329/**
329 * @brief Query whether an Ecore_Evas' window is focused or not. 330 * @brief Query whether the default seat has the Ecore_Evas focus.
330 * 331 *
331 * @param ee The Ecore_Evas to set 332 * @param ee The Ecore_Evas to set
332 * @return @c EINA_TRUE if @p ee if focused, @c EINA_FALSE if not. 333 * @return @c EINA_TRUE if @p ee if focused, @c EINA_FALSE if not.
333 * 334 *
334 * @see ecore_evas_focus_set() 335 * @see ecore_evas_focus_set()
336 * @see ecore_evas_focus_device_get()
335 */ 337 */
336EAPI Eina_Bool ecore_evas_focus_get(const Ecore_Evas *ee); 338EAPI Eina_Bool ecore_evas_focus_get(const Ecore_Evas *ee);
339
340/**
341 * @brief Set the Ecore_Evas windows focus for a given seat.
342 *
343 * @param ee The Ecore_Evas
344 * @param seat An Efl_Input_Device that represents the seat or @c NULL for the default seat.
345 * @param on @c EINA_TRUE for focus, @c EINA_FALSE to defocus.
346 *
347 * This function focuses @p ee if @p on is @c EINA_TRUE, or unfocuses @p ee if
348 * @p on is @c EINA_FALSE.
349 *
350 * @warning Support for this depends on the underlying windowing system.
351 * @see ecore_evas_focus_device_get()
352 * @since 1.19
353 */
354EAPI void ecore_evas_focus_device_set(Ecore_Evas *ee, Eo *seat,
355 Eina_Bool on);
356/**
357 * @brief Query whether an Ecore_Evas' window is focused or not.
358 *
359 * @param ee The Ecore_Evas to set
360 * @param seat An Efl_Input_Device that represents the seat or @c NULL for the default seat.
361 * @return @c EINA_TRUE if @p ee if focused, @c EINA_FALSE if not.
362 *
363 * @see ecore_evas_focus_device_set()
364 * @since 1.19
365 */
366EAPI Eina_Bool ecore_evas_focus_device_get(const Ecore_Evas *ee, Eo *seat);
337/** 367/**
338 * @brief Iconify or uniconify an Ecore_Evas' window. 368 * @brief Iconify or uniconify an Ecore_Evas' window.
339 * 369 *
@@ -1751,6 +1781,8 @@ EAPI void ecore_evas_callback_destroy_set(Ecore_Evas *ee, Ecore_Evas_Even
1751 * 1781 *
1752 * @warning If and when this function is called depends on the underlying 1782 * @warning If and when this function is called depends on the underlying
1753 * windowing system. 1783 * windowing system.
1784 * @note This function only reports focus in events for the default seat!
1785 * @see ecore_evas_callback_focus_device_in_set()
1754 */ 1786 */
1755EAPI void ecore_evas_callback_focus_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); 1787EAPI void ecore_evas_callback_focus_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1756/** 1788/**
@@ -1763,9 +1795,39 @@ EAPI void ecore_evas_callback_focus_in_set(Ecore_Evas *ee, Ecore_Evas_Eve
1763 * 1795 *
1764 * @warning If and when this function is called depends on the underlying 1796 * @warning If and when this function is called depends on the underlying
1765 * windowing system. 1797 * windowing system.
1798 * @note This function only reports focus in events for the default seat!
1799 * @see ecore_evas_callback_focus_device_out_set()
1766 */ 1800 */
1767EAPI void ecore_evas_callback_focus_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func); 1801EAPI void ecore_evas_callback_focus_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func);
1768/** 1802/**
1803 * @brief Set a callback for Ecore_Evas focus in events.
1804 * @param ee The Ecore_Evas to set callbacks on
1805 * @param func The function to call
1806
1807 * A call to this function will set a callback on an Ecore_Evas, causing
1808 * @p func to be called whenever @p ee gets focus.
1809 *
1810 * @warning If and when this function is called depends on the underlying
1811 * windowing system.
1812 * @see ecore_evas_callback_focus_device_out_set()
1813 * @since 1.19
1814 */
1815EAPI void ecore_evas_callback_focus_device_in_set(Ecore_Evas *ee, Ecore_Evas_Focus_Device_Event_Cb func);
1816/**
1817 * @brief Set a callback for Ecore_Evas focus out events.
1818 * @param ee The Ecore_Evas to set callbacks on
1819 * @param func The function to call
1820
1821 * A call to this function will set a callback on an Ecore_Evas, causing
1822 * @p func to be called whenever @p ee loses focus.
1823 *
1824 * @warning If and when this function is called depends on the underlying
1825 * windowing system.
1826 * @see ecore_evas_callback_focus_device_in_set()
1827 * @since 1.19
1828 */
1829EAPI void ecore_evas_callback_focus_device_out_set(Ecore_Evas *ee, Ecore_Evas_Focus_Device_Event_Cb func);
1830/**
1769 * @brief Set a callback for Ecore_Evas sticky events. 1831 * @brief Set a callback for Ecore_Evas sticky events.
1770 * @param ee The Ecore_Evas to set callbacks on 1832 * @param ee The Ecore_Evas to set callbacks on
1771 * @param func The function to call 1833 * @param func The function to call
diff --git a/src/lib/ecore_evas/Ecore_Evas_Types.h b/src/lib/ecore_evas/Ecore_Evas_Types.h
index eeff920f81..e84a674b39 100644
--- a/src/lib/ecore_evas/Ecore_Evas_Types.h
+++ b/src/lib/ecore_evas/Ecore_Evas_Types.h
@@ -41,6 +41,7 @@ typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window;
41/* basic data types */ 41/* basic data types */
42typedef struct _Ecore_Evas Ecore_Evas; 42typedef struct _Ecore_Evas Ecore_Evas;
43typedef void (*Ecore_Evas_Event_Cb) (Ecore_Evas *ee); /**< Callback used for several ecore evas events @since 1.2 */ 43typedef void (*Ecore_Evas_Event_Cb) (Ecore_Evas *ee); /**< Callback used for several ecore evas events @since 1.2 */
44typedef 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*/
44#endif 45#endif
45 46
46#ifndef _ECORE_WAYLAND_H_ 47#ifndef _ECORE_WAYLAND_H_
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c
index 421345daa9..ae3fed8ded 100644
--- a/src/lib/ecore_evas/ecore_evas.c
+++ b/src/lib/ecore_evas/ecore_evas.c
@@ -66,6 +66,23 @@ static int _ecore_evas_fps_debug = 0;
66static int _ecore_evas_render_sync = 1; 66static int _ecore_evas_render_sync = 1;
67 67
68static void 68static void
69_ecore_evas_focus_out_dispatch(Ecore_Evas *ee, Efl_Input_Device *seat)
70{
71 evas_canvas_seat_focus_out(ee->evas, seat);
72 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
73 if (ee->func.fn_focus_device_out) ee->func.fn_focus_device_out(ee, seat);
74}
75
76static void
77_ecore_evas_device_del_cb(void *data, const Efl_Event *ev)
78{
79 Ecore_Evas *ee = data;
80
81 ee->prop.focused_by = eina_list_remove(ee->prop.focused_by, ev->object);
82 _ecore_evas_focus_out_dispatch(ee, ev->object);
83}
84
85static void
69_ecore_evas_animator(void *data, const Efl_Event *ev EINA_UNUSED) 86_ecore_evas_animator(void *data, const Efl_Event *ev EINA_UNUSED)
70{ 87{
71 Ecore_Evas *ee = data; 88 Ecore_Evas *ee = data;
@@ -1005,6 +1022,16 @@ ecore_evas_callback_focus_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1005} 1022}
1006 1023
1007EAPI void 1024EAPI void
1025ecore_evas_callback_focus_device_in_set(Ecore_Evas *ee,
1026 Ecore_Evas_Focus_Device_Event_Cb func)
1027{
1028 ECORE_EVAS_CHECK(ee);
1029 IFC(ee, fn_callback_focus_device_in_set) (ee, func);
1030 IFE;
1031 ee->func.fn_focus_device_in = func;
1032}
1033
1034EAPI void
1008ecore_evas_callback_focus_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) 1035ecore_evas_callback_focus_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1009{ 1036{
1010 ECORE_EVAS_CHECK(ee); 1037 ECORE_EVAS_CHECK(ee);
@@ -1014,6 +1041,16 @@ ecore_evas_callback_focus_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1014} 1041}
1015 1042
1016EAPI void 1043EAPI void
1044ecore_evas_callback_focus_device_out_set(Ecore_Evas *ee,
1045 Ecore_Evas_Focus_Device_Event_Cb func)
1046{
1047 ECORE_EVAS_CHECK(ee);
1048 IFC(ee, fn_callback_focus_device_out_set) (ee, func);
1049 IFE;
1050 ee->func.fn_focus_device_out = func;
1051}
1052
1053EAPI void
1017ecore_evas_callback_sticky_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func) 1054ecore_evas_callback_sticky_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
1018{ 1055{
1019 ECORE_EVAS_CHECK(ee); 1056 ECORE_EVAS_CHECK(ee);
@@ -1553,30 +1590,75 @@ ecore_evas_layer_get(const Ecore_Evas *ee)
1553 return ee->prop.layer; 1590 return ee->prop.layer;
1554} 1591}
1555 1592
1593EAPI Eina_Bool
1594ecore_evas_focus_device_get(const Ecore_Evas *ee, Efl_Input_Device *seat)
1595{
1596 ECORE_EVAS_CHECK(ee, EINA_FALSE);
1597 if (!seat)
1598 seat = evas_default_device_get(ee->evas, EFL_INPUT_DEVICE_CLASS_SEAT);
1599 return eina_list_data_find(ee->prop.focused_by, seat) ? EINA_TRUE : EINA_FALSE;
1600}
1601
1556EAPI void 1602EAPI void
1557ecore_evas_focus_set(Ecore_Evas *ee, Eina_Bool on) 1603_ecore_evas_focus_device_set(Ecore_Evas *ee, Efl_Input_Device *seat,
1604 Eina_Bool on)
1558{ 1605{
1559 ECORE_EVAS_CHECK(ee); 1606 Eina_Bool present;
1560 IFC(ee, fn_focus_set) (ee, on); 1607
1561 IFE; 1608 if (!seat)
1609 seat = evas_default_device_get(ee->evas, EFL_INPUT_DEVICE_CLASS_SEAT);
1610 EINA_SAFETY_ON_NULL_RETURN(seat);
1611
1612 if (efl_input_device_type_get(seat) != EFL_INPUT_DEVICE_CLASS_SEAT)
1613 {
1614 ERR("The Input device must be an seat");
1615 return;
1616 }
1617
1618 present = ecore_evas_focus_device_get(ee, seat);
1562 if (on) 1619 if (on)
1563 { 1620 {
1564 evas_focus_in(ee->evas); 1621 if (present) return;
1622 ee->prop.focused_by = eina_list_append(ee->prop.focused_by, seat);
1623 efl_event_callback_add(seat, EFL_EVENT_DEL,
1624 _ecore_evas_device_del_cb, ee);
1625 evas_canvas_seat_focus_in(ee->evas, seat);
1565 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); 1626 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
1627 if (ee->func.fn_focus_device_in) ee->func.fn_focus_device_in(ee, seat);
1566 } 1628 }
1567 else 1629 else
1568 { 1630 {
1569 evas_focus_out(ee->evas); 1631 if (!present) return;
1570 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); 1632 ee->prop.focused_by = eina_list_remove(ee->prop.focused_by, seat);
1633 efl_event_callback_del(seat, EFL_EVENT_DEL,
1634 _ecore_evas_device_del_cb, ee);
1635 _ecore_evas_focus_out_dispatch(ee, seat);
1571 } 1636 }
1572 ee->prop.focused = !!on; 1637}
1638
1639EAPI void
1640ecore_evas_focus_device_set(Ecore_Evas *ee, Efl_Input_Device *seat,
1641 Eina_Bool on)
1642{
1643 ECORE_EVAS_CHECK(ee);
1644 IFC(ee, fn_focus_device_set) (ee, seat, on);
1645 IFE;
1646 _ecore_evas_focus_device_set(ee, seat, on);
1647}
1648
1649EAPI void
1650ecore_evas_focus_set(Ecore_Evas *ee, Eina_Bool on)
1651{
1652 ECORE_EVAS_CHECK(ee);
1653 IFC(ee, fn_focus_set) (ee, on);
1654 IFE;
1655 ecore_evas_focus_device_set(ee, NULL, on);
1573} 1656}
1574 1657
1575EAPI Eina_Bool 1658EAPI Eina_Bool
1576ecore_evas_focus_get(const Ecore_Evas *ee) 1659ecore_evas_focus_get(const Ecore_Evas *ee)
1577{ 1660{
1578 ECORE_EVAS_CHECK(ee, EINA_FALSE); 1661 return ecore_evas_focus_device_get(ee, NULL);
1579 return ee->prop.focused ? EINA_TRUE : EINA_FALSE;
1580} 1662}
1581 1663
1582EAPI void 1664EAPI void
@@ -2672,6 +2754,7 @@ _ecore_evas_vnc_stop(Ecore_Evas *ee)
2672EAPI void 2754EAPI void
2673_ecore_evas_free(Ecore_Evas *ee) 2755_ecore_evas_free(Ecore_Evas *ee)
2674{ 2756{
2757 Efl_Input_Device *seat;
2675 Ecore_Evas_Interface *iface; 2758 Ecore_Evas_Interface *iface;
2676 2759
2677 ee->deleted = EINA_TRUE; 2760 ee->deleted = EINA_TRUE;
@@ -2695,6 +2778,11 @@ _ecore_evas_free(Ecore_Evas *ee)
2695 { 2778 {
2696 _ecore_evas_free(ee->sub_ecore_evas->data); 2779 _ecore_evas_free(ee->sub_ecore_evas->data);
2697 } 2780 }
2781 EINA_LIST_FREE(ee->prop.focused_by, seat)
2782 {
2783 efl_event_callback_del(seat, EFL_EVENT_DEL,
2784 _ecore_evas_device_del_cb, ee);
2785 }
2698 if (ee->data) eina_hash_free(ee->data); 2786 if (ee->data) eina_hash_free(ee->data);
2699 ee->data = NULL; 2787 ee->data = NULL;
2700 if (ee->name) free(ee->name); 2788 if (ee->name) free(ee->name);
diff --git a/src/lib/ecore_evas/ecore_evas_buffer.c b/src/lib/ecore_evas/ecore_evas_buffer.c
index deb2387001..ae9fb62646 100644
--- a/src/lib/ecore_evas/ecore_evas_buffer.c
+++ b/src/lib/ecore_evas/ecore_evas_buffer.c
@@ -105,12 +105,10 @@ _ecore_evas_show(Ecore_Evas *ee)
105 Ecore_Evas_Engine_Buffer_Data *bdata = ee->engine.data; 105 Ecore_Evas_Engine_Buffer_Data *bdata = ee->engine.data;
106 106
107 if (bdata->image) return; 107 if (bdata->image) return;
108 if (ee->prop.focused) return; 108 if (ecore_evas_focus_device_get(ee, NULL)) return;
109 ee->prop.focused = EINA_TRUE;
110 ee->prop.withdrawn = EINA_FALSE; 109 ee->prop.withdrawn = EINA_FALSE;
111 if (ee->func.fn_state_change) ee->func.fn_state_change(ee); 110 if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
112 evas_focus_in(ee->evas); 111 _ecore_evas_focus_device_set(ee, NULL, EINA_TRUE);
113 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
114} 112}
115 113
116static int 114static int
@@ -413,9 +411,7 @@ _ecore_evas_buffer_cb_focus_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj
413 Ecore_Evas *ee; 411 Ecore_Evas *ee;
414 412
415 ee = data; 413 ee = data;
416 ee->prop.focused = EINA_TRUE; 414 _ecore_evas_focus_device_set(ee, NULL, EINA_TRUE);
417 evas_focus_in(ee->evas);
418 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
419} 415}
420 416
421static void 417static void
@@ -424,9 +420,7 @@ _ecore_evas_buffer_cb_focus_out(void *data, Evas *e EINA_UNUSED, Evas_Object *ob
424 Ecore_Evas *ee; 420 Ecore_Evas *ee;
425 421
426 ee = data; 422 ee = data;
427 ee->prop.focused = EINA_FALSE; 423 _ecore_evas_focus_device_set(ee, NULL, EINA_FALSE);
428 evas_focus_out(ee->evas);
429 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
430} 424}
431 425
432static void 426static void
@@ -608,6 +602,9 @@ static Ecore_Evas_Engine_Func _ecore_buffer_engine_func =
608 NULL, // fn_animator_unregister 602 NULL, // fn_animator_unregister
609 603
610 NULL, // fn_evas_changed 604 NULL, // fn_evas_changed
605 NULL, //fn_focus_device_set
606 NULL, //fn_callback_focus_device_in_set
607 NULL, //fn_callback_focus_device_out_set
611}; 608};
612 609
613static void * 610static void *
@@ -672,7 +669,6 @@ ecore_evas_buffer_allocfunc_new(int w, int h,
672 ee->prop.max.w = 0; 669 ee->prop.max.w = 0;
673 ee->prop.max.h = 0; 670 ee->prop.max.h = 0;
674 ee->prop.layer = 0; 671 ee->prop.layer = 0;
675 ee->prop.focused = EINA_TRUE;
676 ee->prop.borderless = EINA_TRUE; 672 ee->prop.borderless = EINA_TRUE;
677 ee->prop.override = EINA_TRUE; 673 ee->prop.override = EINA_TRUE;
678 ee->prop.maximized = EINA_TRUE; 674 ee->prop.maximized = EINA_TRUE;
@@ -727,7 +723,8 @@ ecore_evas_buffer_allocfunc_new(int w, int h,
727 _ecore_evas_register(ee); 723 _ecore_evas_register(ee);
728 724
729 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); 725 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
730 726 _ecore_evas_focus_device_set(ee, NULL, EINA_TRUE);
727
731 return ee; 728 return ee;
732} 729}
733 730
@@ -811,7 +808,6 @@ ecore_evas_object_image_new(Ecore_Evas *ee_target)
811 ee->prop.max.w = 0; 808 ee->prop.max.w = 0;
812 ee->prop.max.h = 0; 809 ee->prop.max.h = 0;
813 ee->prop.layer = 0; 810 ee->prop.layer = 0;
814 ee->prop.focused = EINA_FALSE;
815 ee->prop.borderless = EINA_TRUE; 811 ee->prop.borderless = EINA_TRUE;
816 ee->prop.override = EINA_TRUE; 812 ee->prop.override = EINA_TRUE;
817 ee->prop.maximized = EINA_FALSE; 813 ee->prop.maximized = EINA_FALSE;
diff --git a/src/lib/ecore_evas/ecore_evas_ews.c b/src/lib/ecore_evas/ecore_evas_ews.c
index 6f90654f6b..c7dcb7087f 100644
--- a/src/lib/ecore_evas/ecore_evas_ews.c
+++ b/src/lib/ecore_evas/ecore_evas_ews.c
@@ -465,19 +465,11 @@ static void
465_ecore_evas_ews_focus_set(Ecore_Evas *ee, Eina_Bool on) 465_ecore_evas_ews_focus_set(Ecore_Evas *ee, Eina_Bool on)
466{ 466{
467 evas_object_focus_set(ee->engine.ews.image, on); 467 evas_object_focus_set(ee->engine.ews.image, on);
468 ee->prop.focused = on; 468 _ecore_evas_focus_device_set(ee, NULL, on);
469 if (on) 469 if (on)
470 { 470 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_FOCUS);
471 evas_focus_in(ee->evas);
472 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
473 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_FOCUS);
474 }
475 else 471 else
476 { 472 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_UNFOCUS);
477 evas_focus_out(ee->evas);
478 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
479 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_UNFOCUS);
480 }
481} 473}
482 474
483static void 475static void
@@ -501,7 +493,8 @@ _ecore_evas_ews_override_set(Ecore_Evas *ee, Eina_Bool on)
501{ 493{
502 if (ee->prop.override == on) return; 494 if (ee->prop.override == on) return;
503 if (ee->visible) evas_object_show(ee->engine.ews.image); 495 if (ee->visible) evas_object_show(ee->engine.ews.image);
504 if (ee->prop.focused) evas_object_focus_set(ee->engine.ews.image, EINA_TRUE); 496 if (ecore_evas_focus_device_get(ee, NULL))
497 evas_object_focus_set(ee->engine.ews.image, EINA_TRUE);
505 ee->prop.override = on; 498 ee->prop.override = on;
506 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); 499 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
507} 500}
@@ -721,6 +714,9 @@ static const Ecore_Evas_Engine_Func _ecore_ews_engine_func =
721 NULL, // fn_animator_unregister 714 NULL, // fn_animator_unregister
722 715
723 NULL, // fn_evas_changed 716 NULL, // fn_evas_changed
717 NULL, //fn_focus_device_set
718 NULL, //fn_callback_focus_device_in_set
719 NULL, //fn_callback_focus_device_out_set
724}; 720};
725 721
726void 722void
diff --git a/src/lib/ecore_evas/ecore_evas_private.h b/src/lib/ecore_evas/ecore_evas_private.h
index 5184e94d2b..af1c5319f6 100644
--- a/src/lib/ecore_evas/ecore_evas_private.h
+++ b/src/lib/ecore_evas/ecore_evas_private.h
@@ -158,6 +158,10 @@ struct _Ecore_Evas_Engine_Func
158 void (*fn_animator_unregister)(Ecore_Evas *ee); 158 void (*fn_animator_unregister)(Ecore_Evas *ee);
159 159
160 void (*fn_evas_changed)(Ecore_Evas *ee, Eina_Bool changed); 160 void (*fn_evas_changed)(Ecore_Evas *ee, Eina_Bool changed);
161
162 void (*fn_focus_device_set) (Ecore_Evas *ee, Efl_Input_Device *seat, Eina_Bool on);
163 void (*fn_callback_focus_device_in_set) (Ecore_Evas *ee, Ecore_Evas_Focus_Device_Event_Cb func);
164 void (*fn_callback_focus_device_out_set) (Ecore_Evas *ee, Ecore_Evas_Focus_Device_Event_Cb func);
161}; 165};
162 166
163struct _Ecore_Evas_Interface 167struct _Ecore_Evas_Interface
@@ -257,13 +261,13 @@ struct _Ecore_Evas
257 Eina_List *hints; 261 Eina_List *hints;
258 int id; 262 int id;
259 } aux_hint; 263 } aux_hint;
264 Eina_List *focused_by;
260 int layer; 265 int layer;
261 Ecore_Window window; 266 Ecore_Window window;
262 unsigned char avoid_damage; 267 unsigned char avoid_damage;
263 Ecore_Evas *group_ee; 268 Ecore_Evas *group_ee;
264 Ecore_Window group_ee_win; 269 Ecore_Window group_ee_win;
265 double aspect; 270 double aspect;
266 Eina_Bool focused : 1;
267 Eina_Bool iconified : 1; 271 Eina_Bool iconified : 1;
268 Eina_Bool borderless : 1; 272 Eina_Bool borderless : 1;
269 Eina_Bool override : 1; 273 Eina_Bool override : 1;
@@ -300,6 +304,8 @@ struct _Ecore_Evas
300 void (*fn_msg_handle) (Ecore_Evas *ee, int maj, int min, void *data, int size); 304 void (*fn_msg_handle) (Ecore_Evas *ee, int maj, int min, void *data, int size);
301 void (*fn_pointer_xy_get) (const Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y); 305 void (*fn_pointer_xy_get) (const Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y);
302 Eina_Bool (*fn_pointer_warp) (const Ecore_Evas *ee, Evas_Coord x, Evas_Coord y); 306 Eina_Bool (*fn_pointer_warp) (const Ecore_Evas *ee, Evas_Coord x, Evas_Coord y);
307 void (*fn_focus_device_in) (Ecore_Evas *ee, Efl_Input_Device *seat);
308 void (*fn_focus_device_out) (Ecore_Evas *ee, Efl_Input_Device *seat);
303 } func; 309 } func;
304 310
305 Ecore_Evas_Engine engine; 311 Ecore_Evas_Engine engine;
@@ -445,6 +451,10 @@ EAPI void ecore_evas_animator_tick(Ecore_Evas *ee, Eina_Rectangle *viewport, dou
445 451
446Eina_Module *_ecore_evas_vnc_server_module_load(void); 452Eina_Module *_ecore_evas_vnc_server_module_load(void);
447 453
454
455EAPI void _ecore_evas_focus_device_set(Ecore_Evas *ee, Efl_Input_Device *seat,
456 Eina_Bool on);
457
448#undef EAPI 458#undef EAPI
449#define EAPI 459#define EAPI
450 460
diff --git a/src/lib/evas/canvas/evas_canvas.eo b/src/lib/evas/canvas/evas_canvas.eo
index 8f0c9ae3be..d4bbfaca8c 100644
--- a/src/lib/evas/canvas/evas_canvas.eo
+++ b/src/lib/evas/canvas/evas_canvas.eo
@@ -954,6 +954,20 @@ class Evas.Canvas (Efl.Object, Efl.Canvas, Efl.Animator, Efl.Input.Interface)
954 focus_in { 954 focus_in {
955 [[Inform to the evas that it got the focus from the default seat.]] 955 [[Inform to the evas that it got the focus from the default seat.]]
956 } 956 }
957 seat_focus_in {
958 [[Inform to the evas that it got the focus from a given seat. @since 1.19]]
959 legacy: null;
960 params {
961 @in seat: Efl.Input.Device; [[The seat or $null for the default seat.]]
962 }
963 }
964 seat_focus_out {
965 [[Inform to the evas that it lost the focus from a given seat. @since 1.19]]
966 legacy: null;
967 params {
968 @in seat: Efl.Input.Device; [[The seat or $null for the default seat.]]
969 }
970 }
957 obscured_rectangle_add { 971 obscured_rectangle_add {
958 [[Add an "obscured region" to an Evas canvas. 972 [[Add an "obscured region" to an Evas canvas.
959 973
diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c
index 0c58d832f9..22f4fa357a 100644
--- a/src/lib/evas/canvas/evas_main.c
+++ b/src/lib/evas/canvas/evas_main.c
@@ -539,7 +539,8 @@ _evas_canvas_data_attach_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e)
539} 539}
540 540
541static void 541static void
542_evas_canvas_focus_inout_dispatch(Eo *eo_e, Evas_Public_Data *e, Eina_Bool in) 542_evas_canvas_focus_inout_dispatch(Eo *eo_e, Efl_Input_Device *seat,
543 Eina_Bool in)
543{ 544{
544 Efl_Input_Focus_Data *ev_data; 545 Efl_Input_Focus_Data *ev_data;
545 Efl_Input_Focus *evt; 546 Efl_Input_Focus *evt;
@@ -547,7 +548,7 @@ _evas_canvas_focus_inout_dispatch(Eo *eo_e, Evas_Public_Data *e, Eina_Bool in)
547 evt = efl_input_instance_get(EFL_INPUT_FOCUS_CLASS, eo_e, (void **) &ev_data); 548 evt = efl_input_instance_get(EFL_INPUT_FOCUS_CLASS, eo_e, (void **) &ev_data);
548 if (!evt) return; 549 if (!evt) return;
549 550
550 ev_data->device = efl_ref(e->default_seat); 551 ev_data->device = efl_ref(seat);
551 ev_data->timestamp = time(NULL); 552 ev_data->timestamp = time(NULL);
552 efl_event_callback_call(eo_e, 553 efl_event_callback_call(eo_e,
553 in ? EFL_EVENT_FOCUS_IN : EFL_EVENT_FOCUS_OUT, 554 in ? EFL_EVENT_FOCUS_IN : EFL_EVENT_FOCUS_OUT,
@@ -556,15 +557,33 @@ _evas_canvas_focus_inout_dispatch(Eo *eo_e, Evas_Public_Data *e, Eina_Bool in)
556} 557}
557 558
558EOLIAN static void 559EOLIAN static void
560_evas_canvas_seat_focus_in(Eo *eo_e, Evas_Public_Data *e,
561 Efl_Input_Device *seat)
562{
563 if (!seat) seat = e->default_seat;
564 if (!seat || efl_input_device_type_get(seat) != EFL_INPUT_DEVICE_CLASS_SEAT) return;
565 _evas_canvas_focus_inout_dispatch(eo_e, seat, EINA_TRUE);
566}
567
568EOLIAN static void
569_evas_canvas_seat_focus_out(Eo *eo_e, Evas_Public_Data *e,
570 Efl_Input_Device *seat)
571{
572 if (!seat) seat = e->default_seat;
573 if (!seat || efl_input_device_type_get(seat) != EFL_INPUT_DEVICE_CLASS_SEAT) return;
574 _evas_canvas_focus_inout_dispatch(eo_e, seat, EINA_FALSE);
575}
576
577EOLIAN static void
559_evas_canvas_focus_in(Eo *eo_e, Evas_Public_Data *e) 578_evas_canvas_focus_in(Eo *eo_e, Evas_Public_Data *e)
560{ 579{
561 _evas_canvas_focus_inout_dispatch(eo_e, e, EINA_TRUE); 580 _evas_canvas_seat_focus_in(eo_e, e, NULL);
562} 581}
563 582
564EOLIAN static void 583EOLIAN static void
565_evas_canvas_focus_out(Eo *eo_e, Evas_Public_Data *e) 584_evas_canvas_focus_out(Eo *eo_e, Evas_Public_Data *e)
566{ 585{
567 _evas_canvas_focus_inout_dispatch(eo_e, e, EINA_FALSE); 586 _evas_canvas_seat_focus_out(eo_e, e, NULL);
568} 587}
569 588
570EOLIAN static Eina_Bool 589EOLIAN static Eina_Bool
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 1bfb0850e9..9271d5bc9e 100644
--- a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
+++ b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
@@ -186,10 +186,7 @@ _ecore_evas_cocoa_event_got_focus(void *data EINA_UNUSED, int type EINA_UNUSED,
186 ee = _ecore_evas_cocoa_match(e->cocoa_window); 186 ee = _ecore_evas_cocoa_match(e->cocoa_window);
187 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; 187 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
188 188
189 ee->prop.focused = EINA_TRUE; 189 _ecore_evas_focus_device_set(ee, NULL, EINA_TRUE);
190 evas_focus_in(ee->evas);
191 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
192
193 return ECORE_CALLBACK_PASS_ON; 190 return ECORE_CALLBACK_PASS_ON;
194} 191}
195 192
@@ -202,10 +199,7 @@ _ecore_evas_cocoa_event_lost_focus(void *data EINA_UNUSED, int type EINA_UNUSED,
202 ee = _ecore_evas_cocoa_match(e->cocoa_window); 199 ee = _ecore_evas_cocoa_match(e->cocoa_window);
203 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; 200 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
204 201
205 evas_focus_out(ee->evas); 202 _ecore_evas_focus_device_set(ee, NULL, EINA_TRUE);
206 ee->prop.focused = EINA_FALSE;
207 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
208
209 return ECORE_CALLBACK_PASS_ON; 203 return ECORE_CALLBACK_PASS_ON;
210} 204}
211 205
@@ -676,6 +670,9 @@ static Ecore_Evas_Engine_Func _ecore_cocoa_engine_func =
676 NULL, // fn_animator_unregister 670 NULL, // fn_animator_unregister
677 671
678 NULL, // fn_evas_changed 672 NULL, // fn_evas_changed
673 NULL, //fn_focus_device_set
674 NULL, //fn_callback_focus_device_in_set
675 NULL, //fn_callback_focus_device_out_set
679 }; 676 };
680 677
681static Ecore_Cocoa_Window * 678static Ecore_Cocoa_Window *
diff --git a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
index d0f730a0f5..917f1defb7 100644
--- a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
+++ b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c
@@ -793,6 +793,9 @@ static Ecore_Evas_Engine_Func _ecore_evas_drm_engine_func =
793 _drm_animator_unregister, // animator_unregister 793 _drm_animator_unregister, // animator_unregister
794 794
795 _drm_evas_changed, // evas_changed 795 _drm_evas_changed, // evas_changed
796 NULL, //fn_focus_device_set
797 NULL, //fn_callback_focus_device_in_set
798 NULL, //fn_callback_focus_device_out_set
796}; 799};
797 800
798static Ecore_Evas * 801static Ecore_Evas *
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 785f9cd0f4..ff392bfa0b 100644
--- a/src/modules/ecore_evas/engines/extn/ecore_evas_extn.c
+++ b/src/modules/ecore_evas/engines/extn/ecore_evas_extn.c
@@ -750,8 +750,11 @@ _ecore_evas_extn_cb_focus_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj E
750 Ecore_Evas *ee = data; 750 Ecore_Evas *ee = data;
751 Ecore_Evas_Engine_Buffer_Data *bdata = ee->engine.data; 751 Ecore_Evas_Engine_Buffer_Data *bdata = ee->engine.data;
752 Extn *extn; 752 Extn *extn;
753 Evas_Device *dev;
753 754
754 ee->prop.focused = EINA_TRUE; 755 dev = evas_default_device_get(ee->evas, EFL_INPUT_DEVICE_CLASS_SEAT);
756 if (ecore_evas_focus_device_get(ee, dev)) return;
757 ee->prop.focused_by = eina_list_append(ee->prop.focused_by, dev);
755 extn = bdata->data; 758 extn = bdata->data;
756 if (!extn) return; 759 if (!extn) return;
757 if (!extn->ipc.server) return; 760 if (!extn->ipc.server) return;
@@ -765,7 +768,8 @@ _ecore_evas_extn_cb_focus_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj
765 Ecore_Evas_Engine_Buffer_Data *bdata = ee->engine.data; 768 Ecore_Evas_Engine_Buffer_Data *bdata = ee->engine.data;
766 Extn *extn; 769 Extn *extn;
767 770
768 ee->prop.focused = EINA_FALSE; 771 ee->prop.focused_by = eina_list_remove(ee->prop.focused_by,
772 evas_default_device_get(ee->evas, EFL_INPUT_DEVICE_CLASS_SEAT));
769 extn = bdata->data; 773 extn = bdata->data;
770 if (!extn) return; 774 if (!extn) return;
771 if (!extn->ipc.server) return; 775 if (!extn->ipc.server) return;
@@ -916,6 +920,9 @@ static const Ecore_Evas_Engine_Func _ecore_extn_plug_engine_func =
916 NULL, // fn_animator_unregister 920 NULL, // fn_animator_unregister
917 921
918 NULL, // fn_evas_changed 922 NULL, // fn_evas_changed
923 NULL, //fn_focus_device_set
924 NULL, //fn_callback_focus_device_in_set
925 NULL, //fn_callback_focus_device_out_set
919}; 926};
920 927
921static Eina_Bool 928static Eina_Bool
@@ -1199,7 +1206,6 @@ ecore_evas_extn_plug_new_internal(Ecore_Evas *ee_target)
1199 ee->prop.max.w = 0; 1206 ee->prop.max.w = 0;
1200 ee->prop.max.h = 0; 1207 ee->prop.max.h = 0;
1201 ee->prop.layer = 0; 1208 ee->prop.layer = 0;
1202 ee->prop.focused = EINA_FALSE;
1203 ee->prop.borderless = EINA_TRUE; 1209 ee->prop.borderless = EINA_TRUE;
1204 ee->prop.override = EINA_TRUE; 1210 ee->prop.override = EINA_TRUE;
1205 ee->prop.maximized = EINA_FALSE; 1211 ee->prop.maximized = EINA_FALSE;
@@ -1660,20 +1666,10 @@ _ipc_client_data(void *data, int type EINA_UNUSED, void *event)
1660 } 1666 }
1661 break; 1667 break;
1662 case OP_FOCUS: 1668 case OP_FOCUS:
1663 if (!ee->prop.focused) 1669 if (!ecore_evas_focus_device_get(ee, NULL)) _ecore_evas_focus_device_set(ee, NULL, EINA_TRUE);
1664 {
1665 ee->prop.focused = EINA_TRUE;
1666 evas_focus_in(ee->evas);
1667 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
1668 }
1669 break; 1670 break;
1670 case OP_UNFOCUS: 1671 case OP_UNFOCUS:
1671 if (ee->prop.focused) 1672 if (ecore_evas_focus_device_get(ee, NULL)) _ecore_evas_focus_device_set(ee, NULL, EINA_FALSE);
1672 {
1673 ee->prop.focused = EINA_FALSE;
1674 evas_focus_out(ee->evas);
1675 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
1676 }
1677 break; 1673 break;
1678 case OP_EV_MOUSE_IN: 1674 case OP_EV_MOUSE_IN:
1679 if (ee->events_block) break; 1675 if (ee->events_block) break;
@@ -2125,7 +2121,6 @@ ecore_evas_extn_socket_new_internal(int w, int h)
2125 ee->prop.max.w = 0; 2121 ee->prop.max.w = 0;
2126 ee->prop.max.h = 0; 2122 ee->prop.max.h = 0;
2127 ee->prop.layer = 0; 2123 ee->prop.layer = 0;
2128 ee->prop.focused = EINA_FALSE;
2129 ee->prop.borderless = EINA_TRUE; 2124 ee->prop.borderless = EINA_TRUE;
2130 ee->prop.override = EINA_TRUE; 2125 ee->prop.override = EINA_TRUE;
2131 ee->prop.maximized = EINA_FALSE; 2126 ee->prop.maximized = EINA_FALSE;
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 558f82f752..adc74b1ca4 100644
--- a/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c
+++ b/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c
@@ -416,12 +416,10 @@ _ecore_evas_rotation_set(Ecore_Evas *ee, int rotation, int resize EINA_UNUSED)
416static void 416static void
417_ecore_evas_show(Ecore_Evas *ee) 417_ecore_evas_show(Ecore_Evas *ee)
418{ 418{
419 if (ee->prop.focused) return; 419 if (ecore_evas_focus_device_get(ee, NULL)) return;
420 ee->prop.withdrawn = EINA_FALSE; 420 ee->prop.withdrawn = EINA_FALSE;
421 if (ee->func.fn_state_change) ee->func.fn_state_change(ee); 421 if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
422 ee->prop.focused = EINA_TRUE; 422 _ecore_evas_focus_device_set(ee, NULL, EINA_TRUE);
423 evas_focus_in(ee->evas);
424 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
425} 423}
426 424
427static void 425static void
@@ -429,12 +427,7 @@ _ecore_evas_hide(Ecore_Evas *ee)
429{ 427{
430 ee->prop.withdrawn = EINA_TRUE; 428 ee->prop.withdrawn = EINA_TRUE;
431 if (ee->func.fn_state_change) ee->func.fn_state_change(ee); 429 if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
432 if (ee->prop.focused) 430 _ecore_evas_focus_device_set(ee, NULL, EINA_FALSE);
433 {
434 ee->prop.focused = EINA_FALSE;
435 evas_focus_out(ee->evas);
436 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
437 }
438} 431}
439 432
440static void 433static void
@@ -644,6 +637,9 @@ static Ecore_Evas_Engine_Func _ecore_fb_engine_func =
644 NULL, // fn_animator_unregister 637 NULL, // fn_animator_unregister
645 638
646 NULL, // fn_evas_changed 639 NULL, // fn_evas_changed
640 NULL, //fn_focus_device_set
641 NULL, //fn_callback_focus_device_in_set
642 NULL, //fn_callback_focus_device_out_set
647}; 643};
648 644
649EAPI Ecore_Evas * 645EAPI Ecore_Evas *
@@ -692,7 +688,6 @@ ecore_evas_fb_new_internal(const char *disp_name, int rotation, int w, int h)
692 ee->prop.max.w = 0; 688 ee->prop.max.w = 0;
693 ee->prop.max.h = 0; 689 ee->prop.max.h = 0;
694 ee->prop.layer = 0; 690 ee->prop.layer = 0;
695 ee->prop.focused = EINA_FALSE;
696 ee->prop.borderless = EINA_TRUE; 691 ee->prop.borderless = EINA_TRUE;
697 ee->prop.override = EINA_TRUE; 692 ee->prop.override = EINA_TRUE;
698 ee->prop.maximized = EINA_TRUE; 693 ee->prop.maximized = EINA_TRUE;
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 7938dce2e5..7eaf88e050 100644
--- a/src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c
+++ b/src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c
@@ -67,10 +67,7 @@ _ecore_evas_psl1ght_event_got_focus(void *data EINA_UNUSED, int type EINA_UNUSED
67 67
68 if (!ee) return ECORE_CALLBACK_PASS_ON; 68 if (!ee) return ECORE_CALLBACK_PASS_ON;
69 /* pass on event */ 69 /* pass on event */
70 ee->prop.focused = EINA_TRUE; 70 _ecore_evas_focus_device_set(ee, NULL, EINA_TRUE);
71 evas_focus_in(ee->evas);
72 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
73
74 return ECORE_CALLBACK_PASS_ON; 71 return ECORE_CALLBACK_PASS_ON;
75} 72}
76 73
@@ -83,10 +80,7 @@ _ecore_evas_psl1ght_event_lost_focus(void *data EINA_UNUSED, int type EINA_UNUSE
83 80
84 if (!ee) return ECORE_CALLBACK_PASS_ON; 81 if (!ee) return ECORE_CALLBACK_PASS_ON;
85 /* pass on event */ 82 /* pass on event */
86 evas_focus_out(ee->evas); 83 _ecore_evas_focus_device_set(ee, NULL, EINA_FALSE);
87 ee->prop.focused = EINA_FALSE;
88 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
89
90 return ECORE_CALLBACK_PASS_ON; 84 return ECORE_CALLBACK_PASS_ON;
91} 85}
92 86
@@ -313,10 +307,8 @@ _ecore_evas_show(Ecore_Evas *ee)
313{ 307{
314 ee->prop.withdrawn = EINA_FALSE; 308 ee->prop.withdrawn = EINA_FALSE;
315 if (ee->func.fn_state_change) ee->func.fn_state_change(ee); 309 if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
316 if (ee->prop.focused) return; 310 if (ecore_evas_focus_device_get(ee, NULL)) return;
317 ee->prop.focused = EINA_TRUE; 311 _ecore_evas_focus_device_set(ee, NULL, EINA_TRUE);
318 evas_focus_in(ee->evas);
319 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
320} 312}
321 313
322static void 314static void
@@ -466,6 +458,9 @@ static Ecore_Evas_Engine_Func _ecore_psl1ght_engine_func =
466 NULL, // fn_animator_unregister 458 NULL, // fn_animator_unregister
467 459
468 NULL, // fn_evas_changed 460 NULL, // fn_evas_changed
461 NULL, //fn_focus_device_set
462 NULL, //fn_callback_focus_device_in_set
463 NULL, //fn_callback_focus_device_out_set
469}; 464};
470 465
471EAPI Ecore_Evas * 466EAPI Ecore_Evas *
@@ -496,7 +491,6 @@ ecore_evas_psl1ght_new_internal(const char *name, int w, int h)
496 ee->prop.max.w = 0; 491 ee->prop.max.w = 0;
497 ee->prop.max.h = 0; 492 ee->prop.max.h = 0;
498 ee->prop.layer = 0; 493 ee->prop.layer = 0;
499 ee->prop.focused = EINA_TRUE;
500 ee->prop.borderless = EINA_TRUE; 494 ee->prop.borderless = EINA_TRUE;
501 ee->prop.override = EINA_TRUE; 495 ee->prop.override = EINA_TRUE;
502 ee->prop.maximized = EINA_TRUE; 496 ee->prop.maximized = EINA_TRUE;
@@ -558,6 +552,7 @@ ecore_evas_psl1ght_new_internal(const char *name, int w, int h)
558 if (getenv("ECORE_EVAS_PSL1GHT_CURSOR_PATH")) 552 if (getenv("ECORE_EVAS_PSL1GHT_CURSOR_PATH"))
559 ecore_evas_cursor_set(ee, getenv("ECORE_EVAS_PSL1GHT_CURSOR_PATH"), EVAS_LAYER_MAX, 0, 0); 553 ecore_evas_cursor_set(ee, getenv("ECORE_EVAS_PSL1GHT_CURSOR_PATH"), EVAS_LAYER_MAX, 0, 0);
560 554
555 _ecore_evas_focus_device_set(ee, NULL, EINA_TRUE);
561 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); 556 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
562 557
563 return ee; 558 return ee;
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 2382fdac44..e45dd0f99e 100644
--- a/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c
+++ b/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c
@@ -103,12 +103,9 @@ _ecore_evas_sdl_event_got_focus(void *data EINA_UNUSED, int type EINA_UNUSED, vo
103 Ecore_Evas *ee; 103 Ecore_Evas *ee;
104 104
105 ee = _ecore_evas_sdl_match(ev->windowID); 105 ee = _ecore_evas_sdl_match(ev->windowID);
106
107 if (!ee) return ECORE_CALLBACK_PASS_ON;
108 /* pass on event */ 106 /* pass on event */
109 ee->prop.focused = EINA_TRUE; 107 if (!ee) return ECORE_CALLBACK_PASS_ON;
110 evas_focus_in(ee->evas); 108 _ecore_evas_focus_device_set(ee, NULL, EINA_TRUE);
111 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
112 return ECORE_CALLBACK_PASS_ON; 109 return ECORE_CALLBACK_PASS_ON;
113} 110}
114 111
@@ -122,9 +119,7 @@ _ecore_evas_sdl_event_lost_focus(void *data EINA_UNUSED, int type EINA_UNUSED, v
122 119
123 if (!ee) return ECORE_CALLBACK_PASS_ON; 120 if (!ee) return ECORE_CALLBACK_PASS_ON;
124 /* pass on event */ 121 /* pass on event */
125 ee->prop.focused = EINA_FALSE; 122 _ecore_evas_focus_device_set(ee, NULL, EINA_FALSE);
126 evas_focus_out(ee->evas);
127 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
128 return ECORE_CALLBACK_PASS_ON; 123 return ECORE_CALLBACK_PASS_ON;
129} 124}
130 125
@@ -411,8 +406,8 @@ _ecore_evas_show(Ecore_Evas *ee)
411{ 406{
412 ee->prop.withdrawn = EINA_FALSE; 407 ee->prop.withdrawn = EINA_FALSE;
413 if (ee->func.fn_state_change) ee->func.fn_state_change(ee); 408 if (ee->func.fn_state_change) ee->func.fn_state_change(ee);
414 if (ee->prop.focused) return; 409 if (ecore_evas_focus_device_get(ee, NULL)) return;
415 ee->prop.focused = EINA_TRUE; 410 _ecore_evas_focus_device_set(ee, NULL, EINA_TRUE);
416 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); 411 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
417} 412}
418 413
@@ -555,6 +550,9 @@ static Ecore_Evas_Engine_Func _ecore_sdl_engine_func =
555 NULL, // fn_animator_unregister 550 NULL, // fn_animator_unregister
556 551
557 NULL, // fn_evas_changed 552 NULL, // fn_evas_changed
553 NULL, //fn_focus_device_set
554 NULL, //fn_callback_focus_device_in_set
555 NULL, //fn_callback_focus_device_out_set
558}; 556};
559 557
560static Ecore_Evas* 558static Ecore_Evas*
@@ -599,7 +597,6 @@ _ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fu
599 ee->prop.max.w = 0; 597 ee->prop.max.w = 0;
600 ee->prop.max.h = 0; 598 ee->prop.max.h = 0;
601 ee->prop.layer = 0; 599 ee->prop.layer = 0;
602 ee->prop.focused = EINA_TRUE;
603 ee->prop.borderless = EINA_TRUE; 600 ee->prop.borderless = EINA_TRUE;
604 ee->prop.override = EINA_TRUE; 601 ee->prop.override = EINA_TRUE;
605 ee->prop.maximized = EINA_TRUE; 602 ee->prop.maximized = EINA_TRUE;
@@ -725,6 +722,7 @@ _ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fu
725 ee->engine.func->fn_render = _ecore_evas_sdl_render; 722 ee->engine.func->fn_render = _ecore_evas_sdl_render;
726 _ecore_evas_register(ee); 723 _ecore_evas_register(ee);
727 724
725 _ecore_evas_focus_device_set(ee, NULL, EINA_TRUE);
728 ecore_evas_sdl_count++; 726 ecore_evas_sdl_count++;
729 return ee; 727 return ee;
730 728
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 232d96b0cb..0ebff5be92 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
@@ -85,6 +85,9 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
85 NULL, // fn_animator_unregister 85 NULL, // fn_animator_unregister
86 86
87 NULL, // fn_evas_changed 87 NULL, // fn_evas_changed
88 NULL, //fn_focus_device_set
89 NULL, //fn_callback_focus_device_in_set
90 NULL, //fn_callback_focus_device_out_set
88}; 91};
89 92
90#define _smart_frame_type "ecore_evas_wl_frame" 93#define _smart_frame_type "ecore_evas_wl_frame"
@@ -207,10 +210,7 @@ _ecore_evas_wl_common_cb_focus_in(void *data EINA_UNUSED, int type EINA_UNUSED,
207 ee = ecore_event_window_match(ev->window); 210 ee = ecore_event_window_match(ev->window);
208 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; 211 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
209 if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 212 if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
210 if (ee->prop.focused) return ECORE_CALLBACK_PASS_ON; 213 _ecore_evas_focus_device_set(ee, ev->dev, EINA_TRUE);
211 ee->prop.focused = EINA_TRUE;
212 evas_focus_in(ee->evas);
213 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
214 return ECORE_CALLBACK_PASS_ON; 214 return ECORE_CALLBACK_PASS_ON;
215} 215}
216 216
@@ -226,10 +226,7 @@ _ecore_evas_wl_common_cb_focus_out(void *data EINA_UNUSED, int type EINA_UNUSED,
226 ee = ecore_event_window_match(ev->window); 226 ee = ecore_event_window_match(ev->window);
227 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; 227 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
228 if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 228 if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
229 if (!ee->prop.focused) return ECORE_CALLBACK_PASS_ON; 229 _ecore_evas_focus_device_set(ee, ev->dev, EINA_FALSE);
230 evas_focus_out(ee->evas);
231 ee->prop.focused = EINA_FALSE;
232 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
233 return ECORE_CALLBACK_PASS_ON; 230 return ECORE_CALLBACK_PASS_ON;
234} 231}
235 232
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 1187d5dba2..d5107a0276 100644
--- a/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c
+++ b/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c
@@ -237,9 +237,7 @@ _ecore_evas_win32_event_window_focus_in(void *data EINA_UNUSED, int type EINA_UN
237 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; 237 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
238 if ((Ecore_Window)e->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 238 if ((Ecore_Window)e->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
239 239
240 ee->prop.focused = EINA_TRUE; 240 _ecore_evas_focus_device_set(ee, NULL, EINA_TRUE);
241 evas_focus_in(ee->evas);
242 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
243 return ECORE_CALLBACK_PASS_ON; 241 return ECORE_CALLBACK_PASS_ON;
244} 242}
245 243
@@ -254,9 +252,7 @@ _ecore_evas_win32_event_window_focus_out(void *data EINA_UNUSED, int type EINA_U
254 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; 252 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
255 if ((Ecore_Window)e->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 253 if ((Ecore_Window)e->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
256 254
257 evas_focus_out(ee->evas); 255 _ecore_evas_focus_device_set(ee, NULL, EINA_FALSE);
258 ee->prop.focused = EINA_FALSE;
259 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
260 return ECORE_CALLBACK_PASS_ON; 256 return ECORE_CALLBACK_PASS_ON;
261} 257}
262 258
@@ -958,7 +954,7 @@ _ecore_evas_win32_override_set(Ecore_Evas *ee, Eina_Bool on)
958 /* FIXME: use borderless_set for now */ 954 /* FIXME: use borderless_set for now */
959 ecore_win32_window_borderless_set(window, on); 955 ecore_win32_window_borderless_set(window, on);
960 if (ee->should_be_visible) ecore_win32_window_show(window); 956 if (ee->should_be_visible) ecore_win32_window_show(window);
961 if (ee->prop.focused) ecore_win32_window_focus(window); 957 if (ecore_evas_focus_device_get(ee, NULL)) ecore_win32_window_focus(window);
962 ee->prop.override = on; 958 ee->prop.override = on;
963} 959}
964 960
@@ -1077,7 +1073,7 @@ _ecore_evas_win32_alpha_set(Ecore_Evas *ee, int alpha)
1077 if (ee->prop.borderless) 1073 if (ee->prop.borderless)
1078 ecore_win32_window_borderless_set((struct _Ecore_Win32_Window *)ee->prop.window, ee->prop.borderless); 1074 ecore_win32_window_borderless_set((struct _Ecore_Win32_Window *)ee->prop.window, ee->prop.borderless);
1079 if (ee->visible) ecore_win32_window_show((struct _Ecore_Win32_Window *)ee->prop.window); 1075 if (ee->visible) ecore_win32_window_show((struct _Ecore_Win32_Window *)ee->prop.window);
1080 if (ee->prop.focused) ecore_win32_window_focus((struct _Ecore_Win32_Window *)ee->prop.window); 1076 if (ecore_evas_focus_device_get(ee, NULL)) ecore_win32_window_focus((struct _Ecore_Win32_Window *)ee->prop.window);
1081 if (ee->prop.title) 1077 if (ee->prop.title)
1082 { 1078 {
1083 ecore_win32_window_title_set((struct _Ecore_Win32_Window *)ee->prop.window, ee->prop.title); 1079 ecore_win32_window_title_set((struct _Ecore_Win32_Window *)ee->prop.window, ee->prop.title);
@@ -1206,6 +1202,9 @@ static Ecore_Evas_Engine_Func _ecore_win32_engine_func =
1206 NULL, // fn_animator_unregister 1202 NULL, // fn_animator_unregister
1207 1203
1208 NULL, // fn_evas_changed 1204 NULL, // fn_evas_changed
1205 NULL, //fn_focus_device_set
1206 NULL, //fn_callback_focus_device_in_set
1207 NULL, //fn_callback_focus_device_out_set
1209}; 1208};
1210 1209
1211#endif /* BUILD_ECORE_EVAS_WIN32 */ 1210#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 2a71070e07..b86fca8f9a 100644
--- a/src/modules/ecore_evas/engines/x/ecore_evas_x.c
+++ b/src/modules/ecore_evas/engines/x/ecore_evas_x.c
@@ -1500,9 +1500,7 @@ _ecore_evas_x_event_window_focus_in(void *data EINA_UNUSED, int type EINA_UNUSED
1500 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 1500 if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
1501//xx// filtering with these doesnt help 1501//xx// filtering with these doesnt help
1502//xx// if (e->mode == ECORE_X_EVENT_MODE_UNGRAB) return ECORE_CALLBACK_PASS_ON; 1502//xx// if (e->mode == ECORE_X_EVENT_MODE_UNGRAB) return ECORE_CALLBACK_PASS_ON;
1503 ee->prop.focused = EINA_TRUE; 1503 _ecore_evas_focus_device_set(ee, NULL, EINA_TRUE);
1504 evas_focus_in(ee->evas);
1505 if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee);
1506 return ECORE_CALLBACK_PASS_ON; 1504 return ECORE_CALLBACK_PASS_ON;
1507} 1505}
1508 1506
@@ -1521,9 +1519,7 @@ _ecore_evas_x_event_window_focus_out(void *data EINA_UNUSED, int type EINA_UNUSE
1521 1519
1522// if (ee->prop.fullscreen) 1520// if (ee->prop.fullscreen)
1523// ecore_x_window_focus(ee->prop.window); 1521// ecore_x_window_focus(ee->prop.window);
1524 evas_focus_out(ee->evas); 1522 _ecore_evas_focus_device_set(ee, NULL, EINA_FALSE);
1525 ee->prop.focused = EINA_FALSE;
1526 if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee);
1527 return ECORE_CALLBACK_PASS_ON; 1523 return ECORE_CALLBACK_PASS_ON;
1528} 1524}
1529 1525
@@ -2721,7 +2717,7 @@ _alpha_do(Ecore_Evas *ee, int alpha)
2721 ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); 2717 ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless);
2722 if (ee->visible || ee->should_be_visible) 2718 if (ee->visible || ee->should_be_visible)
2723 ecore_x_window_show(ee->prop.window); 2719 ecore_x_window_show(ee->prop.window);
2724 if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); 2720 if (ecore_evas_focus_device_get(ee, NULL)) ecore_x_window_focus(ee->prop.window);
2725 if (ee->prop.title) 2721 if (ee->prop.title)
2726 { 2722 {
2727 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); 2723 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
@@ -2877,7 +2873,7 @@ _ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha)
2877 ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); 2873 ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless);
2878 if (ee->visible || ee->should_be_visible) 2874 if (ee->visible || ee->should_be_visible)
2879 ecore_x_window_show(ee->prop.window); 2875 ecore_x_window_show(ee->prop.window);
2880 if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); 2876 if (ecore_evas_focus_device_get(ee, NULL)) ecore_x_window_focus(ee->prop.window);
2881 if (ee->prop.title) 2877 if (ee->prop.title)
2882 { 2878 {
2883 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); 2879 ecore_x_icccm_title_set(ee->prop.window, ee->prop.title);
@@ -3359,7 +3355,7 @@ _ecore_evas_x_override_set(Ecore_Evas *ee, Eina_Bool on)
3359 if (ee->should_be_visible) ecore_x_window_hide(ee->prop.window); 3355 if (ee->should_be_visible) ecore_x_window_hide(ee->prop.window);
3360 ecore_x_window_override_set(ee->prop.window, on); 3356 ecore_x_window_override_set(ee->prop.window, on);
3361 if (ee->should_be_visible) ecore_x_window_show(ee->prop.window); 3357 if (ee->should_be_visible) ecore_x_window_show(ee->prop.window);
3362 if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); 3358 if (ecore_evas_focus_device_get(ee, NULL)) ecore_x_window_focus(ee->prop.window);
3363 ee->prop.override = on; 3359 ee->prop.override = on;
3364} 3360}
3365 3361
@@ -3788,6 +3784,9 @@ static Ecore_Evas_Engine_Func _ecore_x_engine_func =
3788 NULL, // fn_animator_unregister 3784 NULL, // fn_animator_unregister
3789 3785
3790 NULL, // fn_evas_changed 3786 NULL, // fn_evas_changed
3787 NULL, //fn_focus_device_set
3788 NULL, //fn_callback_focus_device_in_set
3789 NULL, //fn_callback_focus_device_out_set
3791}; 3790};
3792 3791
3793/* 3792/*