diff options
Diffstat (limited to 'libraries/ecore/src/lib/ecore_evas')
17 files changed, 5234 insertions, 186 deletions
diff --git a/libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h b/libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h index 256e57c..8d9abc4 100644 --- a/libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h +++ b/libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h | |||
@@ -81,6 +81,8 @@ extern "C" { | |||
81 | #define HAVE_ECORE_EVAS_WINCE 1 | 81 | #define HAVE_ECORE_EVAS_WINCE 1 |
82 | #define HAVE_ECORE_EVAS_EWS 1 | 82 | #define HAVE_ECORE_EVAS_EWS 1 |
83 | #define HAVE_ECORE_EVAS_PSL1GHT 1 | 83 | #define HAVE_ECORE_EVAS_PSL1GHT 1 |
84 | #define HAVE_ECORE_EVAS_WAYLAND_SHM 1 | ||
85 | #define HAVE_ECORE_EVAS_WAYLAND_EGL 1 | ||
84 | 86 | ||
85 | typedef enum _Ecore_Evas_Engine_Type | 87 | typedef enum _Ecore_Evas_Engine_Type |
86 | { | 88 | { |
@@ -104,7 +106,9 @@ typedef enum _Ecore_Evas_Engine_Type | |||
104 | ECORE_EVAS_ENGINE_SOFTWARE_16_WINCE, | 106 | ECORE_EVAS_ENGINE_SOFTWARE_16_WINCE, |
105 | ECORE_EVAS_ENGINE_OPENGL_SDL, | 107 | ECORE_EVAS_ENGINE_OPENGL_SDL, |
106 | ECORE_EVAS_ENGINE_EWS, | 108 | ECORE_EVAS_ENGINE_EWS, |
107 | ECORE_EVAS_ENGINE_PSL1GHT | 109 | ECORE_EVAS_ENGINE_PSL1GHT, |
110 | ECORE_EVAS_ENGINE_WAYLAND_SHM, | ||
111 | ECORE_EVAS_ENGINE_WAYLAND_EGL | ||
108 | } Ecore_Evas_Engine_Type; | 112 | } Ecore_Evas_Engine_Type; |
109 | 113 | ||
110 | typedef enum _Ecore_Evas_Avoid_Damage_Type | 114 | typedef enum _Ecore_Evas_Avoid_Damage_Type |
@@ -689,6 +693,11 @@ EAPI Ecore_Evas *ecore_evas_fb_new(const char *disp_name, int rotation, int | |||
689 | EAPI Ecore_Evas *ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w, int h); | 693 | EAPI Ecore_Evas *ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w, int h); |
690 | EAPI Ecore_DirectFB_Window *ecore_evas_directfb_window_get(const Ecore_Evas *ee); | 694 | EAPI Ecore_DirectFB_Window *ecore_evas_directfb_window_get(const Ecore_Evas *ee); |
691 | 695 | ||
696 | EAPI Ecore_Evas *ecore_evas_wayland_shm_new(const char *disp_name, int x, int y, int w, int h, int frame); | ||
697 | EAPI Ecore_Evas *ecore_evas_wayland_egl_new(const char *disp_name, int x, int y, int w, int h, int frame); | ||
698 | EAPI void ecore_evas_wayland_resize(Ecore_Evas *ee, int location); | ||
699 | EAPI void ecore_evas_wayland_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source); | ||
700 | |||
692 | /** | 701 | /** |
693 | * @brief Create a new @c Ecore_Evas canvas bound to the Evas | 702 | * @brief Create a new @c Ecore_Evas canvas bound to the Evas |
694 | * @b buffer engine | 703 | * @b buffer engine |
@@ -818,7 +827,7 @@ EAPI void ecore_evas_ews_delete_request(Ecore_Evas *ee); | |||
818 | 827 | ||
819 | /** | 828 | /** |
820 | * @brief Create an Evas image object with image data <b>bound to an | 829 | * @brief Create an Evas image object with image data <b>bound to an |
821 | * own, internal @c Ecore_Evas canvas wrapper<b> | 830 | * own, internal @c Ecore_Evas canvas wrapper</b> |
822 | * | 831 | * |
823 | * @param ee_target @c Ecore_Evas to have the canvas receiving the new | 832 | * @param ee_target @c Ecore_Evas to have the canvas receiving the new |
824 | * image object | 833 | * image object |
@@ -1320,7 +1329,7 @@ EAPI void ecore_evas_size_base_get(const Ecore_Evas *ee, int *w, int *h); | |||
1320 | * @param h The step height | 1329 | * @param h The step height |
1321 | * | 1330 | * |
1322 | * This function sets the size steps of @p ee to be @p w x @p h. This | 1331 | * This function sets the size steps of @p ee to be @p w x @p h. This |
1323 | * limits the size of this @cEcore_Evas window to be @b always an | 1332 | * limits the size of this @c Ecore_Evas window to be @b always an |
1324 | * integer multiple of the step size, for each axis. | 1333 | * integer multiple of the step size, for each axis. |
1325 | */ | 1334 | */ |
1326 | EAPI void ecore_evas_size_step_set(Ecore_Evas *ee, int w, int h); | 1335 | EAPI void ecore_evas_size_step_set(Ecore_Evas *ee, int w, int h); |
@@ -1450,6 +1459,9 @@ EAPI Eina_Bool ecore_evas_comp_sync_get(const Ecore_Evas *ee); | |||
1450 | */ | 1459 | */ |
1451 | EAPI void ecore_evas_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h); | 1460 | EAPI void ecore_evas_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h); |
1452 | 1461 | ||
1462 | EAPI void ecore_evas_draw_frame_set(Ecore_Evas *ee, Eina_Bool draw_frame); | ||
1463 | EAPI Eina_Bool ecore_evas_draw_frame_get(const Ecore_Evas *ee); | ||
1464 | |||
1453 | /** | 1465 | /** |
1454 | * @brief Associate the given object to this ecore evas. | 1466 | * @brief Associate the given object to this ecore evas. |
1455 | * | 1467 | * |
@@ -1625,29 +1637,238 @@ EAPI void ecore_evas_ews_manager_set(const void *manager); | |||
1625 | */ | 1637 | */ |
1626 | EAPI const void *ecore_evas_ews_manager_get(void); | 1638 | EAPI const void *ecore_evas_ews_manager_get(void); |
1627 | 1639 | ||
1628 | EAPI extern int ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE; /**< manager was changed */ | 1640 | EAPI extern int ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE; /**< manager was changed @since 1.1 */ |
1629 | EAPI extern int ECORE_EVAS_EWS_EVENT_ADD; /**< window was created */ | 1641 | EAPI extern int ECORE_EVAS_EWS_EVENT_ADD; /**< window was created @since 1.1 */ |
1630 | EAPI extern int ECORE_EVAS_EWS_EVENT_DEL; /**< window was deleted, pointer is already invalid but may be used as reference for further cleanup work. */ | 1642 | EAPI extern int ECORE_EVAS_EWS_EVENT_DEL; /**< window was deleted, pointer is already invalid but may be used as reference for further cleanup work. @since 1.1 */ |
1631 | EAPI extern int ECORE_EVAS_EWS_EVENT_RESIZE; /**< window was resized */ | 1643 | EAPI extern int ECORE_EVAS_EWS_EVENT_RESIZE; /**< window was resized @since 1.1 */ |
1632 | EAPI extern int ECORE_EVAS_EWS_EVENT_MOVE; /**< window was moved */ | 1644 | EAPI extern int ECORE_EVAS_EWS_EVENT_MOVE; /**< window was moved @since 1.1 */ |
1633 | EAPI extern int ECORE_EVAS_EWS_EVENT_SHOW; /**< window become visible */ | 1645 | EAPI extern int ECORE_EVAS_EWS_EVENT_SHOW; /**< window become visible @since 1.1 */ |
1634 | EAPI extern int ECORE_EVAS_EWS_EVENT_HIDE; /**< window become hidden */ | 1646 | EAPI extern int ECORE_EVAS_EWS_EVENT_HIDE; /**< window become hidden @since 1.1 */ |
1635 | EAPI extern int ECORE_EVAS_EWS_EVENT_FOCUS; /**< window was focused */ | 1647 | EAPI extern int ECORE_EVAS_EWS_EVENT_FOCUS; /**< window was focused @since 1.1 */ |
1636 | EAPI extern int ECORE_EVAS_EWS_EVENT_UNFOCUS; /**< window lost focus */ | 1648 | EAPI extern int ECORE_EVAS_EWS_EVENT_UNFOCUS; /**< window lost focus @since 1.1 */ |
1637 | EAPI extern int ECORE_EVAS_EWS_EVENT_RAISE; /**< window was raised */ | 1649 | EAPI extern int ECORE_EVAS_EWS_EVENT_RAISE; /**< window was raised @since 1.1 */ |
1638 | EAPI extern int ECORE_EVAS_EWS_EVENT_LOWER; /**< window was lowered */ | 1650 | EAPI extern int ECORE_EVAS_EWS_EVENT_LOWER; /**< window was lowered @since 1.1 */ |
1639 | EAPI extern int ECORE_EVAS_EWS_EVENT_ACTIVATE; /**< window was activated */ | 1651 | EAPI extern int ECORE_EVAS_EWS_EVENT_ACTIVATE; /**< window was activated @since 1.1 */ |
1640 | 1652 | ||
1641 | EAPI extern int ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE; /**< window minimized/iconified changed */ | 1653 | EAPI extern int ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE; /**< window minimized/iconified changed @since 1.1 */ |
1642 | EAPI extern int ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE; /**< window maximized changed */ | 1654 | EAPI extern int ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE; /**< window maximized changed @since 1.1 */ |
1643 | EAPI extern int ECORE_EVAS_EWS_EVENT_LAYER_CHANGE; /**< window layer changed */ | 1655 | EAPI extern int ECORE_EVAS_EWS_EVENT_LAYER_CHANGE; /**< window layer changed @since 1.1 */ |
1644 | EAPI extern int ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE; /**< window fullscreen changed */ | 1656 | EAPI extern int ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE; /**< window fullscreen changed @since 1.1 */ |
1645 | EAPI extern int ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE; /**< some other window property changed (title, name, class, alpha, transparent, shaped...) */ | 1657 | EAPI extern int ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE; /**< some other window property changed (title, name, class, alpha, transparent, shaped...) @since 1.1 */ |
1646 | 1658 | ||
1647 | /** | 1659 | /** |
1648 | * @} | 1660 | * @} |
1649 | */ | 1661 | */ |
1650 | 1662 | ||
1663 | /** | ||
1664 | * @defgroup Ecore_Evas_Extn External plug/socket infrastructure to remote canvases | ||
1665 | * | ||
1666 | * These functions allow 1 process to create a "socket" was pluged into which another | ||
1667 | * process can create a "plug" remotely to plug into. | ||
1668 | * Socket can provides content for several plugs. | ||
1669 | * This is best for small sized objects (about the size range | ||
1670 | * of a small icon up to a few large icons). Sine the plug is actually an | ||
1671 | * image object, you can fetch the pixel data | ||
1672 | * | ||
1673 | * @since 1.2 | ||
1674 | * @{ | ||
1675 | */ | ||
1676 | |||
1677 | EAPI extern int ECORE_EVAS_EXTN_CLIENT_ADD; /**< this event is received when a plug has connected to an extn socket @since 1.2 */ | ||
1678 | EAPI extern int ECORE_EVAS_EXTN_CLIENT_DEL; /**< this event is received when a plug has disconnected from an extn socket @since 1.2 */ | ||
1679 | |||
1680 | /** | ||
1681 | * @brief Create a new Ecore_Evas canvas for the new external ecore evas socket | ||
1682 | * | ||
1683 | * @param w The width of the canvas, in pixels | ||
1684 | * @param h The height of the canvas, in pixels | ||
1685 | * @return A new @c Ecore_Evas instance or @c NULL, on failure | ||
1686 | * | ||
1687 | * This creates a new extn_socket canvas wrapper, with image data array | ||
1688 | * @b bound to the ARGB format, 8 bits per pixel. | ||
1689 | * | ||
1690 | * If creation is successful, an Ecore_Evas handle is returned or NULL if creation | ||
1691 | * fails. Also focus, show, hide etc. callbacks | ||
1692 | * will also be called if the plug object is shown, or already visible on | ||
1693 | * connect, or if it is hidden later, focused or unfocused. | ||
1694 | * | ||
1695 | * This function has to be flowed by ecore_evas_extn_socket_listen(), | ||
1696 | * for starting ecore ipc service. | ||
1697 | * | ||
1698 | * @code | ||
1699 | * Eina_Bool res = EINA_FALSE; | ||
1700 | * Ecore_Evas *ee = ecore_evas_extn_socket_new(1, 1); | ||
1701 | * | ||
1702 | * res = ecore_evas_extn_socket_listen("svcname", 1, EINA_FALSE); | ||
1703 | * if (!res) return; | ||
1704 | * ecore_evas_resize(ee, 240, 400); | ||
1705 | * @endcode | ||
1706 | * | ||
1707 | * or | ||
1708 | * | ||
1709 | * @code | ||
1710 | * Eina_Bool res = EINA_FALSE; | ||
1711 | * Ecore_Evas *ee = ecore_evas_extn_socket_new(240, 400); | ||
1712 | * | ||
1713 | * res = ecore_evas_extn_socket_listen("svcname", 1, EINA_FALSE); | ||
1714 | * if (!res) return; | ||
1715 | * @endcode | ||
1716 | * | ||
1717 | * When a client(plug) connects, you will get the ECORE_EVAS_EXTN_CLIENT_ADD event | ||
1718 | * in the ecore event queue, with event_info being the image object pointer | ||
1719 | * passed as a void pointer. When a client disconnects you will get the | ||
1720 | * ECORE_EVAS_EXTN_CLIENT_DEL event. | ||
1721 | * | ||
1722 | * You can set up event handles for these events as follows: | ||
1723 | * | ||
1724 | * @code | ||
1725 | * static void client_add_cb(void *data, int event, void *event_info) | ||
1726 | * { | ||
1727 | * Evas_Object *obj = event_info; | ||
1728 | * printf("client added to image object %p\n", obj); | ||
1729 | * evas_object_show(obj); | ||
1730 | * } | ||
1731 | * | ||
1732 | * static void client_del_cb(void *data, int event, void *event_info) | ||
1733 | * { | ||
1734 | * Evas_Object *obj = event_info; | ||
1735 | * printf("client deleted from image object %p\n", obj); | ||
1736 | * evas_object_hide(obj); | ||
1737 | * } | ||
1738 | * | ||
1739 | * void setup(void) | ||
1740 | * { | ||
1741 | * ecore_event_handler_add(ECORE_EVAS_EXTN_CLIENT_ADD, | ||
1742 | * client_add_cb, NULL); | ||
1743 | * ecore_event_handler_add(ECORE_EVAS_EXTN_CLIENT_DEL, | ||
1744 | * client_del_cb, NULL); | ||
1745 | * } | ||
1746 | * @endcode | ||
1747 | * | ||
1748 | * Note that events come in later after the event happened. You may want to be | ||
1749 | * careful as data structures you had associated with the image object | ||
1750 | * may have been freed after deleting, but the object may still be around | ||
1751 | * awating cleanup and thus still be valid.You can change the size with something like: | ||
1752 | * | ||
1753 | * @see ecore_evas_extn_socket_listen() | ||
1754 | * @see ecore_evas_extn_plug_new() | ||
1755 | * @see ecore_evas_extn_plug_object_data_lock() | ||
1756 | * @see ecore_evas_extn_plug_object_data_unlock() | ||
1757 | * | ||
1758 | * @since 1.2 | ||
1759 | */ | ||
1760 | EAPI Ecore_Evas *ecore_evas_extn_socket_new(int w, int h); | ||
1761 | |||
1762 | /** | ||
1763 | * @brief Create a socket to provide the service for external ecore evas socket. | ||
1764 | * | ||
1765 | * @param svcname The name of the service to be advertised. ensure that it is unique (when combined with @p svcnum) otherwise creation may fail. | ||
1766 | * @param svcnum A number (any value, 0 beig the common default) to differentiate multiple instances of services with the same name. | ||
1767 | * @param svcsys A boolean that if true, specifies to create a system-wide service all users can connect to, otherwise the service is private to the user ide that created the service. | ||
1768 | * @return EINA_TRUE if creation is successful, EINA_FALSE if it does not. | ||
1769 | * | ||
1770 | * This creates socket specified by @p svcname, @p svcnum and @p svcsys. If creation | ||
1771 | * is successful, EINA_TRUE is returned or EINA_FALSE if creation | ||
1772 | * fails. | ||
1773 | * | ||
1774 | * @see ecore_evas_extn_socket_new() | ||
1775 | * @see ecore_evas_extn_plug_new() | ||
1776 | * @see ecore_evas_extn_plug_object_data_lock() | ||
1777 | * @see ecore_evas_extn_plug_object_data_unlock() | ||
1778 | * | ||
1779 | * @since 1.2 | ||
1780 | */ | ||
1781 | EAPI Eina_Bool ecore_evas_extn_socket_listen(Ecore_Evas *ee, const char *svcname, int svcnum, Eina_Bool svcsys); | ||
1782 | |||
1783 | /** | ||
1784 | * @brief Lock the pixel data so the socket cannot change it | ||
1785 | * | ||
1786 | * @param obj The image object returned by ecore_evas_extn_plug_new() to lock | ||
1787 | * | ||
1788 | * You may need to get the image pixel data with evas_object_image_data_get() | ||
1789 | * from the image object, but need to ensure that it does not change while | ||
1790 | * you are using the data. This function lets you set an advisory lock on the | ||
1791 | * image data so the external plug process will not render to it or alter it. | ||
1792 | * | ||
1793 | * You should only hold the lock for just as long as you need to read out the | ||
1794 | * image data or otherwise deal with it, and then unlokc it with | ||
1795 | * ecore_evas_extn_plug_object_data_unlock(). Keeping a lock over more than | ||
1796 | * 1 iteration of the main ecore loop will be problematic, so avoid it. Also | ||
1797 | * forgetting to unlock may cause the socket process to freeze and thus create | ||
1798 | * odd behavior. | ||
1799 | * | ||
1800 | * @see ecore_evas_extn_plug_new() | ||
1801 | * @see ecore_evas_extn_plug_object_data_unlock() | ||
1802 | * | ||
1803 | * @since 1.2 | ||
1804 | */ | ||
1805 | EAPI void ecore_evas_extn_plug_object_data_lock(Evas_Object *obj); | ||
1806 | |||
1807 | /** | ||
1808 | * @brief Unlock the pixel data so the socket can change it again. | ||
1809 | * | ||
1810 | * @param obj The image object returned by ecore_evas_extn_plug_new() to unlock | ||
1811 | * | ||
1812 | * This unlocks after an advisor lock has been taken by | ||
1813 | * ecore_evas_extn_plug_object_data_lock(). | ||
1814 | * | ||
1815 | * @see ecore_evas_extn_plug_new() | ||
1816 | * @see ecore_evas_extn_plug_object_data_lock() | ||
1817 | * | ||
1818 | * @since 1.2 | ||
1819 | */ | ||
1820 | EAPI void ecore_evas_extn_plug_object_data_unlock(Evas_Object *obj); | ||
1821 | |||
1822 | /** | ||
1823 | * @brief Create a new external ecore evas plug | ||
1824 | * | ||
1825 | * @param ee_target The Ecore_Evas containing the canvas in which the new image object will live. | ||
1826 | * @return An evas image object that will contain the image output of a socket. | ||
1827 | * | ||
1828 | * This creates an image object that will contain the output of another | ||
1829 | * processes socket canvas when it connects. All input will be sent back to | ||
1830 | * this process as well, effectively swallowing or placing the socket process | ||
1831 | * in the canvas of the plug process in place of the image object. The image | ||
1832 | * object by default is created to be filled (equivalent of | ||
1833 | * evas_object_image_filled_add() on creation) so image content will scale | ||
1834 | * toi fill the image unless otherwise reconfigured. The Ecore_Evas size | ||
1835 | * of the plug is the master size and determines size in pixels of the | ||
1836 | * plug canvas. You can change the size with something like: | ||
1837 | * | ||
1838 | * @code | ||
1839 | * Eina_Bool res = EINA_FALSE; | ||
1840 | * Evas_Object *obj = ecore_evas_extn_plug_new(ee); | ||
1841 | * | ||
1842 | * res = ecore_evas_extn_plug_connect("svcname", 1, EINA_FALSE); | ||
1843 | * if (!res) return; | ||
1844 | * ecore_evas_resize(ee, 240, 400); | ||
1845 | * @endcode | ||
1846 | * | ||
1847 | * @see ecore_evas_extn_socket_new() | ||
1848 | * @see ecore_evas_extn_plug_connect() | ||
1849 | * @since 1.2 | ||
1850 | */ | ||
1851 | EAPI Evas_Object *ecore_evas_extn_plug_new(Ecore_Evas *ee_target); | ||
1852 | |||
1853 | /** | ||
1854 | * @brief Connect a external ecore evas plug to service provided by external ecore evas socket | ||
1855 | * | ||
1856 | * @param obj The Ecore_Evas containing the canvas in which the new image object will live. | ||
1857 | * @param svcname The service name to connect to set up by the socket. | ||
1858 | * @param svcnum The service number to connect to (set up by socket). | ||
1859 | * @param svcsys Booleain to set if the service is a system one or not (set up by socket). | ||
1860 | * @return EINA_TRUE if creation is successful, EINA_FALSE if it does not. | ||
1861 | * | ||
1862 | * | ||
1863 | * @see ecore_evas_extn_plug_new() | ||
1864 | * | ||
1865 | * @since 1.2 | ||
1866 | */ | ||
1867 | EAPI Eina_Bool ecore_evas_extn_plug_connect(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys); | ||
1868 | |||
1869 | /** | ||
1870 | * @} | ||
1871 | */ | ||
1651 | 1872 | ||
1652 | /** | 1873 | /** |
1653 | * @} | 1874 | * @} |
diff --git a/libraries/ecore/src/lib/ecore_evas/Makefile.am b/libraries/ecore/src/lib/ecore_evas/Makefile.am index fbb7190..a1d9215 100644 --- a/libraries/ecore/src/lib/ecore_evas/Makefile.am +++ b/libraries/ecore/src/lib/ecore_evas/Makefile.am | |||
@@ -1,8 +1,8 @@ | |||
1 | MAINTAINERCLEANFILES = Makefile.in | 1 | MAINTAINERCLEANFILES = Makefile.in |
2 | 2 | ||
3 | if BUILD_ECORE_X | 3 | if BUILD_ECORE_X |
4 | ECORE_X_INC = -I$(top_srcdir)/src/lib/ecore_x @x_cflags@ @ECORE_XCB_CFLAGS@ | 4 | ECORE_X_INC = -I$(top_srcdir)/src/lib/ecore_x @x_cflags@ |
5 | ECORE_X_LIB = $(top_builddir)/src/lib/ecore_x/libecore_x.la @x_libs@ @ECORE_XCB_LIBS@ | 5 | ECORE_X_LIB = $(top_builddir)/src/lib/ecore_x/libecore_x.la @x_libs@ |
6 | else | 6 | else |
7 | ECORE_X_INC = | 7 | ECORE_X_INC = |
8 | ECORE_X_LIB = | 8 | ECORE_X_LIB = |
@@ -66,6 +66,24 @@ ECORE_PSL1GHT_INC = | |||
66 | ECORE_PSL1GHT_LIB = | 66 | ECORE_PSL1GHT_LIB = |
67 | endif | 67 | endif |
68 | 68 | ||
69 | if BUILD_ECORE_WAYLAND | ||
70 | ECORE_WAYLAND_INC = -I$(top_srcdir)/src/lib/ecore_wayland @WAYLAND_CFLAGS@ | ||
71 | ECORE_WAYLAND_LIB = $(top_builddir)/src/lib/ecore_wayland/libecore_wayland.la | ||
72 | ECORE_WAYLAND_LIBADD = @WAYLAND_LIBS@ $(ECORE_WAYLAND_LIB) | ||
73 | else | ||
74 | ECORE_WAYLAND_INC = | ||
75 | ECORE_WAYLAND_LIB = | ||
76 | ECORE_WAYLAND_LIBADD = | ||
77 | endif | ||
78 | |||
79 | if BUILD_ECORE_IPC | ||
80 | ECORE_IPC_INC= \ | ||
81 | -I$(top_srcdir)/src/lib/ecore_ipc \ | ||
82 | -I$(top_builddir)/src/lib/ecore_ipc | ||
83 | |||
84 | ECORE_IPC_LIB=$(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la | ||
85 | endif | ||
86 | |||
69 | AM_CPPFLAGS = \ | 87 | AM_CPPFLAGS = \ |
70 | -I$(top_srcdir)/src/lib/ecore \ | 88 | -I$(top_srcdir)/src/lib/ecore \ |
71 | -I$(top_srcdir)/src/lib/ecore_evas \ | 89 | -I$(top_srcdir)/src/lib/ecore_evas \ |
@@ -84,9 +102,12 @@ $(ECORE_SDL_INC) \ | |||
84 | $(ECORE_COCOA_INC) \ | 102 | $(ECORE_COCOA_INC) \ |
85 | $(ECORE_WINCE_INC) \ | 103 | $(ECORE_WINCE_INC) \ |
86 | $(ECORE_PSL1GHT_INC) \ | 104 | $(ECORE_PSL1GHT_INC) \ |
105 | $(ECORE_WAYLAND_INC) \ | ||
106 | $(ECORE_IPC_INC) \ | ||
87 | @EVAS_CFLAGS@ \ | 107 | @EVAS_CFLAGS@ \ |
88 | @EINA_CFLAGS@ \ | 108 | @EINA_CFLAGS@ \ |
89 | @EVIL_CFLAGS@ | 109 | @EVIL_CFLAGS@ \ |
110 | @WAYLAND_EGL_CFLAGS@ | ||
90 | 111 | ||
91 | AM_CFLAGS = @WIN32_CFLAGS@ | 112 | AM_CFLAGS = @WIN32_CFLAGS@ |
92 | 113 | ||
@@ -106,7 +127,10 @@ ecore_evas_sdl.c \ | |||
106 | ecore_evas_cocoa.c \ | 127 | ecore_evas_cocoa.c \ |
107 | ecore_evas_wince.c \ | 128 | ecore_evas_wince.c \ |
108 | ecore_evas_ews.c \ | 129 | ecore_evas_ews.c \ |
109 | ecore_evas_psl1ght.c | 130 | ecore_evas_psl1ght.c \ |
131 | ecore_evas_wayland_shm.c \ | ||
132 | ecore_evas_wayland_egl.c \ | ||
133 | ecore_evas_extn.c | ||
110 | 134 | ||
111 | libecore_evas_la_LIBADD = \ | 135 | libecore_evas_la_LIBADD = \ |
112 | $(ECORE_X_LIB) \ | 136 | $(ECORE_X_LIB) \ |
@@ -117,13 +141,17 @@ $(ECORE_SDL_LIB) \ | |||
117 | $(ECORE_SDL_LIBADD) \ | 141 | $(ECORE_SDL_LIBADD) \ |
118 | $(ECORE_COCOA_LIB) \ | 142 | $(ECORE_COCOA_LIB) \ |
119 | $(ECORE_WINCE_LIB) \ | 143 | $(ECORE_WINCE_LIB) \ |
144 | $(ECORE_IPC_LIB) \ | ||
120 | $(ECORE_PSL1GHT_LIB) \ | 145 | $(ECORE_PSL1GHT_LIB) \ |
146 | $(ECORE_WAYLAND_LIB) \ | ||
147 | $(ECORE_WAYLAND_LIBADD) \ | ||
121 | $(top_builddir)/src/lib/ecore_input/libecore_input.la \ | 148 | $(top_builddir)/src/lib/ecore_input/libecore_input.la \ |
122 | $(top_builddir)/src/lib/ecore_input_evas/libecore_input_evas.la \ | 149 | $(top_builddir)/src/lib/ecore_input_evas/libecore_input_evas.la \ |
123 | $(top_builddir)/src/lib/ecore/libecore.la \ | 150 | $(top_builddir)/src/lib/ecore/libecore.la \ |
124 | @EVAS_LIBS@ \ | 151 | @EVAS_LIBS@ \ |
125 | @EINA_LIBS@ \ | 152 | @EINA_LIBS@ \ |
126 | @EVIL_LIBS@ | 153 | @EVIL_LIBS@ \ |
154 | @WAYLAND_EGL_LIBS@ | ||
127 | 155 | ||
128 | libecore_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ | 156 | libecore_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ |
129 | 157 | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/Makefile.in b/libraries/ecore/src/lib/ecore_evas/Makefile.in index 793e59d..a269b75 100644 --- a/libraries/ecore/src/lib/ecore_evas/Makefile.in +++ b/libraries/ecore/src/lib/ecore_evas/Makefile.in | |||
@@ -95,11 +95,15 @@ LTLIBRARIES = $(lib_LTLIBRARIES) | |||
95 | @BUILD_ECORE_COCOA_TRUE@am__DEPENDENCIES_7 = $(top_builddir)/src/lib/ecore_cocoa/libecore_cocoa.la | 95 | @BUILD_ECORE_COCOA_TRUE@am__DEPENDENCIES_7 = $(top_builddir)/src/lib/ecore_cocoa/libecore_cocoa.la |
96 | @BUILD_ECORE_WINCE_TRUE@am__DEPENDENCIES_8 = $(top_builddir)/src/lib/ecore_wince/libecore_wince.la | 96 | @BUILD_ECORE_WINCE_TRUE@am__DEPENDENCIES_8 = $(top_builddir)/src/lib/ecore_wince/libecore_wince.la |
97 | @BUILD_ECORE_PSL1GHT_TRUE@am__DEPENDENCIES_9 = $(top_builddir)/src/lib/ecore_psl1ght/libecore_psl1ght.la | 97 | @BUILD_ECORE_PSL1GHT_TRUE@am__DEPENDENCIES_9 = $(top_builddir)/src/lib/ecore_psl1ght/libecore_psl1ght.la |
98 | @BUILD_ECORE_WAYLAND_TRUE@am__DEPENDENCIES_10 = $(top_builddir)/src/lib/ecore_wayland/libecore_wayland.la | ||
99 | @BUILD_ECORE_WAYLAND_TRUE@am__DEPENDENCIES_11 = \ | ||
100 | @BUILD_ECORE_WAYLAND_TRUE@ $(am__DEPENDENCIES_10) | ||
98 | libecore_evas_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ | 101 | libecore_evas_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ |
99 | $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ | 102 | $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ |
100 | $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_5) \ | 103 | $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_5) \ |
101 | $(am__DEPENDENCIES_6) $(am__DEPENDENCIES_7) \ | 104 | $(am__DEPENDENCIES_6) $(am__DEPENDENCIES_7) \ |
102 | $(am__DEPENDENCIES_8) $(am__DEPENDENCIES_9) \ | 105 | $(am__DEPENDENCIES_8) $(ECORE_IPC_LIB) $(am__DEPENDENCIES_9) \ |
106 | $(am__DEPENDENCIES_10) $(am__DEPENDENCIES_11) \ | ||
103 | $(top_builddir)/src/lib/ecore_input/libecore_input.la \ | 107 | $(top_builddir)/src/lib/ecore_input/libecore_input.la \ |
104 | $(top_builddir)/src/lib/ecore_input_evas/libecore_input_evas.la \ | 108 | $(top_builddir)/src/lib/ecore_input_evas/libecore_input_evas.la \ |
105 | $(top_builddir)/src/lib/ecore/libecore.la | 109 | $(top_builddir)/src/lib/ecore/libecore.la |
@@ -107,7 +111,8 @@ am_libecore_evas_la_OBJECTS = ecore_evas.lo ecore_evas_util.lo \ | |||
107 | ecore_evas_x.lo ecore_evas_fb.lo ecore_evas_buffer.lo \ | 111 | ecore_evas_x.lo ecore_evas_fb.lo ecore_evas_buffer.lo \ |
108 | ecore_evas_directfb.lo ecore_evas_win32.lo ecore_evas_sdl.lo \ | 112 | ecore_evas_directfb.lo ecore_evas_win32.lo ecore_evas_sdl.lo \ |
109 | ecore_evas_cocoa.lo ecore_evas_wince.lo ecore_evas_ews.lo \ | 113 | ecore_evas_cocoa.lo ecore_evas_wince.lo ecore_evas_ews.lo \ |
110 | ecore_evas_psl1ght.lo | 114 | ecore_evas_psl1ght.lo ecore_evas_wayland_shm.lo \ |
115 | ecore_evas_wayland_egl.lo ecore_evas_extn.lo | ||
111 | libecore_evas_la_OBJECTS = $(am_libecore_evas_la_OBJECTS) | 116 | libecore_evas_la_OBJECTS = $(am_libecore_evas_la_OBJECTS) |
112 | AM_V_lt = $(am__v_lt_$(V)) | 117 | AM_V_lt = $(am__v_lt_$(V)) |
113 | am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) | 118 | am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) |
@@ -266,10 +271,10 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ | |||
266 | PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ | 271 | PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ |
267 | PIXMAN_LIBS = @PIXMAN_LIBS@ | 272 | PIXMAN_LIBS = @PIXMAN_LIBS@ |
268 | PKG_CONFIG = @PKG_CONFIG@ | 273 | PKG_CONFIG = @PKG_CONFIG@ |
269 | PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ | ||
270 | PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ | ||
271 | POSUB = @POSUB@ | 274 | POSUB = @POSUB@ |
272 | RANLIB = @RANLIB@ | 275 | RANLIB = @RANLIB@ |
276 | SCIM_CFLAGS = @SCIM_CFLAGS@ | ||
277 | SCIM_LIBS = @SCIM_LIBS@ | ||
273 | SDL_CFLAGS = @SDL_CFLAGS@ | 278 | SDL_CFLAGS = @SDL_CFLAGS@ |
274 | SDL_CONFIG = @SDL_CONFIG@ | 279 | SDL_CONFIG = @SDL_CONFIG@ |
275 | SDL_LIBS = @SDL_LIBS@ | 280 | SDL_LIBS = @SDL_LIBS@ |
@@ -288,6 +293,10 @@ TSLIB_LIBS = @TSLIB_LIBS@ | |||
288 | USE_NLS = @USE_NLS@ | 293 | USE_NLS = @USE_NLS@ |
289 | VERSION = @VERSION@ | 294 | VERSION = @VERSION@ |
290 | VMAJ = @VMAJ@ | 295 | VMAJ = @VMAJ@ |
296 | WAYLAND_CFLAGS = @WAYLAND_CFLAGS@ | ||
297 | WAYLAND_EGL_CFLAGS = @WAYLAND_EGL_CFLAGS@ | ||
298 | WAYLAND_EGL_LIBS = @WAYLAND_EGL_LIBS@ | ||
299 | WAYLAND_LIBS = @WAYLAND_LIBS@ | ||
291 | WIN32_CFLAGS = @WIN32_CFLAGS@ | 300 | WIN32_CFLAGS = @WIN32_CFLAGS@ |
292 | WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ | 301 | WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ |
293 | WIN32_LIBS = @WIN32_LIBS@ | 302 | WIN32_LIBS = @WIN32_LIBS@ |
@@ -401,6 +410,8 @@ ecore_imf_cflags = @ecore_imf_cflags@ | |||
401 | ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ | 410 | ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ |
402 | ecore_imf_evas_libs = @ecore_imf_evas_libs@ | 411 | ecore_imf_evas_libs = @ecore_imf_evas_libs@ |
403 | ecore_imf_libs = @ecore_imf_libs@ | 412 | ecore_imf_libs = @ecore_imf_libs@ |
413 | ecore_imf_scim_cflags = @ecore_imf_scim_cflags@ | ||
414 | ecore_imf_scim_libs = @ecore_imf_scim_libs@ | ||
404 | ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ | 415 | ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ |
405 | ecore_imf_xim_libs = @ecore_imf_xim_libs@ | 416 | ecore_imf_xim_libs = @ecore_imf_xim_libs@ |
406 | ecore_input_cflags = @ecore_input_cflags@ | 417 | ecore_input_cflags = @ecore_input_cflags@ |
@@ -413,6 +424,8 @@ ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ | |||
413 | ecore_psl1ght_libs = @ecore_psl1ght_libs@ | 424 | ecore_psl1ght_libs = @ecore_psl1ght_libs@ |
414 | ecore_sdl_cflags = @ecore_sdl_cflags@ | 425 | ecore_sdl_cflags = @ecore_sdl_cflags@ |
415 | ecore_sdl_libs = @ecore_sdl_libs@ | 426 | ecore_sdl_libs = @ecore_sdl_libs@ |
427 | ecore_wayland_cflags = @ecore_wayland_cflags@ | ||
428 | ecore_wayland_libs = @ecore_wayland_libs@ | ||
416 | ecore_win32_cflags = @ecore_win32_cflags@ | 429 | ecore_win32_cflags = @ecore_win32_cflags@ |
417 | ecore_win32_libs = @ecore_win32_libs@ | 430 | ecore_win32_libs = @ecore_win32_libs@ |
418 | ecore_wince_cflags = @ecore_wince_cflags@ | 431 | ecore_wince_cflags = @ecore_wince_cflags@ |
@@ -457,12 +470,14 @@ requirements_ecore_fb = @requirements_ecore_fb@ | |||
457 | requirements_ecore_file = @requirements_ecore_file@ | 470 | requirements_ecore_file = @requirements_ecore_file@ |
458 | requirements_ecore_imf = @requirements_ecore_imf@ | 471 | requirements_ecore_imf = @requirements_ecore_imf@ |
459 | requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ | 472 | requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ |
473 | requirements_ecore_imf_scim = @requirements_ecore_imf_scim@ | ||
460 | requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ | 474 | requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ |
461 | requirements_ecore_input = @requirements_ecore_input@ | 475 | requirements_ecore_input = @requirements_ecore_input@ |
462 | requirements_ecore_input_evas = @requirements_ecore_input_evas@ | 476 | requirements_ecore_input_evas = @requirements_ecore_input_evas@ |
463 | requirements_ecore_ipc = @requirements_ecore_ipc@ | 477 | requirements_ecore_ipc = @requirements_ecore_ipc@ |
464 | requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ | 478 | requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ |
465 | requirements_ecore_sdl = @requirements_ecore_sdl@ | 479 | requirements_ecore_sdl = @requirements_ecore_sdl@ |
480 | requirements_ecore_wayland = @requirements_ecore_wayland@ | ||
466 | requirements_ecore_win32 = @requirements_ecore_win32@ | 481 | requirements_ecore_win32 = @requirements_ecore_win32@ |
467 | requirements_ecore_wince = @requirements_ecore_wince@ | 482 | requirements_ecore_wince = @requirements_ecore_wince@ |
468 | requirements_ecore_x = @requirements_ecore_x@ | 483 | requirements_ecore_x = @requirements_ecore_x@ |
@@ -481,9 +496,9 @@ x_includes = @x_includes@ | |||
481 | x_libs = @x_libs@ | 496 | x_libs = @x_libs@ |
482 | MAINTAINERCLEANFILES = Makefile.in | 497 | MAINTAINERCLEANFILES = Makefile.in |
483 | @BUILD_ECORE_X_FALSE@ECORE_X_INC = | 498 | @BUILD_ECORE_X_FALSE@ECORE_X_INC = |
484 | @BUILD_ECORE_X_TRUE@ECORE_X_INC = -I$(top_srcdir)/src/lib/ecore_x @x_cflags@ @ECORE_XCB_CFLAGS@ | 499 | @BUILD_ECORE_X_TRUE@ECORE_X_INC = -I$(top_srcdir)/src/lib/ecore_x @x_cflags@ |
485 | @BUILD_ECORE_X_FALSE@ECORE_X_LIB = | 500 | @BUILD_ECORE_X_FALSE@ECORE_X_LIB = |
486 | @BUILD_ECORE_X_TRUE@ECORE_X_LIB = $(top_builddir)/src/lib/ecore_x/libecore_x.la @x_libs@ @ECORE_XCB_LIBS@ | 501 | @BUILD_ECORE_X_TRUE@ECORE_X_LIB = $(top_builddir)/src/lib/ecore_x/libecore_x.la @x_libs@ |
487 | @BUILD_ECORE_FB_FALSE@ECORE_FB_INC = | 502 | @BUILD_ECORE_FB_FALSE@ECORE_FB_INC = |
488 | @BUILD_ECORE_FB_TRUE@ECORE_FB_INC = -I$(top_srcdir)/src/lib/ecore_fb | 503 | @BUILD_ECORE_FB_TRUE@ECORE_FB_INC = -I$(top_srcdir)/src/lib/ecore_fb |
489 | @BUILD_ECORE_FB_FALSE@ECORE_FB_LIB = | 504 | @BUILD_ECORE_FB_FALSE@ECORE_FB_LIB = |
@@ -514,6 +529,17 @@ MAINTAINERCLEANFILES = Makefile.in | |||
514 | @BUILD_ECORE_PSL1GHT_TRUE@ECORE_PSL1GHT_INC = -I$(top_srcdir)/src/lib/ecore_psl1ght | 529 | @BUILD_ECORE_PSL1GHT_TRUE@ECORE_PSL1GHT_INC = -I$(top_srcdir)/src/lib/ecore_psl1ght |
515 | @BUILD_ECORE_PSL1GHT_FALSE@ECORE_PSL1GHT_LIB = | 530 | @BUILD_ECORE_PSL1GHT_FALSE@ECORE_PSL1GHT_LIB = |
516 | @BUILD_ECORE_PSL1GHT_TRUE@ECORE_PSL1GHT_LIB = $(top_builddir)/src/lib/ecore_psl1ght/libecore_psl1ght.la | 531 | @BUILD_ECORE_PSL1GHT_TRUE@ECORE_PSL1GHT_LIB = $(top_builddir)/src/lib/ecore_psl1ght/libecore_psl1ght.la |
532 | @BUILD_ECORE_WAYLAND_FALSE@ECORE_WAYLAND_INC = | ||
533 | @BUILD_ECORE_WAYLAND_TRUE@ECORE_WAYLAND_INC = -I$(top_srcdir)/src/lib/ecore_wayland @WAYLAND_CFLAGS@ | ||
534 | @BUILD_ECORE_WAYLAND_FALSE@ECORE_WAYLAND_LIB = | ||
535 | @BUILD_ECORE_WAYLAND_TRUE@ECORE_WAYLAND_LIB = $(top_builddir)/src/lib/ecore_wayland/libecore_wayland.la | ||
536 | @BUILD_ECORE_WAYLAND_FALSE@ECORE_WAYLAND_LIBADD = | ||
537 | @BUILD_ECORE_WAYLAND_TRUE@ECORE_WAYLAND_LIBADD = @WAYLAND_LIBS@ $(ECORE_WAYLAND_LIB) | ||
538 | @BUILD_ECORE_IPC_TRUE@ECORE_IPC_INC = \ | ||
539 | @BUILD_ECORE_IPC_TRUE@-I$(top_srcdir)/src/lib/ecore_ipc \ | ||
540 | @BUILD_ECORE_IPC_TRUE@-I$(top_builddir)/src/lib/ecore_ipc | ||
541 | |||
542 | @BUILD_ECORE_IPC_TRUE@ECORE_IPC_LIB = $(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la | ||
517 | AM_CPPFLAGS = \ | 543 | AM_CPPFLAGS = \ |
518 | -I$(top_srcdir)/src/lib/ecore \ | 544 | -I$(top_srcdir)/src/lib/ecore \ |
519 | -I$(top_srcdir)/src/lib/ecore_evas \ | 545 | -I$(top_srcdir)/src/lib/ecore_evas \ |
@@ -532,9 +558,12 @@ $(ECORE_SDL_INC) \ | |||
532 | $(ECORE_COCOA_INC) \ | 558 | $(ECORE_COCOA_INC) \ |
533 | $(ECORE_WINCE_INC) \ | 559 | $(ECORE_WINCE_INC) \ |
534 | $(ECORE_PSL1GHT_INC) \ | 560 | $(ECORE_PSL1GHT_INC) \ |
561 | $(ECORE_WAYLAND_INC) \ | ||
562 | $(ECORE_IPC_INC) \ | ||
535 | @EVAS_CFLAGS@ \ | 563 | @EVAS_CFLAGS@ \ |
536 | @EINA_CFLAGS@ \ | 564 | @EINA_CFLAGS@ \ |
537 | @EVIL_CFLAGS@ | 565 | @EVIL_CFLAGS@ \ |
566 | @WAYLAND_EGL_CFLAGS@ | ||
538 | 567 | ||
539 | AM_CFLAGS = @WIN32_CFLAGS@ | 568 | AM_CFLAGS = @WIN32_CFLAGS@ |
540 | lib_LTLIBRARIES = libecore_evas.la | 569 | lib_LTLIBRARIES = libecore_evas.la |
@@ -552,7 +581,10 @@ ecore_evas_sdl.c \ | |||
552 | ecore_evas_cocoa.c \ | 581 | ecore_evas_cocoa.c \ |
553 | ecore_evas_wince.c \ | 582 | ecore_evas_wince.c \ |
554 | ecore_evas_ews.c \ | 583 | ecore_evas_ews.c \ |
555 | ecore_evas_psl1ght.c | 584 | ecore_evas_psl1ght.c \ |
585 | ecore_evas_wayland_shm.c \ | ||
586 | ecore_evas_wayland_egl.c \ | ||
587 | ecore_evas_extn.c | ||
556 | 588 | ||
557 | libecore_evas_la_LIBADD = \ | 589 | libecore_evas_la_LIBADD = \ |
558 | $(ECORE_X_LIB) \ | 590 | $(ECORE_X_LIB) \ |
@@ -563,13 +595,17 @@ $(ECORE_SDL_LIB) \ | |||
563 | $(ECORE_SDL_LIBADD) \ | 595 | $(ECORE_SDL_LIBADD) \ |
564 | $(ECORE_COCOA_LIB) \ | 596 | $(ECORE_COCOA_LIB) \ |
565 | $(ECORE_WINCE_LIB) \ | 597 | $(ECORE_WINCE_LIB) \ |
598 | $(ECORE_IPC_LIB) \ | ||
566 | $(ECORE_PSL1GHT_LIB) \ | 599 | $(ECORE_PSL1GHT_LIB) \ |
600 | $(ECORE_WAYLAND_LIB) \ | ||
601 | $(ECORE_WAYLAND_LIBADD) \ | ||
567 | $(top_builddir)/src/lib/ecore_input/libecore_input.la \ | 602 | $(top_builddir)/src/lib/ecore_input/libecore_input.la \ |
568 | $(top_builddir)/src/lib/ecore_input_evas/libecore_input_evas.la \ | 603 | $(top_builddir)/src/lib/ecore_input_evas/libecore_input_evas.la \ |
569 | $(top_builddir)/src/lib/ecore/libecore.la \ | 604 | $(top_builddir)/src/lib/ecore/libecore.la \ |
570 | @EVAS_LIBS@ \ | 605 | @EVAS_LIBS@ \ |
571 | @EINA_LIBS@ \ | 606 | @EINA_LIBS@ \ |
572 | @EVIL_LIBS@ | 607 | @EVIL_LIBS@ \ |
608 | @WAYLAND_EGL_LIBS@ | ||
573 | 609 | ||
574 | libecore_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ | 610 | libecore_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ |
575 | EXTRA_DIST = \ | 611 | EXTRA_DIST = \ |
@@ -654,10 +690,13 @@ distclean-compile: | |||
654 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_cocoa.Plo@am__quote@ | 690 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_cocoa.Plo@am__quote@ |
655 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_directfb.Plo@am__quote@ | 691 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_directfb.Plo@am__quote@ |
656 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_ews.Plo@am__quote@ | 692 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_ews.Plo@am__quote@ |
693 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_extn.Plo@am__quote@ | ||
657 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_fb.Plo@am__quote@ | 694 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_fb.Plo@am__quote@ |
658 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_psl1ght.Plo@am__quote@ | 695 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_psl1ght.Plo@am__quote@ |
659 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_sdl.Plo@am__quote@ | 696 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_sdl.Plo@am__quote@ |
660 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_util.Plo@am__quote@ | 697 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_util.Plo@am__quote@ |
698 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_wayland_egl.Plo@am__quote@ | ||
699 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_wayland_shm.Plo@am__quote@ | ||
661 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_win32.Plo@am__quote@ | 700 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_win32.Plo@am__quote@ |
662 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_wince.Plo@am__quote@ | 701 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_wince.Plo@am__quote@ |
663 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_x.Plo@am__quote@ | 702 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_x.Plo@am__quote@ |
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas.c index dc42f92..2b04488 100644 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas.c +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas.c | |||
@@ -2,14 +2,21 @@ | |||
2 | # include <config.h> | 2 | # include <config.h> |
3 | #endif | 3 | #endif |
4 | 4 | ||
5 | #include <stdlib.h> | ||
5 | #include <string.h> | 6 | #include <string.h> |
6 | #include <sys/types.h> | 7 | #include <sys/types.h> |
7 | #include <errno.h> | 8 | #include <errno.h> |
9 | #include <sys/stat.h> | ||
10 | #include <fcntl.h> | ||
8 | 11 | ||
9 | #ifndef _MSC_VER | 12 | #ifndef _MSC_VER |
10 | # include <unistd.h> | 13 | # include <unistd.h> |
11 | #endif | 14 | #endif |
12 | 15 | ||
16 | #ifdef HAVE_SYS_MMAN_H | ||
17 | # include <sys/mman.h> | ||
18 | #endif | ||
19 | |||
13 | #ifdef HAVE_EVIL | 20 | #ifdef HAVE_EVIL |
14 | # include <Evil.h> | 21 | # include <Evil.h> |
15 | #endif | 22 | #endif |
@@ -194,6 +201,18 @@ ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine) | |||
194 | #else | 201 | #else |
195 | return EINA_FALSE; | 202 | return EINA_FALSE; |
196 | #endif | 203 | #endif |
204 | case ECORE_EVAS_ENGINE_WAYLAND_SHM: | ||
205 | #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM | ||
206 | return EINA_TRUE; | ||
207 | #else | ||
208 | return EINA_FALSE; | ||
209 | #endif | ||
210 | case ECORE_EVAS_ENGINE_WAYLAND_EGL: | ||
211 | #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL | ||
212 | return EINA_TRUE; | ||
213 | #else | ||
214 | return EINA_FALSE; | ||
215 | #endif | ||
197 | default: | 216 | default: |
198 | return EINA_FALSE; | 217 | return EINA_FALSE; |
199 | }; | 218 | }; |
@@ -237,6 +256,8 @@ ecore_evas_init(void) | |||
237 | _ecore_evas_ews_events_init(); | 256 | _ecore_evas_ews_events_init(); |
238 | #endif | 257 | #endif |
239 | 258 | ||
259 | _ecore_evas_extn_init(); | ||
260 | |||
240 | if (getenv("ECORE_EVAS_COMP_NOSYNC")) | 261 | if (getenv("ECORE_EVAS_COMP_NOSYNC")) |
241 | _ecore_evas_app_comp_sync = 0; | 262 | _ecore_evas_app_comp_sync = 0; |
242 | return _ecore_evas_init_count; | 263 | return _ecore_evas_init_count; |
@@ -257,6 +278,8 @@ ecore_evas_shutdown(void) | |||
257 | 278 | ||
258 | while (ecore_evases) _ecore_evas_free(ecore_evases); | 279 | while (ecore_evases) _ecore_evas_free(ecore_evases); |
259 | 280 | ||
281 | _ecore_evas_extn_shutdown(); | ||
282 | |||
260 | if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown(); | 283 | if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown(); |
261 | ecore_idle_enterer_del(ecore_evas_idle_enterer); | 284 | ecore_idle_enterer_del(ecore_evas_idle_enterer); |
262 | ecore_evas_idle_enterer = NULL; | 285 | ecore_evas_idle_enterer = NULL; |
@@ -282,6 +305,7 @@ ecore_evas_shutdown(void) | |||
282 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE | 305 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE |
283 | while (_ecore_evas_wince_shutdown()); | 306 | while (_ecore_evas_wince_shutdown()); |
284 | #endif | 307 | #endif |
308 | |||
285 | if (_ecore_evas_async_events_fd) | 309 | if (_ecore_evas_async_events_fd) |
286 | ecore_main_fd_handler_del(_ecore_evas_async_events_fd); | 310 | ecore_main_fd_handler_del(_ecore_evas_async_events_fd); |
287 | 311 | ||
@@ -577,6 +601,40 @@ _ecore_evas_constructor_psl1ght(int x __UNUSED__, int y __UNUSED__, int w, int h | |||
577 | } | 601 | } |
578 | #endif | 602 | #endif |
579 | 603 | ||
604 | #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM | ||
605 | static Ecore_Evas * | ||
606 | _ecore_evas_constructor_wayland_shm(int x, int y, int w, int h, const char *extra_options) | ||
607 | { | ||
608 | char *disp_name = NULL; | ||
609 | unsigned int frame = 0; | ||
610 | Ecore_Evas *ee; | ||
611 | |||
612 | _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name); | ||
613 | _ecore_evas_parse_extra_options_uint(extra_options, "frame=", &frame); | ||
614 | ee = ecore_evas_wayland_shm_new(disp_name, x, y, w, h, frame); | ||
615 | free(disp_name); | ||
616 | |||
617 | return ee; | ||
618 | } | ||
619 | #endif | ||
620 | |||
621 | #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL | ||
622 | static Ecore_Evas * | ||
623 | _ecore_evas_constructor_wayland_egl(int x, int y, int w, int h, const char *extra_options) | ||
624 | { | ||
625 | char *disp_name = NULL; | ||
626 | unsigned int frame = 0; | ||
627 | Ecore_Evas *ee; | ||
628 | |||
629 | _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name); | ||
630 | _ecore_evas_parse_extra_options_uint(extra_options, "frame=", &frame); | ||
631 | ee = ecore_evas_wayland_egl_new(disp_name, x, y, w, h, frame); | ||
632 | free(disp_name); | ||
633 | |||
634 | return ee; | ||
635 | } | ||
636 | #endif | ||
637 | |||
580 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI | 638 | #ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI |
581 | static Ecore_Evas * | 639 | static Ecore_Evas * |
582 | _ecore_evas_constructor_software_gdi(int x, int y, int w, int h, const char *extra_options) | 640 | _ecore_evas_constructor_software_gdi(int x, int y, int w, int h, const char *extra_options) |
@@ -714,7 +772,16 @@ static const struct ecore_evas_engine _engines[] = { | |||
714 | {"psl1ght", _ecore_evas_constructor_psl1ght}, | 772 | {"psl1ght", _ecore_evas_constructor_psl1ght}, |
715 | #endif | 773 | #endif |
716 | 774 | ||
717 | /* Last chance to have a window */ | 775 | /* Wayland */ |
776 | #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM | ||
777 | {"wayland_shm", _ecore_evas_constructor_wayland_shm}, | ||
778 | #endif | ||
779 | |||
780 | #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL | ||
781 | {"wayland_egl", _ecore_evas_constructor_wayland_egl}, | ||
782 | #endif | ||
783 | |||
784 | /* Last chance to have a window */ | ||
718 | #ifdef BUILD_ECORE_EVAS_OPENGL_SDL | 785 | #ifdef BUILD_ECORE_EVAS_OPENGL_SDL |
719 | {"opengl_sdl", _ecore_evas_constructor_opengl_sdl}, | 786 | {"opengl_sdl", _ecore_evas_constructor_opengl_sdl}, |
720 | #endif | 787 | #endif |
@@ -1938,7 +2005,7 @@ ecore_evas_fullscreen_get(const Ecore_Evas *ee) | |||
1938 | * Set whether or not an Ecore_Evas' window should avoid damage | 2005 | * Set whether or not an Ecore_Evas' window should avoid damage |
1939 | * | 2006 | * |
1940 | * @param ee The Ecore_Evas | 2007 | * @param ee The Ecore_Evas |
1941 | * @param The type of the damage management | 2008 | * @param on The type of the damage management |
1942 | * | 2009 | * |
1943 | * This function causes @p ee to be drawn to a pixmap to avoid recalculations. | 2010 | * This function causes @p ee to be drawn to a pixmap to avoid recalculations. |
1944 | * On expose events it will copy from the pixmap to the window. | 2011 | * On expose events it will copy from the pixmap to the window. |
@@ -2008,8 +2075,8 @@ ecore_evas_withdrawn_get(const Ecore_Evas *ee) | |||
2008 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | 2075 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, |
2009 | "ecore_evas_withdrawn_get"); | 2076 | "ecore_evas_withdrawn_get"); |
2010 | return EINA_FALSE; | 2077 | return EINA_FALSE; |
2011 | } else | 2078 | } |
2012 | return ee->prop.withdrawn ? EINA_TRUE : EINA_FALSE; | 2079 | return ee->prop.withdrawn ? EINA_TRUE : EINA_FALSE; |
2013 | } | 2080 | } |
2014 | 2081 | ||
2015 | /** | 2082 | /** |
@@ -2048,8 +2115,8 @@ ecore_evas_sticky_get(const Ecore_Evas *ee) | |||
2048 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, | 2115 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, |
2049 | "ecore_evas_sticky_get"); | 2116 | "ecore_evas_sticky_get"); |
2050 | return EINA_FALSE; | 2117 | return EINA_FALSE; |
2051 | } else | 2118 | } |
2052 | return ee->prop.sticky ? EINA_TRUE : EINA_FALSE; | 2119 | return ee->prop.sticky ? EINA_TRUE : EINA_FALSE; |
2053 | } | 2120 | } |
2054 | 2121 | ||
2055 | EAPI void | 2122 | EAPI void |
@@ -2170,6 +2237,28 @@ ecore_evas_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int | |||
2170 | IFE; | 2237 | IFE; |
2171 | } | 2238 | } |
2172 | 2239 | ||
2240 | EAPI void | ||
2241 | ecore_evas_draw_frame_set(Ecore_Evas *ee, Eina_Bool draw_frame) | ||
2242 | { | ||
2243 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2244 | { | ||
2245 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_draw_frame_set"); | ||
2246 | return; | ||
2247 | } | ||
2248 | ee->prop.draw_frame = draw_frame; | ||
2249 | } | ||
2250 | |||
2251 | EAPI Eina_Bool | ||
2252 | ecore_evas_draw_frame_get(const Ecore_Evas *ee) | ||
2253 | { | ||
2254 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) | ||
2255 | { | ||
2256 | ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_draw_frame_get"); | ||
2257 | return EINA_FALSE; | ||
2258 | } | ||
2259 | return ee->prop.draw_frame; | ||
2260 | } | ||
2261 | |||
2173 | /* fps debug calls - for debugging how much time your app actually spends */ | 2262 | /* fps debug calls - for debugging how much time your app actually spends */ |
2174 | /* rendering graphics... :) */ | 2263 | /* rendering graphics... :) */ |
2175 | 2264 | ||
@@ -2586,3 +2675,55 @@ ecore_evas_input_event_unregister(Ecore_Evas *ee) | |||
2586 | { | 2675 | { |
2587 | ecore_event_window_unregister((Ecore_Window)ee); | 2676 | ecore_event_window_unregister((Ecore_Window)ee); |
2588 | } | 2677 | } |
2678 | |||
2679 | #if defined(BUILD_ECORE_EVAS_WAYLAND_SHM) || defined (BUILD_ECORE_EVAS_WAYLAND_EGL) | ||
2680 | EAPI void | ||
2681 | ecore_evas_wayland_resize(Ecore_Evas *ee, int location) | ||
2682 | { | ||
2683 | if (!ee) return; | ||
2684 | if (!strcmp(ee->driver, "wayland_shm")) | ||
2685 | { | ||
2686 | #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM | ||
2687 | _ecore_evas_wayland_shm_resize(ee, location); | ||
2688 | #endif | ||
2689 | } | ||
2690 | else if (!strcmp(ee->driver, "wayland_egl")) | ||
2691 | { | ||
2692 | #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL | ||
2693 | _ecore_evas_wayland_egl_resize(ee, location); | ||
2694 | #endif | ||
2695 | } | ||
2696 | } | ||
2697 | |||
2698 | EAPI void | ||
2699 | ecore_evas_wayland_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source) | ||
2700 | { | ||
2701 | if ((!ee) || (!source)) return; | ||
2702 | if (!ee->engine.wl.surface) return; | ||
2703 | |||
2704 | if (!strcmp(ee->driver, "wayland_shm")) | ||
2705 | { | ||
2706 | #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM | ||
2707 | _ecore_evas_wayland_shm_drag_start(ee, drag_ee, source); | ||
2708 | #endif | ||
2709 | } | ||
2710 | else if (!strcmp(ee->driver, "wayland_egl")) | ||
2711 | { | ||
2712 | #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL | ||
2713 | _ecore_evas_wayland_egl_drag_start(ee, drag_ee, source); | ||
2714 | #endif | ||
2715 | } | ||
2716 | } | ||
2717 | #else | ||
2718 | EAPI void | ||
2719 | ecore_evas_wayland_resize(Ecore_Evas *ee __UNUSED__, int location __UNUSED__) | ||
2720 | { | ||
2721 | |||
2722 | } | ||
2723 | |||
2724 | EAPI void | ||
2725 | ecore_evas_wayland_drag_start(Ecore_Evas *ee __UNUSED__, Ecore_Evas *drag_ee __UNUSED__, void *source __UNUSED__) | ||
2726 | { | ||
2727 | |||
2728 | } | ||
2729 | #endif | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c index a3e49d6..3f82efb 100644 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #endif | 3 | #endif |
4 | 4 | ||
5 | // NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar! | 5 | // NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar! |
6 | #include <stdlib.h> | ||
6 | 7 | ||
7 | #include <Ecore.h> | 8 | #include <Ecore.h> |
8 | #include "ecore_private.h" | 9 | #include "ecore_private.h" |
@@ -93,6 +94,12 @@ _ecore_evas_resize(Ecore_Evas *ee, int w, int h) | |||
93 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | 94 | if (ee->func.fn_resize) ee->func.fn_resize(ee); |
94 | } | 95 | } |
95 | 96 | ||
97 | static void | ||
98 | _ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h) | ||
99 | { | ||
100 | _ecore_evas_resize(ee, w, h); | ||
101 | } | ||
102 | |||
96 | int | 103 | int |
97 | _ecore_evas_buffer_shutdown(void) | 104 | _ecore_evas_buffer_shutdown(void) |
98 | { | 105 | { |
@@ -168,6 +175,14 @@ _ecore_evas_buffer_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y) | |||
168 | if (fw < 1) fw = 1; | 175 | if (fw < 1) fw = 1; |
169 | if (fh < 1) fh = 1; | 176 | if (fh < 1) fh = 1; |
170 | 177 | ||
178 | if (evas_object_map_get(ee->engine.buffer.image) && | ||
179 | evas_object_map_enable_get(ee->engine.buffer.image)) | ||
180 | { | ||
181 | fx = 0; fy = 0; | ||
182 | fw = ee->w; fh = ee->h; | ||
183 | ww = ee->w; hh = ee->h; | ||
184 | } | ||
185 | |||
171 | if ((fx == 0) && (fy == 0) && (fw == ww) && (fh == hh)) | 186 | if ((fx == 0) && (fy == 0) && (fw == ww) && (fh == hh)) |
172 | { | 187 | { |
173 | *x = (ee->w * (*x - xx)) / fw; | 188 | *x = (ee->w * (*x - xx)) / fw; |
@@ -188,51 +203,80 @@ _ecore_evas_buffer_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y) | |||
188 | } | 203 | } |
189 | 204 | ||
190 | static void | 205 | static void |
191 | _ecore_evas_buffer_cb_mouse_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | 206 | _ecore_evas_buffer_transfer_modifiers_locks(Evas *e, Evas *e2) |
207 | { | ||
208 | const char *mods[] = | ||
209 | { "Shift", "Control", "Alt", "Meta", "Hyper", "Super", NULL }; | ||
210 | const char *locks[] = | ||
211 | { "Scroll_Lock", "Num_Lock", "Caps_Lock", NULL }; | ||
212 | int i; | ||
213 | |||
214 | for (i = 0; mods[i]; i++) | ||
215 | { | ||
216 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), mods[i])) | ||
217 | evas_key_modifier_on(e2, mods[i]); | ||
218 | else | ||
219 | evas_key_modifier_off(e2, mods[i]); | ||
220 | } | ||
221 | for (i = 0; locks[i]; i++) | ||
222 | { | ||
223 | if (evas_key_lock_is_set(evas_key_lock_get(e), locks[i])) | ||
224 | evas_key_lock_on(e2, locks[i]); | ||
225 | else | ||
226 | evas_key_lock_off(e2, locks[i]); | ||
227 | } | ||
228 | } | ||
229 | |||
230 | static void | ||
231 | _ecore_evas_buffer_cb_mouse_in(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
192 | { | 232 | { |
193 | Ecore_Evas *ee; | 233 | Ecore_Evas *ee; |
194 | Evas_Event_Mouse_In *ev; | 234 | Evas_Event_Mouse_In *ev; |
195 | 235 | ||
196 | ee = data; | 236 | ee = data; |
197 | ev = event_info; | 237 | ev = event_info; |
238 | _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); | ||
198 | evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL); | 239 | evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL); |
199 | } | 240 | } |
200 | 241 | ||
201 | static void | 242 | static void |
202 | _ecore_evas_buffer_cb_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | 243 | _ecore_evas_buffer_cb_mouse_out(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) |
203 | { | 244 | { |
204 | Ecore_Evas *ee; | 245 | Ecore_Evas *ee; |
205 | Evas_Event_Mouse_Out *ev; | 246 | Evas_Event_Mouse_Out *ev; |
206 | 247 | ||
207 | ee = data; | 248 | ee = data; |
208 | ev = event_info; | 249 | ev = event_info; |
250 | _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); | ||
209 | evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL); | 251 | evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL); |
210 | } | 252 | } |
211 | 253 | ||
212 | static void | 254 | static void |
213 | _ecore_evas_buffer_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | 255 | _ecore_evas_buffer_cb_mouse_down(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) |
214 | { | 256 | { |
215 | Ecore_Evas *ee; | 257 | Ecore_Evas *ee; |
216 | Evas_Event_Mouse_Down *ev; | 258 | Evas_Event_Mouse_Down *ev; |
217 | 259 | ||
218 | ee = data; | 260 | ee = data; |
219 | ev = event_info; | 261 | ev = event_info; |
262 | _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); | ||
220 | evas_event_feed_mouse_down(ee->evas, ev->button, ev->flags, ev->timestamp, NULL); | 263 | evas_event_feed_mouse_down(ee->evas, ev->button, ev->flags, ev->timestamp, NULL); |
221 | } | 264 | } |
222 | 265 | ||
223 | static void | 266 | static void |
224 | _ecore_evas_buffer_cb_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | 267 | _ecore_evas_buffer_cb_mouse_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) |
225 | { | 268 | { |
226 | Ecore_Evas *ee; | 269 | Ecore_Evas *ee; |
227 | Evas_Event_Mouse_Up *ev; | 270 | Evas_Event_Mouse_Up *ev; |
228 | 271 | ||
229 | ee = data; | 272 | ee = data; |
230 | ev = event_info; | 273 | ev = event_info; |
274 | _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); | ||
231 | evas_event_feed_mouse_up(ee->evas, ev->button, ev->flags, ev->timestamp, NULL); | 275 | evas_event_feed_mouse_up(ee->evas, ev->button, ev->flags, ev->timestamp, NULL); |
232 | } | 276 | } |
233 | 277 | ||
234 | static void | 278 | static void |
235 | _ecore_evas_buffer_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | 279 | _ecore_evas_buffer_cb_mouse_move(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) |
236 | { | 280 | { |
237 | Ecore_Evas *ee; | 281 | Ecore_Evas *ee; |
238 | Evas_Event_Mouse_Move *ev; | 282 | Evas_Event_Mouse_Move *ev; |
@@ -243,22 +287,24 @@ _ecore_evas_buffer_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *ob | |||
243 | x = ev->cur.canvas.x; | 287 | x = ev->cur.canvas.x; |
244 | y = ev->cur.canvas.y; | 288 | y = ev->cur.canvas.y; |
245 | _ecore_evas_buffer_coord_translate(ee, &x, &y); | 289 | _ecore_evas_buffer_coord_translate(ee, &x, &y); |
290 | _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); | ||
246 | _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp); | 291 | _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp); |
247 | } | 292 | } |
248 | 293 | ||
249 | static void | 294 | static void |
250 | _ecore_evas_buffer_cb_mouse_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | 295 | _ecore_evas_buffer_cb_mouse_wheel(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) |
251 | { | 296 | { |
252 | Ecore_Evas *ee; | 297 | Ecore_Evas *ee; |
253 | Evas_Event_Mouse_Wheel *ev; | 298 | Evas_Event_Mouse_Wheel *ev; |
254 | 299 | ||
255 | ee = data; | 300 | ee = data; |
256 | ev = event_info; | 301 | ev = event_info; |
302 | _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); | ||
257 | evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z, ev->timestamp, NULL); | 303 | evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z, ev->timestamp, NULL); |
258 | } | 304 | } |
259 | 305 | ||
260 | static void | 306 | static void |
261 | _ecore_evas_buffer_cb_multi_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | 307 | _ecore_evas_buffer_cb_multi_down(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) |
262 | { | 308 | { |
263 | Ecore_Evas *ee; | 309 | Ecore_Evas *ee; |
264 | Evas_Event_Multi_Down *ev; | 310 | Evas_Event_Multi_Down *ev; |
@@ -274,11 +320,12 @@ _ecore_evas_buffer_cb_multi_down(void *data, Evas *e __UNUSED__, Evas_Object *ob | |||
274 | _ecore_evas_buffer_coord_translate(ee, &x, &y); | 320 | _ecore_evas_buffer_coord_translate(ee, &x, &y); |
275 | xf = (ev->canvas.xsub - (double)xx) + (double)x; | 321 | xf = (ev->canvas.xsub - (double)xx) + (double)x; |
276 | yf = (ev->canvas.ysub - (double)yy) + (double)y; | 322 | yf = (ev->canvas.ysub - (double)yy) + (double)y; |
323 | _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); | ||
277 | evas_event_feed_multi_down(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->flags, ev->timestamp, NULL); | 324 | evas_event_feed_multi_down(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->flags, ev->timestamp, NULL); |
278 | } | 325 | } |
279 | 326 | ||
280 | static void | 327 | static void |
281 | _ecore_evas_buffer_cb_multi_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | 328 | _ecore_evas_buffer_cb_multi_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) |
282 | { | 329 | { |
283 | Ecore_Evas *ee; | 330 | Ecore_Evas *ee; |
284 | Evas_Event_Multi_Up *ev; | 331 | Evas_Event_Multi_Up *ev; |
@@ -294,11 +341,12 @@ _ecore_evas_buffer_cb_multi_up(void *data, Evas *e __UNUSED__, Evas_Object *obj | |||
294 | _ecore_evas_buffer_coord_translate(ee, &x, &y); | 341 | _ecore_evas_buffer_coord_translate(ee, &x, &y); |
295 | xf = (ev->canvas.xsub - (double)xx) + (double)x; | 342 | xf = (ev->canvas.xsub - (double)xx) + (double)x; |
296 | yf = (ev->canvas.ysub - (double)yy) + (double)y; | 343 | yf = (ev->canvas.ysub - (double)yy) + (double)y; |
344 | _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); | ||
297 | evas_event_feed_multi_up(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->flags, ev->timestamp, NULL); | 345 | evas_event_feed_multi_up(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->flags, ev->timestamp, NULL); |
298 | } | 346 | } |
299 | 347 | ||
300 | static void | 348 | static void |
301 | _ecore_evas_buffer_cb_multi_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | 349 | _ecore_evas_buffer_cb_multi_move(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) |
302 | { | 350 | { |
303 | Ecore_Evas *ee; | 351 | Ecore_Evas *ee; |
304 | Evas_Event_Multi_Move *ev; | 352 | Evas_Event_Multi_Move *ev; |
@@ -314,6 +362,7 @@ _ecore_evas_buffer_cb_multi_move(void *data, Evas *e __UNUSED__, Evas_Object *ob | |||
314 | _ecore_evas_buffer_coord_translate(ee, &x, &y); | 362 | _ecore_evas_buffer_coord_translate(ee, &x, &y); |
315 | xf = (ev->cur.canvas.xsub - (double)xx) + (double)x; | 363 | xf = (ev->cur.canvas.xsub - (double)xx) + (double)x; |
316 | yf = (ev->cur.canvas.ysub - (double)yy) + (double)y; | 364 | yf = (ev->cur.canvas.ysub - (double)yy) + (double)y; |
365 | _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); | ||
317 | evas_event_feed_multi_move(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->timestamp, NULL); | 366 | evas_event_feed_multi_move(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->timestamp, NULL); |
318 | } | 367 | } |
319 | 368 | ||
@@ -334,42 +383,7 @@ _ecore_evas_buffer_cb_key_down(void *data, Evas *e, Evas_Object *obj __UNUSED__, | |||
334 | 383 | ||
335 | ee = data; | 384 | ee = data; |
336 | ev = event_info; | 385 | ev = event_info; |
337 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift")) | 386 | _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); |
338 | evas_key_modifier_on(ee->evas, "Shift"); | ||
339 | else | ||
340 | evas_key_modifier_off(ee->evas, "Shift"); | ||
341 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control")) | ||
342 | evas_key_modifier_on(ee->evas, "Control"); | ||
343 | else | ||
344 | evas_key_modifier_off(ee->evas, "Control"); | ||
345 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt")) | ||
346 | evas_key_modifier_on(ee->evas, "Alt"); | ||
347 | else | ||
348 | evas_key_modifier_off(ee->evas, "Alt"); | ||
349 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta")) | ||
350 | evas_key_modifier_on(ee->evas, "Meta"); | ||
351 | else | ||
352 | evas_key_modifier_off(ee->evas, "Meta"); | ||
353 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper")) | ||
354 | evas_key_modifier_on(ee->evas, "Hyper"); | ||
355 | else | ||
356 | evas_key_modifier_off(ee->evas, "Hyper"); | ||
357 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super")) | ||
358 | evas_key_modifier_on(ee->evas, "Super"); | ||
359 | else | ||
360 | evas_key_modifier_off(ee->evas, "Super"); | ||
361 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock")) | ||
362 | evas_key_lock_on(ee->evas, "Scroll_Lock"); | ||
363 | else | ||
364 | evas_key_lock_off(ee->evas, "Scroll_Lock"); | ||
365 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock")) | ||
366 | evas_key_lock_on(ee->evas, "Num_Lock"); | ||
367 | else | ||
368 | evas_key_lock_off(ee->evas, "Num_Lock"); | ||
369 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock")) | ||
370 | evas_key_lock_on(ee->evas, "Caps_Lock"); | ||
371 | else | ||
372 | evas_key_lock_off(ee->evas, "Caps_Lock"); | ||
373 | evas_event_feed_key_down(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL); | 387 | evas_event_feed_key_down(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL); |
374 | } | 388 | } |
375 | 389 | ||
@@ -381,42 +395,7 @@ _ecore_evas_buffer_cb_key_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, v | |||
381 | 395 | ||
382 | ee = data; | 396 | ee = data; |
383 | ev = event_info; | 397 | ev = event_info; |
384 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift")) | 398 | _ecore_evas_buffer_transfer_modifiers_locks(e, ee->evas); |
385 | evas_key_modifier_on(ee->evas, "Shift"); | ||
386 | else | ||
387 | evas_key_modifier_off(ee->evas, "Shift"); | ||
388 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control")) | ||
389 | evas_key_modifier_on(ee->evas, "Control"); | ||
390 | else | ||
391 | evas_key_modifier_off(ee->evas, "Control"); | ||
392 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt")) | ||
393 | evas_key_modifier_on(ee->evas, "Alt"); | ||
394 | else | ||
395 | evas_key_modifier_off(ee->evas, "Alt"); | ||
396 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta")) | ||
397 | evas_key_modifier_on(ee->evas, "Meta"); | ||
398 | else | ||
399 | evas_key_modifier_off(ee->evas, "Meta"); | ||
400 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper")) | ||
401 | evas_key_modifier_on(ee->evas, "Hyper"); | ||
402 | else | ||
403 | evas_key_modifier_off(ee->evas, "Hyper"); | ||
404 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super")) | ||
405 | evas_key_modifier_on(ee->evas, "Super"); | ||
406 | else | ||
407 | evas_key_modifier_off(ee->evas, "Super"); | ||
408 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock")) | ||
409 | evas_key_lock_on(ee->evas, "Scroll_Lock"); | ||
410 | else | ||
411 | evas_key_lock_off(ee->evas, "Scroll_Lock"); | ||
412 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock")) | ||
413 | evas_key_lock_on(ee->evas, "Num_Lock"); | ||
414 | else | ||
415 | evas_key_lock_off(ee->evas, "Num_Lock"); | ||
416 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock")) | ||
417 | evas_key_lock_on(ee->evas, "Caps_Lock"); | ||
418 | else | ||
419 | evas_key_lock_off(ee->evas, "Caps_Lock"); | ||
420 | evas_event_feed_key_up(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL); | 399 | evas_event_feed_key_up(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL); |
421 | } | 400 | } |
422 | 401 | ||
@@ -469,6 +448,20 @@ _ecore_evas_buffer_alpha_set(Ecore_Evas *ee, int alpha) | |||
469 | ee->alpha = alpha; | 448 | ee->alpha = alpha; |
470 | if (ee->engine.buffer.image) | 449 | if (ee->engine.buffer.image) |
471 | evas_object_image_alpha_set(ee->engine.buffer.image, ee->alpha); | 450 | evas_object_image_alpha_set(ee->engine.buffer.image, ee->alpha); |
451 | else | ||
452 | { | ||
453 | Evas_Engine_Info_Buffer *einfo; | ||
454 | |||
455 | einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); | ||
456 | if (einfo) | ||
457 | { | ||
458 | if (ee->alpha) | ||
459 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; | ||
460 | else | ||
461 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32; | ||
462 | evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); | ||
463 | } | ||
464 | } | ||
472 | } | 465 | } |
473 | 466 | ||
474 | static Ecore_Evas_Engine_Func _ecore_buffer_engine_func = | 467 | static Ecore_Evas_Engine_Func _ecore_buffer_engine_func = |
@@ -491,7 +484,7 @@ static Ecore_Evas_Engine_Func _ecore_buffer_engine_func = | |||
491 | NULL, | 484 | NULL, |
492 | NULL, | 485 | NULL, |
493 | _ecore_evas_resize, | 486 | _ecore_evas_resize, |
494 | NULL, | 487 | _ecore_evas_move_resize, |
495 | NULL, | 488 | NULL, |
496 | NULL, | 489 | NULL, |
497 | _ecore_evas_show, | 490 | _ecore_evas_show, |
@@ -520,7 +513,7 @@ static Ecore_Evas_Engine_Func _ecore_buffer_engine_func = | |||
520 | _ecore_evas_buffer_alpha_set, | 513 | _ecore_evas_buffer_alpha_set, |
521 | NULL, //transparent | 514 | NULL, //transparent |
522 | 515 | ||
523 | NULL, // render | 516 | _ecore_evas_buffer_render, |
524 | NULL // screen_geometry_get | 517 | NULL // screen_geometry_get |
525 | }; | 518 | }; |
526 | #endif | 519 | #endif |
@@ -604,7 +597,7 @@ ecore_evas_buffer_allocfunc_new(int w, int h, void *(*alloc_func) (void *data, i | |||
604 | einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); | 597 | einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); |
605 | if (einfo) | 598 | if (einfo) |
606 | { | 599 | { |
607 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; | 600 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32; |
608 | einfo->info.dest_buffer = ee->engine.buffer.pixels; | 601 | einfo->info.dest_buffer = ee->engine.buffer.pixels; |
609 | einfo->info.dest_buffer_row_bytes = ee->w * sizeof(int); | 602 | einfo->info.dest_buffer_row_bytes = ee->w * sizeof(int); |
610 | einfo->info.use_color_key = 0; | 603 | einfo->info.use_color_key = 0; |
@@ -636,7 +629,6 @@ ecore_evas_buffer_allocfunc_new(int w, int h, void *(*alloc_func) (void *data, i | |||
636 | 629 | ||
637 | evas_event_feed_mouse_in(ee->evas, 0, NULL); | 630 | evas_event_feed_mouse_in(ee->evas, 0, NULL); |
638 | 631 | ||
639 | ee->engine.func->fn_render = _ecore_evas_buffer_render; | ||
640 | _ecore_evas_register(ee); | 632 | _ecore_evas_register(ee); |
641 | 633 | ||
642 | evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); | 634 | evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); |
@@ -818,8 +810,6 @@ ecore_evas_object_image_new(Ecore_Evas *ee_target) | |||
818 | 810 | ||
819 | ee_target->sub_ecore_evas = eina_list_append(ee_target->sub_ecore_evas, ee); | 811 | ee_target->sub_ecore_evas = eina_list_append(ee_target->sub_ecore_evas, ee); |
820 | 812 | ||
821 | ee->engine.func->fn_render = _ecore_evas_buffer_render; | ||
822 | |||
823 | return o; | 813 | return o; |
824 | #else | 814 | #else |
825 | return NULL; | 815 | return NULL; |
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c index 1f946d5..36d41f8 100644 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c | |||
@@ -568,7 +568,7 @@ ecore_evas_cocoa_new(Ecore_Cocoa_Window *parent, int x, int y, int w, int h) | |||
568 | #else | 568 | #else |
569 | ERR("Cocoa support in ecore-evas not enabled"); | 569 | ERR("Cocoa support in ecore-evas not enabled"); |
570 | return NULL; | 570 | return NULL; |
571 | parent = NULL; | 571 | (void) parent; |
572 | x = y = w = h = 0; | 572 | (void) x; (void) y; (void) w; (void) h; |
573 | #endif | 573 | #endif |
574 | } | 574 | } |
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_ews.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_ews.c index e19fb05..eccf98b 100644 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_ews.c +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_ews.c | |||
@@ -2,6 +2,11 @@ | |||
2 | # include <config.h> | 2 | # include <config.h> |
3 | #endif | 3 | #endif |
4 | 4 | ||
5 | #include <stdlib.h> | ||
6 | #include <string.h> | ||
7 | #include <sys/types.h> | ||
8 | |||
9 | #include <Eina.h> | ||
5 | #include <Ecore.h> | 10 | #include <Ecore.h> |
6 | #include "ecore_private.h" | 11 | #include "ecore_private.h" |
7 | #include <Ecore_Input.h> | 12 | #include <Ecore_Input.h> |
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_extn.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_extn.c new file mode 100644 index 0000000..e46ab4a --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_extn.c | |||
@@ -0,0 +1,2152 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <stdlib.h> | ||
6 | #include <unistd.h> | ||
7 | |||
8 | #include <Ecore.h> | ||
9 | #include "ecore_private.h" | ||
10 | #include <Ecore_Input.h> | ||
11 | |||
12 | #ifdef BUILD_ECORE_IPC | ||
13 | # ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER | ||
14 | # define EXTN_ENABLED 1 | ||
15 | # endif | ||
16 | #endif | ||
17 | |||
18 | #include "ecore_evas_private.h" | ||
19 | #include "Ecore_Evas.h" | ||
20 | #ifdef EXTN_ENABLED | ||
21 | #include "Ecore_Ipc.h" | ||
22 | |||
23 | #include <stdio.h> | ||
24 | #include <stdlib.h> | ||
25 | #include <sys/types.h> | ||
26 | #include <unistd.h> | ||
27 | #include <math.h> | ||
28 | #include <time.h> | ||
29 | #include <sys/mman.h> | ||
30 | #include <sys/stat.h> | ||
31 | #include <fcntl.h> | ||
32 | #include <string.h> | ||
33 | #include <sys/file.h> | ||
34 | |||
35 | typedef struct _Shmfile Shmfile; | ||
36 | |||
37 | struct _Shmfile | ||
38 | { | ||
39 | int fd; | ||
40 | int size; | ||
41 | void *addr; | ||
42 | const char *file; | ||
43 | }; | ||
44 | |||
45 | static int blank = 0x00000000; | ||
46 | |||
47 | static Shmfile * | ||
48 | shmfile_new(const char *base, int id, int size, Eina_Bool sys) | ||
49 | { | ||
50 | Shmfile *sf; | ||
51 | char file[PATH_MAX]; | ||
52 | |||
53 | sf = calloc(1, sizeof(Shmfile)); | ||
54 | do | ||
55 | { | ||
56 | mode_t mode; | ||
57 | |||
58 | snprintf(file, sizeof(file), "/%s-%i-%i.%i.%i", | ||
59 | base, id, (int)time(NULL), (int)getpid(), (int)rand()); | ||
60 | mode = S_IRUSR | S_IWUSR; | ||
61 | if (sys) mode |= S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; | ||
62 | sf->fd = shm_open(file, O_RDWR | O_CREAT | O_EXCL, mode); | ||
63 | } | ||
64 | while (sf->fd < 0); | ||
65 | |||
66 | sf->file = eina_stringshare_add(file); | ||
67 | if (!sf->file) | ||
68 | { | ||
69 | close(sf->fd); | ||
70 | shm_unlink(sf->file); | ||
71 | eina_stringshare_del(sf->file); | ||
72 | free(sf); | ||
73 | return NULL; | ||
74 | } | ||
75 | sf->size = size; | ||
76 | if (ftruncate(sf->fd, size) < 0) | ||
77 | { | ||
78 | close(sf->fd); | ||
79 | shm_unlink(sf->file); | ||
80 | eina_stringshare_del(sf->file); | ||
81 | free(sf); | ||
82 | return NULL; | ||
83 | } | ||
84 | sf->addr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, sf->fd, 0); | ||
85 | if (sf->addr == MAP_FAILED) | ||
86 | { | ||
87 | close(sf->fd); | ||
88 | shm_unlink(sf->file); | ||
89 | eina_stringshare_del(sf->file); | ||
90 | free(sf); | ||
91 | return NULL; | ||
92 | } | ||
93 | return sf; | ||
94 | } | ||
95 | |||
96 | void | ||
97 | shmfile_free(Shmfile *sf) | ||
98 | { | ||
99 | munmap(sf->addr, sf->size); | ||
100 | close(sf->fd); | ||
101 | shm_unlink(sf->file); | ||
102 | eina_stringshare_del(sf->file); | ||
103 | free(sf); | ||
104 | } | ||
105 | |||
106 | static Shmfile * | ||
107 | shmfile_open(const char *ref, int size, Eina_Bool sys) | ||
108 | { | ||
109 | Shmfile *sf; | ||
110 | mode_t mode; | ||
111 | |||
112 | sf = calloc(1, sizeof(Shmfile)); | ||
113 | mode = S_IRUSR | S_IWUSR; | ||
114 | if (sys) mode |= S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; | ||
115 | sf->fd = shm_open(ref, O_RDWR, mode); | ||
116 | if (sf->fd < 0) | ||
117 | { | ||
118 | free(sf); | ||
119 | return NULL; | ||
120 | } | ||
121 | sf->file = eina_stringshare_add(ref); | ||
122 | if (!sf->file) | ||
123 | { | ||
124 | close(sf->fd); | ||
125 | eina_stringshare_del(sf->file); | ||
126 | free(sf); | ||
127 | return NULL; | ||
128 | } | ||
129 | sf->size = size; | ||
130 | sf->addr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, sf->fd, 0); | ||
131 | if (sf->addr == MAP_FAILED) | ||
132 | { | ||
133 | close(sf->fd); | ||
134 | eina_stringshare_del(sf->file); | ||
135 | free(sf); | ||
136 | return NULL; | ||
137 | } | ||
138 | return sf; | ||
139 | } | ||
140 | |||
141 | void | ||
142 | shmfile_close(Shmfile *sf) | ||
143 | { | ||
144 | munmap(sf->addr, sf->size); | ||
145 | close(sf->fd); | ||
146 | eina_stringshare_del(sf->file); | ||
147 | free(sf); | ||
148 | } | ||
149 | |||
150 | // procotol version - change this as needed | ||
151 | #define MAJOR 0x1011 | ||
152 | |||
153 | enum // opcodes | ||
154 | { | ||
155 | OP_RESIZE, | ||
156 | OP_SHOW, | ||
157 | OP_HIDE, | ||
158 | OP_FOCUS, | ||
159 | OP_UNFOCUS, | ||
160 | OP_UPDATE, | ||
161 | OP_UPDATE_DONE, | ||
162 | OP_LOCK_FILE, | ||
163 | OP_SHM_REF, | ||
164 | OP_EV_MOUSE_IN, | ||
165 | OP_EV_MOUSE_OUT, | ||
166 | OP_EV_MOUSE_UP, | ||
167 | OP_EV_MOUSE_DOWN, | ||
168 | OP_EV_MOUSE_MOVE, | ||
169 | OP_EV_MOUSE_WHEEL, | ||
170 | OP_EV_MULTI_UP, | ||
171 | OP_EV_MULTI_DOWN, | ||
172 | OP_EV_MULTI_MOVE, | ||
173 | OP_EV_KEY_UP, | ||
174 | OP_EV_KEY_DOWN, | ||
175 | OP_EV_HOLD | ||
176 | }; | ||
177 | |||
178 | enum | ||
179 | { | ||
180 | MOD_SHIFT = (1 << 0), | ||
181 | MOD_CTRL = (1 << 1), | ||
182 | MOD_ALT = (1 << 2), | ||
183 | MOD_META = (1 << 3), | ||
184 | MOD_HYPER = (1 << 4), | ||
185 | MOD_SUPER = (1 << 5), | ||
186 | MOD_CAPS = (1 << 6), | ||
187 | MOD_NUM = (1 << 7), | ||
188 | MOD_SCROLL = (1 << 8), | ||
189 | }; | ||
190 | |||
191 | typedef struct _Ipc_Data_Resize Ipc_Data_Resize; | ||
192 | typedef struct _Ipc_Data_Update Ipc_Data_Update; | ||
193 | typedef struct _Ipc_Data_Ev_Mouse_In Ipc_Data_Ev_Mouse_In; | ||
194 | typedef struct _Ipc_Data_Ev_Mouse_Out Ipc_Data_Ev_Mouse_Out; | ||
195 | typedef struct _Ipc_Data_Ev_Mouse_Up Ipc_Data_Ev_Mouse_Up; | ||
196 | typedef struct _Ipc_Data_Ev_Mouse_Down Ipc_Data_Ev_Mouse_Down; | ||
197 | typedef struct _Ipc_Data_Ev_Mouse_Move Ipc_Data_Ev_Mouse_Move; | ||
198 | typedef struct _Ipc_Data_Ev_Mouse_Wheel Ipc_Data_Ev_Mouse_Wheel; | ||
199 | typedef struct _Ipc_Data_Ev_Hold Ipc_Data_Ev_Hold; | ||
200 | typedef struct _Ipc_Data_Ev_Multi_Up Ipc_Data_Ev_Multi_Up; | ||
201 | typedef struct _Ipc_Data_Ev_Multi_Down Ipc_Data_Ev_Multi_Down; | ||
202 | typedef struct _Ipc_Data_Ev_Multi_Move Ipc_Data_Ev_Multi_Move; | ||
203 | typedef struct _Ipc_Data_Ev_Key_Up Ipc_Data_Ev_Key_Up; | ||
204 | typedef struct _Ipc_Data_Ev_Key_Down Ipc_Data_Ev_Key_Down; | ||
205 | |||
206 | struct _Ipc_Data_Resize | ||
207 | { | ||
208 | int w, h; | ||
209 | }; | ||
210 | |||
211 | struct _Ipc_Data_Update | ||
212 | { | ||
213 | int x, w, y, h; | ||
214 | }; | ||
215 | |||
216 | struct _Ipc_Data_Ev_Mouse_In | ||
217 | { | ||
218 | unsigned int timestamp; | ||
219 | int mask; | ||
220 | Evas_Event_Flags event_flags; | ||
221 | }; | ||
222 | |||
223 | struct _Ipc_Data_Ev_Mouse_Out | ||
224 | { | ||
225 | unsigned int timestamp; | ||
226 | int mask; | ||
227 | Evas_Event_Flags event_flags; | ||
228 | }; | ||
229 | |||
230 | struct _Ipc_Data_Ev_Mouse_Up | ||
231 | { | ||
232 | int b; | ||
233 | Evas_Button_Flags flags; | ||
234 | int mask; | ||
235 | unsigned int timestamp; | ||
236 | Evas_Event_Flags event_flags; | ||
237 | }; | ||
238 | |||
239 | struct _Ipc_Data_Ev_Mouse_Down | ||
240 | { | ||
241 | int b; | ||
242 | Evas_Button_Flags flags; | ||
243 | int mask; | ||
244 | unsigned int timestamp; | ||
245 | Evas_Event_Flags event_flags; | ||
246 | }; | ||
247 | |||
248 | struct _Ipc_Data_Ev_Mouse_Move | ||
249 | { | ||
250 | int x, y; | ||
251 | Evas_Button_Flags flags; | ||
252 | int mask; | ||
253 | unsigned int timestamp; | ||
254 | Evas_Event_Flags event_flags; | ||
255 | }; | ||
256 | |||
257 | struct _Ipc_Data_Ev_Mouse_Wheel | ||
258 | { | ||
259 | int direction, z; | ||
260 | Evas_Button_Flags flags; | ||
261 | int mask; | ||
262 | unsigned int timestamp; | ||
263 | Evas_Event_Flags event_flags; | ||
264 | }; | ||
265 | |||
266 | struct _Ipc_Data_Ev_Hold | ||
267 | { | ||
268 | int hold; | ||
269 | unsigned int timestamp; | ||
270 | Evas_Event_Flags event_flags; | ||
271 | }; | ||
272 | |||
273 | struct _Ipc_Data_Ev_Multi_Up | ||
274 | { | ||
275 | Evas_Button_Flags flags; | ||
276 | int d, x, y; | ||
277 | double rad, radx, rady, pres, ang, fx, fy; | ||
278 | int mask; | ||
279 | unsigned int timestamp; | ||
280 | Evas_Event_Flags event_flags; | ||
281 | }; | ||
282 | |||
283 | struct _Ipc_Data_Ev_Multi_Down | ||
284 | { | ||
285 | Evas_Button_Flags flags; | ||
286 | int d, x, y; | ||
287 | double rad, radx, rady, pres, ang, fx, fy; | ||
288 | int mask; | ||
289 | unsigned int timestamp; | ||
290 | Evas_Event_Flags event_flags; | ||
291 | }; | ||
292 | |||
293 | struct _Ipc_Data_Ev_Multi_Move | ||
294 | { | ||
295 | int d, x, y; | ||
296 | double rad, radx, rady, pres, ang, fx, fy; | ||
297 | int mask; | ||
298 | unsigned int timestamp; | ||
299 | Evas_Event_Flags event_flags; | ||
300 | }; | ||
301 | |||
302 | struct _Ipc_Data_Ev_Key_Up | ||
303 | { | ||
304 | const char *keyname, *key, *string, *compose; | ||
305 | int mask; | ||
306 | unsigned int timestamp; | ||
307 | Evas_Event_Flags event_flags; | ||
308 | }; | ||
309 | |||
310 | struct _Ipc_Data_Ev_Key_Down | ||
311 | { | ||
312 | const char *keyname, *key, *string, *compose; | ||
313 | int mask; | ||
314 | unsigned int timestamp; | ||
315 | Evas_Event_Flags event_flags; | ||
316 | }; | ||
317 | |||
318 | typedef struct _Extn Extn; | ||
319 | |||
320 | struct _Extn | ||
321 | { | ||
322 | struct { | ||
323 | Ecore_Ipc_Server *server; | ||
324 | Eina_List *clients; | ||
325 | Eina_List *handlers; | ||
326 | Eina_Bool am_server : 1; | ||
327 | } ipc; | ||
328 | struct { | ||
329 | const char *name; | ||
330 | int num; | ||
331 | Eina_Bool sys : 1; | ||
332 | } svc; | ||
333 | struct { | ||
334 | const char *lock; | ||
335 | int lockfd; | ||
336 | const char *shm; | ||
337 | int w, h; | ||
338 | Shmfile *shmfile; | ||
339 | Eina_List *updates; | ||
340 | Eina_Bool have_lock : 1; | ||
341 | } file; | ||
342 | }; | ||
343 | |||
344 | static Eina_List *extn_ee_list = NULL; | ||
345 | |||
346 | EAPI int ECORE_EVAS_EXTN_CLIENT_ADD = 0; | ||
347 | EAPI int ECORE_EVAS_EXTN_CLIENT_DEL = 0; | ||
348 | |||
349 | void | ||
350 | _ecore_evas_extn_init(void) | ||
351 | { | ||
352 | if (ECORE_EVAS_EXTN_CLIENT_ADD) return; | ||
353 | ECORE_EVAS_EXTN_CLIENT_ADD = ecore_event_type_new(); | ||
354 | ECORE_EVAS_EXTN_CLIENT_DEL = ecore_event_type_new(); | ||
355 | } | ||
356 | |||
357 | void | ||
358 | _ecore_evas_extn_shutdown(void) | ||
359 | { | ||
360 | } | ||
361 | |||
362 | static void | ||
363 | _ecore_evas_extn_event_free(void *data, void *ev __UNUSED__) | ||
364 | { | ||
365 | Ecore_Evas *ee = data; | ||
366 | if (ee->engine.buffer.image) | ||
367 | evas_object_unref(ee->engine.buffer.image); | ||
368 | _ecore_evas_unref(ee); | ||
369 | } | ||
370 | |||
371 | static void | ||
372 | _ecore_evas_extn_event(Ecore_Evas *ee, int event) | ||
373 | { | ||
374 | _ecore_evas_ref(ee); | ||
375 | if (ee->engine.buffer.image) | ||
376 | evas_object_ref(ee->engine.buffer.image); | ||
377 | ecore_event_add(event, ee->engine.buffer.image, | ||
378 | _ecore_evas_extn_event_free, ee); | ||
379 | } | ||
380 | |||
381 | static void | ||
382 | _ecore_evas_socket_lock(Ecore_Evas *ee) | ||
383 | { | ||
384 | Extn *extn; | ||
385 | |||
386 | extn = ee->engine.buffer.data; | ||
387 | if (!extn) return; | ||
388 | if (extn->file.lockfd < 0) return; | ||
389 | if (extn->file.have_lock) return; | ||
390 | flock(extn->file.lockfd, LOCK_EX); | ||
391 | extn->file.have_lock = EINA_TRUE; | ||
392 | } | ||
393 | |||
394 | static void | ||
395 | _ecore_evas_socket_unlock(Ecore_Evas *ee) | ||
396 | { | ||
397 | Extn *extn; | ||
398 | |||
399 | extn = ee->engine.buffer.data; | ||
400 | if (!extn) return; | ||
401 | if (extn->file.lockfd < 0) return; | ||
402 | if (!extn->file.have_lock) return; | ||
403 | flock(extn->file.lockfd, LOCK_UN); | ||
404 | extn->file.have_lock = EINA_FALSE; | ||
405 | } | ||
406 | |||
407 | static void | ||
408 | _ecore_evas_extn_plug_targer_render_pre(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__) | ||
409 | { | ||
410 | Ecore_Evas *ee = data; | ||
411 | if (ee) _ecore_evas_socket_lock(ee); | ||
412 | } | ||
413 | |||
414 | static void | ||
415 | _ecore_evas_extn_plug_targer_render_post(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__) | ||
416 | { | ||
417 | Ecore_Evas *ee = data; | ||
418 | if (ee) _ecore_evas_socket_unlock(ee); | ||
419 | } | ||
420 | |||
421 | static void | ||
422 | _ecore_evas_extn_plug_image_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
423 | { | ||
424 | Ecore_Evas *ee = data; | ||
425 | if (ee) ecore_evas_free(ee); | ||
426 | } | ||
427 | |||
428 | static void | ||
429 | _ecore_evas_extn_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y) | ||
430 | { | ||
431 | Evas_Coord xx, yy, ww, hh, fx, fy, fw, fh; | ||
432 | |||
433 | evas_object_geometry_get(ee->engine.buffer.image, &xx, &yy, &ww, &hh); | ||
434 | evas_object_image_fill_get(ee->engine.buffer.image, &fx, &fy, &fw, &fh); | ||
435 | |||
436 | if (fw < 1) fw = 1; | ||
437 | if (fh < 1) fh = 1; | ||
438 | |||
439 | if (evas_object_map_get(ee->engine.buffer.image) && | ||
440 | evas_object_map_enable_get(ee->engine.buffer.image)) | ||
441 | { | ||
442 | fx = 0; fy = 0; | ||
443 | fw = ee->w; fh = ee->h; | ||
444 | ww = ee->w; hh = ee->h; | ||
445 | } | ||
446 | |||
447 | if ((fx == 0) && (fy == 0) && (fw == ww) && (fh == hh)) | ||
448 | { | ||
449 | *x = (ee->w * (*x - xx)) / fw; | ||
450 | *y = (ee->h * (*y - yy)) / fh; | ||
451 | } | ||
452 | else | ||
453 | { | ||
454 | xx = (*x - xx) - fx; | ||
455 | while (xx < 0) xx += fw; | ||
456 | while (xx > fw) xx -= fw; | ||
457 | *x = (ee->w * xx) / fw; | ||
458 | |||
459 | yy = (*y - yy) - fy; | ||
460 | while (yy < 0) yy += fh; | ||
461 | while (yy > fh) yy -= fh; | ||
462 | *y = (ee->h * yy) / fh; | ||
463 | } | ||
464 | } | ||
465 | |||
466 | static void | ||
467 | _ecore_evas_extn_free(Ecore_Evas *ee) | ||
468 | { | ||
469 | Extn *extn; | ||
470 | Ecore_Ipc_Client *client; | ||
471 | |||
472 | extn = ee->engine.buffer.data; | ||
473 | if (extn) | ||
474 | { | ||
475 | Ecore_Event_Handler *hdl; | ||
476 | |||
477 | if (extn->file.have_lock) | ||
478 | _ecore_evas_socket_unlock(ee); | ||
479 | if (extn->file.lockfd) | ||
480 | { | ||
481 | close(extn->file.lockfd); | ||
482 | if (extn->ipc.am_server) | ||
483 | { | ||
484 | if (extn->file.lock) unlink(extn->file.lock); | ||
485 | } | ||
486 | } | ||
487 | if (extn->svc.name) eina_stringshare_del(extn->svc.name); | ||
488 | if (extn->ipc.clients) | ||
489 | { | ||
490 | EINA_LIST_FREE(extn->ipc.clients, client) | ||
491 | ecore_ipc_client_del(client); | ||
492 | } | ||
493 | if (extn->ipc.server) ecore_ipc_server_del(extn->ipc.server); | ||
494 | if (extn->file.lock) eina_stringshare_del(extn->file.lock); | ||
495 | if (extn->file.shm) eina_stringshare_del(extn->file.shm); | ||
496 | if (extn->file.shmfile) | ||
497 | { | ||
498 | if (extn->ipc.am_server) | ||
499 | shmfile_free(extn->file.shmfile); | ||
500 | else | ||
501 | shmfile_close(extn->file.shmfile); | ||
502 | } | ||
503 | |||
504 | EINA_LIST_FREE(extn->ipc.handlers, hdl) | ||
505 | ecore_event_handler_del(hdl); | ||
506 | free(extn); | ||
507 | ecore_ipc_shutdown(); | ||
508 | ee->engine.buffer.data = NULL; | ||
509 | } | ||
510 | if (ee->engine.buffer.image) | ||
511 | { | ||
512 | Ecore_Evas *ee2; | ||
513 | |||
514 | evas_object_event_callback_del_full(ee->engine.buffer.image, | ||
515 | EVAS_CALLBACK_DEL, | ||
516 | _ecore_evas_extn_plug_image_obj_del, | ||
517 | ee); | ||
518 | evas_event_callback_del_full(evas_object_evas_get(ee->engine.buffer.image), | ||
519 | EVAS_CALLBACK_RENDER_PRE, | ||
520 | _ecore_evas_extn_plug_targer_render_pre, | ||
521 | ee); | ||
522 | evas_event_callback_del_full(evas_object_evas_get(ee->engine.buffer.image), | ||
523 | EVAS_CALLBACK_RENDER_POST, | ||
524 | _ecore_evas_extn_plug_targer_render_post, | ||
525 | ee); | ||
526 | evas_object_del(ee->engine.buffer.image); | ||
527 | ee2 = evas_object_data_get(ee->engine.buffer.image, "Ecore_Evas_Parent"); | ||
528 | if (ee2) | ||
529 | { | ||
530 | ee2->sub_ecore_evas = eina_list_remove(ee2->sub_ecore_evas, ee); | ||
531 | } | ||
532 | } | ||
533 | extn_ee_list = eina_list_remove(extn_ee_list, ee); | ||
534 | } | ||
535 | |||
536 | static void | ||
537 | _ecore_evas_resize(Ecore_Evas *ee, int w, int h) | ||
538 | { | ||
539 | if (w < 1) w = 1; | ||
540 | if (h < 1) h = 1; | ||
541 | ee->req.w = w; | ||
542 | ee->req.h = h; | ||
543 | if ((w == ee->w) && (h == ee->h)) return; | ||
544 | ee->w = w; | ||
545 | ee->h = h; | ||
546 | |||
547 | /* | ||
548 | * No need for it if not used later. | ||
549 | Extn *extn; | ||
550 | |||
551 | extn = ee->engine.buffer.data; | ||
552 | */ | ||
553 | if (ee->engine.buffer.image) | ||
554 | evas_object_image_size_set(ee->engine.buffer.image, ee->w, ee->h); | ||
555 | /* Server can have many plugs, so I block resize comand from client to server * | ||
556 | if ((extn) && (extn->ipc.server)) | ||
557 | { | ||
558 | Ipc_Data_Resize ipc; | ||
559 | |||
560 | ipc.w = ee->w; | ||
561 | ipc.h = ee->h; | ||
562 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_RESIZE, 0, 0, 0, &ipc, sizeof(ipc)); | ||
563 | }*/ | ||
564 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
565 | } | ||
566 | |||
567 | static void | ||
568 | _ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h) | ||
569 | { | ||
570 | _ecore_evas_resize(ee, w, h); | ||
571 | } | ||
572 | |||
573 | static int | ||
574 | _ecore_evas_modifiers_locks_mask_get(Evas *e) | ||
575 | { | ||
576 | int mask = 0; | ||
577 | |||
578 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift")) | ||
579 | mask |= MOD_SHIFT; | ||
580 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control")) | ||
581 | mask |= MOD_CTRL; | ||
582 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt")) | ||
583 | mask |= MOD_ALT; | ||
584 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta")) | ||
585 | mask |= MOD_META; | ||
586 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper")) | ||
587 | mask |= MOD_HYPER; | ||
588 | if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super")) | ||
589 | mask |= MOD_SUPER; | ||
590 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock")) | ||
591 | mask |= MOD_SCROLL; | ||
592 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock")) | ||
593 | mask |= MOD_NUM; | ||
594 | if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock")) | ||
595 | mask |= MOD_CAPS; | ||
596 | return mask; | ||
597 | } | ||
598 | |||
599 | static void | ||
600 | _ecore_evas_modifiers_locks_mask_set(Evas *e, int mask) | ||
601 | { | ||
602 | if (mask & MOD_SHIFT) evas_key_modifier_on (e, "Shift"); | ||
603 | else evas_key_modifier_off(e, "Shift"); | ||
604 | if (mask & MOD_CTRL) evas_key_modifier_on (e, "Control"); | ||
605 | else evas_key_modifier_off(e, "Control"); | ||
606 | if (mask & MOD_ALT) evas_key_modifier_on (e, "Alt"); | ||
607 | else evas_key_modifier_off(e, "Alt"); | ||
608 | if (mask & MOD_META) evas_key_modifier_on (e, "Meta"); | ||
609 | else evas_key_modifier_off(e, "Meta"); | ||
610 | if (mask & MOD_HYPER) evas_key_modifier_on (e, "Hyper"); | ||
611 | else evas_key_modifier_off(e, "Hyper"); | ||
612 | if (mask & MOD_SUPER) evas_key_modifier_on (e, "Super"); | ||
613 | else evas_key_modifier_off(e, "Super"); | ||
614 | if (mask & MOD_SCROLL) evas_key_lock_on (e, "Scroll_Lock"); | ||
615 | else evas_key_lock_off(e, "Scroll_Lock"); | ||
616 | if (mask & MOD_NUM) evas_key_lock_on (e, "Num_Lock"); | ||
617 | else evas_key_lock_off(e, "Num_Lock"); | ||
618 | if (mask & MOD_CAPS) evas_key_lock_on (e, "Caps_Lock"); | ||
619 | else evas_key_lock_off(e, "Caps_Lock"); | ||
620 | } | ||
621 | |||
622 | static void | ||
623 | _ecore_evas_extn_cb_mouse_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
624 | { | ||
625 | Ecore_Evas *ee = data; | ||
626 | Evas_Event_Mouse_In *ev = event_info; | ||
627 | Extn *extn; | ||
628 | |||
629 | extn = ee->engine.buffer.data; | ||
630 | if (!extn) return; | ||
631 | if (extn->ipc.server) | ||
632 | { | ||
633 | Ipc_Data_Ev_Mouse_In ipc; | ||
634 | |||
635 | ipc.timestamp = ev->timestamp; | ||
636 | ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); | ||
637 | ipc.event_flags = ev->event_flags; | ||
638 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_IN, 0, 0, 0, &ipc, sizeof(ipc)); | ||
639 | } | ||
640 | } | ||
641 | |||
642 | static void | ||
643 | _ecore_evas_extn_cb_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
644 | { | ||
645 | Ecore_Evas *ee = data; | ||
646 | Evas_Event_Mouse_Out *ev = event_info; | ||
647 | Extn *extn; | ||
648 | |||
649 | extn = ee->engine.buffer.data; | ||
650 | if (!extn) return; | ||
651 | if (extn->ipc.server) | ||
652 | { | ||
653 | Ipc_Data_Ev_Mouse_Out ipc; | ||
654 | |||
655 | ipc.timestamp = ev->timestamp; | ||
656 | ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); | ||
657 | ipc.event_flags = ev->event_flags; | ||
658 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_OUT, 0, 0, 0, &ipc, sizeof(ipc)); | ||
659 | } | ||
660 | } | ||
661 | |||
662 | static void | ||
663 | _ecore_evas_extn_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
664 | { | ||
665 | Ecore_Evas *ee = data; | ||
666 | Evas_Event_Mouse_Down *ev = event_info; | ||
667 | Extn *extn; | ||
668 | |||
669 | extn = ee->engine.buffer.data; | ||
670 | if (!extn) return; | ||
671 | if (extn->ipc.server) | ||
672 | { | ||
673 | Ipc_Data_Ev_Mouse_Down ipc; | ||
674 | |||
675 | ipc.b = ev->button; | ||
676 | ipc.flags = ev->flags; | ||
677 | ipc.timestamp = ev->timestamp; | ||
678 | ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); | ||
679 | ipc.event_flags = ev->event_flags; | ||
680 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_DOWN, 0, 0, 0, &ipc, sizeof(ipc)); | ||
681 | } | ||
682 | } | ||
683 | |||
684 | static void | ||
685 | _ecore_evas_extn_cb_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
686 | { | ||
687 | Ecore_Evas *ee = data; | ||
688 | Evas_Event_Mouse_Up *ev = event_info; | ||
689 | Extn *extn; | ||
690 | |||
691 | extn = ee->engine.buffer.data; | ||
692 | if (!extn) return; | ||
693 | if (extn->ipc.server) | ||
694 | { | ||
695 | Ipc_Data_Ev_Mouse_Up ipc; | ||
696 | |||
697 | ipc.b = ev->button; | ||
698 | ipc.flags = ev->flags; | ||
699 | ipc.timestamp = ev->timestamp; | ||
700 | ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); | ||
701 | ipc.event_flags = ev->event_flags; | ||
702 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_UP, 0, 0, 0, &ipc, sizeof(ipc)); | ||
703 | } | ||
704 | } | ||
705 | |||
706 | static void | ||
707 | _ecore_evas_extn_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
708 | { | ||
709 | Ecore_Evas *ee = data; | ||
710 | Evas_Event_Mouse_Move *ev = event_info; | ||
711 | Extn *extn; | ||
712 | |||
713 | extn = ee->engine.buffer.data; | ||
714 | if (!extn) return; | ||
715 | if (extn->ipc.server) | ||
716 | { | ||
717 | Ipc_Data_Ev_Mouse_Move ipc; | ||
718 | Evas_Coord x, y; | ||
719 | |||
720 | x = ev->cur.canvas.x; | ||
721 | y = ev->cur.canvas.y; | ||
722 | _ecore_evas_extn_coord_translate(ee, &x, &y); | ||
723 | ipc.x = x; | ||
724 | ipc.y = y; | ||
725 | ipc.timestamp = ev->timestamp; | ||
726 | ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); | ||
727 | ipc.event_flags = ev->event_flags; | ||
728 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_MOVE, 0, 0, 0, &ipc, sizeof(ipc)); | ||
729 | } | ||
730 | } | ||
731 | |||
732 | static void | ||
733 | _ecore_evas_extn_cb_mouse_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
734 | { | ||
735 | Ecore_Evas *ee = data; | ||
736 | Evas_Event_Mouse_Wheel *ev = event_info; | ||
737 | Extn *extn; | ||
738 | |||
739 | extn = ee->engine.buffer.data; | ||
740 | if (!extn) return; | ||
741 | if (extn->ipc.server) | ||
742 | { | ||
743 | Ipc_Data_Ev_Mouse_Wheel ipc; | ||
744 | |||
745 | ipc.direction = ev->direction; | ||
746 | ipc.z = ev->z; | ||
747 | ipc.timestamp = ev->timestamp; | ||
748 | ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); | ||
749 | ipc.event_flags = ev->event_flags; | ||
750 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MOUSE_WHEEL, 0, 0, 0, &ipc, sizeof(ipc)); | ||
751 | } | ||
752 | } | ||
753 | |||
754 | static void | ||
755 | _ecore_evas_extn_cb_multi_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
756 | { | ||
757 | Ecore_Evas *ee = data; | ||
758 | Evas_Event_Multi_Down *ev = event_info; | ||
759 | Extn *extn; | ||
760 | |||
761 | extn = ee->engine.buffer.data; | ||
762 | if (!extn) return; | ||
763 | if (extn->ipc.server) | ||
764 | { | ||
765 | Ipc_Data_Ev_Multi_Down ipc; | ||
766 | Evas_Coord x, y; | ||
767 | |||
768 | ipc.d = ev->device; | ||
769 | x = ev->canvas.x; | ||
770 | y = ev->canvas.y; | ||
771 | _ecore_evas_extn_coord_translate(ee, &x, &y); | ||
772 | ipc.x = x; | ||
773 | ipc.y = y; | ||
774 | ipc.rad = ev->radius; | ||
775 | ipc.radx = ev->radius_x; | ||
776 | ipc.rady = ev->radius_y; | ||
777 | ipc.pres = ev->pressure; | ||
778 | ipc.ang = ev->angle; | ||
779 | ipc.fx = ev->canvas.xsub; | ||
780 | ipc.fy = ev->canvas.ysub; | ||
781 | ipc.flags = ev->flags; | ||
782 | ipc.timestamp = ev->timestamp; | ||
783 | ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); | ||
784 | ipc.event_flags = ev->event_flags; | ||
785 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MULTI_DOWN, 0, 0, 0, &ipc, sizeof(ipc)); | ||
786 | } | ||
787 | } | ||
788 | |||
789 | |||
790 | static void | ||
791 | _ecore_evas_extn_cb_multi_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
792 | { | ||
793 | Ecore_Evas *ee = data; | ||
794 | Evas_Event_Multi_Up *ev = event_info; | ||
795 | Extn *extn; | ||
796 | |||
797 | extn = ee->engine.buffer.data; | ||
798 | if (!extn) return; | ||
799 | if (extn->ipc.server) | ||
800 | { | ||
801 | Ipc_Data_Ev_Multi_Up ipc; | ||
802 | Evas_Coord x, y; | ||
803 | |||
804 | ipc.d = ev->device; | ||
805 | x = ev->canvas.x; | ||
806 | y = ev->canvas.y; | ||
807 | _ecore_evas_extn_coord_translate(ee, &x, &y); | ||
808 | ipc.x = x; | ||
809 | ipc.y = y; | ||
810 | ipc.rad = ev->radius; | ||
811 | ipc.radx = ev->radius_x; | ||
812 | ipc.rady = ev->radius_y; | ||
813 | ipc.pres = ev->pressure; | ||
814 | ipc.ang = ev->angle; | ||
815 | ipc.fx = ev->canvas.xsub; | ||
816 | ipc.fy = ev->canvas.ysub; | ||
817 | ipc.flags = ev->flags; | ||
818 | ipc.timestamp = ev->timestamp; | ||
819 | ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); | ||
820 | ipc.event_flags = ev->event_flags; | ||
821 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MULTI_UP, 0, 0, 0, &ipc, sizeof(ipc)); | ||
822 | } | ||
823 | } | ||
824 | |||
825 | static void | ||
826 | _ecore_evas_extn_cb_multi_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
827 | { | ||
828 | Ecore_Evas *ee = data; | ||
829 | Evas_Event_Multi_Move *ev = event_info; | ||
830 | Extn *extn; | ||
831 | |||
832 | extn = ee->engine.buffer.data; | ||
833 | if (!extn) return; | ||
834 | if (extn->ipc.server) | ||
835 | { | ||
836 | Ipc_Data_Ev_Multi_Move ipc; | ||
837 | Evas_Coord x, y; | ||
838 | |||
839 | ipc.d = ev->device; | ||
840 | x = ev->cur.canvas.x; | ||
841 | y = ev->cur.canvas.y; | ||
842 | _ecore_evas_extn_coord_translate(ee, &x, &y); | ||
843 | ipc.x = x; | ||
844 | ipc.y = y; | ||
845 | ipc.rad = ev->radius; | ||
846 | ipc.radx = ev->radius_x; | ||
847 | ipc.rady = ev->radius_y; | ||
848 | ipc.pres = ev->pressure; | ||
849 | ipc.ang = ev->angle; | ||
850 | ipc.fx = ev->cur.canvas.xsub; | ||
851 | ipc.fy = ev->cur.canvas.ysub; | ||
852 | ipc.timestamp = ev->timestamp; | ||
853 | ipc.mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); | ||
854 | ipc.event_flags = ev->event_flags; | ||
855 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_MULTI_MOVE, 0, 0, 0, &ipc, sizeof(ipc)); | ||
856 | } | ||
857 | } | ||
858 | |||
859 | static void | ||
860 | _ecore_evas_extn_cb_free(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
861 | { | ||
862 | Ecore_Evas *ee; | ||
863 | |||
864 | ee = data; | ||
865 | if (ee->driver) _ecore_evas_free(ee); | ||
866 | } | ||
867 | |||
868 | static void | ||
869 | _ecore_evas_extn_cb_key_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
870 | { | ||
871 | Ecore_Evas *ee = data; | ||
872 | Evas_Event_Key_Down *ev = event_info; | ||
873 | Extn *extn; | ||
874 | |||
875 | extn = ee->engine.buffer.data; | ||
876 | if (!extn) return; | ||
877 | if (extn->ipc.server) | ||
878 | { | ||
879 | Ipc_Data_Ev_Key_Down *ipc; | ||
880 | char *st, *p; | ||
881 | int len = 0; | ||
882 | |||
883 | len = sizeof(Ipc_Data_Ev_Key_Down); | ||
884 | if (ev->key) len += strlen(ev->key) + 1; | ||
885 | if (ev->keyname) len += strlen(ev->keyname) + 1; | ||
886 | if (ev->string) len += strlen(ev->string) + 1; | ||
887 | if (ev->compose) len += strlen(ev->compose) + 1; | ||
888 | len += 1; | ||
889 | st = alloca(len); | ||
890 | ipc = (Ipc_Data_Ev_Key_Down *)st; | ||
891 | memset(st, 0, len); | ||
892 | p = st + sizeof(Ipc_Data_Ev_Key_Down); | ||
893 | if (ev->key) | ||
894 | { | ||
895 | strcpy(p, ev->key); | ||
896 | ipc->key = p - (long)st; | ||
897 | p += strlen(p) + 1; | ||
898 | } | ||
899 | if (ev->keyname) | ||
900 | { | ||
901 | strcpy(p, ev->keyname); | ||
902 | ipc->keyname = p - (long)st; | ||
903 | p += strlen(p) + 1; | ||
904 | } | ||
905 | if (ev->string) | ||
906 | { | ||
907 | strcpy(p, ev->string); | ||
908 | ipc->string = p - (long)st; | ||
909 | p += strlen(p) + 1; | ||
910 | } | ||
911 | if (ev->compose) | ||
912 | { | ||
913 | strcpy(p, ev->compose); | ||
914 | ipc->compose = p - (long)st; | ||
915 | p += strlen(p) + 1; | ||
916 | } | ||
917 | ipc->timestamp = ev->timestamp; | ||
918 | ipc->mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); | ||
919 | ipc->event_flags = ev->event_flags; | ||
920 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_KEY_DOWN, 0, 0, 0, ipc, len); | ||
921 | } | ||
922 | } | ||
923 | |||
924 | static void | ||
925 | _ecore_evas_extn_cb_key_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
926 | { | ||
927 | Ecore_Evas *ee = data; | ||
928 | Evas_Event_Key_Up *ev = event_info; | ||
929 | Extn *extn; | ||
930 | |||
931 | extn = ee->engine.buffer.data; | ||
932 | if (!extn) return; | ||
933 | if (extn->ipc.server) | ||
934 | { | ||
935 | Ipc_Data_Ev_Key_Up *ipc; | ||
936 | char *st, *p; | ||
937 | int len = 0; | ||
938 | |||
939 | len = sizeof(Ipc_Data_Ev_Key_Up); | ||
940 | if (ev->key) len += strlen(ev->key) + 1; | ||
941 | if (ev->keyname) len += strlen(ev->keyname) + 1; | ||
942 | if (ev->string) len += strlen(ev->string) + 1; | ||
943 | if (ev->compose) len += strlen(ev->compose) + 1; | ||
944 | len += 1; | ||
945 | st = alloca(len); | ||
946 | ipc = (Ipc_Data_Ev_Key_Up *)st; | ||
947 | memset(st, 0, len); | ||
948 | p = st + sizeof(Ipc_Data_Ev_Key_Down); | ||
949 | if (ev->key) | ||
950 | { | ||
951 | strcpy(p, ev->key); | ||
952 | ipc->key = p - (long)st; | ||
953 | p += strlen(p) + 1; | ||
954 | } | ||
955 | if (ev->keyname) | ||
956 | { | ||
957 | strcpy(p, ev->keyname); | ||
958 | ipc->keyname = p - (long)st; | ||
959 | p += strlen(p) + 1; | ||
960 | } | ||
961 | if (ev->string) | ||
962 | { | ||
963 | strcpy(p, ev->string); | ||
964 | ipc->string = p - (long)st; | ||
965 | p += strlen(p) + 1; | ||
966 | } | ||
967 | if (ev->compose) | ||
968 | { | ||
969 | strcpy(p, ev->compose); | ||
970 | ipc->compose = p - (long)st; | ||
971 | p += strlen(p) + 1; | ||
972 | } | ||
973 | ipc->timestamp = ev->timestamp; | ||
974 | ipc->mask = _ecore_evas_modifiers_locks_mask_get(ee->evas); | ||
975 | ipc->event_flags = ev->event_flags; | ||
976 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_KEY_UP, 0, 0, 0, ipc, len); | ||
977 | } | ||
978 | } | ||
979 | |||
980 | static void | ||
981 | _ecore_evas_extn_cb_hold(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) | ||
982 | { | ||
983 | Ecore_Evas *ee = data; | ||
984 | Evas_Event_Hold *ev = event_info; | ||
985 | Extn *extn; | ||
986 | |||
987 | extn = ee->engine.buffer.data; | ||
988 | if (!extn) return; | ||
989 | if (extn->ipc.server) | ||
990 | { | ||
991 | Ipc_Data_Ev_Hold ipc; | ||
992 | |||
993 | ipc.hold = ev->hold; | ||
994 | ipc.timestamp = ev->timestamp; | ||
995 | ipc.event_flags = ev->event_flags; | ||
996 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_EV_HOLD, 0, 0, 0, &ipc, sizeof(ipc)); | ||
997 | } | ||
998 | } | ||
999 | |||
1000 | static void | ||
1001 | _ecore_evas_extn_cb_focus_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
1002 | { | ||
1003 | Ecore_Evas *ee; | ||
1004 | Extn *extn; | ||
1005 | |||
1006 | ee = data; | ||
1007 | ee->prop.focused = 1; | ||
1008 | extn = ee->engine.buffer.data; | ||
1009 | if (!extn) return; | ||
1010 | if (!extn->ipc.server) return; | ||
1011 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_FOCUS, 0, 0, 0, NULL, 0); | ||
1012 | } | ||
1013 | |||
1014 | static void | ||
1015 | _ecore_evas_extn_cb_focus_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
1016 | { | ||
1017 | Ecore_Evas *ee; | ||
1018 | Extn *extn; | ||
1019 | |||
1020 | ee = data; | ||
1021 | ee->prop.focused = 0; | ||
1022 | extn = ee->engine.buffer.data; | ||
1023 | if (!extn) return; | ||
1024 | if (!extn->ipc.server) return; | ||
1025 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_UNFOCUS, 0, 0, 0, NULL, 0); | ||
1026 | } | ||
1027 | |||
1028 | static void | ||
1029 | _ecore_evas_extn_cb_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
1030 | { | ||
1031 | Ecore_Evas *ee; | ||
1032 | Extn *extn; | ||
1033 | |||
1034 | ee = data; | ||
1035 | ee->visible = 1; | ||
1036 | extn = ee->engine.buffer.data; | ||
1037 | if (!extn) return; | ||
1038 | if (!extn->ipc.server) return; | ||
1039 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_SHOW, 0, 0, 0, NULL, 0); | ||
1040 | } | ||
1041 | |||
1042 | static void | ||
1043 | _ecore_evas_extn_cb_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) | ||
1044 | { | ||
1045 | Ecore_Evas *ee; | ||
1046 | Extn *extn; | ||
1047 | |||
1048 | ee = data; | ||
1049 | ee->visible = 0; | ||
1050 | extn = ee->engine.buffer.data; | ||
1051 | if (!extn) return; | ||
1052 | if (!extn->ipc.server) return; | ||
1053 | ecore_ipc_server_send(extn->ipc.server, MAJOR, OP_HIDE, 0, 0, 0, NULL, 0); | ||
1054 | } | ||
1055 | |||
1056 | static const Ecore_Evas_Engine_Func _ecore_extn_plug_engine_func = | ||
1057 | { | ||
1058 | _ecore_evas_extn_free, | ||
1059 | NULL, | ||
1060 | NULL, | ||
1061 | NULL, | ||
1062 | NULL, | ||
1063 | NULL, | ||
1064 | NULL, | ||
1065 | NULL, | ||
1066 | NULL, | ||
1067 | NULL, | ||
1068 | NULL, | ||
1069 | NULL, | ||
1070 | NULL, | ||
1071 | NULL, | ||
1072 | NULL, | ||
1073 | NULL, | ||
1074 | NULL, | ||
1075 | _ecore_evas_resize, | ||
1076 | _ecore_evas_move_resize, | ||
1077 | NULL, | ||
1078 | NULL, | ||
1079 | NULL, | ||
1080 | NULL, | ||
1081 | NULL, | ||
1082 | NULL, | ||
1083 | NULL, | ||
1084 | NULL, | ||
1085 | NULL, | ||
1086 | NULL, | ||
1087 | NULL, | ||
1088 | NULL, | ||
1089 | NULL, | ||
1090 | NULL, | ||
1091 | NULL, | ||
1092 | NULL, | ||
1093 | NULL, | ||
1094 | NULL, | ||
1095 | NULL, | ||
1096 | NULL, | ||
1097 | NULL, | ||
1098 | NULL, | ||
1099 | NULL, | ||
1100 | NULL, | ||
1101 | NULL, | ||
1102 | NULL, | ||
1103 | NULL, //transparent | ||
1104 | |||
1105 | NULL, // render | ||
1106 | NULL // screen_geometry_get | ||
1107 | }; | ||
1108 | |||
1109 | static Eina_Bool | ||
1110 | _ipc_server_add(void *data, int type __UNUSED__, void *event) | ||
1111 | { | ||
1112 | Ecore_Ipc_Event_Server_Add *e = event; | ||
1113 | Ecore_Evas *ee = data; | ||
1114 | Extn *extn; | ||
1115 | |||
1116 | if (ee != ecore_ipc_server_data_get(e->server)) | ||
1117 | return ECORE_CALLBACK_PASS_ON; | ||
1118 | if (!eina_list_data_find(extn_ee_list, ee)) | ||
1119 | return ECORE_CALLBACK_PASS_ON; | ||
1120 | extn = ee->engine.buffer.data; | ||
1121 | if (!extn) return ECORE_CALLBACK_PASS_ON; | ||
1122 | //FIXME: find a way to let app know server there | ||
1123 | return ECORE_CALLBACK_PASS_ON; | ||
1124 | } | ||
1125 | |||
1126 | static Eina_Bool | ||
1127 | _ipc_server_del(void *data, int type __UNUSED__, void *event) | ||
1128 | { | ||
1129 | Ecore_Ipc_Event_Server_Del *e = event; | ||
1130 | Ecore_Evas *ee = data; | ||
1131 | Extn *extn; | ||
1132 | |||
1133 | extn = ee->engine.buffer.data; | ||
1134 | if (!extn) return ECORE_CALLBACK_PASS_ON; | ||
1135 | if (extn->ipc.server != e->server) return ECORE_CALLBACK_PASS_ON; | ||
1136 | evas_object_image_data_set(ee->engine.buffer.image, NULL); | ||
1137 | ee->engine.buffer.pixels = NULL; | ||
1138 | if (extn->file.shmfile) | ||
1139 | { | ||
1140 | shmfile_close(extn->file.shmfile); | ||
1141 | extn->file.shmfile = NULL; | ||
1142 | } | ||
1143 | if (extn->file.shm) | ||
1144 | { | ||
1145 | eina_stringshare_del(extn->file.shm); | ||
1146 | extn->file.shm = NULL; | ||
1147 | } | ||
1148 | extn->ipc.server = NULL; | ||
1149 | if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee); | ||
1150 | return ECORE_CALLBACK_PASS_ON; | ||
1151 | } | ||
1152 | |||
1153 | static Eina_Bool | ||
1154 | _ipc_server_data(void *data, int type __UNUSED__, void *event) | ||
1155 | { | ||
1156 | Ecore_Ipc_Event_Server_Data *e = event; | ||
1157 | Ecore_Evas *ee = data; | ||
1158 | Extn *extn; | ||
1159 | |||
1160 | if (ee != ecore_ipc_server_data_get(e->server)) | ||
1161 | return ECORE_CALLBACK_PASS_ON; | ||
1162 | if (!eina_list_data_find(extn_ee_list, ee)) | ||
1163 | return ECORE_CALLBACK_PASS_ON; | ||
1164 | extn = ee->engine.buffer.data; | ||
1165 | if (!extn) return ECORE_CALLBACK_PASS_ON; | ||
1166 | if (e->major != MAJOR) | ||
1167 | return ECORE_CALLBACK_PASS_ON; | ||
1168 | switch (e->minor) | ||
1169 | { | ||
1170 | case OP_UPDATE: | ||
1171 | // add rect to update list | ||
1172 | if (e->size >= (int)sizeof(Ipc_Data_Update)) | ||
1173 | { | ||
1174 | Ipc_Data_Update *ipc = malloc(sizeof(Ipc_Data_Update)); | ||
1175 | if (ipc) | ||
1176 | { | ||
1177 | memcpy(ipc, e->data, sizeof(Ipc_Data_Update)); | ||
1178 | extn->file.updates = eina_list_append(extn->file.updates, ipc); | ||
1179 | } | ||
1180 | } | ||
1181 | break; | ||
1182 | case OP_UPDATE_DONE: | ||
1183 | // updates finished being sent - done now. frame ready | ||
1184 | { | ||
1185 | Ipc_Data_Update *ipc; | ||
1186 | |||
1187 | EINA_LIST_FREE(extn->file.updates, ipc) | ||
1188 | { | ||
1189 | if (ee->engine.buffer.image) | ||
1190 | evas_object_image_data_update_add(ee->engine.buffer.image, | ||
1191 | ipc->x, ipc->y, | ||
1192 | ipc->w, ipc->h); | ||
1193 | } | ||
1194 | } | ||
1195 | break; | ||
1196 | case OP_LOCK_FILE: | ||
1197 | if ((e->data) && (e->size > 0) && | ||
1198 | (((unsigned char *)e->data)[e->size - 1] == 0)) | ||
1199 | { | ||
1200 | if (extn->file.lockfd) close(extn->file.lockfd); | ||
1201 | if (extn->file.lock) eina_stringshare_del(extn->file.lock); | ||
1202 | extn->file.lock = eina_stringshare_add(e->data); | ||
1203 | extn->file.lockfd = open(extn->file.lock, O_RDONLY); | ||
1204 | } | ||
1205 | break; | ||
1206 | case OP_SHM_REF: | ||
1207 | // e->ref == w | ||
1208 | // e->ref_to == h | ||
1209 | // e->response == alpha | ||
1210 | // e->data = shm ref string + nul byte | ||
1211 | if ((e->data) && ((unsigned char *)e->data)[e->size - 1] == 0) | ||
1212 | { | ||
1213 | ee->engine.buffer.pixels = NULL; | ||
1214 | if (extn->file.shmfile) | ||
1215 | { | ||
1216 | shmfile_close(extn->file.shmfile); | ||
1217 | extn->file.shmfile = NULL; | ||
1218 | } | ||
1219 | if (extn->file.shm) | ||
1220 | { | ||
1221 | eina_stringshare_del(extn->file.shm); | ||
1222 | extn->file.shm = NULL; | ||
1223 | } | ||
1224 | if ((e->ref > 0) && (e->ref_to > 0)) | ||
1225 | { | ||
1226 | extn->file.w = e->ref; | ||
1227 | extn->file.h = e->ref_to; | ||
1228 | extn->file.shm = eina_stringshare_add(e->data); | ||
1229 | extn->file.shmfile = shmfile_open(extn->file.shm, | ||
1230 | extn->file.w * | ||
1231 | extn->file.h * 4, | ||
1232 | EINA_TRUE); | ||
1233 | if (extn->file.shmfile) | ||
1234 | { | ||
1235 | ee->engine.buffer.pixels = extn->file.shmfile->addr; | ||
1236 | if (ee->engine.buffer.image) | ||
1237 | { | ||
1238 | if (e->response) | ||
1239 | evas_object_image_alpha_set(ee->engine.buffer.image, | ||
1240 | EINA_TRUE); | ||
1241 | else | ||
1242 | evas_object_image_alpha_set(ee->engine.buffer.image, | ||
1243 | EINA_FALSE); | ||
1244 | evas_object_image_size_set(ee->engine.buffer.image, | ||
1245 | extn->file.w, | ||
1246 | extn->file.h); | ||
1247 | evas_object_image_data_set(ee->engine.buffer.image, | ||
1248 | ee->engine.buffer.pixels); | ||
1249 | evas_object_image_data_update_add(ee->engine.buffer.image, | ||
1250 | 0, 0, | ||
1251 | extn->file.w, | ||
1252 | extn->file.h); | ||
1253 | _ecore_evas_resize(ee, | ||
1254 | extn->file.w, | ||
1255 | extn->file.h); | ||
1256 | } | ||
1257 | else | ||
1258 | evas_object_image_data_set(ee->engine.buffer.image, NULL); | ||
1259 | } | ||
1260 | else | ||
1261 | evas_object_image_data_set(ee->engine.buffer.image, NULL); | ||
1262 | } | ||
1263 | else | ||
1264 | evas_object_image_data_set(ee->engine.buffer.image, NULL); | ||
1265 | } | ||
1266 | break; | ||
1267 | case OP_RESIZE: | ||
1268 | if ((e->data) && (e->size >= (int)sizeof(Ipc_Data_Resize))) | ||
1269 | { | ||
1270 | Ipc_Data_Resize *ipc = e->data; | ||
1271 | _ecore_evas_resize(ee, ipc->w, ipc->h); | ||
1272 | } | ||
1273 | break; | ||
1274 | default: | ||
1275 | break; | ||
1276 | } | ||
1277 | return ECORE_CALLBACK_PASS_ON; | ||
1278 | } | ||
1279 | #else | ||
1280 | void | ||
1281 | _ecore_evas_extn_init(void) | ||
1282 | { | ||
1283 | } | ||
1284 | |||
1285 | void | ||
1286 | _ecore_evas_extn_shutdown(void) | ||
1287 | { | ||
1288 | } | ||
1289 | #endif | ||
1290 | |||
1291 | EAPI Evas_Object * | ||
1292 | ecore_evas_extn_plug_new(Ecore_Evas *ee_target) | ||
1293 | { | ||
1294 | #ifdef EXTN_ENABLED | ||
1295 | Evas_Object *o; | ||
1296 | Ecore_Evas *ee; | ||
1297 | int w = 1, h = 1; | ||
1298 | |||
1299 | if (!ee_target) return NULL; | ||
1300 | |||
1301 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
1302 | if (!ee) return NULL; | ||
1303 | |||
1304 | o = evas_object_image_filled_add(ee_target->evas); | ||
1305 | evas_object_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); | ||
1306 | evas_object_image_colorspace_set(o, EVAS_COLORSPACE_ARGB8888); | ||
1307 | evas_object_image_alpha_set(o, 1); | ||
1308 | evas_object_image_size_set(o, 1, 1); | ||
1309 | evas_object_image_data_set(o, &blank); | ||
1310 | |||
1311 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
1312 | |||
1313 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_extn_plug_engine_func; | ||
1314 | |||
1315 | ee->driver = "extn_plug"; | ||
1316 | |||
1317 | ee->rotation = 0; | ||
1318 | ee->visible = 0; | ||
1319 | ee->w = w; | ||
1320 | ee->h = h; | ||
1321 | ee->req.w = ee->w; | ||
1322 | ee->req.h = ee->h; | ||
1323 | |||
1324 | ee->prop.max.w = 0; | ||
1325 | ee->prop.max.h = 0; | ||
1326 | ee->prop.layer = 0; | ||
1327 | ee->prop.focused = 0; | ||
1328 | ee->prop.borderless = 1; | ||
1329 | ee->prop.override = 1; | ||
1330 | ee->prop.maximized = 0; | ||
1331 | ee->prop.fullscreen = 0; | ||
1332 | ee->prop.withdrawn = 0; | ||
1333 | ee->prop.sticky = 0; | ||
1334 | |||
1335 | ee->engine.buffer.image = o; | ||
1336 | evas_object_data_set(ee->engine.buffer.image, "Ecore_Evas", ee); | ||
1337 | evas_object_data_set(ee->engine.buffer.image, "Ecore_Evas_Parent", ee_target); | ||
1338 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1339 | EVAS_CALLBACK_MOUSE_IN, | ||
1340 | _ecore_evas_extn_cb_mouse_in, ee); | ||
1341 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1342 | EVAS_CALLBACK_MOUSE_OUT, | ||
1343 | _ecore_evas_extn_cb_mouse_out, ee); | ||
1344 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1345 | EVAS_CALLBACK_MOUSE_DOWN, | ||
1346 | _ecore_evas_extn_cb_mouse_down, ee); | ||
1347 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1348 | EVAS_CALLBACK_MOUSE_UP, | ||
1349 | _ecore_evas_extn_cb_mouse_up, ee); | ||
1350 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1351 | EVAS_CALLBACK_MOUSE_MOVE, | ||
1352 | _ecore_evas_extn_cb_mouse_move, ee); | ||
1353 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1354 | EVAS_CALLBACK_MOUSE_WHEEL, | ||
1355 | _ecore_evas_extn_cb_mouse_wheel, ee); | ||
1356 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1357 | EVAS_CALLBACK_MULTI_DOWN, | ||
1358 | _ecore_evas_extn_cb_multi_down, ee); | ||
1359 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1360 | EVAS_CALLBACK_MULTI_UP, | ||
1361 | _ecore_evas_extn_cb_multi_up, ee); | ||
1362 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1363 | EVAS_CALLBACK_MULTI_MOVE, | ||
1364 | _ecore_evas_extn_cb_multi_move, ee); | ||
1365 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1366 | EVAS_CALLBACK_FREE, | ||
1367 | _ecore_evas_extn_cb_free, ee); | ||
1368 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1369 | EVAS_CALLBACK_KEY_DOWN, | ||
1370 | _ecore_evas_extn_cb_key_down, ee); | ||
1371 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1372 | EVAS_CALLBACK_KEY_UP, | ||
1373 | _ecore_evas_extn_cb_key_up, ee); | ||
1374 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1375 | EVAS_CALLBACK_HOLD, | ||
1376 | _ecore_evas_extn_cb_hold, ee); | ||
1377 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1378 | EVAS_CALLBACK_FOCUS_IN, | ||
1379 | _ecore_evas_extn_cb_focus_in, ee); | ||
1380 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1381 | EVAS_CALLBACK_FOCUS_OUT, | ||
1382 | _ecore_evas_extn_cb_focus_out, ee); | ||
1383 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1384 | EVAS_CALLBACK_SHOW, | ||
1385 | _ecore_evas_extn_cb_show, ee); | ||
1386 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1387 | EVAS_CALLBACK_HIDE, | ||
1388 | _ecore_evas_extn_cb_hide, ee); | ||
1389 | |||
1390 | evas_object_event_callback_add(ee->engine.buffer.image, | ||
1391 | EVAS_CALLBACK_DEL, | ||
1392 | _ecore_evas_extn_plug_image_obj_del, ee); | ||
1393 | |||
1394 | |||
1395 | extn_ee_list = eina_list_append(extn_ee_list, ee); | ||
1396 | ee_target->sub_ecore_evas = eina_list_append(ee_target->sub_ecore_evas, ee); | ||
1397 | |||
1398 | evas_event_callback_add(ee_target->evas, EVAS_CALLBACK_RENDER_PRE, | ||
1399 | _ecore_evas_extn_plug_targer_render_pre, ee); | ||
1400 | evas_event_callback_add(ee_target->evas, EVAS_CALLBACK_RENDER_POST, | ||
1401 | _ecore_evas_extn_plug_targer_render_post, ee); | ||
1402 | return o; | ||
1403 | #else | ||
1404 | return NULL; | ||
1405 | #endif | ||
1406 | } | ||
1407 | |||
1408 | EAPI Eina_Bool | ||
1409 | ecore_evas_extn_plug_connect(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys) | ||
1410 | { | ||
1411 | #ifdef EXTN_ENABLED | ||
1412 | Extn *extn; | ||
1413 | Ecore_Evas *ee = NULL; | ||
1414 | |||
1415 | if (!obj) return EINA_FALSE; | ||
1416 | |||
1417 | ee = evas_object_data_get(obj, "Ecore_Evas"); | ||
1418 | if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) return EINA_FALSE; | ||
1419 | |||
1420 | extn = calloc(1, sizeof(Extn)); | ||
1421 | if (!extn) return EINA_FALSE; | ||
1422 | |||
1423 | Ecore_Ipc_Type ipctype = ECORE_IPC_LOCAL_USER; | ||
1424 | |||
1425 | ecore_ipc_init(); | ||
1426 | extn->svc.name = eina_stringshare_add(svcname); | ||
1427 | extn->svc.num = svcnum; | ||
1428 | extn->svc.sys = svcsys; | ||
1429 | |||
1430 | if (extn->svc.sys) ipctype = ECORE_IPC_LOCAL_SYSTEM; | ||
1431 | extn->ipc.server = ecore_ipc_server_connect(ipctype, (char *)extn->svc.name, | ||
1432 | extn->svc.num, ee); | ||
1433 | if (!extn->ipc.server) | ||
1434 | { | ||
1435 | eina_stringshare_del(extn->svc.name); | ||
1436 | free(extn); | ||
1437 | ecore_ipc_shutdown(); | ||
1438 | return EINA_FALSE; | ||
1439 | } | ||
1440 | ee->engine.buffer.data = extn; | ||
1441 | extn->ipc.handlers = eina_list_append | ||
1442 | (extn->ipc.handlers, | ||
1443 | ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_ADD, | ||
1444 | _ipc_server_add, ee)); | ||
1445 | extn->ipc.handlers = eina_list_append | ||
1446 | (extn->ipc.handlers, | ||
1447 | ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL, | ||
1448 | _ipc_server_del, ee)); | ||
1449 | extn->ipc.handlers = eina_list_append | ||
1450 | (extn->ipc.handlers, | ||
1451 | ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA, | ||
1452 | _ipc_server_data, ee)); | ||
1453 | return EINA_TRUE; | ||
1454 | #else | ||
1455 | return EINA_FALSE; | ||
1456 | #endif | ||
1457 | } | ||
1458 | |||
1459 | EAPI void | ||
1460 | ecore_evas_extn_plug_object_data_lock(Evas_Object *obj) | ||
1461 | { | ||
1462 | #ifdef EXTN_ENABLED | ||
1463 | Ecore_Evas *ee; | ||
1464 | |||
1465 | ee = ecore_evas_object_ecore_evas_get(obj); | ||
1466 | if (!ee) return; | ||
1467 | _ecore_evas_socket_lock(ee); | ||
1468 | #endif | ||
1469 | } | ||
1470 | |||
1471 | EAPI void | ||
1472 | ecore_evas_extn_plug_object_data_unlock(Evas_Object *obj) | ||
1473 | { | ||
1474 | #ifdef EXTN_ENABLED | ||
1475 | Ecore_Evas *ee; | ||
1476 | |||
1477 | ee = ecore_evas_object_ecore_evas_get(obj); | ||
1478 | if (!ee) return; | ||
1479 | _ecore_evas_socket_unlock(ee); | ||
1480 | #endif | ||
1481 | } | ||
1482 | |||
1483 | #ifdef EXTN_ENABLED | ||
1484 | static void | ||
1485 | _ecore_evas_socket_resize(Ecore_Evas *ee, int w, int h) | ||
1486 | { | ||
1487 | Extn *extn; | ||
1488 | Evas_Engine_Info_Buffer *einfo; | ||
1489 | int stride = 0; | ||
1490 | |||
1491 | if (w < 1) w = 1; | ||
1492 | if (h < 1) h = 1; | ||
1493 | ee->req.w = w; | ||
1494 | ee->req.h = h; | ||
1495 | if ((w == ee->w) && (h == ee->h)) return; | ||
1496 | ee->w = w; | ||
1497 | ee->h = h; | ||
1498 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
1499 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
1500 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1501 | extn = ee->engine.buffer.data; | ||
1502 | if (extn) | ||
1503 | { | ||
1504 | if (extn->file.shmfile) | ||
1505 | shmfile_free(extn->file.shmfile); | ||
1506 | ee->engine.buffer.pixels = NULL; | ||
1507 | extn->file.shmfile = shmfile_new(extn->svc.name, extn->svc.num, | ||
1508 | ee->w * ee->h * 4, extn->svc.sys); | ||
1509 | if (extn->file.shmfile) | ||
1510 | ee->engine.buffer.pixels = extn->file.shmfile->addr; | ||
1511 | |||
1512 | stride = ee->w * 4; | ||
1513 | einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); | ||
1514 | if (einfo) | ||
1515 | { | ||
1516 | if (ee->alpha) | ||
1517 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; | ||
1518 | else | ||
1519 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32; | ||
1520 | einfo->info.dest_buffer = ee->engine.buffer.pixels; | ||
1521 | einfo->info.dest_buffer_row_bytes = stride; | ||
1522 | einfo->info.use_color_key = 0; | ||
1523 | einfo->info.alpha_threshold = 0; | ||
1524 | einfo->info.func.new_update_region = NULL; | ||
1525 | einfo->info.func.free_update_region = NULL; | ||
1526 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
1527 | { | ||
1528 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
1529 | } | ||
1530 | } | ||
1531 | |||
1532 | if (extn->ipc.clients && extn->file.shmfile) | ||
1533 | { | ||
1534 | Ipc_Data_Resize ipc; | ||
1535 | Eina_List *l; | ||
1536 | Ecore_Ipc_Client *client; | ||
1537 | |||
1538 | EINA_LIST_FOREACH(extn->ipc.clients, l, client) | ||
1539 | ecore_ipc_client_send(client, MAJOR, OP_SHM_REF, | ||
1540 | ee->w, ee->h, ee->alpha, | ||
1541 | extn->file.shmfile->file, | ||
1542 | strlen(extn->file.shmfile->file) + 1); | ||
1543 | ipc.w = ee->w; | ||
1544 | ipc.h = ee->h; | ||
1545 | EINA_LIST_FOREACH(extn->ipc.clients, l, client) | ||
1546 | ecore_ipc_client_send(client, MAJOR, OP_RESIZE, | ||
1547 | 0, 0, 0, &ipc, sizeof(ipc)); | ||
1548 | } | ||
1549 | } | ||
1550 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
1551 | } | ||
1552 | |||
1553 | static void | ||
1554 | _ecore_evas_socket_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h) | ||
1555 | { | ||
1556 | _ecore_evas_socket_resize(ee, w, h); | ||
1557 | } | ||
1558 | |||
1559 | int | ||
1560 | _ecore_evas_extn_socket_render(Ecore_Evas *ee) | ||
1561 | { | ||
1562 | Eina_List *updates = NULL, *l, *ll; | ||
1563 | Ecore_Evas *ee2; | ||
1564 | int rend = 0; | ||
1565 | Eina_Rectangle *r; | ||
1566 | Extn *extn; | ||
1567 | Ecore_Ipc_Client *client; | ||
1568 | |||
1569 | extn = ee->engine.buffer.data; | ||
1570 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
1571 | { | ||
1572 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
1573 | if (ee2->engine.func->fn_render) | ||
1574 | rend |= ee2->engine.func->fn_render(ee2); | ||
1575 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
1576 | } | ||
1577 | if (ee->engine.buffer.pixels) | ||
1578 | { | ||
1579 | _ecore_evas_socket_lock(ee); | ||
1580 | updates = evas_render_updates(ee->evas); | ||
1581 | _ecore_evas_socket_unlock(ee); | ||
1582 | } | ||
1583 | EINA_LIST_FOREACH(updates, l, r) | ||
1584 | { | ||
1585 | Ipc_Data_Update ipc; | ||
1586 | |||
1587 | |||
1588 | ipc.x = r->x; | ||
1589 | ipc.y = r->y; | ||
1590 | ipc.w = r->w; | ||
1591 | ipc.h = r->h; | ||
1592 | EINA_LIST_FOREACH(extn->ipc.clients, ll, client) | ||
1593 | ecore_ipc_client_send(client, MAJOR, OP_UPDATE, 0, 0, 0, &ipc, sizeof(ipc)); | ||
1594 | } | ||
1595 | if (updates) | ||
1596 | { | ||
1597 | evas_render_updates_free(updates); | ||
1598 | _ecore_evas_idle_timeout_update(ee); | ||
1599 | EINA_LIST_FOREACH(extn->ipc.clients, ll, client) | ||
1600 | ecore_ipc_client_send(client, MAJOR, OP_UPDATE_DONE, 0, 0, 0, NULL, 0); | ||
1601 | } | ||
1602 | |||
1603 | return updates ? 1 : rend; | ||
1604 | } | ||
1605 | |||
1606 | static Eina_Bool | ||
1607 | _ipc_client_add(void *data, int type __UNUSED__, void *event) | ||
1608 | { | ||
1609 | Ecore_Ipc_Event_Client_Add *e = event; | ||
1610 | Ecore_Evas *ee = data; | ||
1611 | Extn *extn; | ||
1612 | |||
1613 | if (ee != ecore_ipc_server_data_get(ecore_ipc_client_server_get(e->client))) | ||
1614 | return ECORE_CALLBACK_PASS_ON; | ||
1615 | if (!eina_list_data_find(extn_ee_list, ee)) | ||
1616 | return ECORE_CALLBACK_PASS_ON; | ||
1617 | extn = ee->engine.buffer.data; | ||
1618 | if (!extn) return ECORE_CALLBACK_PASS_ON; | ||
1619 | |||
1620 | extn->ipc.clients = eina_list_append(extn->ipc.clients, e->client); | ||
1621 | ecore_ipc_client_send(e->client, MAJOR, OP_LOCK_FILE, 0, 0, 0, extn->file.lock, strlen(extn->file.lock) + 1); | ||
1622 | |||
1623 | if (extn->file.shmfile) | ||
1624 | { | ||
1625 | Ipc_Data_Resize ipc; | ||
1626 | |||
1627 | ecore_ipc_client_send(e->client, MAJOR, OP_SHM_REF, | ||
1628 | ee->w, ee->h, ee->alpha, | ||
1629 | extn->file.shmfile->file, | ||
1630 | strlen(extn->file.shmfile->file) + 1); | ||
1631 | ipc.w = ee->w; | ||
1632 | ipc.h = ee->h; | ||
1633 | |||
1634 | ecore_ipc_client_send(e->client, MAJOR, OP_RESIZE, | ||
1635 | 0, 0, 0, &ipc, sizeof(ipc)); | ||
1636 | } | ||
1637 | _ecore_evas_extn_event(ee, ECORE_EVAS_EXTN_CLIENT_ADD); | ||
1638 | return ECORE_CALLBACK_PASS_ON; | ||
1639 | } | ||
1640 | |||
1641 | static Eina_Bool | ||
1642 | _ipc_client_del(void *data, int type __UNUSED__, void *event) | ||
1643 | { | ||
1644 | Ecore_Ipc_Event_Client_Del *e = event; | ||
1645 | Ecore_Evas *ee = data; | ||
1646 | Extn *extn; | ||
1647 | extn = ee->engine.buffer.data; | ||
1648 | if (!extn) return ECORE_CALLBACK_PASS_ON; | ||
1649 | if (!eina_list_data_find(extn->ipc.clients, e->client)) return ECORE_CALLBACK_PASS_ON; | ||
1650 | |||
1651 | extn->ipc.clients = eina_list_remove(extn->ipc.clients, e->client); | ||
1652 | |||
1653 | _ecore_evas_extn_event(ee, ECORE_EVAS_EXTN_CLIENT_DEL); | ||
1654 | return ECORE_CALLBACK_PASS_ON; | ||
1655 | } | ||
1656 | |||
1657 | static Eina_Bool | ||
1658 | _ipc_client_data(void *data, int type __UNUSED__, void *event) | ||
1659 | { | ||
1660 | Ecore_Ipc_Event_Client_Data *e = event; | ||
1661 | Ecore_Evas *ee = data; | ||
1662 | Extn *extn; | ||
1663 | |||
1664 | if (ee != ecore_ipc_server_data_get(ecore_ipc_client_server_get(e->client))) | ||
1665 | return ECORE_CALLBACK_PASS_ON; | ||
1666 | if (!eina_list_data_find(extn_ee_list, ee)) | ||
1667 | return ECORE_CALLBACK_PASS_ON; | ||
1668 | extn = ee->engine.buffer.data; | ||
1669 | if (!extn) return ECORE_CALLBACK_PASS_ON; | ||
1670 | if (e->major != MAJOR) | ||
1671 | return ECORE_CALLBACK_PASS_ON; | ||
1672 | switch (e->minor) | ||
1673 | { | ||
1674 | case OP_RESIZE: | ||
1675 | if ((e->data) && (e->size >= (int)sizeof(Ipc_Data_Resize))) | ||
1676 | { | ||
1677 | |||
1678 | Ipc_Data_Resize *ipc = e->data; | ||
1679 | /* create callbacke data size changed */ | ||
1680 | _ecore_evas_socket_resize(ee, ipc->w, ipc->h); | ||
1681 | } | ||
1682 | break; | ||
1683 | case OP_SHOW: | ||
1684 | if (!ee->visible) | ||
1685 | { | ||
1686 | ee->visible = 1; | ||
1687 | if (ee->func.fn_show) ee->func.fn_show(ee); | ||
1688 | } | ||
1689 | break; | ||
1690 | case OP_HIDE: | ||
1691 | if (ee->visible) | ||
1692 | { | ||
1693 | ee->visible = 0; | ||
1694 | if (ee->func.fn_hide) ee->func.fn_hide(ee); | ||
1695 | } | ||
1696 | break; | ||
1697 | case OP_FOCUS: | ||
1698 | if (!ee->prop.focused) | ||
1699 | { | ||
1700 | ee->prop.focused = 1; | ||
1701 | evas_focus_in(ee->evas); | ||
1702 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
1703 | } | ||
1704 | break; | ||
1705 | case OP_UNFOCUS: | ||
1706 | if (ee->prop.focused) | ||
1707 | { | ||
1708 | ee->prop.focused = 0; | ||
1709 | evas_focus_out(ee->evas); | ||
1710 | if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); | ||
1711 | } | ||
1712 | break; | ||
1713 | case OP_EV_MOUSE_IN: | ||
1714 | if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_In)) | ||
1715 | { | ||
1716 | Ipc_Data_Ev_Mouse_In *ipc = e->data; | ||
1717 | Evas_Event_Flags flags; | ||
1718 | |||
1719 | flags = evas_event_default_flags_get(ee->evas); | ||
1720 | evas_event_default_flags_set(ee->evas, ipc->event_flags); | ||
1721 | _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); | ||
1722 | evas_event_feed_mouse_in(ee->evas, ipc->timestamp, NULL); | ||
1723 | evas_event_default_flags_set(ee->evas, flags); | ||
1724 | } | ||
1725 | break; | ||
1726 | case OP_EV_MOUSE_OUT: | ||
1727 | if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Out)) | ||
1728 | { | ||
1729 | Ipc_Data_Ev_Mouse_Out *ipc = e->data; | ||
1730 | Evas_Event_Flags flags; | ||
1731 | |||
1732 | flags = evas_event_default_flags_get(ee->evas); | ||
1733 | evas_event_default_flags_set(ee->evas, ipc->event_flags); | ||
1734 | _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); | ||
1735 | evas_event_feed_mouse_out(ee->evas, ipc->timestamp, NULL); | ||
1736 | evas_event_default_flags_set(ee->evas, flags); | ||
1737 | } | ||
1738 | break; | ||
1739 | case OP_EV_MOUSE_UP: | ||
1740 | if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Up)) | ||
1741 | { | ||
1742 | Ipc_Data_Ev_Mouse_Up *ipc = e->data; | ||
1743 | Evas_Event_Flags flags; | ||
1744 | |||
1745 | flags = evas_event_default_flags_get(ee->evas); | ||
1746 | evas_event_default_flags_set(ee->evas, ipc->event_flags); | ||
1747 | _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); | ||
1748 | evas_event_feed_mouse_up(ee->evas, ipc->b, ipc->flags, ipc->timestamp, NULL); | ||
1749 | evas_event_default_flags_set(ee->evas, flags); | ||
1750 | } | ||
1751 | break; | ||
1752 | case OP_EV_MOUSE_DOWN: | ||
1753 | if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Down)) | ||
1754 | { | ||
1755 | Ipc_Data_Ev_Mouse_Up *ipc = e->data; | ||
1756 | Evas_Event_Flags flags; | ||
1757 | |||
1758 | flags = evas_event_default_flags_get(ee->evas); | ||
1759 | evas_event_default_flags_set(ee->evas, ipc->event_flags); | ||
1760 | _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); | ||
1761 | evas_event_feed_mouse_down(ee->evas, ipc->b, ipc->flags, ipc->timestamp, NULL); | ||
1762 | evas_event_default_flags_set(ee->evas, flags); | ||
1763 | } | ||
1764 | break; | ||
1765 | case OP_EV_MOUSE_MOVE: | ||
1766 | if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Move)) | ||
1767 | { | ||
1768 | Ipc_Data_Ev_Mouse_Move *ipc = e->data; | ||
1769 | Evas_Event_Flags flags; | ||
1770 | |||
1771 | flags = evas_event_default_flags_get(ee->evas); | ||
1772 | evas_event_default_flags_set(ee->evas, ipc->event_flags); | ||
1773 | _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); | ||
1774 | evas_event_feed_mouse_move(ee->evas, ipc->x, ipc->y, ipc->timestamp, NULL); | ||
1775 | evas_event_default_flags_set(ee->evas, flags); | ||
1776 | } | ||
1777 | break; | ||
1778 | case OP_EV_MOUSE_WHEEL: | ||
1779 | if (e->size >= (int)sizeof(Ipc_Data_Ev_Mouse_Wheel)) | ||
1780 | { | ||
1781 | Ipc_Data_Ev_Mouse_Wheel *ipc = e->data; | ||
1782 | Evas_Event_Flags flags; | ||
1783 | |||
1784 | flags = evas_event_default_flags_get(ee->evas); | ||
1785 | evas_event_default_flags_set(ee->evas, ipc->event_flags); | ||
1786 | _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); | ||
1787 | evas_event_feed_mouse_wheel(ee->evas, ipc->direction, ipc->z, ipc->timestamp, NULL); | ||
1788 | evas_event_default_flags_set(ee->evas, flags); | ||
1789 | } | ||
1790 | break; | ||
1791 | case OP_EV_MULTI_UP: | ||
1792 | if (e->size >= (int)sizeof(Ipc_Data_Ev_Multi_Up)) | ||
1793 | { | ||
1794 | Ipc_Data_Ev_Multi_Up *ipc = e->data; | ||
1795 | Evas_Event_Flags flags; | ||
1796 | |||
1797 | flags = evas_event_default_flags_get(ee->evas); | ||
1798 | evas_event_default_flags_set(ee->evas, ipc->event_flags); | ||
1799 | _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); | ||
1800 | evas_event_feed_multi_up(ee->evas, ipc->d, ipc->x, ipc->y, ipc->rad, ipc->radx, ipc->rady, ipc->pres, ipc->ang, ipc->fx, ipc->fy, ipc->flags, ipc->timestamp, NULL); | ||
1801 | evas_event_default_flags_set(ee->evas, flags); | ||
1802 | } | ||
1803 | break; | ||
1804 | case OP_EV_MULTI_DOWN: | ||
1805 | if (e->size >= (int)sizeof(Ipc_Data_Ev_Multi_Down)) | ||
1806 | { | ||
1807 | Ipc_Data_Ev_Multi_Down *ipc = e->data; | ||
1808 | Evas_Event_Flags flags; | ||
1809 | |||
1810 | flags = evas_event_default_flags_get(ee->evas); | ||
1811 | evas_event_default_flags_set(ee->evas, ipc->event_flags); | ||
1812 | _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); | ||
1813 | evas_event_feed_multi_down(ee->evas, ipc->d, ipc->x, ipc->y, ipc->rad, ipc->radx, ipc->rady, ipc->pres, ipc->ang, ipc->fx, ipc->fy, ipc->flags, ipc->timestamp, NULL); | ||
1814 | evas_event_default_flags_set(ee->evas, flags); | ||
1815 | } | ||
1816 | break; | ||
1817 | case OP_EV_MULTI_MOVE: | ||
1818 | if (e->size >= (int)sizeof(Ipc_Data_Ev_Multi_Move)) | ||
1819 | { | ||
1820 | Ipc_Data_Ev_Multi_Move *ipc = e->data; | ||
1821 | Evas_Event_Flags flags; | ||
1822 | |||
1823 | flags = evas_event_default_flags_get(ee->evas); | ||
1824 | evas_event_default_flags_set(ee->evas, ipc->event_flags); | ||
1825 | _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); | ||
1826 | evas_event_feed_multi_move(ee->evas, ipc->d, ipc->x, ipc->y, ipc->rad, ipc->radx, ipc->rady, ipc->pres, ipc->ang, ipc->fx, ipc->fy, ipc->timestamp, NULL); | ||
1827 | evas_event_default_flags_set(ee->evas, flags); | ||
1828 | } | ||
1829 | break; | ||
1830 | |||
1831 | #define STRGET(val) \ | ||
1832 | do { \ | ||
1833 | if ((ipc->val) && (ipc->val < (char *)(e->size - 1))) \ | ||
1834 | ipc->val = ((char *)ipc) + (long)ipc->val; \ | ||
1835 | else \ | ||
1836 | ipc->val = NULL; \ | ||
1837 | } while (0) | ||
1838 | |||
1839 | case OP_EV_KEY_UP: | ||
1840 | if (e->size >= (int)sizeof(Ipc_Data_Ev_Key_Up)) | ||
1841 | { | ||
1842 | if ((e->data) && (e->size > 0) && | ||
1843 | (((unsigned char *)e->data)[e->size - 1] == 0)) | ||
1844 | { | ||
1845 | Ipc_Data_Ev_Key_Up *ipc = e->data; | ||
1846 | Evas_Event_Flags flags; | ||
1847 | |||
1848 | STRGET(keyname); | ||
1849 | STRGET(key); | ||
1850 | STRGET(string); | ||
1851 | STRGET(compose); | ||
1852 | flags = evas_event_default_flags_get(ee->evas); | ||
1853 | evas_event_default_flags_set(ee->evas, ipc->event_flags); | ||
1854 | _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); | ||
1855 | evas_event_feed_key_up(ee->evas, ipc->keyname, ipc->key, ipc->string, ipc->compose, ipc->timestamp, NULL); | ||
1856 | evas_event_default_flags_set(ee->evas, flags); | ||
1857 | } | ||
1858 | } | ||
1859 | break; | ||
1860 | case OP_EV_KEY_DOWN: | ||
1861 | if (e->size >= (int)sizeof(Ipc_Data_Ev_Key_Down)) | ||
1862 | { | ||
1863 | if ((e->data) && (e->size > 0) && | ||
1864 | (((unsigned char *)e->data)[e->size - 1] == 0)) | ||
1865 | { | ||
1866 | Ipc_Data_Ev_Key_Down *ipc = e->data; | ||
1867 | Evas_Event_Flags flags; | ||
1868 | |||
1869 | STRGET(keyname); | ||
1870 | STRGET(key); | ||
1871 | STRGET(string); | ||
1872 | STRGET(compose); | ||
1873 | flags = evas_event_default_flags_get(ee->evas); | ||
1874 | evas_event_default_flags_set(ee->evas, ipc->event_flags); | ||
1875 | _ecore_evas_modifiers_locks_mask_set(ee->evas, ipc->mask); | ||
1876 | evas_event_feed_key_down(ee->evas, ipc->keyname, ipc->key, ipc->string, ipc->compose, ipc->timestamp, NULL); | ||
1877 | evas_event_default_flags_set(ee->evas, flags); | ||
1878 | } | ||
1879 | } | ||
1880 | break; | ||
1881 | case OP_EV_HOLD: | ||
1882 | if (e->size >= (int)sizeof(Ipc_Data_Ev_Hold)) | ||
1883 | { | ||
1884 | Ipc_Data_Ev_Hold *ipc = e->data; | ||
1885 | Evas_Event_Flags flags; | ||
1886 | |||
1887 | flags = evas_event_default_flags_get(ee->evas); | ||
1888 | evas_event_default_flags_set(ee->evas, ipc->event_flags); | ||
1889 | evas_event_feed_hold(ee->evas, ipc->hold, ipc->timestamp, NULL); | ||
1890 | evas_event_default_flags_set(ee->evas, flags); | ||
1891 | } | ||
1892 | break; | ||
1893 | default: | ||
1894 | break; | ||
1895 | } | ||
1896 | return ECORE_CALLBACK_PASS_ON; | ||
1897 | } | ||
1898 | |||
1899 | static void | ||
1900 | _ecore_evas_extn_socket_alpha_set(Ecore_Evas *ee, int alpha) | ||
1901 | { | ||
1902 | Extn *extn; | ||
1903 | Eina_List *l; | ||
1904 | Ecore_Ipc_Client *client; | ||
1905 | |||
1906 | if (((ee->alpha) && (alpha)) || ((!ee->alpha) && (!alpha))) return; | ||
1907 | ee->alpha = alpha; | ||
1908 | |||
1909 | extn = ee->engine.buffer.data; | ||
1910 | if (extn) | ||
1911 | { | ||
1912 | Evas_Engine_Info_Buffer *einfo; | ||
1913 | |||
1914 | einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); | ||
1915 | if (einfo) | ||
1916 | { | ||
1917 | if (ee->alpha) | ||
1918 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; | ||
1919 | else | ||
1920 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32; | ||
1921 | evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); | ||
1922 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
1923 | } | ||
1924 | EINA_LIST_FOREACH(extn->ipc.clients, l, client) | ||
1925 | ecore_ipc_client_send(client, MAJOR, OP_SHM_REF, | ||
1926 | ee->w, ee->h, ee->alpha, | ||
1927 | extn->file.shmfile->file, | ||
1928 | strlen(extn->file.shmfile->file) + 1); | ||
1929 | } | ||
1930 | } | ||
1931 | |||
1932 | static const Ecore_Evas_Engine_Func _ecore_extn_socket_engine_func = | ||
1933 | { | ||
1934 | _ecore_evas_extn_free, | ||
1935 | NULL, | ||
1936 | NULL, | ||
1937 | NULL, | ||
1938 | NULL, | ||
1939 | NULL, | ||
1940 | NULL, | ||
1941 | NULL, | ||
1942 | NULL, | ||
1943 | NULL, | ||
1944 | NULL, | ||
1945 | NULL, | ||
1946 | NULL, | ||
1947 | NULL, | ||
1948 | NULL, | ||
1949 | NULL, | ||
1950 | NULL, | ||
1951 | _ecore_evas_socket_resize, | ||
1952 | _ecore_evas_socket_move_resize, | ||
1953 | NULL, | ||
1954 | NULL, | ||
1955 | NULL, | ||
1956 | NULL, | ||
1957 | NULL, | ||
1958 | NULL, | ||
1959 | NULL, | ||
1960 | NULL, | ||
1961 | NULL, | ||
1962 | NULL, | ||
1963 | NULL, | ||
1964 | NULL, | ||
1965 | NULL, | ||
1966 | NULL, | ||
1967 | NULL, | ||
1968 | NULL, | ||
1969 | NULL, | ||
1970 | NULL, | ||
1971 | NULL, | ||
1972 | NULL, | ||
1973 | NULL, | ||
1974 | NULL, | ||
1975 | NULL, | ||
1976 | NULL, | ||
1977 | NULL, | ||
1978 | _ecore_evas_extn_socket_alpha_set, | ||
1979 | NULL, //transparent | ||
1980 | |||
1981 | _ecore_evas_extn_socket_render, // render | ||
1982 | NULL // screen_geometry_get | ||
1983 | }; | ||
1984 | |||
1985 | #endif | ||
1986 | |||
1987 | EAPI Ecore_Evas * | ||
1988 | ecore_evas_extn_socket_new(int w, int h) | ||
1989 | { | ||
1990 | #ifdef EXTN_ENABLED | ||
1991 | Evas_Engine_Info_Buffer *einfo; | ||
1992 | Ecore_Evas *ee; | ||
1993 | int rmethod; | ||
1994 | |||
1995 | rmethod = evas_render_method_lookup("buffer"); | ||
1996 | if (!rmethod) return NULL; | ||
1997 | ee = calloc(1, sizeof(Ecore_Evas)); | ||
1998 | if (!ee) return NULL; | ||
1999 | |||
2000 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
2001 | |||
2002 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_extn_socket_engine_func; | ||
2003 | |||
2004 | ee->driver = "extn_socket"; | ||
2005 | |||
2006 | ee->rotation = 0; | ||
2007 | ee->visible = 0; | ||
2008 | ee->w = w; | ||
2009 | ee->h = h; | ||
2010 | ee->req.w = ee->w; | ||
2011 | ee->req.h = ee->h; | ||
2012 | |||
2013 | ee->prop.max.w = 0; | ||
2014 | ee->prop.max.h = 0; | ||
2015 | ee->prop.layer = 0; | ||
2016 | ee->prop.focused = 0; | ||
2017 | ee->prop.borderless = 1; | ||
2018 | ee->prop.override = 1; | ||
2019 | ee->prop.maximized = 0; | ||
2020 | ee->prop.fullscreen = 0; | ||
2021 | ee->prop.withdrawn = 0; | ||
2022 | ee->prop.sticky = 0; | ||
2023 | |||
2024 | /* init evas here */ | ||
2025 | ee->evas = evas_new(); | ||
2026 | evas_data_attach_set(ee->evas, ee); | ||
2027 | evas_output_method_set(ee->evas, rmethod); | ||
2028 | evas_output_size_set(ee->evas, w, h); | ||
2029 | evas_output_viewport_set(ee->evas, 0, 0, w, h); | ||
2030 | |||
2031 | einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); | ||
2032 | if (einfo) | ||
2033 | { | ||
2034 | if (ee->alpha) | ||
2035 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; | ||
2036 | else | ||
2037 | einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32; | ||
2038 | einfo->info.dest_buffer = NULL; | ||
2039 | einfo->info.dest_buffer_row_bytes = 0; | ||
2040 | einfo->info.use_color_key = 0; | ||
2041 | einfo->info.alpha_threshold = 0; | ||
2042 | einfo->info.func.new_update_region = NULL; | ||
2043 | einfo->info.func.free_update_region = NULL; | ||
2044 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
2045 | { | ||
2046 | ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); | ||
2047 | ecore_evas_free(ee); | ||
2048 | return NULL; | ||
2049 | } | ||
2050 | } | ||
2051 | else | ||
2052 | { | ||
2053 | ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); | ||
2054 | ecore_evas_free(ee); | ||
2055 | return NULL; | ||
2056 | } | ||
2057 | evas_key_modifier_add(ee->evas, "Shift"); | ||
2058 | evas_key_modifier_add(ee->evas, "Control"); | ||
2059 | evas_key_modifier_add(ee->evas, "Alt"); | ||
2060 | evas_key_modifier_add(ee->evas, "Meta"); | ||
2061 | evas_key_modifier_add(ee->evas, "Hyper"); | ||
2062 | evas_key_modifier_add(ee->evas, "Super"); | ||
2063 | evas_key_lock_add(ee->evas, "Caps_Lock"); | ||
2064 | evas_key_lock_add(ee->evas, "Num_Lock"); | ||
2065 | evas_key_lock_add(ee->evas, "Scroll_Lock"); | ||
2066 | |||
2067 | extn_ee_list = eina_list_append(extn_ee_list, ee); | ||
2068 | |||
2069 | _ecore_evas_register(ee); | ||
2070 | |||
2071 | return ee; | ||
2072 | #else | ||
2073 | return NULL; | ||
2074 | #endif | ||
2075 | } | ||
2076 | |||
2077 | EAPI Eina_Bool | ||
2078 | ecore_evas_extn_socket_listen(Ecore_Evas *ee, const char *svcname, int svcnum, Eina_Bool svcsys) | ||
2079 | { | ||
2080 | #ifdef EXTN_ENABLED | ||
2081 | Extn *extn; | ||
2082 | |||
2083 | extn = calloc(1, sizeof(Extn)); | ||
2084 | if (!extn) | ||
2085 | { | ||
2086 | return EINA_FALSE; | ||
2087 | } | ||
2088 | else | ||
2089 | { | ||
2090 | Ecore_Ipc_Type ipctype = ECORE_IPC_LOCAL_USER; | ||
2091 | char buf[PATH_MAX]; | ||
2092 | |||
2093 | ecore_ipc_init(); | ||
2094 | extn->svc.name = eina_stringshare_add(svcname); | ||
2095 | extn->svc.num = svcnum; | ||
2096 | extn->svc.sys = svcsys; | ||
2097 | |||
2098 | snprintf(buf, sizeof(buf), "/tmp/ee-lock-XXXXXX"); | ||
2099 | extn->file.lockfd = mkstemp(buf); | ||
2100 | if (extn->file.lockfd >= 0) | ||
2101 | extn->file.lock = eina_stringshare_add(buf); | ||
2102 | if ((extn->file.lockfd < 0) || (!extn->file.lock)) | ||
2103 | { | ||
2104 | if (extn->file.lockfd) | ||
2105 | { | ||
2106 | close(extn->file.lockfd); | ||
2107 | unlink(buf); | ||
2108 | } | ||
2109 | eina_stringshare_del(extn->svc.name); | ||
2110 | if (extn->file.lock) eina_stringshare_del(extn->file.lock); | ||
2111 | free(extn); | ||
2112 | ecore_ipc_shutdown(); | ||
2113 | return EINA_FALSE; | ||
2114 | } | ||
2115 | |||
2116 | if (extn->svc.sys) ipctype = ECORE_IPC_LOCAL_SYSTEM; | ||
2117 | extn->ipc.am_server = EINA_TRUE; | ||
2118 | extn->ipc.server = ecore_ipc_server_add(ipctype, | ||
2119 | (char *)extn->svc.name, | ||
2120 | extn->svc.num, ee); | ||
2121 | if (!extn->ipc.server) | ||
2122 | { | ||
2123 | if (extn->file.lockfd) | ||
2124 | { | ||
2125 | close(extn->file.lockfd); | ||
2126 | if (extn->file.lock) unlink(extn->file.lock); | ||
2127 | } | ||
2128 | eina_stringshare_del(extn->svc.name); | ||
2129 | eina_stringshare_del(extn->file.lock); | ||
2130 | free(extn); | ||
2131 | ecore_ipc_shutdown(); | ||
2132 | return EINA_FALSE; | ||
2133 | } | ||
2134 | ee->engine.buffer.data = extn; | ||
2135 | extn->ipc.handlers = eina_list_append | ||
2136 | (extn->ipc.handlers, | ||
2137 | ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD, | ||
2138 | _ipc_client_add, ee)); | ||
2139 | extn->ipc.handlers = eina_list_append | ||
2140 | (extn->ipc.handlers, | ||
2141 | ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL, | ||
2142 | _ipc_client_del, ee)); | ||
2143 | extn->ipc.handlers = eina_list_append | ||
2144 | (extn->ipc.handlers, | ||
2145 | ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA, | ||
2146 | _ipc_client_data, ee)); | ||
2147 | } | ||
2148 | return EINA_TRUE; | ||
2149 | #else | ||
2150 | return EINA_FALSE; | ||
2151 | #endif | ||
2152 | } | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c index 3ee913e..74caada 100644 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c | |||
@@ -2,6 +2,7 @@ | |||
2 | # include <config.h> | 2 | # include <config.h> |
3 | #endif | 3 | #endif |
4 | 4 | ||
5 | #include <stdlib.h> | ||
5 | #include <sys/types.h> | 6 | #include <sys/types.h> |
6 | #include <dirent.h> | 7 | #include <dirent.h> |
7 | 8 | ||
@@ -154,9 +155,9 @@ _ecore_evas_fb_render(Ecore_Evas *ee) | |||
154 | if (ee->visible) | 155 | if (ee->visible) |
155 | { | 156 | { |
156 | Eina_List *updates; | 157 | Eina_List *updates; |
157 | |||
158 | Eina_List *ll; | 158 | Eina_List *ll; |
159 | Ecore_Evas *ee2; | 159 | Ecore_Evas *ee2; |
160 | |||
160 | if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); | 161 | if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); |
161 | 162 | ||
162 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | 163 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) |
@@ -184,31 +185,26 @@ _ecore_evas_fb_render(Ecore_Evas *ee) | |||
184 | static int | 185 | static int |
185 | _ecore_evas_fb_init(Ecore_Evas *ee, int w, int h) | 186 | _ecore_evas_fb_init(Ecore_Evas *ee, int w, int h) |
186 | { | 187 | { |
188 | Eina_File_Direct_Info *info; | ||
189 | Eina_Iterator *ls; | ||
187 | Ecore_Fb_Input_Device *device; | 190 | Ecore_Fb_Input_Device *device; |
188 | Ecore_Fb_Input_Device_Cap caps; | 191 | Ecore_Fb_Input_Device_Cap caps; |
189 | int mouse_handled = 0; | 192 | int mouse_handled = 0; |
190 | 193 | ||
191 | DIR *input_dir; | ||
192 | struct dirent *input_entry; | ||
193 | |||
194 | _ecore_evas_init_count++; | 194 | _ecore_evas_init_count++; |
195 | if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; | 195 | if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; |
196 | 196 | ||
197 | ecore_event_evas_init(); | 197 | ecore_event_evas_init(); |
198 | 198 | ||
199 | /* register all input devices */ | 199 | /* register all input devices */ |
200 | input_dir = opendir("/dev/input/"); | 200 | ls = eina_file_direct_ls("/dev/input/"); |
201 | if (!input_dir) return _ecore_evas_init_count; | ||
202 | 201 | ||
203 | while ((input_entry = readdir(input_dir))) | 202 | EINA_ITERATOR_FOREACH(ls, info) |
204 | { | 203 | { |
205 | char device_path[256]; | 204 | if (strncmp(info->path + info->name_start, "event", 5) != 0) |
206 | |||
207 | if (strncmp(input_entry->d_name, "event", 5) != 0) | ||
208 | continue; | 205 | continue; |
209 | 206 | ||
210 | snprintf(device_path, 256, "/dev/input/%s", input_entry->d_name); | 207 | if (!(device = ecore_fb_input_device_open(info->path))) |
211 | if (!(device = ecore_fb_input_device_open(device_path))) | ||
212 | continue; | 208 | continue; |
213 | ecore_fb_input_device_window_set(device, ee); | 209 | ecore_fb_input_device_window_set(device, ee); |
214 | 210 | ||
@@ -240,7 +236,7 @@ _ecore_evas_fb_init(Ecore_Evas *ee, int w, int h) | |||
240 | ecore_evas_input_devices = eina_list_append(ecore_evas_input_devices, device); | 236 | ecore_evas_input_devices = eina_list_append(ecore_evas_input_devices, device); |
241 | } | 237 | } |
242 | } | 238 | } |
243 | closedir(input_dir); | 239 | eina_iterator_free(ls); |
244 | 240 | ||
245 | if (!mouse_handled) | 241 | if (!mouse_handled) |
246 | { | 242 | { |
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_private.h b/libraries/ecore/src/lib/ecore_evas/ecore_evas_private.h index 2c20761..9a88a7a 100644 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_private.h +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_private.h | |||
@@ -1,18 +1,6 @@ | |||
1 | #ifndef _ECORE_EVAS_PRIVATE_H | 1 | #ifndef _ECORE_EVAS_PRIVATE_H |
2 | #define _ECORE_EVAS_PRIVATE_H | 2 | #define _ECORE_EVAS_PRIVATE_H |
3 | 3 | ||
4 | #ifdef HAVE_CONFIG_H | ||
5 | # include <config.h> | ||
6 | #endif | ||
7 | |||
8 | #include <sys/types.h> | ||
9 | #include <sys/stat.h> | ||
10 | #include <fcntl.h> | ||
11 | |||
12 | #ifdef HAVE_SYS_MMAN_H | ||
13 | # include <sys/mman.h> | ||
14 | #endif | ||
15 | |||
16 | #include <Evas.h> | 4 | #include <Evas.h> |
17 | #include <Ecore.h> | 5 | #include <Ecore.h> |
18 | #include <ecore_private.h> | 6 | #include <ecore_private.h> |
@@ -91,9 +79,17 @@ | |||
91 | # include <Evas_Engine_Gl_Cocoa.h> | 79 | # include <Evas_Engine_Gl_Cocoa.h> |
92 | #endif | 80 | #endif |
93 | 81 | ||
94 | /** | 82 | #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM |
95 | Log domain macros and variable | 83 | # include "Ecore_Wayland.h" |
96 | **/ | 84 | # include <Evas_Engine_Wayland_Shm.h> |
85 | #endif | ||
86 | |||
87 | #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL | ||
88 | # include "Ecore_Wayland.h" | ||
89 | # include <Evas_Engine_Wayland_Egl.h> | ||
90 | #endif | ||
91 | |||
92 | /** Log domain macros and variables **/ | ||
97 | 93 | ||
98 | extern int _ecore_evas_log_dom; | 94 | extern int _ecore_evas_log_dom; |
99 | 95 | ||
@@ -272,6 +268,17 @@ struct _Ecore_Evas_Engine | |||
272 | } ews; | 268 | } ews; |
273 | #endif | 269 | #endif |
274 | 270 | ||
271 | #if defined(BUILD_ECORE_EVAS_WAYLAND_SHM) || defined(BUILD_ECORE_EVAS_WAYLAND_EGL) | ||
272 | struct | ||
273 | { | ||
274 | Evas_Object *frame; | ||
275 | |||
276 | struct wl_shell_surface *shell_surface; | ||
277 | struct wl_surface *surface; | ||
278 | struct wl_buffer *buffer; | ||
279 | } wl; | ||
280 | #endif | ||
281 | |||
275 | Ecore_Timer *idle_flush_timer; | 282 | Ecore_Timer *idle_flush_timer; |
276 | }; | 283 | }; |
277 | 284 | ||
@@ -290,6 +297,7 @@ struct _Ecore_Evas | |||
290 | Eina_Bool should_be_visible : 1; | 297 | Eina_Bool should_be_visible : 1; |
291 | Eina_Bool alpha : 1; | 298 | Eina_Bool alpha : 1; |
292 | Eina_Bool transparent : 1; | 299 | Eina_Bool transparent : 1; |
300 | Eina_Bool in : 1; | ||
293 | 301 | ||
294 | Eina_Hash *data; | 302 | Eina_Hash *data; |
295 | 303 | ||
@@ -334,6 +342,7 @@ struct _Ecore_Evas | |||
334 | char withdrawn : 1; | 342 | char withdrawn : 1; |
335 | char sticky : 1; | 343 | char sticky : 1; |
336 | char request_pos : 1; | 344 | char request_pos : 1; |
345 | char draw_frame : 1; | ||
337 | } prop; | 346 | } prop; |
338 | 347 | ||
339 | struct { | 348 | struct { |
@@ -394,6 +403,16 @@ void _ecore_evas_ews_events_init(void); | |||
394 | int _ecore_evas_ews_shutdown(void); | 403 | int _ecore_evas_ews_shutdown(void); |
395 | #endif | 404 | #endif |
396 | 405 | ||
406 | #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM | ||
407 | void _ecore_evas_wayland_shm_resize(Ecore_Evas *ee, int location); | ||
408 | void _ecore_evas_wayland_shm_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source); | ||
409 | #endif | ||
410 | |||
411 | #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL | ||
412 | void _ecore_evas_wayland_egl_resize(Ecore_Evas *ee, int location); | ||
413 | void _ecore_evas_wayland_egl_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source); | ||
414 | #endif | ||
415 | |||
397 | void _ecore_evas_fps_debug_init(void); | 416 | void _ecore_evas_fps_debug_init(void); |
398 | void _ecore_evas_fps_debug_shutdown(void); | 417 | void _ecore_evas_fps_debug_shutdown(void); |
399 | void _ecore_evas_fps_debug_rendertime_add(double t); | 418 | void _ecore_evas_fps_debug_rendertime_add(double t); |
@@ -430,4 +449,7 @@ void _ecore_evas_mouse_multi_up_process(Ecore_Evas *ee, int device, | |||
430 | 449 | ||
431 | extern Eina_Bool _ecore_evas_app_comp_sync; | 450 | extern Eina_Bool _ecore_evas_app_comp_sync; |
432 | 451 | ||
452 | void _ecore_evas_extn_init(void); | ||
453 | void _ecore_evas_extn_shutdown(void); | ||
454 | |||
433 | #endif | 455 | #endif |
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c index 0849c79..be130ad 100644 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c | |||
@@ -16,7 +16,7 @@ | |||
16 | static int _ecore_evas_init_count = 0; | 16 | static int _ecore_evas_init_count = 0; |
17 | 17 | ||
18 | static Ecore_Evas *psl1ght_ee = NULL; | 18 | static Ecore_Evas *psl1ght_ee = NULL; |
19 | static Ecore_Event_Handler *ecore_evas_event_handlers[4] = { | 19 | static Ecore_Event_Handler *ecore_evas_event_handlers[5] = { |
20 | NULL, NULL, NULL, NULL | 20 | NULL, NULL, NULL, NULL |
21 | }; | 21 | }; |
22 | 22 | ||
@@ -48,7 +48,7 @@ _ecore_evas_psl1ght_event_got_focus(void *data __UNUSED__, int type __UNUSED__, | |||
48 | ee->prop.focused = 1; | 48 | ee->prop.focused = 1; |
49 | evas_focus_in(ee->evas); | 49 | evas_focus_in(ee->evas); |
50 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | 50 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); |
51 | 51 | ||
52 | return ECORE_CALLBACK_PASS_ON; | 52 | return ECORE_CALLBACK_PASS_ON; |
53 | } | 53 | } |
54 | 54 | ||
@@ -64,7 +64,7 @@ _ecore_evas_psl1ght_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, | |||
64 | evas_focus_out(ee->evas); | 64 | evas_focus_out(ee->evas); |
65 | ee->prop.focused = 0; | 65 | ee->prop.focused = 0; |
66 | if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); | 66 | if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); |
67 | 67 | ||
68 | return ECORE_CALLBACK_PASS_ON; | 68 | return ECORE_CALLBACK_PASS_ON; |
69 | } | 69 | } |
70 | 70 | ||
@@ -98,6 +98,19 @@ _ecore_evas_psl1ght_event_key_modifiers(void *data __UNUSED__, int type __UNUSED | |||
98 | return ECORE_CALLBACK_PASS_ON; | 98 | return ECORE_CALLBACK_PASS_ON; |
99 | } | 99 | } |
100 | 100 | ||
101 | static Eina_Bool | ||
102 | _ecore_evas_psl1ght_event_quit (void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) | ||
103 | { | ||
104 | Ecore_Evas *ee; | ||
105 | |||
106 | ee = _ecore_evas_psl1ght_match(); | ||
107 | |||
108 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | ||
109 | if (ee->func.fn_delete_request) | ||
110 | ee->func.fn_delete_request(ee); | ||
111 | return ECORE_CALLBACK_PASS_ON; | ||
112 | } | ||
113 | |||
101 | static int | 114 | static int |
102 | _ecore_evas_render(Ecore_Evas *ee) | 115 | _ecore_evas_render(Ecore_Evas *ee) |
103 | { | 116 | { |
@@ -170,10 +183,21 @@ _ecore_evas_psl1ght_init(int w __UNUSED__, int h __UNUSED__) | |||
170 | 183 | ||
171 | ecore_event_evas_init(); | 184 | ecore_event_evas_init(); |
172 | 185 | ||
173 | ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_PSL1GHT_EVENT_GOT_FOCUS, _ecore_evas_psl1ght_event_got_focus, NULL); | 186 | ecore_evas_event_handlers[0] = |
174 | ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_PSL1GHT_EVENT_LOST_FOCUS, _ecore_evas_psl1ght_event_lost_focus, NULL); | 187 | ecore_event_handler_add(ECORE_PSL1GHT_EVENT_GOT_FOCUS, |
175 | ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_PSL1GHT_EVENT_EXPOSE, _ecore_evas_psl1ght_event_video_expose, NULL); | 188 | _ecore_evas_psl1ght_event_got_focus, NULL); |
176 | ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_PSL1GHT_EVENT_KEY_MODIFIERS, _ecore_evas_psl1ght_event_key_modifiers, NULL); | 189 | ecore_evas_event_handlers[1] = |
190 | ecore_event_handler_add(ECORE_PSL1GHT_EVENT_LOST_FOCUS, | ||
191 | _ecore_evas_psl1ght_event_lost_focus, NULL); | ||
192 | ecore_evas_event_handlers[2] = | ||
193 | ecore_event_handler_add(ECORE_PSL1GHT_EVENT_EXPOSE, | ||
194 | _ecore_evas_psl1ght_event_video_expose, NULL); | ||
195 | ecore_evas_event_handlers[3] = | ||
196 | ecore_event_handler_add(ECORE_PSL1GHT_EVENT_KEY_MODIFIERS, | ||
197 | _ecore_evas_psl1ght_event_key_modifiers, NULL); | ||
198 | ecore_evas_event_handlers[4] = | ||
199 | ecore_event_handler_add(ECORE_PSL1GHT_EVENT_QUIT, | ||
200 | _ecore_evas_psl1ght_event_quit, NULL); | ||
177 | 201 | ||
178 | return _ecore_evas_init_count; | 202 | return _ecore_evas_init_count; |
179 | } | 203 | } |
@@ -209,6 +233,12 @@ _ecore_evas_psl1ght_free(Ecore_Evas *ee) | |||
209 | } | 233 | } |
210 | 234 | ||
211 | static void | 235 | static void |
236 | _ecore_evas_psl1ght_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) | ||
237 | { | ||
238 | ee->func.fn_delete_request = func; | ||
239 | } | ||
240 | |||
241 | static void | ||
212 | _ecore_evas_screen_resized(Ecore_Evas *ee) | 242 | _ecore_evas_screen_resized(Ecore_Evas *ee) |
213 | { | 243 | { |
214 | int w, h; | 244 | int w, h; |
@@ -324,7 +354,7 @@ static Ecore_Evas_Engine_Func _ecore_psl1ght_engine_func = | |||
324 | NULL, | 354 | NULL, |
325 | NULL, | 355 | NULL, |
326 | NULL, | 356 | NULL, |
327 | NULL, | 357 | _ecore_evas_psl1ght_callback_delete_request_set, |
328 | NULL, | 358 | NULL, |
329 | NULL, | 359 | NULL, |
330 | NULL, | 360 | NULL, |
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_sdl.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_sdl.c index b333d96..a3be2c7 100644 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_sdl.c +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_sdl.c | |||
@@ -15,6 +15,9 @@ | |||
15 | # endif | 15 | # endif |
16 | #endif | 16 | #endif |
17 | 17 | ||
18 | #include <stdlib.h> | ||
19 | #include <string.h> | ||
20 | |||
18 | #include "ecore_evas_private.h" | 21 | #include "ecore_evas_private.h" |
19 | #include "Ecore_Evas.h" | 22 | #include "Ecore_Evas.h" |
20 | 23 | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_util.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_util.c index 95b6d22..839f0c8 100644 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_util.c +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_util.c | |||
@@ -2,6 +2,7 @@ | |||
2 | # include <config.h> | 2 | # include <config.h> |
3 | #endif | 3 | #endif |
4 | 4 | ||
5 | #include <stdlib.h> | ||
5 | #include <string.h> | 6 | #include <string.h> |
6 | 7 | ||
7 | #include <Ecore.h> | 8 | #include <Ecore.h> |
@@ -115,15 +116,16 @@ _ecore_evas_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj _ | |||
115 | } | 116 | } |
116 | 117 | ||
117 | static void | 118 | static void |
118 | _ecore_evas_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) | 119 | _ecore_evas_obj_callback_resize(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__) |
119 | { | 120 | { |
120 | Ecore_Evas *ee = data; | 121 | Ecore_Evas *ee = data; |
121 | Evas_Coord ow, oh, w, h; | 122 | Evas_Coord ow, oh, fw, fh; |
122 | 123 | ||
123 | evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); | 124 | evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); |
124 | ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); | 125 | evas_output_framespace_get(e, NULL, NULL, &fw, &fh); |
125 | /*if ((w != ow) || (h != oh))*/ /* avoid recursion on ecore_evas_resize side */ | 126 | ow += fw; |
126 | ecore_evas_resize(ee, ow, oh); | 127 | oh += fh; |
128 | ecore_evas_resize(ee, ow, oh); | ||
127 | } | 129 | } |
128 | 130 | ||
129 | static void | 131 | static void |
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_egl.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_egl.c new file mode 100644 index 0000000..72e8555 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_egl.c | |||
@@ -0,0 +1,1131 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #define LOGFNS 1 | ||
6 | |||
7 | #ifdef LOGFNS | ||
8 | # include <stdio.h> | ||
9 | # define LOGFN(fl, ln, fn) \ | ||
10 | printf("-ECORE_EVAS-WL: %25s: %5i - %s\n", fl, ln, fn); | ||
11 | #else | ||
12 | # define LOGFN(fl, ln, fn) | ||
13 | #endif | ||
14 | |||
15 | #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL | ||
16 | # include <stdlib.h> | ||
17 | # include <string.h> | ||
18 | # include <unistd.h> | ||
19 | # include <sys/types.h> | ||
20 | # include <sys/mman.h> | ||
21 | #endif | ||
22 | |||
23 | #include <Eina.h> | ||
24 | #include <Evas.h> | ||
25 | #include <Ecore.h> | ||
26 | |||
27 | #include "ecore_evas_private.h" | ||
28 | #include "Ecore_Evas.h" | ||
29 | |||
30 | #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL | ||
31 | # include <wayland-egl.h> | ||
32 | # include <Evas_Engine_Wayland_Egl.h> | ||
33 | # include <Ecore_Wayland.h> | ||
34 | |||
35 | /* local structures */ | ||
36 | typedef struct _EE_Wl_Smart_Data EE_Wl_Smart_Data; | ||
37 | struct _EE_Wl_Smart_Data | ||
38 | { | ||
39 | Evas_Object *frame, *text; | ||
40 | Evas_Coord x, y, w, h; | ||
41 | }; | ||
42 | |||
43 | /* local function prototypes */ | ||
44 | static int _ecore_evas_wl_init(void); | ||
45 | static int _ecore_evas_wl_shutdown(void); | ||
46 | static void _ecore_evas_wl_pre_free(Ecore_Evas *ee); | ||
47 | static void _ecore_evas_wl_free(Ecore_Evas *ee); | ||
48 | static void _ecore_evas_wl_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
49 | static void _ecore_evas_wl_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
50 | static void _ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
51 | static void _ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
52 | static void _ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
53 | static void _ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
54 | static void _ecore_evas_wl_move(Ecore_Evas *ee, int x, int y); | ||
55 | static void _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h); | ||
56 | static void _ecore_evas_wl_show(Ecore_Evas *ee); | ||
57 | static void _ecore_evas_wl_hide(Ecore_Evas *ee); | ||
58 | static void _ecore_evas_wl_raise(Ecore_Evas *ee); | ||
59 | static void _ecore_evas_wl_lower(Ecore_Evas *ee); | ||
60 | static void _ecore_evas_wl_activate(Ecore_Evas *ee); | ||
61 | static void _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *t); | ||
62 | static void _ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c); | ||
63 | static void _ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h); | ||
64 | static void _ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h); | ||
65 | static void _ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h); | ||
66 | static void _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h); | ||
67 | static void _ecore_evas_wl_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y); | ||
68 | static void _ecore_evas_wl_object_cursor_del(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__); | ||
69 | static void _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer); | ||
70 | static void _ecore_evas_wl_focus_set(Ecore_Evas *ee, int focus __UNUSED__); | ||
71 | static void _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify); | ||
72 | static void _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max); | ||
73 | static void _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full __UNUSED__); | ||
74 | static int _ecore_evas_wl_render(Ecore_Evas *ee); | ||
75 | static void _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h); | ||
76 | |||
77 | static Eina_Bool _ecore_evas_wl_event_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
78 | static Eina_Bool _ecore_evas_wl_event_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
79 | static Eina_Bool _ecore_evas_wl_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
80 | static Eina_Bool _ecore_evas_wl_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
81 | static Eina_Bool _ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
82 | static Eina_Bool _ecore_evas_wl_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
83 | static Eina_Bool _ecore_evas_wl_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
84 | static Eina_Bool _ecore_evas_wl_event_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
85 | |||
86 | static void _ecore_evas_wl_handle_configure(void *data, struct wl_shell_surface *shell_surface __UNUSED__, uint32_t timestamp __UNUSED__, uint32_t edges __UNUSED__, int32_t width, int32_t height); | ||
87 | static void _ecore_evas_wl_handle_popup_done(void *data __UNUSED__, struct wl_shell_surface *shell_surface __UNUSED__); | ||
88 | |||
89 | /* SMART stuff for frame */ | ||
90 | static Evas_Smart *_ecore_evas_wl_smart = NULL; | ||
91 | |||
92 | static void _ecore_evas_wl_smart_init(void); | ||
93 | static void _ecore_evas_wl_smart_add(Evas_Object *obj); | ||
94 | static void _ecore_evas_wl_smart_del(Evas_Object *obj); | ||
95 | static void _ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h); | ||
96 | static void _ecore_evas_wl_smart_show(Evas_Object *obj); | ||
97 | static void _ecore_evas_wl_smart_hide(Evas_Object *obj); | ||
98 | |||
99 | static Evas_Object *_ecore_evas_wl_frame_add(Evas *evas); | ||
100 | |||
101 | /* local variables */ | ||
102 | static int _ecore_evas_wl_init_count = 0; | ||
103 | static Ecore_Event_Handler *_ecore_evas_wl_event_handlers[8]; | ||
104 | static uint32_t _ecore_evas_wl_btn_timestamp; | ||
105 | static const struct wl_shell_surface_listener _ecore_evas_wl_shell_surface_listener = | ||
106 | { | ||
107 | _ecore_evas_wl_handle_configure, | ||
108 | _ecore_evas_wl_handle_popup_done | ||
109 | }; | ||
110 | |||
111 | static Ecore_Evas_Engine_Func _ecore_wl_engine_func = | ||
112 | { | ||
113 | _ecore_evas_wl_free, | ||
114 | _ecore_evas_wl_callback_resize_set, | ||
115 | _ecore_evas_wl_callback_move_set, | ||
116 | NULL, // callback show set | ||
117 | NULL, // callback hide set | ||
118 | _ecore_evas_wl_callback_delete_request_set, | ||
119 | NULL, // callback destroy set | ||
120 | _ecore_evas_wl_callback_focus_in_set, | ||
121 | _ecore_evas_wl_callback_focus_out_set, | ||
122 | _ecore_evas_wl_callback_mouse_in_set, | ||
123 | NULL, // callback mouse out set | ||
124 | NULL, // callback sticky set | ||
125 | NULL, // callback unsticky set | ||
126 | NULL, // callback pre render set | ||
127 | NULL, // callback post render set | ||
128 | _ecore_evas_wl_move, | ||
129 | NULL, // func managed move | ||
130 | _ecore_evas_wl_resize, | ||
131 | NULL, // _ecore_evas_wl_move_resize, | ||
132 | NULL, // func rotation set | ||
133 | NULL, // func shaped set | ||
134 | _ecore_evas_wl_show, | ||
135 | _ecore_evas_wl_hide, | ||
136 | _ecore_evas_wl_raise, | ||
137 | _ecore_evas_wl_lower, | ||
138 | _ecore_evas_wl_activate, | ||
139 | _ecore_evas_wl_title_set, | ||
140 | _ecore_evas_wl_name_class_set, | ||
141 | _ecore_evas_wl_size_min_set, | ||
142 | _ecore_evas_wl_size_max_set, | ||
143 | _ecore_evas_wl_size_base_set, | ||
144 | _ecore_evas_wl_size_step_set, | ||
145 | _ecore_evas_wl_object_cursor_set, | ||
146 | _ecore_evas_wl_layer_set, | ||
147 | _ecore_evas_wl_focus_set, | ||
148 | _ecore_evas_wl_iconified_set, | ||
149 | NULL, // func borderless set | ||
150 | NULL, // func override set | ||
151 | _ecore_evas_wl_maximized_set, | ||
152 | _ecore_evas_wl_fullscreen_set, | ||
153 | NULL, // _ecore_evas_wl_avoid_damage_set, | ||
154 | NULL, // func withdrawn set | ||
155 | NULL, // func sticky set | ||
156 | NULL, // func ignore events set | ||
157 | NULL, // func alpha set | ||
158 | NULL, // func transparent set | ||
159 | _ecore_evas_wl_render, | ||
160 | _ecore_evas_wl_screen_geometry_get | ||
161 | }; | ||
162 | |||
163 | #endif | ||
164 | |||
165 | #ifdef BUILD_ECORE_EVAS_WAYLAND_EGL | ||
166 | EAPI Ecore_Evas * | ||
167 | ecore_evas_wayland_egl_new(const char *disp_name, int x, int y, int w, int h, int frame) | ||
168 | { | ||
169 | Evas_Engine_Info_Wayland_Egl *einfo; | ||
170 | Ecore_Evas *ee; | ||
171 | int method = 0; | ||
172 | static int _win_id = 1; | ||
173 | |||
174 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
175 | |||
176 | if (!(method = evas_render_method_lookup("wayland_egl"))) | ||
177 | { | ||
178 | printf("Render method lookup failed for Wayland Egl"); | ||
179 | return NULL; | ||
180 | } | ||
181 | |||
182 | if (!ecore_wl_init(disp_name)) | ||
183 | { | ||
184 | printf("Failed to initialize Ecore Wayland"); | ||
185 | return NULL; | ||
186 | } | ||
187 | |||
188 | if (!(ee = calloc(1, sizeof(Ecore_Evas)))) | ||
189 | { | ||
190 | printf("Failed to allocate Ecore_Evas."); | ||
191 | ecore_wl_shutdown(); | ||
192 | return NULL; | ||
193 | } | ||
194 | |||
195 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
196 | |||
197 | _ecore_evas_wl_init(); | ||
198 | |||
199 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_wl_engine_func; | ||
200 | |||
201 | ee->driver = "wayland_egl"; | ||
202 | if (disp_name) ee->name = strdup(disp_name); | ||
203 | |||
204 | if (w < 1) w = 1; | ||
205 | if (h < 1) h = 1; | ||
206 | |||
207 | ee->req.x = ee->x = x; | ||
208 | ee->req.y = ee->y = y; | ||
209 | ee->req.w = ee->w = w; | ||
210 | ee->req.h = ee->h = h; | ||
211 | ee->rotation = 0; | ||
212 | ee->prop.max.w = ee->prop.max.h = 32767; | ||
213 | ee->prop.layer = 4; | ||
214 | ee->prop.request_pos = 0; | ||
215 | ee->prop.sticky = 0; | ||
216 | ee->prop.draw_frame = frame; | ||
217 | ee->prop.window = _win_id++; | ||
218 | |||
219 | ee->evas = evas_new(); | ||
220 | evas_data_attach_set(ee->evas, ee); | ||
221 | evas_output_method_set(ee->evas, method); | ||
222 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
223 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
224 | |||
225 | if (ee->prop.draw_frame) | ||
226 | evas_output_framespace_set(ee->evas, 4, 18, 8, 22); | ||
227 | |||
228 | if ((einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas))) | ||
229 | { | ||
230 | einfo->info.display = ecore_wl_display_get(); | ||
231 | einfo->info.rotation = ee->rotation; | ||
232 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
233 | { | ||
234 | printf("Failed to set Evas Engine Info for '%s'.", ee->driver); | ||
235 | ecore_evas_free(ee); | ||
236 | return NULL; | ||
237 | } | ||
238 | } | ||
239 | else | ||
240 | { | ||
241 | printf("Failed to get Evas Engine Info for '%s'.", ee->driver); | ||
242 | ecore_evas_free(ee); | ||
243 | return NULL; | ||
244 | } | ||
245 | |||
246 | /* NB: we need to be notified before 'free' so we can munmap the evas | ||
247 | * engine destination */ | ||
248 | ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_pre_free); | ||
249 | |||
250 | if (ee->prop.draw_frame) | ||
251 | { | ||
252 | ee->engine.wl.frame = _ecore_evas_wl_frame_add(ee->evas); | ||
253 | evas_object_is_frame_object_set(ee->engine.wl.frame, EINA_TRUE); | ||
254 | evas_object_move(ee->engine.wl.frame, 0, 0); | ||
255 | } | ||
256 | |||
257 | ecore_evas_input_event_register(ee); | ||
258 | _ecore_evas_register(ee); | ||
259 | |||
260 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
261 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
262 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
263 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
264 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
265 | |||
266 | evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); | ||
267 | |||
268 | return ee; | ||
269 | } | ||
270 | |||
271 | /* local functions */ | ||
272 | static int | ||
273 | _ecore_evas_wl_init(void) | ||
274 | { | ||
275 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
276 | |||
277 | if (++_ecore_evas_wl_init_count != 1) | ||
278 | return _ecore_evas_wl_init_count; | ||
279 | |||
280 | _ecore_evas_wl_event_handlers[0] = | ||
281 | ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, | ||
282 | _ecore_evas_wl_event_mouse_down, NULL); | ||
283 | _ecore_evas_wl_event_handlers[1] = | ||
284 | ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, | ||
285 | _ecore_evas_wl_event_mouse_up, NULL); | ||
286 | _ecore_evas_wl_event_handlers[2] = | ||
287 | ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, | ||
288 | _ecore_evas_wl_event_mouse_move, NULL); | ||
289 | _ecore_evas_wl_event_handlers[3] = | ||
290 | ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, | ||
291 | _ecore_evas_wl_event_mouse_wheel, NULL); | ||
292 | _ecore_evas_wl_event_handlers[4] = | ||
293 | ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_IN, | ||
294 | _ecore_evas_wl_event_mouse_in, NULL); | ||
295 | _ecore_evas_wl_event_handlers[5] = | ||
296 | ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_OUT, | ||
297 | _ecore_evas_wl_event_mouse_out, NULL); | ||
298 | _ecore_evas_wl_event_handlers[6] = | ||
299 | ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN, | ||
300 | _ecore_evas_wl_event_focus_in, NULL); | ||
301 | _ecore_evas_wl_event_handlers[7] = | ||
302 | ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT, | ||
303 | _ecore_evas_wl_event_focus_out, NULL); | ||
304 | |||
305 | ecore_event_evas_init(); | ||
306 | |||
307 | return _ecore_evas_wl_init_count; | ||
308 | } | ||
309 | |||
310 | static int | ||
311 | _ecore_evas_wl_shutdown(void) | ||
312 | { | ||
313 | unsigned int i = 0; | ||
314 | |||
315 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
316 | |||
317 | if (--_ecore_evas_wl_init_count != 0) | ||
318 | return _ecore_evas_wl_init_count; | ||
319 | |||
320 | for (i = 0; i < sizeof(_ecore_evas_wl_event_handlers) / sizeof(Ecore_Event_Handler *); i++) | ||
321 | { | ||
322 | if (_ecore_evas_wl_event_handlers[i]) | ||
323 | ecore_event_handler_del(_ecore_evas_wl_event_handlers[i]); | ||
324 | } | ||
325 | |||
326 | ecore_event_evas_shutdown(); | ||
327 | |||
328 | return _ecore_evas_wl_init_count; | ||
329 | } | ||
330 | |||
331 | static void | ||
332 | _ecore_evas_wl_pre_free(Ecore_Evas *ee) | ||
333 | { | ||
334 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
335 | |||
336 | if (!ee) return; | ||
337 | if (ee->engine.wl.frame) evas_object_del(ee->engine.wl.frame); | ||
338 | } | ||
339 | |||
340 | static void | ||
341 | _ecore_evas_wl_free(Ecore_Evas *ee) | ||
342 | { | ||
343 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
344 | |||
345 | if (ee) | ||
346 | { | ||
347 | /* destroy shell surface */ | ||
348 | if (ee->engine.wl.shell_surface) | ||
349 | wl_shell_surface_destroy(ee->engine.wl.shell_surface); | ||
350 | ee->engine.wl.shell_surface = NULL; | ||
351 | |||
352 | /* destroy surface */ | ||
353 | if (ee->engine.wl.surface) wl_surface_destroy(ee->engine.wl.surface); | ||
354 | ee->engine.wl.surface = NULL; | ||
355 | |||
356 | ecore_event_window_unregister(ee->prop.window); | ||
357 | ecore_evas_input_event_unregister(ee); | ||
358 | } | ||
359 | _ecore_evas_wl_shutdown(); | ||
360 | ecore_wl_shutdown(); | ||
361 | } | ||
362 | |||
363 | static void | ||
364 | _ecore_evas_wl_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
365 | { | ||
366 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
367 | |||
368 | if (!ee) return; | ||
369 | ee->func.fn_resize = func; | ||
370 | } | ||
371 | |||
372 | static void | ||
373 | _ecore_evas_wl_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
374 | { | ||
375 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
376 | |||
377 | if (!ee) return; | ||
378 | ee->func.fn_move = func; | ||
379 | } | ||
380 | |||
381 | static void | ||
382 | _ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
383 | { | ||
384 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
385 | |||
386 | if (!ee) return; | ||
387 | ee->func.fn_delete_request = func; | ||
388 | } | ||
389 | |||
390 | static void | ||
391 | _ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
392 | { | ||
393 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
394 | |||
395 | if (!ee) return; | ||
396 | ee->func.fn_focus_in = func; | ||
397 | } | ||
398 | |||
399 | static void | ||
400 | _ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
401 | { | ||
402 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
403 | |||
404 | if (!ee) return; | ||
405 | ee->func.fn_focus_out = func; | ||
406 | } | ||
407 | |||
408 | static void | ||
409 | _ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
410 | { | ||
411 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
412 | |||
413 | if (!ee) return; | ||
414 | ee->func.fn_mouse_in = func; | ||
415 | } | ||
416 | |||
417 | static void | ||
418 | _ecore_evas_wl_move(Ecore_Evas *ee, int x, int y) | ||
419 | { | ||
420 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
421 | |||
422 | if (!ee) return; | ||
423 | // if ((ee->x == x) && (ee->y == y)) return; | ||
424 | ee->req.x = x; | ||
425 | ee->req.y = y; | ||
426 | |||
427 | ee->x = x; | ||
428 | ee->y = y; | ||
429 | if (ee->engine.wl.shell_surface) | ||
430 | { | ||
431 | wl_shell_surface_move(ee->engine.wl.shell_surface, | ||
432 | ecore_wl_input_device_get(), | ||
433 | _ecore_evas_wl_btn_timestamp); | ||
434 | } | ||
435 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
436 | } | ||
437 | |||
438 | static void | ||
439 | _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h) | ||
440 | { | ||
441 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
442 | |||
443 | if (!ee) return; | ||
444 | if (w < 1) w = 1; | ||
445 | if (h < 1) h = 1; | ||
446 | if ((ee->w == w) && (ee->h == h)) return; | ||
447 | |||
448 | ee->req.w = w; | ||
449 | ee->req.h = h; | ||
450 | |||
451 | /* if (ee->visible) */ | ||
452 | /* { */ | ||
453 | /* damage old surface, if it exists */ | ||
454 | |||
455 | /* NB: This removes any lingering screen artifacts in the compositor. | ||
456 | * This may be a 'HACK' if the issue is actually in the wayland | ||
457 | * compositor, but for now lets implement this so we don't have screen | ||
458 | * artifacts laying around during a resize */ | ||
459 | /* if (ee->engine.wl.surface) */ | ||
460 | /* wl_surface_damage(ee->engine.wl.surface, 0, 0, ee->w, ee->h); */ | ||
461 | /* } */ | ||
462 | |||
463 | ee->w = w; | ||
464 | ee->h = h; | ||
465 | |||
466 | // ecore_wl_flush(); | ||
467 | |||
468 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
469 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
470 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
471 | if (ee->engine.wl.frame) | ||
472 | evas_object_resize(ee->engine.wl.frame, ee->w, ee->h); | ||
473 | |||
474 | /* if ((ee->visible) && (ee->engine.wl.surface)) */ | ||
475 | /* wl_surface_damage(ee->engine.wl.surface, 0, 0, ee->w, ee->h); */ | ||
476 | |||
477 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
478 | } | ||
479 | |||
480 | static void | ||
481 | _ecore_evas_wl_show(Ecore_Evas *ee) | ||
482 | { | ||
483 | Evas_Engine_Info_Wayland_Egl *einfo; | ||
484 | |||
485 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
486 | |||
487 | if (!ee) return; | ||
488 | if (ee->visible) return; | ||
489 | |||
490 | einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas); | ||
491 | |||
492 | /* create new surface */ | ||
493 | ee->engine.wl.surface = | ||
494 | wl_compositor_create_surface(ecore_wl_compositor_get()); | ||
495 | wl_surface_set_user_data(ee->engine.wl.surface, (void *)ee->prop.window); | ||
496 | |||
497 | /* create new shell surface */ | ||
498 | ee->engine.wl.shell_surface = | ||
499 | wl_shell_get_shell_surface(ecore_wl_shell_get(), ee->engine.wl.surface); | ||
500 | |||
501 | /* set the engine surface here. This should trigger an egl window create */ | ||
502 | einfo->info.surface = ee->engine.wl.surface; | ||
503 | evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); | ||
504 | |||
505 | /* add listener for configure events (happen on shell surface resize) */ | ||
506 | wl_shell_surface_add_listener(ee->engine.wl.shell_surface, | ||
507 | &_ecore_evas_wl_shell_surface_listener, ee); | ||
508 | |||
509 | /* Raise this surface to the top */ | ||
510 | wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface); | ||
511 | |||
512 | if (ee->engine.wl.frame) | ||
513 | { | ||
514 | evas_object_show(ee->engine.wl.frame); | ||
515 | evas_object_resize(ee->engine.wl.frame, ee->w, ee->h); | ||
516 | } | ||
517 | |||
518 | ecore_wl_flush(); | ||
519 | |||
520 | ee->visible = 1; | ||
521 | if (ee->func.fn_show) ee->func.fn_show(ee); | ||
522 | } | ||
523 | |||
524 | static void | ||
525 | _ecore_evas_wl_hide(Ecore_Evas *ee) | ||
526 | { | ||
527 | Evas_Engine_Info_Wayland_Egl *einfo; | ||
528 | |||
529 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
530 | |||
531 | if (!ee) return; | ||
532 | if (!ee->visible) return; | ||
533 | |||
534 | /* get engine info */ | ||
535 | einfo = (Evas_Engine_Info_Wayland_Egl *)evas_engine_info_get(ee->evas); | ||
536 | einfo->info.surface = NULL; | ||
537 | evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); | ||
538 | |||
539 | /* destroy shell surface */ | ||
540 | if (ee->engine.wl.shell_surface) | ||
541 | wl_shell_surface_destroy(ee->engine.wl.shell_surface); | ||
542 | ee->engine.wl.shell_surface = NULL; | ||
543 | |||
544 | /* destroy surface */ | ||
545 | if (ee->engine.wl.surface) wl_surface_destroy(ee->engine.wl.surface); | ||
546 | ee->engine.wl.surface = NULL; | ||
547 | |||
548 | ee->visible = 0; | ||
549 | ee->should_be_visible = 0; | ||
550 | if (ee->func.fn_hide) ee->func.fn_hide(ee); | ||
551 | } | ||
552 | |||
553 | static void | ||
554 | _ecore_evas_wl_raise(Ecore_Evas *ee) | ||
555 | { | ||
556 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
557 | |||
558 | if ((!ee) || (!ee->visible)) return; | ||
559 | if (!ee->engine.wl.shell_surface) return; | ||
560 | wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface); | ||
561 | } | ||
562 | |||
563 | static void | ||
564 | _ecore_evas_wl_lower(Ecore_Evas *ee) | ||
565 | { | ||
566 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
567 | |||
568 | if ((!ee) || (!ee->visible)) return; | ||
569 | /* FIXME: Need a way to tell Wayland to lower */ | ||
570 | } | ||
571 | |||
572 | static void | ||
573 | _ecore_evas_wl_activate(Ecore_Evas *ee) | ||
574 | { | ||
575 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
576 | |||
577 | if ((!ee) || (!ee->visible)) return; | ||
578 | if (!ee->engine.wl.shell_surface) return; | ||
579 | wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface); | ||
580 | } | ||
581 | |||
582 | static void | ||
583 | _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *t) | ||
584 | { | ||
585 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
586 | |||
587 | if (!ee) return; | ||
588 | if (ee->prop.title) free(ee->prop.title); | ||
589 | ee->prop.title = NULL; | ||
590 | if (t) ee->prop.title = strdup(t); | ||
591 | |||
592 | if ((ee->prop.draw_frame) && (ee->engine.wl.frame)) | ||
593 | { | ||
594 | EE_Wl_Smart_Data *sd; | ||
595 | |||
596 | if (!(sd = evas_object_smart_data_get(ee->engine.wl.frame))) return; | ||
597 | evas_object_text_text_set(sd->text, ee->prop.title); | ||
598 | } | ||
599 | } | ||
600 | |||
601 | static void | ||
602 | _ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c) | ||
603 | { | ||
604 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
605 | |||
606 | if (!ee) return; | ||
607 | if (ee->prop.name) free(ee->prop.name); | ||
608 | if (ee->prop.clas) free(ee->prop.clas); | ||
609 | ee->prop.name = NULL; | ||
610 | ee->prop.clas = NULL; | ||
611 | if (n) ee->prop.name = strdup(n); | ||
612 | if (c) ee->prop.clas = strdup(c); | ||
613 | /* FIXME: Forward these changes to Wayland somehow */ | ||
614 | } | ||
615 | |||
616 | static void | ||
617 | _ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h) | ||
618 | { | ||
619 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
620 | |||
621 | if (!ee) return; | ||
622 | if (w < 0) w = 0; | ||
623 | if (h < 0) h = 0; | ||
624 | if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return; | ||
625 | ee->prop.min.w = w; | ||
626 | ee->prop.min.h = h; | ||
627 | } | ||
628 | |||
629 | static void | ||
630 | _ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h) | ||
631 | { | ||
632 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
633 | |||
634 | if (!ee) return; | ||
635 | if (w < 0) w = 0; | ||
636 | if (h < 0) h = 0; | ||
637 | if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return; | ||
638 | ee->prop.max.w = w; | ||
639 | ee->prop.max.h = h; | ||
640 | } | ||
641 | |||
642 | static void | ||
643 | _ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h) | ||
644 | { | ||
645 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
646 | |||
647 | if (!ee) return; | ||
648 | if (w < 0) w = 0; | ||
649 | if (h < 0) h = 0; | ||
650 | if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return; | ||
651 | ee->prop.base.w = w; | ||
652 | ee->prop.base.h = h; | ||
653 | } | ||
654 | |||
655 | static void | ||
656 | _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h) | ||
657 | { | ||
658 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
659 | |||
660 | if (!ee) return; | ||
661 | if (w < 0) w = 0; | ||
662 | if (h < 0) h = 0; | ||
663 | if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return; | ||
664 | ee->prop.step.w = w; | ||
665 | ee->prop.step.h = h; | ||
666 | } | ||
667 | |||
668 | static void | ||
669 | _ecore_evas_wl_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) | ||
670 | { | ||
671 | int x = 0, y = 0; | ||
672 | |||
673 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
674 | |||
675 | if (!ee) return; | ||
676 | if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); | ||
677 | ee->prop.cursor.object = NULL; | ||
678 | |||
679 | if (!obj) | ||
680 | { | ||
681 | ee->prop.cursor.layer = 0; | ||
682 | ee->prop.cursor.hot.x = 0; | ||
683 | ee->prop.cursor.hot.y = 0; | ||
684 | return; | ||
685 | } | ||
686 | |||
687 | ee->prop.cursor.object = obj; | ||
688 | ee->prop.cursor.layer = layer; | ||
689 | ee->prop.cursor.hot.x = hot_x; | ||
690 | ee->prop.cursor.hot.y = hot_y; | ||
691 | |||
692 | evas_pointer_output_xy_get(ee->evas, &x, &y); | ||
693 | evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); | ||
694 | evas_object_move(ee->prop.cursor.object, | ||
695 | x - ee->prop.cursor.hot.x, y - ee->prop.cursor.hot.y); | ||
696 | evas_object_pass_events_set(ee->prop.cursor.object, 1); | ||
697 | if (evas_pointer_inside_get(ee->evas)) | ||
698 | evas_object_show(ee->prop.cursor.object); | ||
699 | |||
700 | evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, | ||
701 | _ecore_evas_wl_object_cursor_del, ee); | ||
702 | } | ||
703 | |||
704 | static void | ||
705 | _ecore_evas_wl_object_cursor_del(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__) | ||
706 | { | ||
707 | Ecore_Evas *ee; | ||
708 | |||
709 | if (!(ee = data)) return; | ||
710 | ee->prop.cursor.object = NULL; | ||
711 | } | ||
712 | |||
713 | static void | ||
714 | _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer) | ||
715 | { | ||
716 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
717 | |||
718 | if (!ee) return; | ||
719 | if (ee->prop.layer == layer) return; | ||
720 | if (layer < 1) layer = 1; | ||
721 | else if (layer > 255) layer = 255; | ||
722 | ee->prop.layer = layer; | ||
723 | } | ||
724 | |||
725 | static void | ||
726 | _ecore_evas_wl_focus_set(Ecore_Evas *ee, int focus __UNUSED__) | ||
727 | { | ||
728 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
729 | |||
730 | if ((!ee) || (!ee->visible)) return; | ||
731 | if (!ee->engine.wl.shell_surface) return; | ||
732 | wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface); | ||
733 | } | ||
734 | |||
735 | static void | ||
736 | _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify) | ||
737 | { | ||
738 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
739 | |||
740 | if (!ee) return; | ||
741 | if (ee->prop.iconified == iconify) return; | ||
742 | ee->prop.iconified = iconify; | ||
743 | /* FIXME: Implement this in Wayland someshow */ | ||
744 | } | ||
745 | |||
746 | static void | ||
747 | _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max) | ||
748 | { | ||
749 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
750 | |||
751 | if (!ee) return; | ||
752 | if (ee->prop.maximized == max) return; | ||
753 | ee->prop.maximized = max; | ||
754 | /* FIXME: Implement this in Wayland someshow */ | ||
755 | } | ||
756 | |||
757 | static void | ||
758 | _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full __UNUSED__) | ||
759 | { | ||
760 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
761 | |||
762 | if ((!ee) || (!ee->visible)) return; | ||
763 | if (!ee->engine.wl.shell_surface) return; | ||
764 | wl_shell_surface_set_fullscreen(ee->engine.wl.shell_surface); | ||
765 | } | ||
766 | |||
767 | static int | ||
768 | _ecore_evas_wl_render(Ecore_Evas *ee) | ||
769 | { | ||
770 | int rend = 0; | ||
771 | |||
772 | if (!ee) return 0; | ||
773 | if (!ee->visible) | ||
774 | evas_norender(ee->evas); | ||
775 | else | ||
776 | { | ||
777 | Eina_List *ll = NULL, *updates = NULL; | ||
778 | Ecore_Evas *ee2 = NULL; | ||
779 | |||
780 | if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); | ||
781 | |||
782 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
783 | { | ||
784 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
785 | if (ee2->engine.func->fn_render) | ||
786 | rend |= ee2->engine.func->fn_render(ee2); | ||
787 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
788 | } | ||
789 | |||
790 | if ((updates = evas_render_updates(ee->evas))) | ||
791 | { | ||
792 | /* if (ee->engine.wl.surface) */ | ||
793 | /* { */ | ||
794 | /* Eina_List *l = NULL; */ | ||
795 | /* Eina_Rectangle *r; */ | ||
796 | |||
797 | /* EINA_LIST_FOREACH(updates, l, r) */ | ||
798 | /* wl_surface_damage(ee->engine.wl.surface, */ | ||
799 | /* r->x, r->y, r->w, r->h); */ | ||
800 | /* } */ | ||
801 | |||
802 | evas_render_updates_free(updates); | ||
803 | _ecore_evas_idle_timeout_update(ee); | ||
804 | rend = 1; | ||
805 | |||
806 | ecore_wl_flush(); | ||
807 | } | ||
808 | |||
809 | if (ee->func.fn_post_render) ee->func.fn_post_render(ee); | ||
810 | } | ||
811 | |||
812 | return rend; | ||
813 | } | ||
814 | |||
815 | static void | ||
816 | _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h) | ||
817 | { | ||
818 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
819 | |||
820 | if (x) *x = 0; | ||
821 | if (y) *y = 0; | ||
822 | ecore_wl_screen_size_get(w, h); | ||
823 | } | ||
824 | |||
825 | static Eina_Bool | ||
826 | _ecore_evas_wl_event_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
827 | { | ||
828 | Ecore_Evas *ee; | ||
829 | Ecore_Event_Mouse_Button *ev; | ||
830 | |||
831 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
832 | |||
833 | ev = event; | ||
834 | _ecore_evas_wl_btn_timestamp = ev->timestamp; | ||
835 | ee = ecore_event_window_match(ev->window); | ||
836 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
837 | if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
838 | evas_event_feed_mouse_down(ee->evas, ev->buttons, ev->modifiers, | ||
839 | ev->timestamp, NULL); | ||
840 | return ECORE_CALLBACK_PASS_ON; | ||
841 | } | ||
842 | |||
843 | static Eina_Bool | ||
844 | _ecore_evas_wl_event_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
845 | { | ||
846 | Ecore_Evas *ee; | ||
847 | Ecore_Event_Mouse_Button *ev; | ||
848 | |||
849 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
850 | |||
851 | ev = event; | ||
852 | ee = ecore_event_window_match(ev->window); | ||
853 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
854 | if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
855 | evas_event_feed_mouse_up(ee->evas, ev->buttons, ev->modifiers, | ||
856 | ev->timestamp, NULL); | ||
857 | return ECORE_CALLBACK_PASS_ON; | ||
858 | } | ||
859 | |||
860 | static Eina_Bool | ||
861 | _ecore_evas_wl_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
862 | { | ||
863 | Ecore_Evas *ee; | ||
864 | Ecore_Event_Mouse_Move *ev; | ||
865 | |||
866 | ev = event; | ||
867 | ee = ecore_event_window_match(ev->window); | ||
868 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
869 | if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
870 | ee->mouse.x = ev->x; | ||
871 | ee->mouse.y = ev->y; | ||
872 | evas_event_feed_mouse_move(ee->evas, ev->x, ev->y, ev->timestamp, NULL); | ||
873 | _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp); | ||
874 | return ECORE_CALLBACK_PASS_ON; | ||
875 | } | ||
876 | |||
877 | static Eina_Bool | ||
878 | _ecore_evas_wl_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
879 | { | ||
880 | Ecore_Evas *ee; | ||
881 | Ecore_Event_Mouse_Wheel *ev; | ||
882 | |||
883 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
884 | |||
885 | ev = event; | ||
886 | ee = ecore_event_window_match(ev->window); | ||
887 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
888 | if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
889 | evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z, | ||
890 | ev->timestamp, NULL); | ||
891 | return ECORE_CALLBACK_PASS_ON; | ||
892 | } | ||
893 | |||
894 | static Eina_Bool | ||
895 | _ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
896 | { | ||
897 | Ecore_Evas *ee; | ||
898 | Ecore_Wl_Event_Mouse_In *ev; | ||
899 | |||
900 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
901 | |||
902 | ev = event; | ||
903 | ee = ecore_event_window_match(ev->window); | ||
904 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
905 | if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
906 | if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); | ||
907 | ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers); | ||
908 | evas_event_feed_mouse_in(ee->evas, ev->time, NULL); | ||
909 | _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->time); | ||
910 | return ECORE_CALLBACK_PASS_ON; | ||
911 | } | ||
912 | |||
913 | static Eina_Bool | ||
914 | _ecore_evas_wl_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
915 | { | ||
916 | Ecore_Evas *ee; | ||
917 | Ecore_Wl_Event_Mouse_Out *ev; | ||
918 | |||
919 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
920 | |||
921 | ev = event; | ||
922 | ee = ecore_event_window_match(ev->window); | ||
923 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
924 | if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
925 | ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers); | ||
926 | _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->time); | ||
927 | evas_event_feed_mouse_out(ee->evas, ev->time, NULL); | ||
928 | if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); | ||
929 | if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); | ||
930 | return ECORE_CALLBACK_PASS_ON; | ||
931 | } | ||
932 | |||
933 | static Eina_Bool | ||
934 | _ecore_evas_wl_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
935 | { | ||
936 | Ecore_Evas *ee; | ||
937 | Ecore_Wl_Event_Focus_In *ev; | ||
938 | |||
939 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
940 | |||
941 | ev = event; | ||
942 | ee = ecore_event_window_match(ev->window); | ||
943 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
944 | if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
945 | ee->prop.focused = 1; | ||
946 | evas_focus_in(ee->evas); | ||
947 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
948 | return ECORE_CALLBACK_PASS_ON; | ||
949 | } | ||
950 | |||
951 | static Eina_Bool | ||
952 | _ecore_evas_wl_event_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
953 | { | ||
954 | Ecore_Evas *ee; | ||
955 | Ecore_Wl_Event_Focus_Out *ev; | ||
956 | |||
957 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
958 | |||
959 | ev = event; | ||
960 | ee = ecore_event_window_match(ev->window); | ||
961 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
962 | if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
963 | evas_focus_out(ee->evas); | ||
964 | ee->prop.focused = 0; | ||
965 | if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); | ||
966 | return ECORE_CALLBACK_PASS_ON; | ||
967 | } | ||
968 | |||
969 | static void | ||
970 | _ecore_evas_wl_handle_configure(void *data, struct wl_shell_surface *shell_surface, uint32_t timestamp __UNUSED__, uint32_t edges __UNUSED__, int32_t width, int32_t height) | ||
971 | { | ||
972 | Ecore_Evas *ee; | ||
973 | |||
974 | /* NB: Trap to prevent compositor from crashing */ | ||
975 | if ((width <= 0) || (height <= 0)) return; | ||
976 | |||
977 | if (!(ee = data)) return; | ||
978 | |||
979 | printf("EGL Handle Configure Message\n"); | ||
980 | if ((shell_surface) && (ee->engine.wl.shell_surface)) | ||
981 | { | ||
982 | if (ee->engine.wl.shell_surface != shell_surface) return; | ||
983 | ecore_evas_resize(ee, width, height); | ||
984 | } | ||
985 | } | ||
986 | |||
987 | static void | ||
988 | _ecore_evas_wl_handle_popup_done(void *data __UNUSED__, struct wl_shell_surface *shell_surface __UNUSED__) | ||
989 | { | ||
990 | |||
991 | } | ||
992 | |||
993 | static void | ||
994 | _ecore_evas_wl_smart_init(void) | ||
995 | { | ||
996 | if (_ecore_evas_wl_smart) return; | ||
997 | { | ||
998 | static const Evas_Smart_Class sc = | ||
999 | { | ||
1000 | "ecore_evas_wl_frame", EVAS_SMART_CLASS_VERSION, | ||
1001 | _ecore_evas_wl_smart_add, | ||
1002 | _ecore_evas_wl_smart_del, | ||
1003 | NULL, | ||
1004 | _ecore_evas_wl_smart_resize, | ||
1005 | _ecore_evas_wl_smart_show, | ||
1006 | _ecore_evas_wl_smart_hide, | ||
1007 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL | ||
1008 | }; | ||
1009 | _ecore_evas_wl_smart = evas_smart_class_new(&sc); | ||
1010 | } | ||
1011 | } | ||
1012 | |||
1013 | static void | ||
1014 | _ecore_evas_wl_smart_add(Evas_Object *obj) | ||
1015 | { | ||
1016 | EE_Wl_Smart_Data *sd; | ||
1017 | Evas *evas; | ||
1018 | |||
1019 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1020 | |||
1021 | if (!(sd = calloc(1, sizeof(EE_Wl_Smart_Data)))) return; | ||
1022 | |||
1023 | evas = evas_object_evas_get(obj); | ||
1024 | |||
1025 | sd->x = 0; | ||
1026 | sd->y = 0; | ||
1027 | sd->w = 1; | ||
1028 | sd->h = 1; | ||
1029 | |||
1030 | sd->frame = evas_object_rectangle_add(evas); | ||
1031 | evas_object_is_frame_object_set(sd->frame, EINA_TRUE); | ||
1032 | evas_object_color_set(sd->frame, 249, 249, 249, 255); | ||
1033 | evas_object_smart_member_add(sd->frame, obj); | ||
1034 | |||
1035 | sd->text = evas_object_text_add(evas); | ||
1036 | evas_object_color_set(sd->text, 0, 0, 0, 255); | ||
1037 | evas_object_text_style_set(sd->text, EVAS_TEXT_STYLE_PLAIN); | ||
1038 | evas_object_text_font_set(sd->text, "Sans", 10); | ||
1039 | evas_object_text_text_set(sd->text, "Smart Test"); | ||
1040 | |||
1041 | evas_object_smart_data_set(obj, sd); | ||
1042 | } | ||
1043 | |||
1044 | static void | ||
1045 | _ecore_evas_wl_smart_del(Evas_Object *obj) | ||
1046 | { | ||
1047 | EE_Wl_Smart_Data *sd; | ||
1048 | |||
1049 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1050 | |||
1051 | if (!(sd = evas_object_smart_data_get(obj))) return; | ||
1052 | evas_object_del(sd->text); | ||
1053 | evas_object_del(sd->frame); | ||
1054 | free(sd); | ||
1055 | } | ||
1056 | |||
1057 | static void | ||
1058 | _ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) | ||
1059 | { | ||
1060 | EE_Wl_Smart_Data *sd; | ||
1061 | |||
1062 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1063 | |||
1064 | if (!(sd = evas_object_smart_data_get(obj))) return; | ||
1065 | if ((sd->w == w) && (sd->h == h)) return; | ||
1066 | sd->w = w; | ||
1067 | sd->h = h; | ||
1068 | evas_object_resize(sd->frame, w, h); | ||
1069 | } | ||
1070 | |||
1071 | static void | ||
1072 | _ecore_evas_wl_smart_show(Evas_Object *obj) | ||
1073 | { | ||
1074 | EE_Wl_Smart_Data *sd; | ||
1075 | |||
1076 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1077 | |||
1078 | if (!(sd = evas_object_smart_data_get(obj))) return; | ||
1079 | evas_object_show(sd->frame); | ||
1080 | evas_object_show(sd->text); | ||
1081 | } | ||
1082 | |||
1083 | static void | ||
1084 | _ecore_evas_wl_smart_hide(Evas_Object *obj) | ||
1085 | { | ||
1086 | EE_Wl_Smart_Data *sd; | ||
1087 | |||
1088 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1089 | |||
1090 | if (!(sd = evas_object_smart_data_get(obj))) return; | ||
1091 | evas_object_hide(sd->text); | ||
1092 | evas_object_hide(sd->frame); | ||
1093 | } | ||
1094 | |||
1095 | static Evas_Object * | ||
1096 | _ecore_evas_wl_frame_add(Evas *evas) | ||
1097 | { | ||
1098 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1099 | |||
1100 | _ecore_evas_wl_smart_init(); | ||
1101 | return evas_object_smart_add(evas, _ecore_evas_wl_smart); | ||
1102 | } | ||
1103 | |||
1104 | void | ||
1105 | _ecore_evas_wayland_egl_resize(Ecore_Evas *ee, int location) | ||
1106 | { | ||
1107 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1108 | |||
1109 | if ((!ee) || (!ee->engine.wl.shell_surface)) return; | ||
1110 | wl_shell_surface_resize(ee->engine.wl.shell_surface, | ||
1111 | ecore_wl_input_device_get(), | ||
1112 | _ecore_evas_wl_btn_timestamp, location); | ||
1113 | } | ||
1114 | |||
1115 | void | ||
1116 | _ecore_evas_wayland_egl_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source) | ||
1117 | { | ||
1118 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1119 | |||
1120 | if ((!ee) || (!ee->engine.wl.surface)) return; | ||
1121 | if ((!source) || (!drag_ee)) return; | ||
1122 | ecore_wl_drag_start(source, ee->engine.wl.surface, drag_ee->engine.wl.buffer); | ||
1123 | } | ||
1124 | |||
1125 | #else | ||
1126 | EAPI Ecore_Evas * | ||
1127 | ecore_evas_wayland_egl_new(const char *disp_name __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__, int frame __UNUSED__) | ||
1128 | { | ||
1129 | return NULL; | ||
1130 | } | ||
1131 | #endif | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_shm.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_shm.c new file mode 100644 index 0000000..e3b15c8 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_wayland_shm.c | |||
@@ -0,0 +1,1257 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include "config.h" | ||
3 | #endif | ||
4 | |||
5 | //#define LOGFNS 1 | ||
6 | |||
7 | #ifdef LOGFNS | ||
8 | # include <stdio.h> | ||
9 | # define LOGFN(fl, ln, fn) \ | ||
10 | printf("-ECORE_EVAS-WL: %25s: %5i - %s\n", fl, ln, fn); | ||
11 | #else | ||
12 | # define LOGFN(fl, ln, fn) | ||
13 | #endif | ||
14 | |||
15 | #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM | ||
16 | # include <stdlib.h> | ||
17 | # include <string.h> | ||
18 | # include <unistd.h> | ||
19 | # include <sys/types.h> | ||
20 | # include <sys/mman.h> | ||
21 | #endif | ||
22 | |||
23 | # include <Eina.h> | ||
24 | # include <Evas.h> | ||
25 | # include <Ecore.h> | ||
26 | |||
27 | # include "ecore_evas_private.h" | ||
28 | # include "Ecore_Evas.h" | ||
29 | |||
30 | #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM | ||
31 | # include <Evas_Engine_Wayland_Shm.h> | ||
32 | # include <Ecore_Wayland.h> | ||
33 | |||
34 | /* local structures */ | ||
35 | typedef struct _EE_Wl_Smart_Data EE_Wl_Smart_Data; | ||
36 | struct _EE_Wl_Smart_Data | ||
37 | { | ||
38 | Evas_Object *frame; | ||
39 | Evas_Object *text; | ||
40 | Evas_Coord x, y, w, h; | ||
41 | }; | ||
42 | |||
43 | /* local function prototypes */ | ||
44 | static int _ecore_evas_wl_init(void); | ||
45 | static int _ecore_evas_wl_shutdown(void); | ||
46 | static void _ecore_evas_wl_pre_free(Ecore_Evas *ee); | ||
47 | static void _ecore_evas_wl_free(Ecore_Evas *ee); | ||
48 | static void _ecore_evas_wl_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
49 | static void _ecore_evas_wl_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
50 | static void _ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
51 | static void _ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
52 | static void _ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
53 | static void _ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)); | ||
54 | static void _ecore_evas_wl_move(Ecore_Evas *ee, int x, int y); | ||
55 | static void _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h); | ||
56 | static void _ecore_evas_wl_show(Ecore_Evas *ee); | ||
57 | static void _ecore_evas_wl_hide(Ecore_Evas *ee); | ||
58 | static void _ecore_evas_wl_raise(Ecore_Evas *ee); | ||
59 | static void _ecore_evas_wl_lower(Ecore_Evas *ee); | ||
60 | static void _ecore_evas_wl_activate(Ecore_Evas *ee); | ||
61 | static void _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *t); | ||
62 | static void _ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c); | ||
63 | static void _ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h); | ||
64 | static void _ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h); | ||
65 | static void _ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h); | ||
66 | static void _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h); | ||
67 | static void _ecore_evas_wl_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y); | ||
68 | static void _ecore_evas_wl_object_cursor_del(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__); | ||
69 | static void _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer); | ||
70 | static void _ecore_evas_wl_focus_set(Ecore_Evas *ee, int focus __UNUSED__); | ||
71 | static void _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify); | ||
72 | static void _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max); | ||
73 | static void _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full __UNUSED__); | ||
74 | static int _ecore_evas_wl_render(Ecore_Evas *ee); | ||
75 | static void _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h); | ||
76 | static void _ecore_evas_wl_buffer_new(Ecore_Evas *ee, void **dest); | ||
77 | |||
78 | static Eina_Bool _ecore_evas_wl_event_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
79 | static Eina_Bool _ecore_evas_wl_event_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
80 | static Eina_Bool _ecore_evas_wl_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
81 | static Eina_Bool _ecore_evas_wl_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
82 | static Eina_Bool _ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
83 | static Eina_Bool _ecore_evas_wl_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
84 | static Eina_Bool _ecore_evas_wl_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
85 | static Eina_Bool _ecore_evas_wl_event_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event); | ||
86 | |||
87 | static void _ecore_evas_wl_handle_configure(void *data, struct wl_shell_surface *shell_surface __UNUSED__, uint32_t timestamp __UNUSED__, uint32_t edges __UNUSED__, int32_t width, int32_t height); | ||
88 | static void _ecore_evas_wl_handle_popup_done(void *data __UNUSED__, struct wl_shell_surface *shell_surface __UNUSED__); | ||
89 | |||
90 | /* SMART stuff for frame */ | ||
91 | static Evas_Smart *_ecore_evas_wl_smart = NULL; | ||
92 | |||
93 | static void _ecore_evas_wl_smart_init(void); | ||
94 | static void _ecore_evas_wl_smart_add(Evas_Object *obj); | ||
95 | static void _ecore_evas_wl_smart_del(Evas_Object *obj); | ||
96 | static void _ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h); | ||
97 | static void _ecore_evas_wl_smart_show(Evas_Object *obj); | ||
98 | static void _ecore_evas_wl_smart_hide(Evas_Object *obj); | ||
99 | |||
100 | static Evas_Object *_ecore_evas_wl_frame_add(Evas *evas); | ||
101 | |||
102 | /* local variables */ | ||
103 | static int _ecore_evas_wl_init_count = 0; | ||
104 | static Ecore_Event_Handler *_ecore_evas_wl_event_handlers[8]; | ||
105 | static uint32_t _ecore_evas_wl_btn_timestamp; | ||
106 | static const struct wl_shell_surface_listener _ecore_evas_wl_shell_surface_listener = | ||
107 | { | ||
108 | _ecore_evas_wl_handle_configure, | ||
109 | _ecore_evas_wl_handle_popup_done | ||
110 | }; | ||
111 | |||
112 | static Ecore_Evas_Engine_Func _ecore_wl_engine_func = | ||
113 | { | ||
114 | _ecore_evas_wl_free, | ||
115 | _ecore_evas_wl_callback_resize_set, | ||
116 | _ecore_evas_wl_callback_move_set, | ||
117 | NULL, // callback show set | ||
118 | NULL, // callback hide set | ||
119 | _ecore_evas_wl_callback_delete_request_set, | ||
120 | NULL, // callback destroy set | ||
121 | _ecore_evas_wl_callback_focus_in_set, | ||
122 | _ecore_evas_wl_callback_focus_out_set, | ||
123 | _ecore_evas_wl_callback_mouse_in_set, | ||
124 | NULL, // callback mouse out set | ||
125 | NULL, // callback sticky set | ||
126 | NULL, // callback unsticky set | ||
127 | NULL, // callback pre render set | ||
128 | NULL, // callback post render set | ||
129 | _ecore_evas_wl_move, | ||
130 | NULL, // func managed move | ||
131 | _ecore_evas_wl_resize, | ||
132 | NULL, // func move_resize | ||
133 | NULL, // func rotation set | ||
134 | NULL, // func shaped set | ||
135 | _ecore_evas_wl_show, | ||
136 | _ecore_evas_wl_hide, | ||
137 | _ecore_evas_wl_raise, | ||
138 | _ecore_evas_wl_lower, | ||
139 | _ecore_evas_wl_activate, | ||
140 | _ecore_evas_wl_title_set, | ||
141 | _ecore_evas_wl_name_class_set, | ||
142 | _ecore_evas_wl_size_min_set, | ||
143 | _ecore_evas_wl_size_max_set, | ||
144 | _ecore_evas_wl_size_base_set, | ||
145 | _ecore_evas_wl_size_step_set, | ||
146 | _ecore_evas_wl_object_cursor_set, | ||
147 | _ecore_evas_wl_layer_set, | ||
148 | _ecore_evas_wl_focus_set, | ||
149 | _ecore_evas_wl_iconified_set, | ||
150 | NULL, // func borderless set | ||
151 | NULL, // func override set | ||
152 | _ecore_evas_wl_maximized_set, | ||
153 | _ecore_evas_wl_fullscreen_set, | ||
154 | NULL, // func avoid_damage set | ||
155 | NULL, // func withdrawn set | ||
156 | NULL, // func sticky set | ||
157 | NULL, // func ignore_events set | ||
158 | NULL, // func alpha set | ||
159 | NULL, // func transparent set | ||
160 | _ecore_evas_wl_render, | ||
161 | _ecore_evas_wl_screen_geometry_get | ||
162 | }; | ||
163 | |||
164 | /* external variables */ | ||
165 | #endif | ||
166 | |||
167 | #ifdef BUILD_ECORE_EVAS_WAYLAND_SHM | ||
168 | EAPI Ecore_Evas * | ||
169 | ecore_evas_wayland_shm_new(const char *disp_name, int x, int y, int w, int h, int frame) | ||
170 | { | ||
171 | Evas_Engine_Info_Wayland_Shm *einfo; | ||
172 | Ecore_Evas *ee; | ||
173 | int method = 0; | ||
174 | static int _win_id = 1; | ||
175 | |||
176 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
177 | |||
178 | if (!(method = evas_render_method_lookup("wayland_shm"))) | ||
179 | { | ||
180 | ERR("Render method lookup failed."); | ||
181 | return NULL; | ||
182 | } | ||
183 | |||
184 | if (!(ecore_wl_init(disp_name))) | ||
185 | { | ||
186 | ERR("Failed to initialize Ecore Wayland."); | ||
187 | return NULL; | ||
188 | } | ||
189 | |||
190 | if (!(ee = calloc(1, sizeof(Ecore_Evas)))) | ||
191 | { | ||
192 | ERR("Failed to allocate Ecore_Evas."); | ||
193 | ecore_wl_shutdown(); | ||
194 | return NULL; | ||
195 | } | ||
196 | |||
197 | ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); | ||
198 | |||
199 | _ecore_evas_wl_init(); | ||
200 | |||
201 | ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_wl_engine_func; | ||
202 | |||
203 | ee->driver = "wayland_shm"; | ||
204 | if (disp_name) ee->name = strdup(disp_name); | ||
205 | |||
206 | if (w < 1) w = 1; | ||
207 | if (h < 1) h = 1; | ||
208 | |||
209 | ee->req.x = ee->x = x; | ||
210 | ee->req.y = ee->y = y; | ||
211 | ee->req.w = ee->w = w; | ||
212 | ee->req.h = ee->h = h; | ||
213 | ee->rotation = 0; | ||
214 | ee->prop.max.w = ee->prop.max.h = 32767; | ||
215 | ee->prop.layer = 4; | ||
216 | ee->prop.request_pos = 0; | ||
217 | ee->prop.sticky = 0; | ||
218 | ee->prop.draw_frame = frame; | ||
219 | ee->prop.window = _win_id++; | ||
220 | |||
221 | ee->evas = evas_new(); | ||
222 | evas_data_attach_set(ee->evas, ee); | ||
223 | evas_output_method_set(ee->evas, method); | ||
224 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
225 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
226 | |||
227 | if (ee->prop.draw_frame) | ||
228 | evas_output_framespace_set(ee->evas, 4, 18, 8, 22); | ||
229 | |||
230 | if ((einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas))) | ||
231 | { | ||
232 | einfo->info.rotation = ee->rotation; | ||
233 | einfo->info.debug = EINA_FALSE; | ||
234 | if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) | ||
235 | { | ||
236 | ERR("Failed to set Evas Engine Info for '%s'.", ee->driver); | ||
237 | ecore_evas_free(ee); | ||
238 | return NULL; | ||
239 | } | ||
240 | } | ||
241 | else | ||
242 | { | ||
243 | ERR("Failed to get Evas Engine Info for '%s'.", ee->driver); | ||
244 | ecore_evas_free(ee); | ||
245 | return NULL; | ||
246 | } | ||
247 | |||
248 | /* NB: we need to be notified before 'free' so we can munmap the evas | ||
249 | * engine destination */ | ||
250 | ecore_evas_callback_pre_free_set(ee, _ecore_evas_wl_pre_free); | ||
251 | |||
252 | if (ee->prop.draw_frame) | ||
253 | { | ||
254 | ee->engine.wl.frame = _ecore_evas_wl_frame_add(ee->evas); | ||
255 | evas_object_is_frame_object_set(ee->engine.wl.frame, EINA_TRUE); | ||
256 | evas_object_move(ee->engine.wl.frame, 0, 0); | ||
257 | } | ||
258 | |||
259 | ecore_evas_input_event_register(ee); | ||
260 | _ecore_evas_register(ee); | ||
261 | |||
262 | ecore_event_window_register(ee->prop.window, ee, ee->evas, | ||
263 | (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, | ||
264 | (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, | ||
265 | (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, | ||
266 | (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); | ||
267 | |||
268 | evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); | ||
269 | |||
270 | return ee; | ||
271 | } | ||
272 | |||
273 | /* local functions */ | ||
274 | static int | ||
275 | _ecore_evas_wl_init(void) | ||
276 | { | ||
277 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
278 | |||
279 | if (++_ecore_evas_wl_init_count != 1) | ||
280 | return _ecore_evas_wl_init_count; | ||
281 | |||
282 | _ecore_evas_wl_event_handlers[0] = | ||
283 | ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, | ||
284 | _ecore_evas_wl_event_mouse_down, NULL); | ||
285 | _ecore_evas_wl_event_handlers[1] = | ||
286 | ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, | ||
287 | _ecore_evas_wl_event_mouse_up, NULL); | ||
288 | _ecore_evas_wl_event_handlers[2] = | ||
289 | ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, | ||
290 | _ecore_evas_wl_event_mouse_move, NULL); | ||
291 | _ecore_evas_wl_event_handlers[3] = | ||
292 | ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, | ||
293 | _ecore_evas_wl_event_mouse_wheel, NULL); | ||
294 | _ecore_evas_wl_event_handlers[4] = | ||
295 | ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_IN, | ||
296 | _ecore_evas_wl_event_mouse_in, NULL); | ||
297 | _ecore_evas_wl_event_handlers[5] = | ||
298 | ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_OUT, | ||
299 | _ecore_evas_wl_event_mouse_out, NULL); | ||
300 | _ecore_evas_wl_event_handlers[6] = | ||
301 | ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_IN, | ||
302 | _ecore_evas_wl_event_focus_in, NULL); | ||
303 | _ecore_evas_wl_event_handlers[7] = | ||
304 | ecore_event_handler_add(ECORE_WL_EVENT_FOCUS_OUT, | ||
305 | _ecore_evas_wl_event_focus_out, NULL); | ||
306 | |||
307 | ecore_event_evas_init(); | ||
308 | |||
309 | return _ecore_evas_wl_init_count; | ||
310 | } | ||
311 | |||
312 | static int | ||
313 | _ecore_evas_wl_shutdown(void) | ||
314 | { | ||
315 | unsigned int i = 0; | ||
316 | |||
317 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
318 | |||
319 | if (--_ecore_evas_wl_init_count != 0) | ||
320 | return _ecore_evas_wl_init_count; | ||
321 | |||
322 | for (i = 0; i < sizeof(_ecore_evas_wl_event_handlers) / sizeof(Ecore_Event_Handler *); i++) | ||
323 | { | ||
324 | if (_ecore_evas_wl_event_handlers[i]) | ||
325 | ecore_event_handler_del(_ecore_evas_wl_event_handlers[i]); | ||
326 | } | ||
327 | |||
328 | ecore_event_evas_shutdown(); | ||
329 | |||
330 | return _ecore_evas_wl_init_count; | ||
331 | } | ||
332 | |||
333 | static void | ||
334 | _ecore_evas_wl_pre_free(Ecore_Evas *ee) | ||
335 | { | ||
336 | Evas_Engine_Info_Wayland_Shm *einfo; | ||
337 | |||
338 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
339 | |||
340 | /* destroy frame */ | ||
341 | if (ee->engine.wl.frame) evas_object_del(ee->engine.wl.frame); | ||
342 | |||
343 | /* get engine info */ | ||
344 | einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas); | ||
345 | if ((einfo) && (einfo->info.dest)) | ||
346 | { | ||
347 | int ret = 0; | ||
348 | |||
349 | /* munmap previous engine destination */ | ||
350 | ret = munmap(einfo->info.dest, ((ee->w * sizeof(int)) * ee->h)); | ||
351 | } | ||
352 | } | ||
353 | |||
354 | static void | ||
355 | _ecore_evas_wl_free(Ecore_Evas *ee) | ||
356 | { | ||
357 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
358 | |||
359 | /* destroy buffer */ | ||
360 | if (ee->engine.wl.buffer) wl_buffer_destroy(ee->engine.wl.buffer); | ||
361 | ee->engine.wl.buffer = NULL; | ||
362 | |||
363 | /* destroy shell surface */ | ||
364 | if (ee->engine.wl.shell_surface) | ||
365 | wl_shell_surface_destroy(ee->engine.wl.shell_surface); | ||
366 | ee->engine.wl.shell_surface = NULL; | ||
367 | |||
368 | /* destroy surface */ | ||
369 | if (ee->engine.wl.surface) wl_surface_destroy(ee->engine.wl.surface); | ||
370 | ee->engine.wl.surface = NULL; | ||
371 | |||
372 | ecore_event_window_unregister(ee->prop.window); | ||
373 | ecore_evas_input_event_unregister(ee); | ||
374 | |||
375 | _ecore_evas_wl_shutdown(); | ||
376 | ecore_wl_shutdown(); | ||
377 | } | ||
378 | |||
379 | static void | ||
380 | _ecore_evas_wl_callback_resize_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
381 | { | ||
382 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
383 | |||
384 | if (!ee) return; | ||
385 | ee->func.fn_resize = func; | ||
386 | } | ||
387 | |||
388 | static void | ||
389 | _ecore_evas_wl_callback_move_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
390 | { | ||
391 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
392 | |||
393 | if (!ee) return; | ||
394 | ee->func.fn_move = func; | ||
395 | } | ||
396 | |||
397 | static void | ||
398 | _ecore_evas_wl_callback_delete_request_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
399 | { | ||
400 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
401 | |||
402 | if (!ee) return; | ||
403 | ee->func.fn_delete_request = func; | ||
404 | } | ||
405 | |||
406 | static void | ||
407 | _ecore_evas_wl_callback_focus_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
408 | { | ||
409 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
410 | |||
411 | if (!ee) return; | ||
412 | ee->func.fn_focus_in = func; | ||
413 | } | ||
414 | |||
415 | static void | ||
416 | _ecore_evas_wl_callback_focus_out_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
417 | { | ||
418 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
419 | |||
420 | if (!ee) return; | ||
421 | ee->func.fn_focus_out = func; | ||
422 | } | ||
423 | |||
424 | static void | ||
425 | _ecore_evas_wl_callback_mouse_in_set(Ecore_Evas *ee, void (*func)(Ecore_Evas *ee)) | ||
426 | { | ||
427 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
428 | |||
429 | if (!ee) return; | ||
430 | ee->func.fn_mouse_in = func; | ||
431 | } | ||
432 | |||
433 | static void | ||
434 | _ecore_evas_wl_move(Ecore_Evas *ee, int x, int y) | ||
435 | { | ||
436 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
437 | |||
438 | if (!ee) return; | ||
439 | // if ((ee->x == x) && (ee->y == y)) return; | ||
440 | ee->req.x = x; | ||
441 | ee->req.y = y; | ||
442 | |||
443 | ee->x = x; | ||
444 | ee->y = y; | ||
445 | |||
446 | if (ee->engine.wl.shell_surface) | ||
447 | { | ||
448 | wl_shell_surface_move(ee->engine.wl.shell_surface, | ||
449 | ecore_wl_input_device_get(), | ||
450 | _ecore_evas_wl_btn_timestamp); | ||
451 | } | ||
452 | |||
453 | if (ee->func.fn_move) ee->func.fn_move(ee); | ||
454 | } | ||
455 | |||
456 | static void | ||
457 | _ecore_evas_wl_resize(Ecore_Evas *ee, int w, int h) | ||
458 | { | ||
459 | Evas_Engine_Info_Wayland_Shm *einfo; | ||
460 | |||
461 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
462 | |||
463 | if (!ee) return; | ||
464 | if (w < 1) w = 1; | ||
465 | if (h < 1) h = 1; | ||
466 | if ((ee->w == w) && (ee->h == h)) return; | ||
467 | |||
468 | ee->req.w = w; | ||
469 | ee->req.h = h; | ||
470 | |||
471 | if (ee->visible) | ||
472 | { | ||
473 | /* damage old surface, if it exists */ | ||
474 | |||
475 | /* NB: This removes any lingering screen artifacts in the compositor. | ||
476 | * This may be a 'HACK' if the issue is actually in the wayland | ||
477 | * compositor, but for now lets implement this so we don't have screen | ||
478 | * artifacts laying around during a resize */ | ||
479 | if (ee->engine.wl.surface) | ||
480 | wl_surface_damage(ee->engine.wl.surface, 0, 0, ee->w, ee->h); | ||
481 | } | ||
482 | |||
483 | /* get engine info */ | ||
484 | einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas); | ||
485 | if (einfo->info.dest) | ||
486 | { | ||
487 | int ret = 0; | ||
488 | |||
489 | /* munmap previous engine destination */ | ||
490 | ret = munmap(einfo->info.dest, ((ee->w * sizeof(int)) * ee->h)); | ||
491 | } | ||
492 | |||
493 | /* free old buffer */ | ||
494 | if (ee->engine.wl.buffer) wl_buffer_destroy(ee->engine.wl.buffer); | ||
495 | ee->engine.wl.buffer = NULL; | ||
496 | |||
497 | ee->w = w; | ||
498 | ee->h = h; | ||
499 | |||
500 | /* create buffer @ new size (also mmaps the new destination) */ | ||
501 | _ecore_evas_wl_buffer_new(ee, &einfo->info.dest); | ||
502 | |||
503 | /* flush new buffer fd */ | ||
504 | ecore_wl_flush(); | ||
505 | |||
506 | /* change evas output & viewport sizes */ | ||
507 | evas_output_size_set(ee->evas, ee->w, ee->h); | ||
508 | evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); | ||
509 | evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); | ||
510 | if (ee->engine.wl.frame) | ||
511 | evas_object_resize(ee->engine.wl.frame, ee->w, ee->h); | ||
512 | |||
513 | /* set new engine destination */ | ||
514 | evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); | ||
515 | |||
516 | /* damage buffer */ | ||
517 | wl_buffer_damage(ee->engine.wl.buffer, 0, 0, ee->w, ee->h); | ||
518 | |||
519 | if (ee->visible) | ||
520 | { | ||
521 | /* damage surface */ | ||
522 | wl_surface_damage(ee->engine.wl.surface, 0, 0, ee->w, ee->h); | ||
523 | |||
524 | /* if visible, attach to surface */ | ||
525 | wl_surface_attach(ee->engine.wl.surface, ee->engine.wl.buffer, 0, 0); | ||
526 | } | ||
527 | |||
528 | if (ee->func.fn_resize) ee->func.fn_resize(ee); | ||
529 | } | ||
530 | |||
531 | static void | ||
532 | _ecore_evas_wl_show(Ecore_Evas *ee) | ||
533 | { | ||
534 | Evas_Engine_Info_Wayland_Shm *einfo; | ||
535 | |||
536 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
537 | |||
538 | if (!ee) return; | ||
539 | if (ee->visible) return; | ||
540 | |||
541 | /* get engine info */ | ||
542 | einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas); | ||
543 | |||
544 | /* create new surface */ | ||
545 | ee->engine.wl.surface = | ||
546 | wl_compositor_create_surface(ecore_wl_compositor_get()); | ||
547 | wl_surface_set_user_data(ee->engine.wl.surface, (void *)ee->prop.window); | ||
548 | |||
549 | /* get new shell surface */ | ||
550 | ee->engine.wl.shell_surface = | ||
551 | wl_shell_get_shell_surface(ecore_wl_shell_get(), ee->engine.wl.surface); | ||
552 | |||
553 | /* set toplevel */ | ||
554 | wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface); | ||
555 | |||
556 | /* create buffer @ new size (also mmaps the new destination) */ | ||
557 | _ecore_evas_wl_buffer_new(ee, &einfo->info.dest); | ||
558 | |||
559 | if (ee->engine.wl.frame) | ||
560 | { | ||
561 | evas_object_show(ee->engine.wl.frame); | ||
562 | evas_object_resize(ee->engine.wl.frame, ee->w, ee->h); | ||
563 | } | ||
564 | |||
565 | /* set new engine destination */ | ||
566 | evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); | ||
567 | |||
568 | /* add configure listener for wayland resize events */ | ||
569 | wl_shell_surface_add_listener(ee->engine.wl.shell_surface, | ||
570 | &_ecore_evas_wl_shell_surface_listener, ee); | ||
571 | |||
572 | /* flush new buffer fd */ | ||
573 | ecore_wl_flush(); | ||
574 | |||
575 | /* attach buffer to surface */ | ||
576 | wl_surface_attach(ee->engine.wl.surface, ee->engine.wl.buffer, 0, 0); | ||
577 | |||
578 | /* NB: No need to do a damage here. If we do, we end up w/ screen | ||
579 | * artifacts in the compositor */ | ||
580 | /* wl_surface_damage(ee->engine.wl.surface, 0, 0, ee->w, ee->h); */ | ||
581 | |||
582 | ee->visible = 1; | ||
583 | if (ee->func.fn_show) ee->func.fn_show(ee); | ||
584 | } | ||
585 | |||
586 | static void | ||
587 | _ecore_evas_wl_hide(Ecore_Evas *ee) | ||
588 | { | ||
589 | Evas_Engine_Info_Wayland_Shm *einfo; | ||
590 | |||
591 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
592 | |||
593 | if (!ee) return; | ||
594 | if (!ee->visible) return; | ||
595 | |||
596 | /* get engine info */ | ||
597 | einfo = (Evas_Engine_Info_Wayland_Shm *)evas_engine_info_get(ee->evas); | ||
598 | if (einfo->info.dest) | ||
599 | { | ||
600 | int ret = 0; | ||
601 | |||
602 | /* munmap previous engine destination */ | ||
603 | ret = munmap(einfo->info.dest, ((ee->w * sizeof(int)) * ee->h)); | ||
604 | einfo->info.dest = NULL; | ||
605 | } | ||
606 | |||
607 | /* free old buffer */ | ||
608 | if (ee->engine.wl.buffer) wl_buffer_destroy(ee->engine.wl.buffer); | ||
609 | ee->engine.wl.buffer = NULL; | ||
610 | |||
611 | /* set new engine destination */ | ||
612 | evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); | ||
613 | |||
614 | /* destroy shell surface */ | ||
615 | if (ee->engine.wl.shell_surface) | ||
616 | wl_shell_surface_destroy(ee->engine.wl.shell_surface); | ||
617 | ee->engine.wl.shell_surface = NULL; | ||
618 | |||
619 | /* destroy surface */ | ||
620 | if (ee->engine.wl.surface) wl_surface_destroy(ee->engine.wl.surface); | ||
621 | ee->engine.wl.surface = NULL; | ||
622 | |||
623 | ee->visible = 0; | ||
624 | ee->should_be_visible = 0; | ||
625 | if (ee->func.fn_hide) ee->func.fn_hide(ee); | ||
626 | } | ||
627 | |||
628 | static void | ||
629 | _ecore_evas_wl_raise(Ecore_Evas *ee) | ||
630 | { | ||
631 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
632 | |||
633 | if ((!ee) || (!ee->visible)) return; | ||
634 | if (!ee->engine.wl.shell_surface) return; | ||
635 | wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface); | ||
636 | } | ||
637 | |||
638 | static void | ||
639 | _ecore_evas_wl_lower(Ecore_Evas *ee) | ||
640 | { | ||
641 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
642 | |||
643 | if ((!ee) || (!ee->visible)) return; | ||
644 | /* FIXME: Need a way to tell Wayland to lower */ | ||
645 | } | ||
646 | |||
647 | static void | ||
648 | _ecore_evas_wl_activate(Ecore_Evas *ee) | ||
649 | { | ||
650 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
651 | |||
652 | if ((!ee) || (!ee->visible)) return; | ||
653 | if (!ee->engine.wl.shell_surface) return; | ||
654 | wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface); | ||
655 | } | ||
656 | |||
657 | static void | ||
658 | _ecore_evas_wl_title_set(Ecore_Evas *ee, const char *t) | ||
659 | { | ||
660 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
661 | |||
662 | if (!ee) return; | ||
663 | if (ee->prop.title) free(ee->prop.title); | ||
664 | ee->prop.title = NULL; | ||
665 | if (t) ee->prop.title = strdup(t); | ||
666 | |||
667 | if ((ee->prop.draw_frame) && (ee->engine.wl.frame)) | ||
668 | { | ||
669 | EE_Wl_Smart_Data *sd; | ||
670 | |||
671 | if (!(sd = evas_object_smart_data_get(ee->engine.wl.frame))) return; | ||
672 | evas_object_text_text_set(sd->text, ee->prop.title); | ||
673 | } | ||
674 | } | ||
675 | |||
676 | static void | ||
677 | _ecore_evas_wl_name_class_set(Ecore_Evas *ee, const char *n, const char *c) | ||
678 | { | ||
679 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
680 | |||
681 | if (!ee) return; | ||
682 | if (ee->prop.name) free(ee->prop.name); | ||
683 | if (ee->prop.clas) free(ee->prop.clas); | ||
684 | ee->prop.name = NULL; | ||
685 | ee->prop.clas = NULL; | ||
686 | if (n) ee->prop.name = strdup(n); | ||
687 | if (c) ee->prop.clas = strdup(c); | ||
688 | /* FIXME: Forward these changes to Wayland somehow */ | ||
689 | } | ||
690 | |||
691 | static void | ||
692 | _ecore_evas_wl_size_min_set(Ecore_Evas *ee, int w, int h) | ||
693 | { | ||
694 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
695 | |||
696 | if (!ee) return; | ||
697 | if (w < 0) w = 0; | ||
698 | if (h < 0) h = 0; | ||
699 | if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return; | ||
700 | ee->prop.min.w = w; | ||
701 | ee->prop.min.h = h; | ||
702 | } | ||
703 | |||
704 | static void | ||
705 | _ecore_evas_wl_size_max_set(Ecore_Evas *ee, int w, int h) | ||
706 | { | ||
707 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
708 | |||
709 | if (!ee) return; | ||
710 | if (w < 0) w = 0; | ||
711 | if (h < 0) h = 0; | ||
712 | if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return; | ||
713 | ee->prop.max.w = w; | ||
714 | ee->prop.max.h = h; | ||
715 | } | ||
716 | |||
717 | static void | ||
718 | _ecore_evas_wl_size_base_set(Ecore_Evas *ee, int w, int h) | ||
719 | { | ||
720 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
721 | |||
722 | if (!ee) return; | ||
723 | if (w < 0) w = 0; | ||
724 | if (h < 0) h = 0; | ||
725 | if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return; | ||
726 | ee->prop.base.w = w; | ||
727 | ee->prop.base.h = h; | ||
728 | } | ||
729 | |||
730 | static void | ||
731 | _ecore_evas_wl_size_step_set(Ecore_Evas *ee, int w, int h) | ||
732 | { | ||
733 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
734 | |||
735 | if (!ee) return; | ||
736 | if (w < 0) w = 0; | ||
737 | if (h < 0) h = 0; | ||
738 | if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return; | ||
739 | ee->prop.step.w = w; | ||
740 | ee->prop.step.h = h; | ||
741 | } | ||
742 | |||
743 | static void | ||
744 | _ecore_evas_wl_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) | ||
745 | { | ||
746 | int x = 0, y = 0; | ||
747 | |||
748 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
749 | |||
750 | if (!ee) return; | ||
751 | if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); | ||
752 | ee->prop.cursor.object = NULL; | ||
753 | |||
754 | if (!obj) | ||
755 | { | ||
756 | ee->prop.cursor.layer = 0; | ||
757 | ee->prop.cursor.hot.x = 0; | ||
758 | ee->prop.cursor.hot.y = 0; | ||
759 | return; | ||
760 | } | ||
761 | |||
762 | ee->prop.cursor.object = obj; | ||
763 | ee->prop.cursor.layer = layer; | ||
764 | ee->prop.cursor.hot.x = hot_x; | ||
765 | ee->prop.cursor.hot.y = hot_y; | ||
766 | |||
767 | evas_pointer_output_xy_get(ee->evas, &x, &y); | ||
768 | evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); | ||
769 | evas_object_move(ee->prop.cursor.object, | ||
770 | x - ee->prop.cursor.hot.x, y - ee->prop.cursor.hot.y); | ||
771 | evas_object_pass_events_set(ee->prop.cursor.object, 1); | ||
772 | if (evas_pointer_inside_get(ee->evas)) | ||
773 | evas_object_show(ee->prop.cursor.object); | ||
774 | |||
775 | evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, | ||
776 | _ecore_evas_wl_object_cursor_del, ee); | ||
777 | } | ||
778 | |||
779 | static void | ||
780 | _ecore_evas_wl_object_cursor_del(void *data, Evas *evas __UNUSED__, Evas_Object *obj __UNUSED__, void *event __UNUSED__) | ||
781 | { | ||
782 | Ecore_Evas *ee; | ||
783 | |||
784 | if (!(ee = data)) return; | ||
785 | ee->prop.cursor.object = NULL; | ||
786 | } | ||
787 | |||
788 | static void | ||
789 | _ecore_evas_wl_layer_set(Ecore_Evas *ee, int layer) | ||
790 | { | ||
791 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
792 | |||
793 | if (!ee) return; | ||
794 | if (ee->prop.layer == layer) return; | ||
795 | if (layer < 1) layer = 1; | ||
796 | else if (layer > 255) layer = 255; | ||
797 | ee->prop.layer = layer; | ||
798 | } | ||
799 | |||
800 | static void | ||
801 | _ecore_evas_wl_focus_set(Ecore_Evas *ee, int focus __UNUSED__) | ||
802 | { | ||
803 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
804 | |||
805 | if ((!ee) || (!ee->visible)) return; | ||
806 | if (!ee->engine.wl.shell_surface) return; | ||
807 | wl_shell_surface_set_toplevel(ee->engine.wl.shell_surface); | ||
808 | } | ||
809 | |||
810 | static void | ||
811 | _ecore_evas_wl_iconified_set(Ecore_Evas *ee, int iconify) | ||
812 | { | ||
813 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
814 | |||
815 | if (!ee) return; | ||
816 | if (ee->prop.iconified == iconify) return; | ||
817 | ee->prop.iconified = iconify; | ||
818 | /* FIXME: Implement this in Wayland someshow */ | ||
819 | } | ||
820 | |||
821 | static void | ||
822 | _ecore_evas_wl_maximized_set(Ecore_Evas *ee, int max) | ||
823 | { | ||
824 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
825 | |||
826 | if (!ee) return; | ||
827 | if (ee->prop.maximized == max) return; | ||
828 | ee->prop.maximized = max; | ||
829 | /* FIXME: Implement this in Wayland someshow */ | ||
830 | } | ||
831 | |||
832 | static void | ||
833 | _ecore_evas_wl_fullscreen_set(Ecore_Evas *ee, int full __UNUSED__) | ||
834 | { | ||
835 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
836 | |||
837 | if ((!ee) || (!ee->visible)) return; | ||
838 | if (!ee->engine.wl.shell_surface) return; | ||
839 | wl_shell_surface_set_fullscreen(ee->engine.wl.shell_surface); | ||
840 | } | ||
841 | |||
842 | static int | ||
843 | _ecore_evas_wl_render(Ecore_Evas *ee) | ||
844 | { | ||
845 | int rend = 0; | ||
846 | |||
847 | if (!ee) return 0; | ||
848 | if (!ee->visible) | ||
849 | evas_norender(ee->evas); | ||
850 | else | ||
851 | { | ||
852 | Eina_List *ll = NULL, *updates = NULL; | ||
853 | Ecore_Evas *ee2 = NULL; | ||
854 | |||
855 | if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); | ||
856 | |||
857 | EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) | ||
858 | { | ||
859 | if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); | ||
860 | if (ee2->engine.func->fn_render) | ||
861 | rend |= ee2->engine.func->fn_render(ee2); | ||
862 | if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); | ||
863 | } | ||
864 | |||
865 | if ((updates = evas_render_updates(ee->evas))) | ||
866 | { | ||
867 | Eina_List *l = NULL; | ||
868 | Eina_Rectangle *r; | ||
869 | |||
870 | EINA_LIST_FOREACH(updates, l, r) | ||
871 | { | ||
872 | if (ee->engine.wl.buffer) | ||
873 | wl_buffer_damage(ee->engine.wl.buffer, | ||
874 | r->x, r->y, r->w, r->h); | ||
875 | |||
876 | if (ee->engine.wl.surface) | ||
877 | wl_surface_damage(ee->engine.wl.surface, | ||
878 | r->x, r->y, r->w, r->h); | ||
879 | } | ||
880 | |||
881 | evas_render_updates_free(updates); | ||
882 | _ecore_evas_idle_timeout_update(ee); | ||
883 | rend = 1; | ||
884 | |||
885 | ecore_wl_flush(); | ||
886 | } | ||
887 | |||
888 | if (ee->func.fn_post_render) ee->func.fn_post_render(ee); | ||
889 | } | ||
890 | |||
891 | return rend; | ||
892 | } | ||
893 | |||
894 | static void | ||
895 | _ecore_evas_wl_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h) | ||
896 | { | ||
897 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
898 | |||
899 | if (x) *x = 0; | ||
900 | if (y) *y = 0; | ||
901 | ecore_wl_screen_size_get(w, h); | ||
902 | } | ||
903 | |||
904 | static Eina_Bool | ||
905 | _ecore_evas_wl_event_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
906 | { | ||
907 | Ecore_Evas *ee; | ||
908 | Ecore_Event_Mouse_Button *ev; | ||
909 | |||
910 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
911 | |||
912 | ev = event; | ||
913 | _ecore_evas_wl_btn_timestamp = ev->timestamp; | ||
914 | ee = ecore_event_window_match(ev->window); | ||
915 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
916 | if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
917 | evas_event_feed_mouse_down(ee->evas, ev->buttons, ev->modifiers, | ||
918 | ev->timestamp, NULL); | ||
919 | return ECORE_CALLBACK_PASS_ON; | ||
920 | } | ||
921 | |||
922 | static Eina_Bool | ||
923 | _ecore_evas_wl_event_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
924 | { | ||
925 | Ecore_Evas *ee; | ||
926 | Ecore_Event_Mouse_Button *ev; | ||
927 | |||
928 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
929 | |||
930 | ev = event; | ||
931 | ee = ecore_event_window_match(ev->window); | ||
932 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
933 | if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
934 | evas_event_feed_mouse_up(ee->evas, ev->buttons, ev->modifiers, | ||
935 | ev->timestamp, NULL); | ||
936 | return ECORE_CALLBACK_PASS_ON; | ||
937 | } | ||
938 | |||
939 | static Eina_Bool | ||
940 | _ecore_evas_wl_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
941 | { | ||
942 | Ecore_Evas *ee; | ||
943 | Ecore_Event_Mouse_Move *ev; | ||
944 | |||
945 | ev = event; | ||
946 | ee = ecore_event_window_match(ev->window); | ||
947 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
948 | if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
949 | ee->mouse.x = ev->x; | ||
950 | ee->mouse.y = ev->y; | ||
951 | evas_event_feed_mouse_move(ee->evas, ev->x, ev->y, ev->timestamp, NULL); | ||
952 | _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->timestamp); | ||
953 | return ECORE_CALLBACK_PASS_ON; | ||
954 | } | ||
955 | |||
956 | static Eina_Bool | ||
957 | _ecore_evas_wl_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
958 | { | ||
959 | Ecore_Evas *ee; | ||
960 | Ecore_Event_Mouse_Wheel *ev; | ||
961 | |||
962 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
963 | |||
964 | ev = event; | ||
965 | ee = ecore_event_window_match(ev->window); | ||
966 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
967 | if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
968 | evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z, | ||
969 | ev->timestamp, NULL); | ||
970 | return ECORE_CALLBACK_PASS_ON; | ||
971 | } | ||
972 | |||
973 | static Eina_Bool | ||
974 | _ecore_evas_wl_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
975 | { | ||
976 | Ecore_Evas *ee; | ||
977 | Ecore_Wl_Event_Mouse_In *ev; | ||
978 | |||
979 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
980 | |||
981 | ev = event; | ||
982 | ee = ecore_event_window_match(ev->window); | ||
983 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
984 | if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
985 | if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); | ||
986 | ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers); | ||
987 | evas_event_feed_mouse_in(ee->evas, ev->time, NULL); | ||
988 | _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->time); | ||
989 | return ECORE_CALLBACK_PASS_ON; | ||
990 | } | ||
991 | |||
992 | static Eina_Bool | ||
993 | _ecore_evas_wl_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
994 | { | ||
995 | Ecore_Evas *ee; | ||
996 | Ecore_Wl_Event_Mouse_Out *ev; | ||
997 | |||
998 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
999 | |||
1000 | ev = event; | ||
1001 | ee = ecore_event_window_match(ev->window); | ||
1002 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
1003 | if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
1004 | ecore_event_evas_modifier_lock_update(ee->evas, ev->modifiers); | ||
1005 | _ecore_evas_mouse_move_process(ee, ev->x, ev->y, ev->time); | ||
1006 | evas_event_feed_mouse_out(ee->evas, ev->time, NULL); | ||
1007 | if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); | ||
1008 | if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); | ||
1009 | return ECORE_CALLBACK_PASS_ON; | ||
1010 | } | ||
1011 | |||
1012 | static Eina_Bool | ||
1013 | _ecore_evas_wl_event_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
1014 | { | ||
1015 | Ecore_Evas *ee; | ||
1016 | Ecore_Wl_Event_Focus_In *ev; | ||
1017 | |||
1018 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1019 | |||
1020 | ev = event; | ||
1021 | ee = ecore_event_window_match(ev->window); | ||
1022 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
1023 | if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
1024 | ee->prop.focused = 1; | ||
1025 | evas_focus_in(ee->evas); | ||
1026 | if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); | ||
1027 | return ECORE_CALLBACK_PASS_ON; | ||
1028 | } | ||
1029 | |||
1030 | static Eina_Bool | ||
1031 | _ecore_evas_wl_event_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) | ||
1032 | { | ||
1033 | Ecore_Evas *ee; | ||
1034 | Ecore_Wl_Event_Focus_Out *ev; | ||
1035 | |||
1036 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1037 | |||
1038 | ev = event; | ||
1039 | ee = ecore_event_window_match(ev->window); | ||
1040 | if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; | ||
1041 | if (ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | ||
1042 | evas_focus_out(ee->evas); | ||
1043 | ee->prop.focused = 0; | ||
1044 | if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); | ||
1045 | return ECORE_CALLBACK_PASS_ON; | ||
1046 | } | ||
1047 | |||
1048 | static void | ||
1049 | _ecore_evas_wl_handle_configure(void *data, struct wl_shell_surface *shell_surface, uint32_t timestamp __UNUSED__, uint32_t edges __UNUSED__, int32_t width, int32_t height) | ||
1050 | { | ||
1051 | Ecore_Evas *ee; | ||
1052 | |||
1053 | /* NB: Trap to prevent compositor from crashing */ | ||
1054 | if ((width <= 0) || (height <= 0)) return; | ||
1055 | |||
1056 | if (!(ee = data)) return; | ||
1057 | |||
1058 | if ((shell_surface) && (ee->engine.wl.shell_surface)) | ||
1059 | { | ||
1060 | if (ee->engine.wl.shell_surface != shell_surface) return; | ||
1061 | ecore_evas_resize(ee, width, height); | ||
1062 | } | ||
1063 | } | ||
1064 | |||
1065 | static void | ||
1066 | _ecore_evas_wl_handle_popup_done(void *data __UNUSED__, struct wl_shell_surface *shell_surface __UNUSED__) | ||
1067 | { | ||
1068 | |||
1069 | } | ||
1070 | |||
1071 | static void | ||
1072 | _ecore_evas_wl_buffer_new(Ecore_Evas *ee, void **dest) | ||
1073 | { | ||
1074 | static unsigned int format; | ||
1075 | char tmp[PATH_MAX]; | ||
1076 | int fd = -1, stride = 0, size = 0; | ||
1077 | void *ret; | ||
1078 | |||
1079 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1080 | |||
1081 | if (dest) *dest = NULL; | ||
1082 | |||
1083 | if (!format) format = ecore_wl_format_get(); | ||
1084 | |||
1085 | strcpy(tmp, "/tmp/ecore-wayland_shm-XXXXXX"); | ||
1086 | if ((fd = mkstemp(tmp)) < 0) | ||
1087 | { | ||
1088 | ERR("Could not create temporary file."); | ||
1089 | return; | ||
1090 | } | ||
1091 | |||
1092 | stride = (ee->w * sizeof(int)); | ||
1093 | size = (stride * ee->h); | ||
1094 | if (ftruncate(fd, size) < 0) | ||
1095 | { | ||
1096 | ERR("Could not truncate temporary file."); | ||
1097 | close(fd); | ||
1098 | return; | ||
1099 | } | ||
1100 | |||
1101 | ret = mmap(NULL, size, (PROT_READ | PROT_WRITE), MAP_SHARED, fd, 0); | ||
1102 | unlink(tmp); | ||
1103 | |||
1104 | if (ret == MAP_FAILED) | ||
1105 | { | ||
1106 | ERR("mmap of temporary file failed."); | ||
1107 | close(fd); | ||
1108 | return; | ||
1109 | } | ||
1110 | |||
1111 | if (dest) *dest = ret; | ||
1112 | |||
1113 | ee->engine.wl.buffer = | ||
1114 | wl_shm_create_buffer(ecore_wl_shm_get(), fd, ee->w, ee->h, stride, format); | ||
1115 | |||
1116 | close(fd); | ||
1117 | } | ||
1118 | |||
1119 | static void | ||
1120 | _ecore_evas_wl_smart_init(void) | ||
1121 | { | ||
1122 | if (_ecore_evas_wl_smart) return; | ||
1123 | { | ||
1124 | static const Evas_Smart_Class sc = | ||
1125 | { | ||
1126 | "ecore_evas_wl_frame", EVAS_SMART_CLASS_VERSION, | ||
1127 | _ecore_evas_wl_smart_add, | ||
1128 | _ecore_evas_wl_smart_del, | ||
1129 | NULL, | ||
1130 | _ecore_evas_wl_smart_resize, | ||
1131 | _ecore_evas_wl_smart_show, | ||
1132 | _ecore_evas_wl_smart_hide, | ||
1133 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL | ||
1134 | }; | ||
1135 | _ecore_evas_wl_smart = evas_smart_class_new(&sc); | ||
1136 | } | ||
1137 | } | ||
1138 | |||
1139 | static void | ||
1140 | _ecore_evas_wl_smart_add(Evas_Object *obj) | ||
1141 | { | ||
1142 | EE_Wl_Smart_Data *sd; | ||
1143 | Evas *evas; | ||
1144 | |||
1145 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1146 | |||
1147 | if (!(sd = calloc(1, sizeof(EE_Wl_Smart_Data)))) return; | ||
1148 | |||
1149 | evas = evas_object_evas_get(obj); | ||
1150 | |||
1151 | sd->x = 0; | ||
1152 | sd->y = 0; | ||
1153 | sd->w = 1; | ||
1154 | sd->h = 1; | ||
1155 | |||
1156 | sd->frame = evas_object_rectangle_add(evas); | ||
1157 | evas_object_is_frame_object_set(sd->frame, EINA_TRUE); | ||
1158 | evas_object_color_set(sd->frame, 249, 249, 249, 255); | ||
1159 | evas_object_smart_member_add(sd->frame, obj); | ||
1160 | |||
1161 | sd->text = evas_object_text_add(evas); | ||
1162 | evas_object_color_set(sd->text, 0, 0, 0, 255); | ||
1163 | evas_object_text_style_set(sd->text, EVAS_TEXT_STYLE_PLAIN); | ||
1164 | evas_object_text_font_set(sd->text, "Sans", 10); | ||
1165 | evas_object_text_text_set(sd->text, "Smart Test"); | ||
1166 | |||
1167 | evas_object_smart_data_set(obj, sd); | ||
1168 | } | ||
1169 | |||
1170 | static void | ||
1171 | _ecore_evas_wl_smart_del(Evas_Object *obj) | ||
1172 | { | ||
1173 | EE_Wl_Smart_Data *sd; | ||
1174 | |||
1175 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1176 | |||
1177 | if (!(sd = evas_object_smart_data_get(obj))) return; | ||
1178 | evas_object_del(sd->text); | ||
1179 | evas_object_del(sd->frame); | ||
1180 | free(sd); | ||
1181 | } | ||
1182 | |||
1183 | static void | ||
1184 | _ecore_evas_wl_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h) | ||
1185 | { | ||
1186 | EE_Wl_Smart_Data *sd; | ||
1187 | |||
1188 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1189 | |||
1190 | if (!(sd = evas_object_smart_data_get(obj))) return; | ||
1191 | if ((sd->w == w) && (sd->h == h)) return; | ||
1192 | sd->w = w; | ||
1193 | sd->h = h; | ||
1194 | evas_object_resize(sd->frame, w, h); | ||
1195 | } | ||
1196 | |||
1197 | static void | ||
1198 | _ecore_evas_wl_smart_show(Evas_Object *obj) | ||
1199 | { | ||
1200 | EE_Wl_Smart_Data *sd; | ||
1201 | |||
1202 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1203 | |||
1204 | if (!(sd = evas_object_smart_data_get(obj))) return; | ||
1205 | evas_object_show(sd->frame); | ||
1206 | evas_object_show(sd->text); | ||
1207 | } | ||
1208 | |||
1209 | static void | ||
1210 | _ecore_evas_wl_smart_hide(Evas_Object *obj) | ||
1211 | { | ||
1212 | EE_Wl_Smart_Data *sd; | ||
1213 | |||
1214 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1215 | |||
1216 | if (!(sd = evas_object_smart_data_get(obj))) return; | ||
1217 | evas_object_hide(sd->text); | ||
1218 | evas_object_hide(sd->frame); | ||
1219 | } | ||
1220 | |||
1221 | static Evas_Object * | ||
1222 | _ecore_evas_wl_frame_add(Evas *evas) | ||
1223 | { | ||
1224 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1225 | |||
1226 | _ecore_evas_wl_smart_init(); | ||
1227 | return evas_object_smart_add(evas, _ecore_evas_wl_smart); | ||
1228 | } | ||
1229 | |||
1230 | void | ||
1231 | _ecore_evas_wayland_shm_resize(Ecore_Evas *ee, int location) | ||
1232 | { | ||
1233 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1234 | |||
1235 | if ((!ee) || (!ee->engine.wl.shell_surface)) return; | ||
1236 | wl_shell_surface_resize(ee->engine.wl.shell_surface, | ||
1237 | ecore_wl_input_device_get(), | ||
1238 | _ecore_evas_wl_btn_timestamp, location); | ||
1239 | } | ||
1240 | |||
1241 | void | ||
1242 | _ecore_evas_wayland_shm_drag_start(Ecore_Evas *ee, Ecore_Evas *drag_ee, void *source) | ||
1243 | { | ||
1244 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
1245 | |||
1246 | if ((!ee) || (!ee->engine.wl.surface)) return; | ||
1247 | if ((!source) || (!drag_ee)) return; | ||
1248 | ecore_wl_drag_start(source, ee->engine.wl.surface, drag_ee->engine.wl.buffer); | ||
1249 | } | ||
1250 | |||
1251 | #else | ||
1252 | EAPI Ecore_Evas * | ||
1253 | ecore_evas_wayland_shm_new(const char *disp_name __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__, int frame __UNUSED__) | ||
1254 | { | ||
1255 | return NULL; | ||
1256 | } | ||
1257 | #endif | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c index 2ca7cb0..cfec528 100644 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c | |||
@@ -147,9 +147,9 @@ _ecore_evas_win32_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, voi | |||
147 | if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); | 147 | if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); |
148 | /* FIXME to do */ | 148 | /* FIXME to do */ |
149 | /* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ | 149 | /* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ |
150 | evas_event_feed_mouse_in(ee->evas, e->time, NULL); | 150 | evas_event_feed_mouse_in(ee->evas, e->timestamp, NULL); |
151 | evas_focus_in(ee->evas); | 151 | evas_focus_in(ee->evas); |
152 | _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | 152 | _ecore_evas_mouse_move_process(ee, e->x, e->y, e->timestamp); |
153 | 153 | ||
154 | return 1; | 154 | return 1; |
155 | } | 155 | } |
@@ -169,9 +169,9 @@ _ecore_evas_win32_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, vo | |||
169 | 169 | ||
170 | /* FIXME to do */ | 170 | /* FIXME to do */ |
171 | /* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ | 171 | /* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ |
172 | _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | 172 | _ecore_evas_mouse_move_process(ee, e->x, e->y, e->timestamp); |
173 | 173 | ||
174 | evas_event_feed_mouse_out(ee->evas, e->time, NULL); | 174 | evas_event_feed_mouse_out(ee->evas, e->timestamp, NULL); |
175 | if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); | 175 | if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); |
176 | if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); | 176 | if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); |
177 | 177 | ||
diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c index d9ccd6e..7d3af12 100644 --- a/libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c | |||
@@ -1,4 +1,13 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include <stdlib.h> | ||
1 | #include <string.h> | 6 | #include <string.h> |
7 | |||
8 | #include <Eina.h> | ||
9 | #include <Ecore.h> | ||
10 | |||
2 | #include "ecore_evas_private.h" | 11 | #include "ecore_evas_private.h" |
3 | #include "Ecore_Evas.h" | 12 | #include "Ecore_Evas.h" |
4 | 13 | ||
@@ -731,10 +740,14 @@ _ecore_evas_x_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *e | |||
731 | // (e->mode == ECORE_X_EVENT_MODE_UNGRAB)) | 740 | // (e->mode == ECORE_X_EVENT_MODE_UNGRAB)) |
732 | // return 0; | 741 | // return 0; |
733 | /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */ | 742 | /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */ |
734 | if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); | 743 | if (!ee->in) |
735 | ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers); | 744 | { |
736 | evas_event_feed_mouse_in(ee->evas, e->time, NULL); | 745 | if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); |
737 | _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | 746 | ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers); |
747 | evas_event_feed_mouse_in(ee->evas, e->time, NULL); | ||
748 | _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | ||
749 | ee->in = EINA_TRUE; | ||
750 | } | ||
738 | return ECORE_CALLBACK_PASS_ON; | 751 | return ECORE_CALLBACK_PASS_ON; |
739 | } | 752 | } |
740 | 753 | ||
@@ -783,13 +796,23 @@ _ecore_evas_x_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void * | |||
783 | // (e->mode == ECORE_X_EVENT_MODE_UNGRAB)) | 796 | // (e->mode == ECORE_X_EVENT_MODE_UNGRAB)) |
784 | // return 0; | 797 | // return 0; |
785 | /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */ | 798 | /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */ |
786 | ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers); | 799 | // printf("OUT: ee->in=%i, e->mode=%i, e->detail=%i, dount_count=%i\n", |
787 | _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | 800 | // ee->in, e->mode, e->detail, evas_event_down_count_get(ee->evas)); |
788 | if (e->mode == ECORE_X_EVENT_MODE_GRAB) | 801 | if (ee->in) |
789 | evas_event_feed_mouse_cancel(ee->evas, e->time, NULL); | 802 | { |
790 | evas_event_feed_mouse_out(ee->evas, e->time, NULL); | 803 | if ((evas_event_down_count_get(ee->evas) > 0) && |
791 | if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); | 804 | (!((e->mode == ECORE_X_EVENT_MODE_GRAB) && |
792 | if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); | 805 | (e->detail == ECORE_X_EVENT_DETAIL_NON_LINEAR)))) |
806 | return ECORE_CALLBACK_PASS_ON; | ||
807 | ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers); | ||
808 | _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); | ||
809 | if (e->mode == ECORE_X_EVENT_MODE_GRAB) | ||
810 | evas_event_feed_mouse_cancel(ee->evas, e->time, NULL); | ||
811 | evas_event_feed_mouse_out(ee->evas, e->time, NULL); | ||
812 | if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); | ||
813 | if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); | ||
814 | ee->in = EINA_FALSE; | ||
815 | } | ||
793 | return ECORE_CALLBACK_PASS_ON; | 816 | return ECORE_CALLBACK_PASS_ON; |
794 | } | 817 | } |
795 | 818 | ||
@@ -1023,6 +1046,14 @@ _ecore_evas_x_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void | |||
1023 | ee = ecore_event_window_match(e->win); | 1046 | ee = ecore_event_window_match(e->win); |
1024 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ | 1047 | if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ |
1025 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; | 1048 | if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; |
1049 | if (ee->in) | ||
1050 | { | ||
1051 | evas_event_feed_mouse_cancel(ee->evas, e->time, NULL); | ||
1052 | evas_event_feed_mouse_out(ee->evas, e->time, NULL); | ||
1053 | if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); | ||
1054 | if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); | ||
1055 | ee->in = EINA_FALSE; | ||
1056 | } | ||
1026 | if (!ee->visible) return ECORE_CALLBACK_PASS_ON; | 1057 | if (!ee->visible) return ECORE_CALLBACK_PASS_ON; |
1027 | // if (!ee->visible) return ECORE_CALLBACK_DONE; | 1058 | // if (!ee->visible) return ECORE_CALLBACK_DONE; |
1028 | // printf("HIDE EVENT %p\n", ee); | 1059 | // printf("HIDE EVENT %p\n", ee); |