summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/ecore_con/efl_net_dialer_http.c2
-rw-r--r--src/lib/ecore_con/efl_net_dialer_unix.c1
-rw-r--r--src/lib/ecore_evas/Ecore_Evas.h17
-rw-r--r--src/lib/ecore_evas/ecore_evas.c26
-rw-r--r--src/lib/ecore_evas/ecore_evas_buffer.c1
-rw-r--r--src/lib/ecore_evas/ecore_evas_ews.c1400
-rw-r--r--src/lib/ecore_evas/ecore_evas_module.c3
-rw-r--r--src/lib/ecore_input/ecore_input_joystick.c2
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_display.c16
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_private.h25
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_window.c69
-rw-r--r--src/lib/ecore_x/ecore_x_vsync.c3
-rw-r--r--src/lib/ector/software/ector_renderer_software_image.c8
-rw-r--r--src/lib/edje/Edje_Common.h10
-rw-r--r--src/lib/edje/edje_private.h10
-rw-r--r--src/lib/edje/edje_textblock_styles.c156
-rw-r--r--src/lib/edje/edje_util.c68
-rw-r--r--src/lib/eet/eet_lib.c3
-rw-r--r--src/lib/eeze/eeze_disk.c7
-rw-r--r--src/lib/eeze/eeze_net.c5
-rw-r--r--src/lib/eeze/eeze_udev_walk.c18
-rw-r--r--src/lib/efreet/efreet_mime.c5
-rw-r--r--src/lib/efreet/efreet_utils.c3
-rw-r--r--src/lib/eina/Eina.h2
-rw-r--r--src/lib/eina/eina_fnmatch.c47
-rw-r--r--src/lib/eina/eina_fnmatch.h34
-rw-r--r--src/lib/eina/eina_log.c6
-rw-r--r--src/lib/eina/eina_promise.c17
-rw-r--r--src/lib/eina/eina_sched.c84
-rw-r--r--src/lib/eina/eina_sched.h53
-rw-r--r--src/lib/eina/eina_thread.c295
-rw-r--r--src/lib/eina/eina_thread.h36
-rw-r--r--src/lib/eina/eina_thread_posix.c368
-rw-r--r--src/lib/eina/eina_thread_win32.c397
-rw-r--r--src/lib/eina/eina_win32_dllmain.c18
-rw-r--r--src/lib/eina/meson.build8
-rw-r--r--src/lib/eio/efl_io_model.c46
-rw-r--r--src/lib/eio/efl_io_model_private.h2
-rw-r--r--src/lib/elementary/Efl_Ui.h4
-rw-r--r--src/lib/elementary/Elementary.h4
-rw-r--r--src/lib/elementary/efl_ui_collection.c7
-rw-r--r--src/lib/elementary/efl_ui_format.c15
-rw-r--r--src/lib/elementary/efl_ui_frame.c12
-rw-r--r--src/lib/elementary/efl_ui_layout.c10
-rw-r--r--src/lib/elementary/efl_ui_scroll_util.c67
-rw-r--r--src/lib/elementary/efl_ui_tab_bar.c47
-rw-r--r--src/lib/elementary/efl_ui_win.c36
-rw-r--r--src/lib/elementary/elm_cnp.c2
-rw-r--r--src/lib/elementary/elm_code_widget.c6
-rw-r--r--src/lib/elementary/elm_config.c593
-rw-r--r--src/lib/elementary/elm_config.h27
-rw-r--r--src/lib/elementary/elm_entry.c44
-rw-r--r--src/lib/elementary/elm_frame.h6
-rw-r--r--src/lib/elementary/elm_gengrid.c18
-rw-r--r--src/lib/elementary/elm_genlist.c24
-rw-r--r--src/lib/elementary/elm_main.c6
-rw-r--r--src/lib/elementary/elm_module_helper.h43
-rw-r--r--src/lib/elementary/elm_priv.h19
-rw-r--r--src/lib/elementary/elm_slider.c3
-rw-r--r--src/lib/elementary/elm_theme.c1
-rw-r--r--src/lib/elementary/elm_widget_entry.h2
-rw-r--r--src/lib/elementary/elm_win.h1
-rw-r--r--src/lib/elementary/elu_ews_wm.c531
-rw-r--r--src/lib/elementary/meson.build1
-rw-r--r--src/lib/elput/Elput.h104
-rw-r--r--src/lib/elput/elput.c6
-rw-r--r--src/lib/elput/elput_gestures.c87
-rw-r--r--src/lib/elput/elput_input.c42
-rw-r--r--src/lib/elput/elput_manager.c1
-rw-r--r--src/lib/elput/elput_private.h12
-rw-r--r--src/lib/elput/elput_root.c150
-rw-r--r--src/lib/elput/meson.build2
-rw-r--r--src/lib/embryo/embryo_str.c3
-rw-r--r--src/lib/eo/eo_base_class.c3
-rw-r--r--src/lib/evas/Evas_GL.h22
-rw-r--r--src/lib/evas/canvas/efl_canvas_proxy.c10
-rw-r--r--src/lib/evas/canvas/efl_canvas_vg_container.c42
-rw-r--r--src/lib/evas/canvas/evas_font_dir.c10
-rw-r--r--src/lib/evas/canvas/evas_object_image.c2
-rw-r--r--src/lib/evas/canvas/evas_object_smart.c27
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c40
-rw-r--r--src/lib/evas/common/evas_image_load.c26
-rw-r--r--src/lib/evas/common/evas_text_utils.c15
-rw-r--r--src/lib/evas/file/evas_path.c10
84 files changed, 2406 insertions, 3008 deletions
diff --git a/src/lib/ecore_con/efl_net_dialer_http.c b/src/lib/ecore_con/efl_net_dialer_http.c
index 7215d9a195..439acbc099 100644
--- a/src/lib/ecore_con/efl_net_dialer_http.c
+++ b/src/lib/ecore_con/efl_net_dialer_http.c
@@ -1198,6 +1198,8 @@ _efl_net_dialer_http_efl_object_destructor(Eo *o, Efl_Net_Dialer_Http_Data *pd)
1198 _secure_free(&pd->authentication.password); 1198 _secure_free(&pd->authentication.password);
1199 eina_stringshare_replace(&pd->ssl.ca, NULL); 1199 eina_stringshare_replace(&pd->ssl.ca, NULL);
1200 eina_stringshare_replace(&pd->ssl.crl, NULL); 1200 eina_stringshare_replace(&pd->ssl.crl, NULL);
1201
1202 _c_shutdown();
1201} 1203}
1202 1204
1203static void 1205static void
diff --git a/src/lib/ecore_con/efl_net_dialer_unix.c b/src/lib/ecore_con/efl_net_dialer_unix.c
index b2d3dfce39..000ba66013 100644
--- a/src/lib/ecore_con/efl_net_dialer_unix.c
+++ b/src/lib/ecore_con/efl_net_dialer_unix.c
@@ -94,6 +94,7 @@ _efl_net_dialer_unix_connected(void *data, const struct sockaddr *addr, socklen_
94{ 94{
95 Eo *o = data; 95 Eo *o = data;
96 Efl_Net_Dialer_Unix_Data *pd = efl_data_scope_get(o, MY_CLASS); 96 Efl_Net_Dialer_Unix_Data *pd = efl_data_scope_get(o, MY_CLASS);
97 if (!pd) return;
97 98
98 pd->connect.thread = NULL; 99 pd->connect.thread = NULL;
99 100
diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h
index 89a9ff843f..dfbd7a749f 100644
--- a/src/lib/ecore_evas/Ecore_Evas.h
+++ b/src/lib/ecore_evas/Ecore_Evas.h
@@ -97,7 +97,7 @@ extern "C" {
97#define HAVE_ECORE_EVAS_COCOA 1 97#define HAVE_ECORE_EVAS_COCOA 1
98#define HAVE_ECORE_EVAS_SDL 1 98#define HAVE_ECORE_EVAS_SDL 1
99//#define HAVE_ECORE_EVAS_WINCE 1 99//#define HAVE_ECORE_EVAS_WINCE 1
100#define HAVE_ECORE_EVAS_EWS 1 100//#define HAVE_ECORE_EVAS_EWS 1 /* @deprecated */
101#define HAVE_ECORE_EVAS_PSL1GHT 1 101#define HAVE_ECORE_EVAS_PSL1GHT 1
102#define HAVE_ECORE_EVAS_WAYLAND_SHM 1 102#define HAVE_ECORE_EVAS_WAYLAND_SHM 1
103#define HAVE_ECORE_EVAS_WAYLAND_EGL 1 103#define HAVE_ECORE_EVAS_WAYLAND_EGL 1
@@ -125,7 +125,7 @@ typedef enum _Ecore_Evas_Engine_Type
125 ECORE_EVAS_ENGINE_SOFTWARE_16_DDRAW, 125 ECORE_EVAS_ENGINE_SOFTWARE_16_DDRAW,
126 ECORE_EVAS_ENGINE_SOFTWARE_16_WINCE, 126 ECORE_EVAS_ENGINE_SOFTWARE_16_WINCE,
127 ECORE_EVAS_ENGINE_OPENGL_SDL, 127 ECORE_EVAS_ENGINE_OPENGL_SDL,
128 ECORE_EVAS_ENGINE_EWS, 128 ECORE_EVAS_ENGINE_EWS, /* @deprecated */
129 ECORE_EVAS_ENGINE_PSL1GHT, 129 ECORE_EVAS_ENGINE_PSL1GHT,
130 ECORE_EVAS_ENGINE_WAYLAND_SHM, 130 ECORE_EVAS_ENGINE_WAYLAND_SHM,
131 ECORE_EVAS_ENGINE_WAYLAND_EGL, 131 ECORE_EVAS_ENGINE_WAYLAND_EGL,
@@ -1788,6 +1788,7 @@ EAPI Ecore_Evas *ecore_evas_buffer_ecore_evas_parent_get(Ecore_Evas *ee);
1788 * @see ecore_evas_ews_ecore_evas_get() 1788 * @see ecore_evas_ews_ecore_evas_get()
1789 * 1789 *
1790 * @since 1.1 1790 * @since 1.1
1791 * @deprecated - @since 1.26
1791 */ 1792 */
1792EAPI Ecore_Evas *ecore_evas_ews_new(int x, int y, int w, int h); 1793EAPI Ecore_Evas *ecore_evas_ews_new(int x, int y, int w, int h);
1793 1794
@@ -1806,6 +1807,7 @@ EAPI Ecore_Evas *ecore_evas_ews_new(int x, int y, int w, int h);
1806 * @see ecore_evas_ews_manager_set() 1807 * @see ecore_evas_ews_manager_set()
1807 * @see ecore_evas_ews_evas_get() 1808 * @see ecore_evas_ews_evas_get()
1808 * @since 1.1 1809 * @since 1.1
1810 * @deprecated - @since 1.26
1809 */ 1811 */
1810EAPI Evas_Object *ecore_evas_ews_backing_store_get(const Ecore_Evas *ee); 1812EAPI Evas_Object *ecore_evas_ews_backing_store_get(const Ecore_Evas *ee);
1811 1813
@@ -1816,6 +1818,7 @@ EAPI Evas_Object *ecore_evas_ews_backing_store_get(const Ecore_Evas *ee);
1816 * @param ee The Ecore_Evas for which window will be deleted. 1818 * @param ee The Ecore_Evas for which window will be deleted.
1817 * 1819 *
1818 * @since 1.1 1820 * @since 1.1
1821 * @deprecated - @since 1.26
1819 */ 1822 */
1820EAPI void ecore_evas_ews_delete_request(Ecore_Evas *ee); 1823EAPI void ecore_evas_ews_delete_request(Ecore_Evas *ee);
1821 1824
@@ -3216,6 +3219,7 @@ EAPI void ecore_evas_callback_new_set(Evas *(*func)(int w, int h));
3216 * ecore_evas_ews_new(). 3219 * ecore_evas_ews_new().
3217 * 3220 *
3218 * @since 1.1 3221 * @since 1.1
3222 * @deprecated - @since 1.26
3219 * @{ 3223 * @{
3220 */ 3224 */
3221 3225
@@ -3227,6 +3231,7 @@ EAPI void ecore_evas_callback_new_set(Evas *(*func)(int w, int h));
3227 * @return @c EINA_TRUE on success, @c EINA_FALSE if ews is already in use. 3231 * @return @c EINA_TRUE on success, @c EINA_FALSE if ews is already in use.
3228 * 3232 *
3229 * @since 1.1 3233 * @since 1.1
3234 * @deprecated - @since 1.26
3230 */ 3235 */
3231EAPI Eina_Bool ecore_evas_ews_engine_set(const char *engine, const char *options); 3236EAPI Eina_Bool ecore_evas_ews_engine_set(const char *engine, const char *options);
3232 3237
@@ -3240,6 +3245,7 @@ EAPI Eina_Bool ecore_evas_ews_engine_set(const char *engine, const char *options
3240 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise. 3245 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
3241 * 3246 *
3242 * @since 1.1 3247 * @since 1.1
3248 * @deprecated - @since 1.26
3243 */ 3249 */
3244EAPI Eina_Bool ecore_evas_ews_setup(int x, int y, int w, int h); 3250EAPI Eina_Bool ecore_evas_ews_setup(int x, int y, int w, int h);
3245 3251
@@ -3253,6 +3259,7 @@ EAPI Eina_Bool ecore_evas_ews_setup(int x, int y, int w, int h);
3253 * 3259 *
3254 * @see ecore_evas_ews_evas_get() 3260 * @see ecore_evas_ews_evas_get()
3255 * @since 1.1 3261 * @since 1.1
3262 * @deprecated - @since 1.26
3256 */ 3263 */
3257EAPI Ecore_Evas *ecore_evas_ews_ecore_evas_get(void); 3264EAPI Ecore_Evas *ecore_evas_ews_ecore_evas_get(void);
3258 3265
@@ -3266,11 +3273,13 @@ EAPI Ecore_Evas *ecore_evas_ews_ecore_evas_get(void);
3266 * 3273 *
3267 * @see ecore_evas_ews_ecore_evas_get() 3274 * @see ecore_evas_ews_ecore_evas_get()
3268 * @since 1.1 3275 * @since 1.1
3276 * @deprecated - @since 1.26
3269 */ 3277 */
3270EAPI Evas *ecore_evas_ews_evas_get(void); 3278EAPI Evas *ecore_evas_ews_evas_get(void);
3271 3279
3272/** 3280/**
3273 * @brief Gets the current background. 3281 * @brief Gets the current background.
3282 * @deprecated - @since 1.26
3274 */ 3283 */
3275EAPI Evas_Object *ecore_evas_ews_background_get(void); 3284EAPI Evas_Object *ecore_evas_ews_background_get(void);
3276 3285
@@ -3284,6 +3293,7 @@ EAPI Evas_Object *ecore_evas_ews_background_get(void);
3284 * rectangle. 3293 * rectangle.
3285 * 3294 *
3286 * @note previous object will be deleted! 3295 * @note previous object will be deleted!
3296 * @deprecated - @since 1.26
3287 */ 3297 */
3288EAPI void ecore_evas_ews_background_set(Evas_Object *o); 3298EAPI void ecore_evas_ews_background_set(Evas_Object *o);
3289 3299
@@ -3295,6 +3305,7 @@ EAPI void ecore_evas_ews_background_set(Evas_Object *o);
3295 * @note Do not change the returned list or its contents. 3305 * @note Do not change the returned list or its contents.
3296 * 3306 *
3297 * @since 1.1 3307 * @since 1.1
3308 * @deprecated - @since 1.26
3298 */ 3309 */
3299EAPI const Eina_List *ecore_evas_ews_children_get(void); 3310EAPI const Eina_List *ecore_evas_ews_children_get(void);
3300 3311
@@ -3309,6 +3320,7 @@ EAPI const Eina_List *ecore_evas_ews_children_get(void);
3309 * 3320 *
3310 * @see ecore_evas_ews_manager_get() 3321 * @see ecore_evas_ews_manager_get()
3311 * @since 1.1 3322 * @since 1.1
3323 * @deprecated - @since 1.26
3312 */ 3324 */
3313EAPI void ecore_evas_ews_manager_set(const void *manager); 3325EAPI void ecore_evas_ews_manager_set(const void *manager);
3314 3326
@@ -3318,6 +3330,7 @@ EAPI void ecore_evas_ews_manager_set(const void *manager);
3318 * @return the value set by ecore_evas_ews_manager_set() 3330 * @return the value set by ecore_evas_ews_manager_set()
3319 * 3331 *
3320 * @since 1.1 3332 * @since 1.1
3333 * @deprecated - @since 1.26
3321 */ 3334 */
3322EAPI const void *ecore_evas_ews_manager_get(void); 3335EAPI const void *ecore_evas_ews_manager_get(void);
3323 3336
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c
index a579abff97..080a2f3894 100644
--- a/src/lib/ecore_evas/ecore_evas.c
+++ b/src/lib/ecore_evas/ecore_evas.c
@@ -565,11 +565,7 @@ ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine)
565 return EINA_FALSE; 565 return EINA_FALSE;
566#endif 566#endif
567 case ECORE_EVAS_ENGINE_EWS: 567 case ECORE_EVAS_ENGINE_EWS:
568#ifdef BUILD_ECORE_EVAS_EWS
569 return EINA_TRUE;
570#else
571 return EINA_FALSE; 568 return EINA_FALSE;
572#endif
573 case ECORE_EVAS_ENGINE_PSL1GHT: 569 case ECORE_EVAS_ENGINE_PSL1GHT:
574 return EINA_FALSE; 570 return EINA_FALSE;
575 case ECORE_EVAS_ENGINE_WAYLAND_SHM: 571 case ECORE_EVAS_ENGINE_WAYLAND_SHM:
@@ -632,10 +628,6 @@ ecore_evas_init(void)
632 if (getenv("ECORE_EVAS_RENDER_NOSYNC")) _ecore_evas_render_sync = 0; 628 if (getenv("ECORE_EVAS_RENDER_NOSYNC")) _ecore_evas_render_sync = 0;
633 if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init(); 629 if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init();
634 630
635#ifdef BUILD_ECORE_EVAS_EWS
636 _ecore_evas_ews_events_init();
637#endif
638
639 _ecore_evas_extn_init(); 631 _ecore_evas_extn_init();
640 632
641 _ecore_evas_engine_init(); 633 _ecore_evas_engine_init();
@@ -680,10 +672,6 @@ ecore_evas_shutdown(void)
680 EINA_LOG_STATE_START, 672 EINA_LOG_STATE_START,
681 EINA_LOG_STATE_SHUTDOWN); 673 EINA_LOG_STATE_SHUTDOWN);
682 674
683#ifdef BUILD_ECORE_EVAS_EWS
684 _ecore_evas_ews_events_flush();
685#endif
686
687 while (ecore_evases) _ecore_evas_free(ecore_evases); 675 while (ecore_evases) _ecore_evas_free(ecore_evases);
688 676
689 if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown(); 677 if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown();
@@ -694,9 +682,6 @@ ecore_evas_shutdown(void)
694 682
695 _ecore_evas_extn_shutdown(); 683 _ecore_evas_extn_shutdown();
696 684
697#ifdef BUILD_ECORE_EVAS_EWS
698 while (_ecore_evas_ews_shutdown());
699#endif
700 _ecore_evas_engine_shutdown(); 685 _ecore_evas_engine_shutdown();
701 686
702 eina_log_domain_unregister(_ecore_evas_log_dom); 687 eina_log_domain_unregister(_ecore_evas_log_dom);
@@ -995,14 +980,6 @@ _ecore_evas_constructor_buffer(int x EINA_UNUSED, int y EINA_UNUSED, int w, int
995 return ecore_evas_buffer_new(w, h); 980 return ecore_evas_buffer_new(w, h);
996} 981}
997 982
998#ifdef BUILD_ECORE_EVAS_EWS
999static Ecore_Evas *
1000_ecore_evas_constructor_ews(int x, int y, int w, int h, const char *extra_options EINA_UNUSED)
1001{
1002 return ecore_evas_ews_new(x, y, w, h);
1003}
1004#endif
1005
1006/* note: keep sorted by priority, highest first */ 983/* note: keep sorted by priority, highest first */
1007static const struct ecore_evas_engine _engines[] = { 984static const struct ecore_evas_engine _engines[] = {
1008 /* unix */ 985 /* unix */
@@ -1022,9 +999,6 @@ static const struct ecore_evas_engine _engines[] = {
1022 {"opengl_sdl", _ecore_evas_constructor_opengl_sdl}, 999 {"opengl_sdl", _ecore_evas_constructor_opengl_sdl},
1023 {"sdl", _ecore_evas_constructor_sdl}, 1000 {"sdl", _ecore_evas_constructor_sdl},
1024 {"buffer", _ecore_evas_constructor_buffer}, 1001 {"buffer", _ecore_evas_constructor_buffer},
1025#ifdef BUILD_ECORE_EVAS_EWS
1026 {"ews", _ecore_evas_constructor_ews},
1027#endif
1028 {NULL, NULL} 1002 {NULL, NULL}
1029}; 1003};
1030 1004
diff --git a/src/lib/ecore_evas/ecore_evas_buffer.c b/src/lib/ecore_evas/ecore_evas_buffer.c
index 2f3f2ff72b..569fe0a077 100644
--- a/src/lib/ecore_evas/ecore_evas_buffer.c
+++ b/src/lib/ecore_evas/ecore_evas_buffer.c
@@ -219,7 +219,6 @@ ecore_evas_buffer_render(Ecore_Evas *ee)
219 return r; 219 return r;
220} 220}
221 221
222// NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar!
223static void 222static void
224_ecore_evas_buffer_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y) 223_ecore_evas_buffer_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y)
225{ 224{
diff --git a/src/lib/ecore_evas/ecore_evas_ews.c b/src/lib/ecore_evas/ecore_evas_ews.c
index 86e939f765..a30617f571 100644
--- a/src/lib/ecore_evas/ecore_evas_ews.c
+++ b/src/lib/ecore_evas/ecore_evas_ews.c
@@ -34,1459 +34,73 @@ EAPI int ECORE_EVAS_EWS_EVENT_LAYER_CHANGE = 0;
34EAPI int ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE = 0; 34EAPI int ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE = 0;
35EAPI int ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE = 0; 35EAPI int ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE = 0;
36 36
37#ifdef BUILD_ECORE_EVAS_EWS
38static int _ecore_evas_init_count = 0;
39
40static Ecore_Evas *_ews_ee = NULL;
41static Evas_Object *_ews_bg = NULL;
42static Eina_List *_ews_children = NULL;
43static const void *_ews_manager = NULL;
44static char *_ews_engine = NULL;
45static char *_ews_options = NULL;
46static int _ews_x = 0;
47static int _ews_y = 0;
48static int _ews_w = 1024;
49static int _ews_h = 768;
50static Eina_Bool _ews_defaults_engine = EINA_TRUE;
51static Eina_Bool _ews_defaults_geo = EINA_TRUE;
52
53static const char EWS_ENGINE_NAME[] = "ews";
54
55static void
56_ecore_evas_ews_pre_free(Ecore_Evas *ee EINA_UNUSED)
57{
58 DBG("EWS backing store free'd");
59 _ews_children = eina_list_free(_ews_children);
60 _ews_ee = NULL;
61 _ews_bg = NULL;
62}
63
64static void
65_ecore_evas_ews_del_request(Ecore_Evas *ee EINA_UNUSED)
66{
67 INF("EWS backing store deletion is forbidden!");
68}
69
70static Ecore_Evas *
71_ecore_evas_ews_ee_new(void)
72{
73 Ecore_Evas *ee = ecore_evas_new(_ews_engine, _ews_x, _ews_y, _ews_w, _ews_h,
74 _ews_options);
75 if (!ee)
76 ERR("Failed: ecore_evas_new(%s, %d, %d, %d, %d, %s)",
77 _ews_engine, _ews_x, _ews_y, _ews_w, _ews_h, _ews_options);
78 else
79 {
80 ecore_evas_size_min_set(ee, _ews_w, _ews_h);
81 ecore_evas_size_max_set(ee, _ews_w, _ews_h);
82 ecore_evas_callback_pre_free_set(ee, _ecore_evas_ews_pre_free);
83 ecore_evas_callback_delete_request_set(ee, _ecore_evas_ews_del_request);
84 ecore_evas_name_class_set(ee, "ecore_evas_ews", "ews");
85 ecore_evas_title_set
86 (ee, "EWS: Ecore + Evas Single Process Windowing System");
87 ecore_evas_show(ee);
88 }
89
90 return ee;
91}
92
93static void
94_ecore_evas_ews_env_setup(void)
95{
96 const char *env = getenv("ECORE_EVAS_EWS");
97 char *p, *n, *tmp;
98
99 if (_ews_defaults_engine)
100 {
101 free(_ews_engine);
102 _ews_engine = NULL;
103 free(_ews_options);
104 _ews_options = NULL;
105 }
106 if (_ews_defaults_geo)
107 {
108 _ews_x = 0;
109 _ews_y = 0;
110 _ews_w = 1024;
111 _ews_h = 768;
112 }
113
114 if ((!env) || (!*env)) return;
115
116 p = tmp = strdup(env);
117 if (!tmp) return;
118
119 n = strchr(p, ':');
120 if (n) *n = '\0';
121 if (_ews_defaults_engine) _ews_engine = strdup(p);
122 if (!n) goto end;
123
124 p = n + 1;
125 n = strchr(p, ':');
126 if (!n) goto end;
127 *n = '\0';
128 if (_ews_defaults_geo) _ews_x = atoi(p);
129
130 p = n + 1;
131 n = strchr(p, ':');
132 if (!n) goto end;
133 *n = '\0';
134 if (_ews_defaults_geo) _ews_y = atoi(p);
135
136 p = n + 1;
137 n = strchr(p, ':');
138 if (!n) goto end;
139 *n = '\0';
140 if (_ews_defaults_geo) _ews_w = atoi(p);
141
142 p = n + 1;
143 n = strchr(p, ':');
144 if (n) *n = '\0';
145 if (_ews_defaults_geo) _ews_h = atoi(p);
146 if (!n) goto end;
147
148 p = n + 1;
149 if (_ews_defaults_engine) _ews_options = strdup(p);
150
151 end:
152 free(tmp);
153}
154
155static void
156_ecore_evas_ews_event_free(void *data EINA_UNUSED, void *ev)
157{
158 Ecore_Evas *ee = ev;
159 _ecore_evas_unref(ee);
160}
161
162static void
163_ecore_evas_ews_event(Ecore_Evas *ee, int event)
164{
165 _ecore_evas_ref(ee);
166 ecore_event_add(event, ee, _ecore_evas_ews_event_free, NULL);
167}
168
169static void
170_ecore_evas_ews_event_free_del(void *data EINA_UNUSED, void *ev EINA_UNUSED)
171{
172 _ecore_evas_ews_shutdown();
173}
174
175static void
176_ecore_evas_ews_free(Ecore_Evas *ee)
177{
178 evas_object_del(ee->engine.ews.image);
179 _ews_ee->sub_ecore_evas = eina_list_remove(_ews_ee->sub_ecore_evas, ee);
180
181 ecore_event_add(ECORE_EVAS_EWS_EVENT_DEL, ee, _ecore_evas_ews_event_free_del, NULL);
182}
183
184static void
185_ecore_evas_ews_move(Ecore_Evas *ee, int x, int y)
186{
187 ee->req.x = x;
188 ee->req.y = y;
189
190 if ((x == ee->x) && (y == ee->y)) return;
191 ee->x = x;
192 ee->y = y;
193 evas_object_move(ee->engine.ews.image, x, y);
194 if (ee->func.fn_move) ee->func.fn_move(ee);
195
196 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_MOVE);
197}
198
199static void
200_ecore_evas_ews_managed_move(Ecore_Evas *ee, int x, int y)
201{
202 ee->req.x = x;
203 ee->req.y = y;
204
205 if ((x == ee->x) && (y == ee->y)) return;
206 ee->x = x;
207 ee->y = y;
208 if (ee->func.fn_move) ee->func.fn_move(ee);
209 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_MOVE);
210}
211
212static void
213_ecore_evas_ews_resize_internal(Ecore_Evas *ee, int w, int h)
214{
215 Evas_Engine_Info_Buffer *einfo;
216 void *pixels;
217 int stride;
218
219 evas_output_size_set(ee->evas, w, h);
220 evas_output_viewport_set(ee->evas, 0, 0, w, h);
221 evas_damage_rectangle_add(ee->evas, 0, 0, w, h);
222
223 evas_object_image_size_set(ee->engine.ews.image, w, h);
224 evas_object_image_fill_set(ee->engine.ews.image, 0, 0, w, h);
225 evas_object_resize(ee->engine.ews.image, w, h);
226
227 pixels = evas_object_image_data_get(ee->engine.ews.image, 1);
228 evas_object_image_data_set(ee->engine.ews.image, pixels); // refcount
229 stride = evas_object_image_stride_get(ee->engine.ews.image);
230
231 einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
232 EINA_SAFETY_ON_NULL_RETURN(einfo);
233
234 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
235 einfo->info.dest_buffer = pixels;
236 einfo->info.dest_buffer_row_bytes = stride;
237 einfo->info.use_color_key = 0;
238 einfo->info.alpha_threshold = 0;
239 einfo->info.func.new_update_region = NULL;
240 einfo->info.func.free_update_region = NULL;
241 evas_object_image_data_set(ee->engine.ews.image, pixels);
242 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
243 {
244 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
245 }
246}
247
248static void
249_ecore_evas_ews_resize(Ecore_Evas *ee, int w, int h)
250{
251 if (w < 1) w = 1;
252 if (h < 1) h = 1;
253
254 ee->req.w = w;
255 ee->req.h = h;
256
257 if ((w == ee->w) && (h == ee->h)) return;
258 ee->w = w;
259 ee->h = h;
260 _ecore_evas_ews_resize_internal(ee, w, h);
261 if (ee->func.fn_resize) ee->func.fn_resize(ee);
262 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_RESIZE);
263}
264
265static void
266_ecore_evas_ews_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
267{
268 _ecore_evas_ews_move(ee, x, y);
269 _ecore_evas_ews_resize(ee, w, h);
270}
271
272static void
273_ecore_evas_ews_rotation_set(Ecore_Evas *ee, int rot, int resize EINA_UNUSED)
274{
275 if (ee->rotation == rot) return;
276 ee->rotation = rot;
277
278 ERR("TODO: rot=%d, resize=%d", rot, resize);
279
280 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
281}
282
283static void
284_ecore_evas_ews_shaped_set(Ecore_Evas *ee, int val)
285{
286 if (ee->shaped == val) return;
287 ee->shaped = val;
288 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
289}
290
291static void
292_ecore_evas_ews_show(Ecore_Evas *ee)
293{
294 ee->should_be_visible = EINA_TRUE;
295 evas_object_show(ee->engine.ews.image);
296 if (ee->prop.fullscreen)
297 evas_object_focus_set(ee->engine.ews.image, EINA_TRUE);
298
299 if (ee->func.fn_show) ee->func.fn_show(ee);
300 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_SHOW);
301}
302
303static void
304_ecore_evas_ews_hide(Ecore_Evas *ee)
305{
306 ee->should_be_visible = EINA_FALSE;
307 evas_object_hide(ee->engine.ews.image);
308
309 if (ee->func.fn_hide) ee->func.fn_hide(ee);
310 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_HIDE);
311}
312
313static void
314_ecore_evas_ews_raise(Ecore_Evas *ee)
315{
316 evas_object_raise(ee->engine.ews.image);
317 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_RAISE);
318}
319
320static void
321_ecore_evas_ews_lower(Ecore_Evas *ee)
322{
323 evas_object_lower(ee->engine.ews.image);
324 evas_object_lower(_ews_bg);
325 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_LOWER);
326}
327
328static void
329_ecore_evas_ews_activate(Ecore_Evas *ee)
330{
331 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_ACTIVATE);
332}
333
334static void
335_ecore_evas_ews_title_set(Ecore_Evas *ee, const char *t)
336{
337 if (ee->prop.title) free(ee->prop.title);
338 ee->prop.title = NULL;
339 if (t) ee->prop.title = strdup(t);
340 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
341}
342
343static void
344_ecore_evas_ews_name_class_set(Ecore_Evas *ee, const char *n, const char *c)
345{
346 if (ee->prop.name) free(ee->prop.name);
347 if (ee->prop.clas) free(ee->prop.clas);
348 ee->prop.name = NULL;
349 ee->prop.clas = NULL;
350 if (n) ee->prop.name = strdup(n);
351 if (c) ee->prop.clas = strdup(c);
352 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
353}
354
355static void
356_ecore_evas_ews_size_min_set(Ecore_Evas *ee, int w, int h)
357{
358 if (w < 0) w = 0;
359 if (h < 0) h = 0;
360 if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return;
361 ee->prop.min.w = w;
362 ee->prop.min.h = h;
363 evas_object_size_hint_min_set(ee->engine.ews.image, w, h);
364 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
365}
366
367static void
368_ecore_evas_ews_size_max_set(Ecore_Evas *ee, int w, int h)
369{
370 if (w < 0) w = 0;
371 if (h < 0) h = 0;
372 if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return;
373 ee->prop.max.w = w;
374 ee->prop.max.h = h;
375 evas_object_size_hint_max_set(ee->engine.ews.image, w, h);
376 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
377}
378
379static void
380_ecore_evas_ews_size_base_set(Ecore_Evas *ee, int w, int h)
381{
382 if (w < 0) w = 0;
383 if (h < 0) h = 0;
384 if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return;
385 ee->prop.base.w = w;
386 ee->prop.base.h = h;
387 evas_object_size_hint_request_set(ee->engine.ews.image, w, h);
388 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
389}
390
391static void
392_ecore_evas_ews_size_step_set(Ecore_Evas *ee, int w, int h)
393{
394 if (w < 1) w = 1;
395 if (h < 1) h = 1;
396 if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return;
397 ee->prop.step.w = w;
398 ee->prop.step.h = h;
399 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
400}
401
402static void
403_ecore_evas_ews_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj EINA_UNUSED,
404 int layer EINA_UNUSED, int hot_x EINA_UNUSED,
405 int hot_y EINA_UNUSED)
406{
407 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
408}
409
410static void
411_ecore_evas_ews_layer_set(Ecore_Evas *ee, int layer)
412{
413 if (layer < EVAS_LAYER_MIN + 2)
414 layer = EVAS_LAYER_MIN + 2;
415 else if (layer > EVAS_LAYER_MAX)
416 layer = EVAS_LAYER_MAX;
417
418 if (ee->prop.layer == layer) return;
419 ee->prop.layer = layer;
420 evas_object_layer_set(ee->engine.ews.image, layer);
421 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_LAYER_CHANGE);
422}
423
424static void
425_ecore_evas_ews_focus_set(Ecore_Evas *ee, Eina_Bool on)
426{
427 evas_object_focus_set(ee->engine.ews.image, on);
428 _ecore_evas_focus_device_set(ee, NULL, on);
429 if (on)
430 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_FOCUS);
431 else
432 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_UNFOCUS);
433}
434
435static void
436_ecore_evas_ews_iconified_set(Ecore_Evas *ee, Eina_Bool on)
437{
438 if (ee->prop.iconified == on) return;
439 ee->prop.iconified = on;
440 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE);
441}
442
443static void
444_ecore_evas_ews_borderless_set(Ecore_Evas *ee, Eina_Bool on)
445{
446 if (ee->prop.borderless == on) return;
447 ee->prop.borderless = on;
448 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
449}
450
451static void
452_ecore_evas_ews_override_set(Ecore_Evas *ee, Eina_Bool on)
453{
454 if (ee->prop.override == on) return;
455 if (ee->visible) evas_object_show(ee->engine.ews.image);
456 if (ecore_evas_focus_device_get(ee, NULL))
457 evas_object_focus_set(ee->engine.ews.image, EINA_TRUE);
458 ee->prop.override = on;
459 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
460}
461
462static void
463_ecore_evas_ews_maximized_set(Ecore_Evas *ee, Eina_Bool on)
464{
465 if (ee->prop.maximized == on) return;
466 ee->prop.maximized = on;
467 if (on) evas_object_show(ee->engine.ews.image);
468 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE);
469}
470
471static void
472_ecore_evas_ews_fullscreen_set(Ecore_Evas *ee, Eina_Bool on)
473{
474 if (ee->prop.fullscreen == on) return;
475 ee->prop.fullscreen = on;
476
477 if (!on)
478 {
479 evas_object_move(ee->engine.ews.image, ee->x, ee->y);
480 evas_object_resize(ee->engine.ews.image, ee->w, ee->h);
481 }
482 else
483 {
484 Evas_Coord w, h;
485 ecore_evas_geometry_get(_ews_ee, NULL, NULL, &w, &h);
486 evas_object_move(ee->engine.ews.image, 0, 0);
487 evas_object_resize(ee->engine.ews.image, w, h);
488 evas_object_focus_set(ee->engine.ews.image, EINA_TRUE);
489 }
490
491 if (ee->should_be_visible)
492 evas_object_show(ee->engine.ews.image);
493 else
494 evas_object_hide(ee->engine.ews.image);
495
496 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE);
497}
498
499static void
500_ecore_evas_ews_avoid_damage_set(Ecore_Evas *ee, int val)
501{
502 if (ee->prop.avoid_damage == val) return;
503 ee->prop.avoid_damage = val;
504 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
505}
506
507static void
508_ecore_evas_ews_withdrawn_set(Ecore_Evas *ee, Eina_Bool on)
509{
510 if (ee->prop.withdrawn == on) return;
511 ee->prop.withdrawn = on;
512 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
513}
514
515static void
516_ecore_evas_ews_sticky_set(Ecore_Evas *ee, Eina_Bool on)
517{
518 if (ee->prop.sticky == on) return;
519 ee->prop.sticky = on;
520 if ((on) && (ee->func.fn_sticky)) ee->func.fn_sticky(ee);
521 else if ((!on) && (ee->func.fn_unsticky)) ee->func.fn_unsticky(ee);
522 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
523}
524
525static void
526_ecore_evas_ews_ignore_events_set(Ecore_Evas *ee, int val)
527{
528 if (ee->ignore_events == val) return;
529 ee->ignore_events = val;
530 evas_object_pass_events_set(ee->engine.ews.image, val);
531 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
532}
533
534static void
535_ecore_evas_ews_alpha_set(Ecore_Evas *ee, int val)
536{
537 if (ee->alpha == val) return;
538 ee->alpha = val;
539 evas_object_image_alpha_set(ee->engine.ews.image, val);
540 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
541}
542
543static void
544_ecore_evas_ews_transparent_set(Ecore_Evas *ee, int val)
545{
546 if (ee->transparent == val) return;
547 ee->transparent = val;
548 evas_object_image_alpha_set(ee->engine.ews.image, val);
549 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
550}
551
552static Eina_Bool
553_ecore_evas_ews_prepare(Ecore_Evas *ee)
554{
555 Evas_Coord w, h;
556 void *pixels;
557
558 evas_object_image_size_get(ee->engine.ews.image, &w, &h);
559 if ((w != ee->w) || (h != ee->h))
560 ecore_evas_resize(ee, w, h);
561
562 pixels = evas_object_image_data_get(ee->engine.ews.image, 1);
563 if (!pixels) return EINA_FALSE;
564
565 evas_object_data_set(ee->engine.ews.image, "_ews.pixels", pixels);
566
567 return EINA_TRUE;
568}
569
570static void
571_ecore_evas_ews_update_image(void *data, Evas *e EINA_UNUSED, void *event_info)
572{
573 Evas_Event_Render_Post *post = event_info;
574 Ecore_Evas *ee = data;
575 Eina_Rectangle *r;
576 Eina_List *l;
577 void *pixels;
578
579 pixels = evas_object_data_get(ee->engine.ews.image, "_ews.pixels");
580 if (!pixels) return ;
581
582 evas_object_image_data_set(ee->engine.ews.image, pixels);
583 EINA_LIST_FOREACH(post->updated_area, l, r)
584 evas_object_image_data_update_add(ee->engine.ews.image,
585 r->x, r->y, r->w, r->h);
586
587 evas_object_data_set(ee->engine.ews.image, "_ews.pixels", NULL);
588}
589
590static void
591_ecore_evas_ews_screen_geometry_get(const Ecore_Evas *ee EINA_UNUSED, int *x, int *y, int *w, int *h)
592{
593 ecore_evas_geometry_get(_ews_ee, x, y, w, h);
594}
595
596static const Ecore_Evas_Engine_Func _ecore_ews_engine_func =
597{
598 _ecore_evas_ews_free,
599 NULL,
600 NULL,
601 NULL,
602 NULL,
603 NULL,
604 NULL,
605 NULL,
606 NULL,
607 NULL,
608 NULL,
609 NULL,
610 NULL,
611 NULL,
612 NULL,
613 _ecore_evas_ews_move,
614 _ecore_evas_ews_managed_move,
615 _ecore_evas_ews_resize,
616 _ecore_evas_ews_move_resize,
617 _ecore_evas_ews_rotation_set,
618 _ecore_evas_ews_shaped_set,
619 _ecore_evas_ews_show,
620 _ecore_evas_ews_hide,
621 _ecore_evas_ews_raise,
622 _ecore_evas_ews_lower,
623 _ecore_evas_ews_activate,
624 _ecore_evas_ews_title_set,
625 _ecore_evas_ews_name_class_set,
626 _ecore_evas_ews_size_min_set,
627 _ecore_evas_ews_size_max_set,
628 _ecore_evas_ews_size_base_set,
629 _ecore_evas_ews_size_step_set,
630 _ecore_evas_ews_object_cursor_set,
631 NULL,
632 _ecore_evas_ews_layer_set,
633 _ecore_evas_ews_focus_set,
634 _ecore_evas_ews_iconified_set,
635 _ecore_evas_ews_borderless_set,
636 _ecore_evas_ews_override_set,
637 _ecore_evas_ews_maximized_set,
638 _ecore_evas_ews_fullscreen_set,
639 _ecore_evas_ews_avoid_damage_set,
640 _ecore_evas_ews_withdrawn_set,
641 _ecore_evas_ews_sticky_set,
642 _ecore_evas_ews_ignore_events_set,
643 _ecore_evas_ews_alpha_set,
644 _ecore_evas_ews_transparent_set,
645 NULL, // profiles_set
646 NULL, // profile_set
647
648 NULL,
649 NULL,
650 NULL,
651 NULL,
652 NULL,
653 NULL,
654
655 NULL,
656 _ecore_evas_ews_screen_geometry_get,
657 NULL, // screen_dpi_get
658 NULL,
659 NULL, // msg_send
660
661 NULL, // pointer_xy_get
662 NULL, // pointer_warp
663
664 NULL, // wm_rot_preferred_rotation_set
665 NULL, // wm_rot_available_rotations_set
666 NULL, // wm_rot_manual_rotation_done_set
667 NULL, // wm_rot_manual_rotation_done
668
669 NULL, // aux_hints_set
670
671 NULL, // fn_animator_register
672 NULL, // fn_animator_unregister
673
674 NULL, // fn_evas_changed
675 NULL, //fn_focus_device_set
676 NULL, //fn_callback_focus_device_in_set
677 NULL, //fn_callback_focus_device_out_set
678 NULL, //fn_callback_device_mouse_in_set
679 NULL, //fn_callback_device_mouse_out_set
680 NULL, //fn_pointer_device_xy_get
681 _ecore_evas_ews_prepare,
682};
683
684void
685_ecore_evas_ews_events_init(void)
686{
687 ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE = ecore_event_type_new();
688 ECORE_EVAS_EWS_EVENT_ADD = ecore_event_type_new();
689 ECORE_EVAS_EWS_EVENT_DEL = ecore_event_type_new();
690 ECORE_EVAS_EWS_EVENT_RESIZE = ecore_event_type_new();
691 ECORE_EVAS_EWS_EVENT_MOVE = ecore_event_type_new();
692 ECORE_EVAS_EWS_EVENT_SHOW = ecore_event_type_new();
693 ECORE_EVAS_EWS_EVENT_HIDE = ecore_event_type_new();
694 ECORE_EVAS_EWS_EVENT_FOCUS = ecore_event_type_new();
695 ECORE_EVAS_EWS_EVENT_UNFOCUS = ecore_event_type_new();
696 ECORE_EVAS_EWS_EVENT_RAISE = ecore_event_type_new();
697 ECORE_EVAS_EWS_EVENT_LOWER = ecore_event_type_new();
698 ECORE_EVAS_EWS_EVENT_ACTIVATE = ecore_event_type_new();
699 ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE = ecore_event_type_new();
700 ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE = ecore_event_type_new();
701 ECORE_EVAS_EWS_EVENT_LAYER_CHANGE = ecore_event_type_new();
702 ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE = ecore_event_type_new();
703 ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE = ecore_event_type_new();
704}
705
706void
707_ecore_evas_ews_events_flush(void)
708{
709 ecore_event_type_flush(ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE,
710 ECORE_EVAS_EWS_EVENT_ADD,
711 ECORE_EVAS_EWS_EVENT_DEL,
712 ECORE_EVAS_EWS_EVENT_RESIZE,
713 ECORE_EVAS_EWS_EVENT_MOVE,
714 ECORE_EVAS_EWS_EVENT_SHOW,
715 ECORE_EVAS_EWS_EVENT_HIDE,
716 ECORE_EVAS_EWS_EVENT_FOCUS,
717 ECORE_EVAS_EWS_EVENT_UNFOCUS,
718 ECORE_EVAS_EWS_EVENT_RAISE,
719 ECORE_EVAS_EWS_EVENT_LOWER,
720 ECORE_EVAS_EWS_EVENT_ACTIVATE,
721 ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE,
722 ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE,
723 ECORE_EVAS_EWS_EVENT_LAYER_CHANGE,
724 ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE,
725 ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
726}
727
728static int
729_ecore_evas_ews_init(void)
730{
731 _ecore_evas_init_count++;
732 if (_ecore_evas_init_count > 1) return _ecore_evas_init_count;
733
734 _ecore_evas_ews_env_setup();
735
736 return _ecore_evas_init_count;
737}
738
739int
740_ecore_evas_ews_shutdown(void)
741{
742 _ecore_evas_init_count--;
743 if (_ecore_evas_init_count == 0)
744 {
745 if (_ews_ee)
746 {
747 ecore_evas_free(_ews_ee);
748 _ews_ee = NULL;
749 }
750 if (_ews_children)
751 {
752 eina_list_free(_ews_children);
753 _ews_children = NULL;
754 }
755
756 free(_ews_engine);
757 _ews_engine = NULL;
758 free(_ews_options);
759 _ews_options = NULL;
760 _ews_defaults_engine = EINA_TRUE;
761 _ews_defaults_geo = EINA_TRUE;
762
763 }
764 if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
765 return _ecore_evas_init_count;
766}
767
768static void
769_ecore_evas_ews_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y)
770{
771 Evas_Coord xx, yy, ww, hh, fx, fy, fw, fh;
772
773 evas_object_geometry_get(ee->engine.ews.image, &xx, &yy, &ww, &hh);
774 evas_object_image_fill_get(ee->engine.ews.image, &fx, &fy, &fw, &fh);
775
776 if (fw < 1) fw = 1;
777 if (fh < 1) fh = 1;
778
779 if ((fx == 0) && (fy == 0) && (fw == ww) && (fh == hh))
780 {
781 *x = (ee->w * (*x - xx)) / fw;
782 *y = (ee->h * (*y - yy)) / fh;
783 }
784 else
785 {
786 xx = (*x - xx) - fx;
787 while (xx < 0) xx += fw;
788 while (xx > fw) xx -= fw;
789 *x = (ee->w * xx) / fw;
790
791 yy = (*y - yy) - fy;
792 while (yy < 0) yy += fh;
793 while (yy > fh) yy -= fh;
794 *y = (ee->h * yy) / fh;
795 }
796}
797
798static void
799_ecore_evas_ews_modifiers_apply(Ecore_Evas *ee, const Evas_Modifier *modifier)
800{
801 Evas *e = ee->evas;
802
803 if (evas_key_modifier_is_set(modifier, "Shift"))
804 evas_key_modifier_on(e, "Shift");
805 else evas_key_modifier_off(e, "Shift");
806
807 if (evas_key_modifier_is_set(modifier, "Control"))
808 evas_key_modifier_on(e, "Control");
809 else evas_key_modifier_off(e, "Control");
810
811 if (evas_key_modifier_is_set(modifier, "Alt"))
812 evas_key_modifier_on(e, "Alt");
813 else evas_key_modifier_off(e, "Alt");
814
815 if (evas_key_modifier_is_set(modifier, "Super"))
816 evas_key_modifier_on(e, "Super");
817 else evas_key_modifier_off(e, "Super");
818
819 if (evas_key_modifier_is_set(modifier, "Hyper"))
820 evas_key_modifier_on(e, "Hyper");
821 else evas_key_modifier_off(e, "Hyper");
822
823 if (evas_key_modifier_is_set(modifier, "Scroll_Lock"))
824 evas_key_lock_on(e, "Scroll_Lock");
825 else evas_key_lock_off(e, "Scroll_Lock");
826
827 if (evas_key_modifier_is_set(modifier, "Num_Lock"))
828 evas_key_lock_on(e, "Num_Lock");
829 else evas_key_lock_off(e, "Num_Lock");
830
831 if (evas_key_modifier_is_set(modifier, "Caps_Lock"))
832 evas_key_lock_on(e, "Caps_Lock");
833 else evas_key_lock_off(e, "Caps_Lock");
834
835 if (evas_key_modifier_is_set(modifier, "Shift_Lock"))
836 evas_key_lock_on(e, "Shift_Lock");
837 else evas_key_lock_off(e, "Shift_Lock");
838}
839
840static void
841_ecore_evas_ews_cb_mouse_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
842{
843 Ecore_Evas *ee = data;
844 Evas_Event_Mouse_In *ev = event_info;
845 Evas_Coord x = ev->canvas.x;
846 Evas_Coord y = ev->canvas.y;
847 _ecore_evas_ews_coord_translate(ee, &x, &y);
848 if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
849 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
850 evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL);
851 _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp);
852}
853
854static void
855_ecore_evas_ews_cb_mouse_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
856{
857 Ecore_Evas *ee = data;
858 Evas_Event_Mouse_Out *ev = event_info;
859 Evas_Coord x = ev->canvas.x;
860 Evas_Coord y = ev->canvas.y;
861 // TODO: consider grab mode in EWS
862 _ecore_evas_ews_coord_translate(ee, &x, &y);
863 if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
864 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
865 evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL);
866 _ecore_evas_default_cursor_hide(ee);
867 _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp);
868}
869
870static void
871_ecore_evas_ews_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
872{
873 Ecore_Evas *ee = data;
874 Evas_Event_Mouse_Down *ev = event_info;
875 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
876 evas_event_feed_mouse_down(ee->evas, ev->button, ev->flags, ev->timestamp, NULL);
877}
878
879static void
880_ecore_evas_ews_cb_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
881{
882 Ecore_Evas *ee = data;
883 Evas_Event_Mouse_Up *ev = event_info;
884 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
885 evas_event_feed_mouse_up(ee->evas, ev->button, ev->flags, ev->timestamp, NULL);
886}
887
888static void
889_ecore_evas_ews_cb_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
890{
891 Ecore_Evas *ee = data;
892 Evas_Event_Mouse_Move *ev = event_info;
893 Evas_Coord x = ev->cur.canvas.x;
894 Evas_Coord y = ev->cur.canvas.y;
895 _ecore_evas_ews_coord_translate(ee, &x, &y);
896 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
897 _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp);
898}
899
900static void
901_ecore_evas_ews_cb_mouse_wheel(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
902{
903 Ecore_Evas *ee = data;
904 Evas_Event_Mouse_Wheel *ev = event_info;
905 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
906 evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z, ev->timestamp, NULL);
907}
908
909static void
910_ecore_evas_ews_cb_multi_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
911{
912 Ecore_Evas *ee = data;
913 Evas_Event_Multi_Down *ev = event_info;
914 Evas_Coord x, y, xx, yy;
915 double xf, yf;
916
917 x = ev->canvas.x;
918 y = ev->canvas.y;
919 xx = x;
920 yy = y;
921 _ecore_evas_ews_coord_translate(ee, &x, &y);
922 xf = (ev->canvas.xsub - (double)xx) + (double)x;
923 yf = (ev->canvas.ysub - (double)yy) + (double)y;
924 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
925 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);
926}
927
928static void
929_ecore_evas_ews_cb_multi_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
930{
931 Ecore_Evas *ee = data;
932 Evas_Event_Multi_Up *ev = event_info;
933 Evas_Coord x, y, xx, yy;
934 double xf, yf;
935
936 x = ev->canvas.x;
937 y = ev->canvas.y;
938 xx = x;
939 yy = y;
940 _ecore_evas_ews_coord_translate(ee, &x, &y);
941 xf = (ev->canvas.xsub - (double)xx) + (double)x;
942 yf = (ev->canvas.ysub - (double)yy) + (double)y;
943 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
944 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);
945}
946
947static void
948_ecore_evas_ews_cb_multi_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
949{
950 Ecore_Evas *ee = data;
951 Evas_Event_Multi_Move *ev = event_info;
952 Evas_Coord x, y, xx, yy;
953 double xf, yf;
954
955 x = ev->cur.canvas.x;
956 y = ev->cur.canvas.y;
957 xx = x;
958 yy = y;
959 _ecore_evas_ews_coord_translate(ee, &x, &y);
960 xf = (ev->cur.canvas.xsub - (double)xx) + (double)x;
961 yf = (ev->cur.canvas.ysub - (double)yy) + (double)y;
962 _ecore_evas_ews_modifiers_apply(ee, ev->modifiers);
963 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);
964}
965
966static void
967_ecore_evas_ews_cb_free(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
968{
969 Ecore_Evas *ee = data;
970 if (ee->driver) _ecore_evas_free(ee);
971}
972
973static void
974_ecore_evas_ews_cb_key_down(void *data, Evas *e, Evas_Object *obj EINA_UNUSED, void *event_info)
975{
976 Ecore_Evas *ee = data;
977 Evas_Event_Key_Down *ev = event_info;
978
979 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift"))
980 evas_key_modifier_on(ee->evas, "Shift");
981 else
982 evas_key_modifier_off(ee->evas, "Shift");
983 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control"))
984 evas_key_modifier_on(ee->evas, "Control");
985 else
986 evas_key_modifier_off(ee->evas, "Control");
987 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt"))
988 evas_key_modifier_on(ee->evas, "Alt");
989 else
990 evas_key_modifier_off(ee->evas, "Alt");
991 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta"))
992 evas_key_modifier_on(ee->evas, "Meta");
993 else
994 evas_key_modifier_off(ee->evas, "Meta");
995 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper"))
996 evas_key_modifier_on(ee->evas, "Hyper");
997 else
998 evas_key_modifier_off(ee->evas, "Hyper");
999 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super"))
1000 evas_key_modifier_on(ee->evas, "Super");
1001 else
1002 evas_key_modifier_off(ee->evas, "Super");
1003 if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock"))
1004 evas_key_lock_on(ee->evas, "Scroll_Lock");
1005 else
1006 evas_key_lock_off(ee->evas, "Scroll_Lock");
1007 if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock"))
1008 evas_key_lock_on(ee->evas, "Num_Lock");
1009 else
1010 evas_key_lock_off(ee->evas, "Num_Lock");
1011 if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock"))
1012 evas_key_lock_on(ee->evas, "Caps_Lock");
1013 else
1014 evas_key_lock_off(ee->evas, "Caps_Lock");
1015 evas_event_feed_key_down(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL);
1016}
1017
1018static void
1019_ecore_evas_ews_cb_key_up(void *data, Evas *e, Evas_Object *obj EINA_UNUSED, void *event_info)
1020{
1021 Ecore_Evas *ee = data;
1022 Evas_Event_Key_Up *ev = event_info;
1023
1024 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift"))
1025 evas_key_modifier_on(ee->evas, "Shift");
1026 else
1027 evas_key_modifier_off(ee->evas, "Shift");
1028 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control"))
1029 evas_key_modifier_on(ee->evas, "Control");
1030 else
1031 evas_key_modifier_off(ee->evas, "Control");
1032 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt"))
1033 evas_key_modifier_on(ee->evas, "Alt");
1034 else
1035 evas_key_modifier_off(ee->evas, "Alt");
1036 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta"))
1037 evas_key_modifier_on(ee->evas, "Meta");
1038 else
1039 evas_key_modifier_off(ee->evas, "Meta");
1040 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper"))
1041 evas_key_modifier_on(ee->evas, "Hyper");
1042 else
1043 evas_key_modifier_off(ee->evas, "Hyper");
1044 if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super"))
1045 evas_key_modifier_on(ee->evas, "Super");
1046 else
1047 evas_key_modifier_off(ee->evas, "Super");
1048 if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock"))
1049 evas_key_lock_on(ee->evas, "Scroll_Lock");
1050 else
1051 evas_key_lock_off(ee->evas, "Scroll_Lock");
1052 if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock"))
1053 evas_key_lock_on(ee->evas, "Num_Lock");
1054 else
1055 evas_key_lock_off(ee->evas, "Num_Lock");
1056 if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock"))
1057 evas_key_lock_on(ee->evas, "Caps_Lock");
1058 else
1059 evas_key_lock_off(ee->evas, "Caps_Lock");
1060 evas_event_feed_key_up(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL);
1061}
1062
1063static void
1064_ecore_evas_ews_cb_focus_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1065{
1066 Ecore_Evas *ee = data;
1067 ecore_evas_focus_set(ee, EINA_TRUE);
1068}
1069
1070static void
1071_ecore_evas_ews_cb_focus_out(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1072{
1073 Ecore_Evas *ee = data;
1074 if (ee->deleted) return;
1075 ecore_evas_focus_set(ee, EINA_FALSE);
1076}
1077
1078static void
1079_ecore_evas_ews_cb_show(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1080{
1081 Ecore_Evas *ee = data;
1082 ecore_evas_show(ee);
1083}
1084
1085static void
1086_ecore_evas_ews_cb_hide(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1087{
1088 Ecore_Evas *ee = data;
1089 if (ee->deleted) return;
1090 ecore_evas_hide(ee);
1091}
1092#endif
1093
1094EAPI Ecore_Evas * 37EAPI Ecore_Evas *
1095ecore_evas_ews_new(int x, int y, int w, int h) 38ecore_evas_ews_new(int x EINA_UNUSED, int y EINA_UNUSED, int w EINA_UNUSED, int h EINA_UNUSED)
1096{ 39{
1097// basically a copy of ecore_evas_buffer_new() keep in sync...
1098#ifdef BUILD_ECORE_EVAS_EWS
1099 Evas_Object *o;
1100 Evas_Engine_Info_Buffer *einfo;
1101 Ecore_Evas *ee;
1102 int rmethod;
1103 static Eina_Bool creating = EINA_FALSE;
1104
1105 if (_ecore_evas_ews_init() < 1) return NULL;
1106
1107 if (creating) return NULL; /* avoid recursive ecore_evas_new() with ews */
1108 creating = EINA_TRUE;
1109 if (!_ews_ee) _ews_ee = _ecore_evas_ews_ee_new();
1110 creating = EINA_FALSE;
1111 if (!_ews_ee)
1112 {
1113 ERR("Could not create EWS backing store");
1114 _ecore_evas_ews_shutdown();
1115 return NULL;
1116 }
1117
1118 rmethod = evas_render_method_lookup("buffer");
1119 if (!rmethod) return NULL;
1120 ee = calloc(1, sizeof(Ecore_Evas));
1121 if (!ee) return NULL;
1122
1123 if (w < 1) w = 1;
1124 if (h < 1) h = 1;
1125
1126 o = evas_object_image_add(_ews_ee->evas);
1127 evas_object_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC);
1128 evas_object_image_colorspace_set(o, EVAS_COLORSPACE_ARGB8888);
1129 evas_object_image_size_set(o, w, h);
1130 evas_object_image_alpha_set(o, 1);
1131
1132 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
1133
1134 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_ews_engine_func;
1135
1136 ee->driver = EWS_ENGINE_NAME;
1137
1138 ee->x = 0;
1139 ee->y = 0;
1140 ee->w = w;
1141 ee->h = h;
1142 ee->req.x = ee->x;
1143 ee->req.y = ee->y;
1144 ee->req.w = ee->w;
1145 ee->req.h = ee->h;
1146
1147 /* init evas here */
1148 ee->evas = evas_new();
1149 evas_data_attach_set(ee->evas, ee);
1150 evas_output_method_set(ee->evas, rmethod);
1151 evas_output_size_set(ee->evas, w, h);
1152 evas_output_viewport_set(ee->evas, 0, 0, w, h);
1153
1154 evas_object_move(o, x, y);
1155 evas_object_resize(o, w, h);
1156 evas_object_image_fill_set(o, 0, 0, w, h);
1157
1158 ee->engine.ews.image = o;
1159 evas_object_data_set(ee->engine.ews.image, "Ecore_Evas", ee);
1160 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_POST, _ecore_evas_ews_update_image, ee);
1161 evas_object_event_callback_add(ee->engine.ews.image,
1162 EVAS_CALLBACK_MOUSE_IN,
1163 _ecore_evas_ews_cb_mouse_in, ee);
1164 evas_object_event_callback_add(ee->engine.ews.image,
1165 EVAS_CALLBACK_MOUSE_OUT,
1166 _ecore_evas_ews_cb_mouse_out, ee);
1167 evas_object_event_callback_add(ee->engine.ews.image,
1168 EVAS_CALLBACK_MOUSE_DOWN,
1169 _ecore_evas_ews_cb_mouse_down, ee);
1170 evas_object_event_callback_add(ee->engine.ews.image,
1171 EVAS_CALLBACK_MOUSE_UP,
1172 _ecore_evas_ews_cb_mouse_up, ee);
1173 evas_object_event_callback_add(ee->engine.ews.image,
1174 EVAS_CALLBACK_MOUSE_MOVE,
1175 _ecore_evas_ews_cb_mouse_move, ee);
1176 evas_object_event_callback_add(ee->engine.ews.image,
1177 EVAS_CALLBACK_MOUSE_WHEEL,
1178 _ecore_evas_ews_cb_mouse_wheel, ee);
1179 evas_object_event_callback_add(ee->engine.ews.image,
1180 EVAS_CALLBACK_MULTI_DOWN,
1181 _ecore_evas_ews_cb_multi_down, ee);
1182 evas_object_event_callback_add(ee->engine.ews.image,
1183 EVAS_CALLBACK_MULTI_UP,
1184 _ecore_evas_ews_cb_multi_up, ee);
1185 evas_object_event_callback_add(ee->engine.ews.image,
1186 EVAS_CALLBACK_MULTI_MOVE,
1187 _ecore_evas_ews_cb_multi_move, ee);
1188 evas_object_event_callback_add(ee->engine.ews.image,
1189 EVAS_CALLBACK_FREE,
1190 _ecore_evas_ews_cb_free, ee);
1191 evas_object_event_callback_add(ee->engine.ews.image,
1192 EVAS_CALLBACK_KEY_DOWN,
1193 _ecore_evas_ews_cb_key_down, ee);
1194 evas_object_event_callback_add(ee->engine.ews.image,
1195 EVAS_CALLBACK_KEY_UP,
1196 _ecore_evas_ews_cb_key_up, ee);
1197 evas_object_event_callback_add(ee->engine.ews.image,
1198 EVAS_CALLBACK_FOCUS_IN,
1199 _ecore_evas_ews_cb_focus_in, ee);
1200 evas_object_event_callback_add(ee->engine.ews.image,
1201 EVAS_CALLBACK_FOCUS_OUT,
1202 _ecore_evas_ews_cb_focus_out, ee);
1203 evas_object_event_callback_add(ee->engine.ews.image,
1204 EVAS_CALLBACK_SHOW,
1205 _ecore_evas_ews_cb_show, ee);
1206 evas_object_event_callback_add(ee->engine.ews.image,
1207 EVAS_CALLBACK_HIDE,
1208 _ecore_evas_ews_cb_hide, ee);
1209 einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas);
1210 if (einfo)
1211 {
1212 void *pixels = evas_object_image_data_get(o, 1);
1213 evas_object_image_data_set(o, pixels); // refcount
1214 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32;
1215 einfo->info.dest_buffer = pixels;
1216 einfo->info.dest_buffer_row_bytes = evas_object_image_stride_get(o);
1217 einfo->info.use_color_key = 0;
1218 einfo->info.alpha_threshold = 0;
1219 einfo->info.func.new_update_region = NULL;
1220 einfo->info.func.free_update_region = NULL;
1221 evas_object_image_data_set(o, pixels);
1222 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1223 {
1224 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1225 ecore_evas_free(ee);
1226 return NULL;
1227 }
1228 }
1229 else
1230 {
1231 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1232 ecore_evas_free(ee);
1233 return NULL;
1234 }
1235 evas_key_modifier_add(ee->evas, "Shift");
1236 evas_key_modifier_add(ee->evas, "Control");
1237 evas_key_modifier_add(ee->evas, "Alt");
1238 evas_key_modifier_add(ee->evas, "Meta");
1239 evas_key_modifier_add(ee->evas, "Hyper");
1240 evas_key_modifier_add(ee->evas, "Super");
1241 evas_key_lock_add(ee->evas, "Caps_Lock");
1242 evas_key_lock_add(ee->evas, "Num_Lock");
1243 evas_key_lock_add(ee->evas, "Scroll_Lock");
1244
1245 if (!_ecore_evas_cursors_init(ee))
1246 {
1247 ERR("Could not init the Ecore Evas cursors");
1248 ecore_evas_free(ee);
1249 }
1250
1251 _ecore_evas_subregister(_ews_ee, ee);
1252 _ews_children = eina_list_append(_ews_children, ee);
1253
1254 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_ADD);
1255
1256 return ee;
1257#else
1258 return NULL; 40 return NULL;
1259 (void)x;
1260 (void)y;
1261 (void)w;
1262 (void)h;
1263#endif
1264} 41}
1265 42
1266EAPI Evas_Object * 43EAPI Evas_Object *
1267ecore_evas_ews_backing_store_get(const Ecore_Evas *ee) 44ecore_evas_ews_backing_store_get(const Ecore_Evas *ee EINA_UNUSED)
1268{ 45{
1269#ifdef BUILD_ECORE_EVAS_EWS
1270 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1271 {
1272 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1273 "ecore_evas_ews_backing_store_get");
1274 return NULL;
1275 }
1276 return ee->engine.ews.image;
1277#else
1278 return NULL; 46 return NULL;
1279 (void)ee;
1280#endif
1281} 47}
1282 48
1283EAPI void 49EAPI void
1284ecore_evas_ews_delete_request(Ecore_Evas *ee) 50ecore_evas_ews_delete_request(Ecore_Evas *ee EINA_UNUSED)
1285{ 51{
1286#ifdef BUILD_ECORE_EVAS_EWS
1287 if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS))
1288 {
1289 ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS,
1290 "ecore_evas_ews_delete_request");
1291 return;
1292 }
1293 if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee);
1294 else ecore_evas_free(ee);
1295#else
1296 (void)ee;
1297#endif
1298} 52}
1299 53
1300 54
1301EAPI Eina_Bool 55EAPI Eina_Bool
1302ecore_evas_ews_engine_set(const char *engine, const char *options) 56ecore_evas_ews_engine_set(const char *engine EINA_UNUSED, const char *options EINA_UNUSED)
1303{ 57{
1304#ifdef BUILD_ECORE_EVAS_EWS
1305 if (_ews_ee) return EINA_FALSE;
1306
1307 free(_ews_engine);
1308 free(_ews_options);
1309
1310 _ews_engine = engine ? strdup(engine) : NULL;
1311 _ews_options = options ? strdup(options) : NULL;
1312
1313 if ((engine) && (!_ews_engine)) return EINA_FALSE;
1314 if ((options) && (!_ews_options))
1315 {
1316 free(_ews_engine);
1317 _ews_engine = NULL;
1318 _ews_defaults_engine = EINA_TRUE;
1319 return EINA_FALSE;
1320 }
1321
1322 _ews_defaults_engine = EINA_FALSE;
1323 return EINA_TRUE;
1324#else
1325 return EINA_FALSE; 58 return EINA_FALSE;
1326 (void)engine;
1327 (void)options;
1328#endif
1329} 59}
1330 60
1331EAPI Eina_Bool 61EAPI Eina_Bool
1332ecore_evas_ews_setup(int x, int y, int w, int h) 62ecore_evas_ews_setup(int x EINA_UNUSED, int y EINA_UNUSED, int w EINA_UNUSED, int h EINA_UNUSED)
1333{ 63{
1334#ifdef BUILD_ECORE_EVAS_EWS
1335 Eina_Bool ret = EINA_TRUE;
1336
1337 _ews_defaults_geo = EINA_FALSE;
1338 _ews_x = x;
1339 _ews_y = y;
1340 _ews_w = w;
1341 _ews_h = h;
1342
1343 if (!_ews_ee) return EINA_TRUE;
1344
1345 /* move-resize is not as implemented as move + resize */
1346 ecore_evas_move(_ews_ee, x, y);
1347 ecore_evas_size_min_set(_ews_ee, w, h);
1348 ecore_evas_size_max_set(_ews_ee, w, h);
1349 ecore_evas_resize(_ews_ee, w, h);
1350
1351 ecore_evas_geometry_get(_ews_ee, &x, &y, &w, &h);
1352
1353#define TST(n) if ((n != _ews_##n)) \
1354 { \
1355 WRN("Asked %d, got %d for "#n, _ews_##n, n); \
1356 ret = EINA_FALSE; \
1357 }
1358 TST(x);
1359 TST(y);
1360 TST(w);
1361 TST(h);
1362#undef TST
1363 return ret;
1364#else
1365 return EINA_FALSE; 64 return EINA_FALSE;
1366 (void)x;
1367 (void)y;
1368 (void)w;
1369 (void)h;
1370#endif
1371} 65}
1372 66
1373EAPI Ecore_Evas * 67EAPI Ecore_Evas *
1374ecore_evas_ews_ecore_evas_get(void) 68ecore_evas_ews_ecore_evas_get(void)
1375{ 69{
1376#ifdef BUILD_ECORE_EVAS_EWS
1377 if (!_ews_ee) _ews_ee = _ecore_evas_ews_ee_new();
1378 return _ews_ee;
1379#else
1380 return NULL; 70 return NULL;
1381#endif
1382} 71}
1383 72
1384EAPI Evas * 73EAPI Evas *
1385ecore_evas_ews_evas_get(void) 74ecore_evas_ews_evas_get(void)
1386{ 75{
1387#ifdef BUILD_ECORE_EVAS_EWS
1388 return ecore_evas_get(ecore_evas_ews_ecore_evas_get());
1389#else
1390 return NULL; 76 return NULL;
1391#endif
1392} 77}
1393 78
1394EAPI Evas_Object * 79EAPI Evas_Object *
1395ecore_evas_ews_background_get(void) 80ecore_evas_ews_background_get(void)
1396{ 81{
1397#ifdef BUILD_ECORE_EVAS_EWS
1398 return _ews_bg;
1399#else
1400 return NULL; 82 return NULL;
1401#endif
1402}
1403
1404#ifdef BUILD_ECORE_EVAS_EWS
1405static void
1406_ecore_evas_ews_background_free(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED)
1407{
1408 _ews_bg = NULL;
1409 ecore_evas_ews_background_set(NULL);
1410} 83}
1411#endif
1412 84
1413EAPI void 85EAPI void
1414ecore_evas_ews_background_set(Evas_Object *o) 86ecore_evas_ews_background_set(Evas_Object *o EINA_UNUSED)
1415{ 87{
1416#ifdef BUILD_ECORE_EVAS_EWS
1417 if ((o) && (o == _ews_bg)) return;
1418
1419 if (_ews_bg)
1420 {
1421 evas_object_del(_ews_bg);
1422 _ews_bg = NULL;
1423 }
1424
1425 if ((!o) && (_ews_ee))
1426 {
1427 o = evas_object_rectangle_add(ecore_evas_get(_ews_ee));
1428 evas_object_color_set(o, 0, 0, 0, 255);
1429 }
1430
1431 if (_ews_ee)
1432 {
1433 Evas_Coord w, h, fw, fh;
1434 Evas *e = ecore_evas_get(_ews_ee);
1435
1436 if (e != evas_object_evas_get(o))
1437 {
1438 ERR("background not in ecore_evas_ews_evas_get() canvas!");
1439 return;
1440 }
1441
1442 evas_output_viewport_get(e, NULL, NULL, &w, &h);
1443 evas_output_framespace_get(e, NULL, NULL, &fw, &fh);
1444 evas_object_move(o, 0, 0);
1445 evas_object_resize(o, w - fw, h - fh);
1446 evas_object_layer_set(o, EVAS_LAYER_MIN + 1);
1447 evas_object_lower(o);
1448 evas_object_show(o);
1449
1450 evas_object_event_callback_add
1451 (o, EVAS_CALLBACK_FREE, _ecore_evas_ews_background_free, NULL);
1452 }
1453
1454 _ews_bg = o;
1455#else
1456 return;
1457 (void)o;
1458#endif
1459} 88}
1460 89
1461 90
1462EAPI const Eina_List * 91EAPI const Eina_List *
1463ecore_evas_ews_children_get(void) 92ecore_evas_ews_children_get(void)
1464{ 93{
1465#ifdef BUILD_ECORE_EVAS_EWS
1466 return _ews_children;
1467#else
1468 return NULL; 94 return NULL;
1469#endif
1470} 95}
1471 96
1472EAPI void 97EAPI void
1473ecore_evas_ews_manager_set(const void *manager) 98ecore_evas_ews_manager_set(const void *manager EINA_UNUSED)
1474{ 99{
1475#ifdef BUILD_ECORE_EVAS_EWS
1476 if (_ews_manager == manager) return;
1477 _ews_manager = manager;
1478 ecore_event_add(ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE, NULL, NULL, NULL);
1479#else
1480 (void)manager;
1481#endif
1482} 100}
1483 101
1484EAPI const void * 102EAPI const void *
1485ecore_evas_ews_manager_get(void) 103ecore_evas_ews_manager_get(void)
1486{ 104{
1487#ifdef BUILD_ECORE_EVAS_EWS
1488 return _ews_manager;
1489#else
1490 return NULL; 105 return NULL;
1491#endif
1492} 106}
diff --git a/src/lib/ecore_evas/ecore_evas_module.c b/src/lib/ecore_evas/ecore_evas_module.c
index 2b5394b06f..4fdd8f70b0 100644
--- a/src/lib/ecore_evas/ecore_evas_module.c
+++ b/src/lib/ecore_evas/ecore_evas_module.c
@@ -251,9 +251,6 @@ _ecore_evas_available_engines_get(void)
251#ifdef BUILD_ECORE_EVAS_BUFFER 251#ifdef BUILD_ECORE_EVAS_BUFFER
252 ADDENG("buffer"); 252 ADDENG("buffer");
253#endif 253#endif
254#ifdef BUILD_ECORE_EVAS_EWS
255 ADDENG("ews");
256#endif
257 } 254 }
258 else if (!strcmp(name, "cocoa")) 255 else if (!strcmp(name, "cocoa"))
259 { 256 {
diff --git a/src/lib/ecore_input/ecore_input_joystick.c b/src/lib/ecore_input/ecore_input_joystick.c
index 7793c3bf35..f25b4ee67e 100644
--- a/src/lib/ecore_input/ecore_input_joystick.c
+++ b/src/lib/ecore_input/ecore_input_joystick.c
@@ -3,7 +3,7 @@
3#endif 3#endif
4 4
5/*FIXME: change OS specific value */ 5/*FIXME: change OS specific value */
6#ifdef __linux__ 6#if defined(__linux__) || defined(__FreeBSD__)
7# include <linux/joystick.h> 7# include <linux/joystick.h>
8#endif 8#endif
9 9
diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c b/src/lib/ecore_wl2/ecore_wl2_display.c
index 7344cf8b74..7a0e20cf31 100644
--- a/src/lib/ecore_wl2/ecore_wl2_display.c
+++ b/src/lib/ecore_wl2/ecore_wl2_display.c
@@ -307,15 +307,6 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const
307 ewd->wl.data_device_manager = 307 ewd->wl.data_device_manager =
308 wl_registry_bind(registry, id, &wl_data_device_manager_interface, ewd->wl.data_device_manager_version); 308 wl_registry_bind(registry, id, &wl_data_device_manager_interface, ewd->wl.data_device_manager_version);
309 } 309 }
310 else if ((eina_streq(interface, "www")) &&
311 (getenv("EFL_WAYLAND_ENABLE_WWW")))
312 {
313 Ecore_Wl2_Window *window;
314
315 ewd->wl.www = wl_registry_bind(registry, id, &www_interface, 1);
316 EINA_INLIST_FOREACH(ewd->windows, window)
317 _ecore_wl2_window_www_surface_init(window);
318 }
319 else if ((!strcmp(interface, "zwp_e_session_recovery")) && 310 else if ((!strcmp(interface, "zwp_e_session_recovery")) &&
320 (!no_session_recovery)) 311 (!no_session_recovery))
321 { 312 {
@@ -335,12 +326,6 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const
335 EINA_INLIST_FOREACH(ewd->windows, window) 326 EINA_INLIST_FOREACH(ewd->windows, window)
336 if (window->surface) efl_aux_hints_get_supported_aux_hints(ewd->wl.efl_aux_hints, window->surface); 327 if (window->surface) efl_aux_hints_get_supported_aux_hints(ewd->wl.efl_aux_hints, window->surface);
337 } 328 }
338 else if (!strcmp(interface, "zwp_teamwork"))
339 {
340 ewd->wl.teamwork =
341 wl_registry_bind(registry, id,
342 &zwp_teamwork_interface, EFL_TEAMWORK_VERSION);
343 }
344 else if (!strcmp(interface, "wl_output")) 329 else if (!strcmp(interface, "wl_output"))
345 _ecore_wl2_output_add(ewd, id); 330 _ecore_wl2_output_add(ewd, id);
346 else if (!strcmp(interface, "wl_seat")) 331 else if (!strcmp(interface, "wl_seat"))
@@ -452,7 +437,6 @@ _ecore_wl2_display_globals_cleanup(Ecore_Wl2_Display *ewd)
452{ 437{
453 if (ewd->wl.session_recovery) 438 if (ewd->wl.session_recovery)
454 zwp_e_session_recovery_destroy(ewd->wl.session_recovery); 439 zwp_e_session_recovery_destroy(ewd->wl.session_recovery);
455 if (ewd->wl.www) www_destroy(ewd->wl.www);
456 if (ewd->wl.xdg_wm_base) xdg_wm_base_destroy(ewd->wl.xdg_wm_base); 440 if (ewd->wl.xdg_wm_base) xdg_wm_base_destroy(ewd->wl.xdg_wm_base);
457 if (ewd->wl.zxdg_shell) zxdg_shell_v6_destroy(ewd->wl.zxdg_shell); 441 if (ewd->wl.zxdg_shell) zxdg_shell_v6_destroy(ewd->wl.zxdg_shell);
458 if (ewd->wl.shm) wl_shm_destroy(ewd->wl.shm); 442 if (ewd->wl.shm) wl_shm_destroy(ewd->wl.shm);
diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h
index e4d19bd1e0..c374c67857 100644
--- a/src/lib/ecore_wl2/ecore_wl2_private.h
+++ b/src/lib/ecore_wl2/ecore_wl2_private.h
@@ -5,12 +5,8 @@
5# include "Ecore_Wl2.h" 5# include "Ecore_Wl2.h"
6# include "Ecore_Input.h" 6# include "Ecore_Input.h"
7# include <xkbcommon/xkbcommon-compose.h> 7# include <xkbcommon/xkbcommon-compose.h>
8# include "www-client-protocol.h"
9# include "ecore_wl2_internal.h" 8# include "ecore_wl2_internal.h"
10 9
11# define EFL_TEAMWORK_VERSION 2
12# include "teamwork-client-protocol.h"
13
14# include "session-recovery-client-protocol.h" 10# include "session-recovery-client-protocol.h"
15 11
16# include "xdg-shell-client-protocol.h" 12# include "xdg-shell-client-protocol.h"
@@ -91,10 +87,8 @@ struct _Ecore_Wl2_Display
91 struct zwp_linux_dmabuf_v1 *dmabuf; 87 struct zwp_linux_dmabuf_v1 *dmabuf;
92 struct zxdg_shell_v6 *zxdg_shell; 88 struct zxdg_shell_v6 *zxdg_shell;
93 struct xdg_wm_base *xdg_wm_base; 89 struct xdg_wm_base *xdg_wm_base;
94 struct www *www;
95 struct zwp_e_session_recovery *session_recovery; 90 struct zwp_e_session_recovery *session_recovery;
96 struct efl_aux_hints *efl_aux_hints; 91 struct efl_aux_hints *efl_aux_hints;
97 struct zwp_teamwork *teamwork;
98 struct efl_hints *efl_hints; 92 struct efl_hints *efl_hints;
99 int compositor_version; 93 int compositor_version;
100 } wl; 94 } wl;
@@ -182,7 +176,6 @@ struct _Ecore_Wl2_Window
182 struct wl_surface *surface; 176 struct wl_surface *surface;
183 void *buffer; 177 void *buffer;
184 struct wl_callback *callback; 178 struct wl_callback *callback;
185 struct www_surface *www_surface;
186 struct xdg_surface *xdg_surface; 179 struct xdg_surface *xdg_surface;
187 struct xdg_toplevel *xdg_toplevel; 180 struct xdg_toplevel *xdg_toplevel;
188 struct xdg_popup *xdg_popup; 181 struct xdg_popup *xdg_popup;
@@ -529,20 +522,6 @@ struct _Ecore_Wl2_Input
529 Eina_List *devices_list; 522 Eina_List *devices_list;
530}; 523};
531 524
532typedef struct Ecore_Wl2_Event_Window_WWW
533{
534 Ecore_Wl2_Window *window;
535 int x_rel;
536 int y_rel;
537 uint32_t timestamp;
538} Ecore_Wl2_Event_Window_WWW;
539
540typedef struct Ecore_Wl2_Event_Window_WWW_Drag
541{
542 Ecore_Wl2_Window *window;
543 Eina_Bool dragging;
544} Ecore_Wl2_Event_Window_WWW_Drag;
545
546typedef struct _Buffer_Handle Buffer_Handle; 525typedef struct _Buffer_Handle Buffer_Handle;
547typedef struct _Ecore_Wl2_Buffer 526typedef struct _Ecore_Wl2_Buffer
548{ 527{
@@ -573,9 +552,6 @@ typedef struct _Ecore_Wl2_Surface
573 Eina_Bool alpha : 1; 552 Eina_Bool alpha : 1;
574} Ecore_Wl2_Surface; 553} Ecore_Wl2_Surface;
575 554
576EAPI extern int _ecore_wl2_event_window_www;
577EAPI extern int _ecore_wl2_event_window_www_drag;
578
579Ecore_Wl2_Window *_ecore_wl2_display_window_surface_find(Ecore_Wl2_Display *display, struct wl_surface *wl_surface); 555Ecore_Wl2_Window *_ecore_wl2_display_window_surface_find(Ecore_Wl2_Display *display, struct wl_surface *wl_surface);
580void _display_event_free(void *d, void *event EINA_UNUSED); 556void _display_event_free(void *d, void *event EINA_UNUSED);
581 557
@@ -605,7 +581,6 @@ void _ecore_wl2_subsurf_free(Ecore_Wl2_Subsurface *subsurf);
605 581
606void _ecore_wl2_window_surface_create(Ecore_Wl2_Window *window); 582void _ecore_wl2_window_surface_create(Ecore_Wl2_Window *window);
607void _ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window); 583void _ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window);
608void _ecore_wl2_window_www_surface_init(Ecore_Wl2_Window *window);
609void _ecore_wl2_window_semi_free(Ecore_Wl2_Window *window); 584void _ecore_wl2_window_semi_free(Ecore_Wl2_Window *window);
610 585
611void _ecore_wl2_offer_unref(Ecore_Wl2_Offer *offer); 586void _ecore_wl2_offer_unref(Ecore_Wl2_Offer *offer);
diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c
index e11e2e30a3..8c018ebd38 100644
--- a/src/lib/ecore_wl2/ecore_wl2_window.c
+++ b/src/lib/ecore_wl2/ecore_wl2_window.c
@@ -28,10 +28,6 @@ _ecore_wl2_window_semi_free(Ecore_Wl2_Window *window)
28 if (window->zxdg_surface) zxdg_surface_v6_destroy(window->zxdg_surface); 28 if (window->zxdg_surface) zxdg_surface_v6_destroy(window->zxdg_surface);
29 window->zxdg_surface = NULL; 29 window->zxdg_surface = NULL;
30 30
31 if (window->www_surface)
32 www_surface_destroy(window->www_surface);
33 window->www_surface = NULL;
34
35 if (window->surface) wl_surface_destroy(window->surface); 31 if (window->surface) wl_surface_destroy(window->surface);
36 window->surface = NULL; 32 window->surface = NULL;
37 window->surface_id = -1; 33 window->surface_id = -1;
@@ -132,70 +128,6 @@ _configure_complete(Ecore_Wl2_Window *window)
132#include "window_v6.x" 128#include "window_v6.x"
133 129
134static void 130static void
135_www_surface_end_drag(void *data, struct www_surface *www_surface EINA_UNUSED)
136{
137 Ecore_Wl2_Window *window = data;
138 Ecore_Wl2_Event_Window_WWW_Drag *ev;
139
140 ev = malloc(sizeof(Ecore_Wl2_Event_Window_WWW_Drag));
141 EINA_SAFETY_ON_NULL_RETURN(ev);
142 ev->window = window;
143 ev->dragging = 0;
144
145 ecore_event_add(_ecore_wl2_event_window_www_drag, ev, NULL, NULL);
146}
147
148static void
149_www_surface_start_drag(void *data, struct www_surface *www_surface EINA_UNUSED)
150{
151 Ecore_Wl2_Window *window = data;
152 Ecore_Wl2_Event_Window_WWW_Drag *ev;
153
154 ev = malloc(sizeof(Ecore_Wl2_Event_Window_WWW_Drag));
155 EINA_SAFETY_ON_NULL_RETURN(ev);
156 ev->window = window;
157 ev->dragging = 1;
158
159 ecore_event_add(_ecore_wl2_event_window_www_drag, ev, NULL, NULL);
160}
161
162static void
163_www_surface_status(void *data, struct www_surface *www_surface EINA_UNUSED, int32_t x_rel, int32_t y_rel, uint32_t timestamp)
164{
165 Ecore_Wl2_Window *window = data;
166 Ecore_Wl2_Event_Window_WWW *ev;
167
168 ev = malloc(sizeof(Ecore_Wl2_Event_Window_WWW));
169 EINA_SAFETY_ON_NULL_RETURN(ev);
170 ev->window = window;
171 ev->x_rel = x_rel;
172 ev->y_rel = y_rel;
173 ev->timestamp = timestamp;
174
175 ecore_event_add(_ecore_wl2_event_window_www, ev, NULL, NULL);
176}
177
178static struct www_surface_listener _www_surface_listener =
179{
180 .status = _www_surface_status,
181 .start_drag = _www_surface_start_drag,
182 .end_drag = _www_surface_end_drag,
183};
184
185void
186_ecore_wl2_window_www_surface_init(Ecore_Wl2_Window *window)
187{
188 if (!window->surface) return;
189 if (!window->display->wl.www) return;
190 if (window->www_surface) return;
191 window->www_surface = www_create(window->display->wl.www, window->surface);
192 www_surface_set_user_data(window->www_surface, window);
193 www_surface_add_listener(window->www_surface, &_www_surface_listener,
194 window);
195}
196
197
198static void
199_xdg_surface_cb_configure(void *data, struct xdg_surface *xdg_surface EINA_UNUSED, uint32_t serial) 131_xdg_surface_cb_configure(void *data, struct xdg_surface *xdg_surface EINA_UNUSED, uint32_t serial)
200{ 132{
201 Ecore_Wl2_Window *window; 133 Ecore_Wl2_Window *window;
@@ -639,7 +571,6 @@ ecore_wl2_window_show(Ecore_Wl2_Window *window)
639 (window->type != ECORE_WL2_WINDOW_TYPE_NONE)) 571 (window->type != ECORE_WL2_WINDOW_TYPE_NONE))
640 { 572 {
641 _ecore_wl2_window_shell_surface_init(window); 573 _ecore_wl2_window_shell_surface_init(window);
642 _ecore_wl2_window_www_surface_init(window);
643 _ecore_wl2_window_show_send(window); 574 _ecore_wl2_window_show_send(window);
644 } 575 }
645 else 576 else
diff --git a/src/lib/ecore_x/ecore_x_vsync.c b/src/lib/ecore_x/ecore_x_vsync.c
index 5ad828d0fe..1014542a6a 100644
--- a/src/lib/ecore_x/ecore_x_vsync.c
+++ b/src/lib/ecore_x/ecore_x_vsync.c
@@ -15,7 +15,6 @@
15#include <sys/stat.h> 15#include <sys/stat.h>
16#include <sys/select.h> 16#include <sys/select.h>
17#include <fcntl.h> 17#include <fcntl.h>
18#include <fnmatch.h>
19 18
20#ifdef HAVE_PRCTL 19#ifdef HAVE_PRCTL
21# include <sys/prctl.h> 20# include <sys/prctl.h>
@@ -648,7 +647,7 @@ glob_match(const char *glob, const char *str)
648{ 647{
649 if (!glob) return EINA_TRUE; 648 if (!glob) return EINA_TRUE;
650 if (!str) return EINA_FALSE; 649 if (!str) return EINA_FALSE;
651 if (!fnmatch(glob, str, 0)) return EINA_TRUE; 650 if (eina_fnmatch(glob, str, 0)) return EINA_TRUE;
652 return EINA_FALSE; 651 return EINA_FALSE;
653} 652}
654 653
diff --git a/src/lib/ector/software/ector_renderer_software_image.c b/src/lib/ector/software/ector_renderer_software_image.c
index f933bd6a00..d7807ed518 100644
--- a/src/lib/ector/software/ector_renderer_software_image.c
+++ b/src/lib/ector/software/ector_renderer_software_image.c
@@ -106,6 +106,10 @@ _ector_renderer_software_image_ector_renderer_draw(Eo *obj EINA_UNUSED,
106 double im11, im12, im21, im22, im31, im32; 106 double im11, im12, im21, im22, im31, im32;
107 uint32_t *dst_buf, *src_buf; 107 uint32_t *dst_buf, *src_buf;
108 int image_w, image_h; 108 int image_w, image_h;
109
110 int dst_buf_width = MIN(pd->boundary.x2, (int)pd->surface->rasterizer->fill_data.raster_buffer->generic->w);
111 int dst_buf_height = MIN(pd->boundary.y2, (int)pd->surface->rasterizer->fill_data.raster_buffer->generic->h);
112
109 ector_buffer_size_get(pd->image->buffer, &image_w, &image_h); 113 ector_buffer_size_get(pd->image->buffer, &image_w, &image_h);
110 114
111 dst_buf = pd->surface->rasterizer->fill_data.raster_buffer->pixels.u32; 115 dst_buf = pd->surface->rasterizer->fill_data.raster_buffer->pixels.u32;
@@ -116,9 +120,9 @@ _ector_renderer_software_image_ector_renderer_draw(Eo *obj EINA_UNUSED,
116 &im31, &im32, NULL); 120 &im31, &im32, NULL);
117 121
118 //Draw 122 //Draw
119 for (int local_y = pd->boundary.y1; local_y < pd->boundary.y2; local_y++) 123 for (int local_y = pd->boundary.y1; local_y < dst_buf_height; local_y++)
120 { 124 {
121 for (int local_x = pd->boundary.x1; local_x < pd->boundary.x2; local_x++) 125 for (int local_x = pd->boundary.x1; local_x < dst_buf_width; local_x++)
122 { 126 {
123 uint32_t *dst = dst_buf + ((int)local_x + ((int)local_y * pix_stride)); 127 uint32_t *dst = dst_buf + ((int)local_x + ((int)local_y * pix_stride));
124 int rx, ry; 128 int rx, ry;
diff --git a/src/lib/edje/Edje_Common.h b/src/lib/edje/Edje_Common.h
index 5e486fe2de..c94a2ff9ac 100644
--- a/src/lib/edje/Edje_Common.h
+++ b/src/lib/edje/Edje_Common.h
@@ -1453,6 +1453,16 @@ EAPI void edje_password_show_last_timeout_set(double password_show_last_timeout)
1453EAPI Eina_Bool edje_color_class_set (const char *color_class, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3); 1453EAPI Eina_Bool edje_color_class_set (const char *color_class, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3);
1454 1454
1455/** 1455/**
1456 * @brief Applies changes mad when setting Edje color classes.
1457 *
1458 * This forces all changes to color classes made by (for example)
1459 * edje_color_class_set() to actually take effect.
1460 *
1461 * @since 1.26
1462 */
1463EAPI void edje_color_class_apply (void);
1464
1465/**
1456 * @brief Gets Edje color class. 1466 * @brief Gets Edje color class.
1457 * 1467 *
1458 * @param color_class 1468 * @param color_class
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index 818a62195f..c0e3f6c247 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -618,6 +618,16 @@ struct _Edje_Style_Tag
618 const char *value; 618 const char *value;
619 const char *font; 619 const char *font;
620 const char *text_class; 620 const char *text_class;
621 const char *color_class;
622 const char *outline_color_class;
623 const char *shadow_color_class;
624 const char *underline_color_class;
625 const char *underline2_color_class;
626 const char *underline_dash_color_class;
627 const char *glow_color_class;
628 const char *glow2_color_class;
629 const char *backing_color_class;
630 const char *strikethrough_color_class;
621 double font_size; 631 double font_size;
622}; 632};
623 633
diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c
index 88d11207ea..f1461c5890 100644
--- a/src/lib/edje/edje_textblock_styles.c
+++ b/src/lib/edje/edje_textblock_styles.c
@@ -145,7 +145,7 @@ _edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag *tag_ret, E
145 else if (_IS_STRINGS_EQUAL(key, key_len, "text_class", 10)) 145 else if (_IS_STRINGS_EQUAL(key, key_len, "text_class", 10))
146 { 146 {
147 if (tag_ret) 147 if (tag_ret)
148 tag_ret->text_class = eina_stringshare_add(val); 148 eina_stringshare_replace(&(tag_ret->text_class), val);
149 149
150 // no need to add text_class tag to style 150 // no need to add text_class tag to style
151 // as evas_textblock_style has no idea about 151 // as evas_textblock_style has no idea about
@@ -153,6 +153,17 @@ _edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag *tag_ret, E
153 free(item); 153 free(item);
154 continue; 154 continue;
155 } 155 }
156 else if (_IS_STRINGS_EQUAL(key, key_len, "color_class", 11))
157 {
158 if (tag_ret)
159 eina_stringshare_replace(&(tag_ret->color_class), val);
160
161 // no need to add color_class tag to style
162 // as evas_textblock_style has no idea about
163 // color_class tag.
164 free(item);
165 continue;
166 }
156 else if (_IS_STRINGS_EQUAL(key, key_len, "font_size", 9)) 167 else if (_IS_STRINGS_EQUAL(key, key_len, "font_size", 9))
157 { 168 {
158 if (tag_ret) 169 if (tag_ret)
@@ -166,7 +177,7 @@ _edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag *tag_ret, E
166 { 177 {
167 char buffer[120]; 178 char buffer[120];
168 snprintf(buffer, sizeof(buffer), "edje/fonts/%s", val); 179 snprintf(buffer, sizeof(buffer), "edje/fonts/%s", val);
169 tag_ret->font = eina_stringshare_add(buffer); 180 eina_stringshare_replace(&tag_ret->font, buffer);
170 if (eina_strbuf_length_get(result)) eina_strbuf_append(result, " "); 181 if (eina_strbuf_length_get(result)) eina_strbuf_append(result, " ");
171 eina_strbuf_append(result, "font="); 182 eina_strbuf_append(result, "font=");
172 eina_strbuf_append(result, buffer); 183 eina_strbuf_append(result, buffer);
@@ -178,6 +189,63 @@ _edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag *tag_ret, E
178 } 189 }
179 } 190 }
180 } 191 }
192 // handle colorclass replacements of color like: color=cc:/fg/normal
193 else if ((_IS_STRINGS_EQUAL(key, key_len, "color", 5)) ||
194 (_IS_STRINGS_EQUAL(key, key_len, "outline_color", 13)) ||
195 (_IS_STRINGS_EQUAL(key, key_len, "shadow_color", 12)) ||
196 (_IS_STRINGS_EQUAL(key, key_len, "underline_color", 15)) ||
197 (_IS_STRINGS_EQUAL(key, key_len, "underline2_color", 16)) ||
198 (_IS_STRINGS_EQUAL(key, key_len, "secondary_underline_color", 25)) ||
199 (_IS_STRINGS_EQUAL(key, key_len, "underline_dash_color", 20)) ||
200 (_IS_STRINGS_EQUAL(key, key_len, "underline_dashed_color", 22)) ||
201 (_IS_STRINGS_EQUAL(key, key_len, "glow_color", 10)) ||
202 (_IS_STRINGS_EQUAL(key, key_len, "glow2_color", 11)) ||
203 (_IS_STRINGS_EQUAL(key, key_len, "secondary_glow_color", 20)) ||
204 (_IS_STRINGS_EQUAL(key, key_len, "backing_color", 13)) ||
205 (_IS_STRINGS_EQUAL(key, key_len, "background_color", 16)) ||
206 (_IS_STRINGS_EQUAL(key, key_len, "strikethrough_color", 19)))
207 {
208 if (!strncmp(val, "cc:", 3))
209 {
210 if ((_IS_STRINGS_EQUAL(key, key_len, "color", 5)))
211 eina_stringshare_replace(&(tag_ret->color_class), val + 3);
212 else if ((_IS_STRINGS_EQUAL(key, key_len, "outline_color", 13)))
213 eina_stringshare_replace(&(tag_ret->outline_color_class), val + 3);
214 else if ((_IS_STRINGS_EQUAL(key, key_len, "shadow_color", 12)))
215 eina_stringshare_replace(&(tag_ret->shadow_color_class), val + 3);
216 else if ((_IS_STRINGS_EQUAL(key, key_len, "underline_color", 15)))
217 eina_stringshare_replace(&(tag_ret->underline_color_class), val + 3);
218 else if ((_IS_STRINGS_EQUAL(key, key_len, "underline2_color", 16)) ||
219 (_IS_STRINGS_EQUAL(key, key_len, "secondary_underline_color", 25)))
220 eina_stringshare_replace(&(tag_ret->underline2_color_class), val + 3);
221 else if ((_IS_STRINGS_EQUAL(key, key_len, "underline_dash_color", 20)) ||
222 (_IS_STRINGS_EQUAL(key, key_len, "underline_dashed_color", 22)))
223 eina_stringshare_replace(&(tag_ret->underline_dash_color_class), val + 3);
224 else if ((_IS_STRINGS_EQUAL(key, key_len, "glow_color", 10)))
225 eina_stringshare_replace(&(tag_ret->glow_color_class), val + 3);
226 else if ((_IS_STRINGS_EQUAL(key, key_len, "glow2_color", 11)) ||
227 (_IS_STRINGS_EQUAL(key, key_len, "secondary_glow_color", 20)))
228 eina_stringshare_replace(&(tag_ret->glow2_color_class), val + 3);
229 else if ((_IS_STRINGS_EQUAL(key, key_len, "backing_color", 13)) ||
230 (_IS_STRINGS_EQUAL(key, key_len, "background_color", 16)))
231 eina_stringshare_replace(&(tag_ret->backing_color_class), val + 3);
232 else if ((_IS_STRINGS_EQUAL(key, key_len, "strikethrough_color", 19)))
233 eina_stringshare_replace(&(tag_ret->strikethrough_color_class), val + 3);
234 }
235 }
236 // XXX: how do we do better for:
237 // color
238 // outline_color
239 // shadow_color
240 //
241 // XXX: and do these too:
242 // underline_color
243 // underline2_color | secondary_underline_color
244 // underline_dash_color | underline_dashed_color
245 // glow_color
246 // glow2_color | secondary_glow_color
247 // backing_color | background_color
248 // strikethrough_color
181 s2 = eina_str_escape(item); 249 s2 = eina_str_escape(item);
182 if (s2) 250 if (s2)
183 { 251 {
@@ -261,6 +329,7 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl)
261 Eina_Strbuf *txt = NULL; 329 Eina_Strbuf *txt = NULL;
262 Edje_Style_Tag *tag; 330 Edje_Style_Tag *tag;
263 Edje_Text_Class *tc; 331 Edje_Text_Class *tc;
332 Edje_Color_Class *cc;
264 char *fontset = _edje_fontset_append_escaped, *fontsource = NULL; 333 char *fontset = _edje_fontset_append_escaped, *fontsource = NULL;
265 334
266 if (!ed->file) return; 335 if (!ed->file) return;
@@ -298,7 +367,8 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl)
298 eina_strbuf_append(txt, "='"); 367 eina_strbuf_append(txt, "='");
299 368
300 /* Configure fonts from text class if it exists */ 369 /* Configure fonts from text class if it exists */
301 tc = _edje_text_class_find(ed, tag->text_class); 370 if (tag->text_class) tc = _edje_text_class_find(ed, tag->text_class);
371 else tc = NULL;
302 372
303 /* Add and Handle tag parsed data */ 373 /* Add and Handle tag parsed data */
304 eina_strbuf_append(txt, tag->value); 374 eina_strbuf_append(txt, tag->value);
@@ -335,6 +405,56 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl)
335 405
336 if (sfont) free(sfont); 406 if (sfont) free(sfont);
337 } 407 }
408 if (tag->color_class)
409 {
410 if ((cc = _edje_color_class_recursive_find(ed, tag->color_class)))
411 eina_strbuf_append_printf(txt, " color=#%02x%02x%02x%02x", cc->r, cc->g, cc->b, cc->a);
412 }
413 if (tag->outline_color_class)
414 {
415 if ((cc = _edje_color_class_recursive_find(ed, tag->outline_color_class)))
416 eina_strbuf_append_printf(txt, " outline_color=#%02x%02x%02x%02x", cc->r, cc->g, cc->b, cc->a);
417 }
418 if (tag->shadow_color_class)
419 {
420 if ((cc = _edje_color_class_recursive_find(ed, tag->shadow_color_class)))
421 eina_strbuf_append_printf(txt, " shadow_color=#%02x%02x%02x%02x", cc->r, cc->g, cc->b, cc->a);
422 }
423 if (tag->underline_color_class)
424 {
425 if ((cc = _edje_color_class_recursive_find(ed, tag->underline_color_class)))
426 eina_strbuf_append_printf(txt, " underline_color=#%02x%02x%02x%02x", cc->r, cc->g, cc->b, cc->a);
427 }
428 if (tag->underline2_color_class)
429 {
430 if ((cc = _edje_color_class_recursive_find(ed, tag->underline2_color_class)))
431 eina_strbuf_append_printf(txt, " underline2_color=#%02x%02x%02x%02x", cc->r, cc->g, cc->b, cc->a);
432 }
433 if (tag->underline_dash_color_class)
434 {
435 if ((cc = _edje_color_class_recursive_find(ed, tag->underline_dash_color_class)))
436 eina_strbuf_append_printf(txt, " underline_dash_color=#%02x%02x%02x%02x", cc->r, cc->g, cc->b, cc->a);
437 }
438 if (tag->glow_color_class)
439 {
440 if ((cc = _edje_color_class_recursive_find(ed, tag->glow_color_class)))
441 eina_strbuf_append_printf(txt, " glow_color=#%02x%02x%02x%02x", cc->r, cc->g, cc->b, cc->a);
442 }
443 if (tag->glow2_color_class)
444 {
445 if ((cc = _edje_color_class_recursive_find(ed, tag->glow2_color_class)))
446 eina_strbuf_append_printf(txt, " glow2_color=#%02x%02x%02x%02x", cc->r, cc->g, cc->b, cc->a);
447 }
448 if (tag->backing_color_class)
449 {
450 if ((cc = _edje_color_class_recursive_find(ed, tag->backing_color_class)))
451 eina_strbuf_append_printf(txt, " backing_color=#%02x%02x%02x%02x", cc->r, cc->g, cc->b, cc->a);
452 }
453 if (tag->strikethrough_color_class)
454 {
455 if ((cc = _edje_color_class_recursive_find(ed, tag->strikethrough_color_class)))
456 eina_strbuf_append_printf(txt, " strikethrough_color=#%02x%02x%02x%02x", cc->r, cc->g, cc->b, cc->a);
457 }
338 458
339 eina_strbuf_append(txt, "'"); 459 eina_strbuf_append(txt, "'");
340 } 460 }
@@ -343,8 +463,7 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl)
343 /* Configure the style */ 463 /* Configure the style */
344 stl->cache = EINA_TRUE; 464 stl->cache = EINA_TRUE;
345 evas_textblock_style_set(stl->style, eina_strbuf_string_get(txt)); 465 evas_textblock_style_set(stl->style, eina_strbuf_string_get(txt));
346 if (txt) 466 if (txt) eina_strbuf_free(txt);
347 eina_strbuf_free(txt);
348} 467}
349 468
350static inline Edje_Style * 469static inline Edje_Style *
@@ -630,6 +749,16 @@ _edje_file_textblock_style_parse_and_fix(Edje_File *edf)
630 eina_strbuf_append(styleBuffer, "'"); 749 eina_strbuf_append(styleBuffer, "'");
631 750
632 if (tag->text_class) stl->readonly = EINA_FALSE; 751 if (tag->text_class) stl->readonly = EINA_FALSE;
752 else if (tag->color_class) stl->readonly = EINA_FALSE;
753 else if (tag->outline_color_class) stl->readonly = EINA_FALSE;
754 else if (tag->shadow_color_class) stl->readonly = EINA_FALSE;
755 else if (tag->underline_color_class) stl->readonly = EINA_FALSE;
756 else if (tag->underline2_color_class) stl->readonly = EINA_FALSE;
757 else if (tag->underline_dash_color_class) stl->readonly = EINA_FALSE;
758 else if (tag->glow_color_class) stl->readonly = EINA_FALSE;
759 else if (tag->glow2_color_class) stl->readonly = EINA_FALSE;
760 else if (tag->backing_color_class) stl->readonly = EINA_FALSE;
761 else if (tag->strikethrough_color_class) stl->readonly = EINA_FALSE;
633 } 762 }
634 /* Configure the style only if it will never change again*/ 763 /* Configure the style only if it will never change again*/
635 if (stl->readonly) 764 if (stl->readonly)
@@ -658,10 +787,21 @@ _edje_file_textblock_style_cleanup(Edje_File *edf)
658 eina_stringshare_del(tag->value); 787 eina_stringshare_del(tag->value);
659 if (edf->free_strings) 788 if (edf->free_strings)
660 { 789 {
661 if (tag->key) eina_stringshare_del(tag->key); 790#define STRSHRDEL(_x) if (tag->_x) eina_stringshare_del(tag->_x)
791 STRSHRDEL(key);
662/* FIXME: Find a proper way to handle it. */ 792/* FIXME: Find a proper way to handle it. */
663 if (tag->text_class) eina_stringshare_del(tag->text_class); 793 STRSHRDEL(text_class);
664 if (tag->font) eina_stringshare_del(tag->font); 794 STRSHRDEL(color_class);
795 STRSHRDEL(outline_color_class);
796 STRSHRDEL(shadow_color_class);
797 STRSHRDEL(underline_color_class);
798 STRSHRDEL(underline2_color_class);
799 STRSHRDEL(underline_dash_color_class);
800 STRSHRDEL(glow_color_class);
801 STRSHRDEL(glow2_color_class);
802 STRSHRDEL(backing_color_class);
803 STRSHRDEL(strikethrough_color_class);
804 STRSHRDEL(font);
665 } 805 }
666 free(tag); 806 free(tag);
667 } 807 }
diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c
index af465288e7..625898947d 100644
--- a/src/lib/edje/edje_util.c
+++ b/src/lib/edje/edje_util.c
@@ -712,6 +712,22 @@ edje_color_class_set(const char *color_class, int r, int g, int b, int a, int r2
712 return result; 712 return result;
713} 713}
714 714
715EAPI void
716edje_color_class_apply(void)
717{
718 Edje *ed;
719
720 EINA_INLIST_FOREACH(_edje_edjes, ed)
721 {
722 ed->dirty = EINA_TRUE;
723 ed->recalc_call = EINA_TRUE;
724#ifdef EDJE_CALC_CACHE
725 ed->all_part_change = EINA_TRUE;
726#endif
727 _edje_recalc(ed);
728 }
729}
730
715EOLIAN Eina_Bool 731EOLIAN Eina_Bool
716_edje_global_efl_gfx_color_class_color_class_set(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, 732_edje_global_efl_gfx_color_class_color_class_set(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED,
717 const char *color_class, Efl_Gfx_Color_Class_Layer layer, int r, int g, int b, int a) 733 const char *color_class, Efl_Gfx_Color_Class_Layer layer, int r, int g, int b, int a)
@@ -5877,6 +5893,32 @@ _edje_color_class_find(const Edje *ed, const char *color_class)
5877 cc = eina_hash_find(ed->file->color_hash, color_class); 5893 cc = eina_hash_find(ed->file->color_hash, color_class);
5878 if (cc) return cc; 5894 if (cc) return cc;
5879 5895
5896 // fall back to parent class. expecting classes like:
5897 // /bg <- fallback for /bg/*
5898 // /bg/normal <- fallback for /bg/normal/*
5899 // /bg/normal/button <- mid grey
5900 // etc.
5901 if (color_class[0] == '/')
5902 {
5903 size_t len = strlen(color_class);
5904 char *color_class_parent = alloca(len + 1);
5905 const char *src = color_class;
5906 char *last_slash = NULL, *dst = color_class_parent;
5907
5908 for (;; src++, dst++)
5909 {
5910 *dst = *src;
5911 if (*dst == '/') last_slash = dst;
5912 if (*dst == 0) break;
5913 }
5914 if (last_slash)
5915 {
5916 if (last_slash == color_class_parent)
5917 return NULL;
5918 *last_slash = 0;
5919 }
5920 return _edje_color_class_find(ed, color_class_parent);
5921 }
5880 return NULL; 5922 return NULL;
5881} 5923}
5882 5924
@@ -5924,6 +5966,32 @@ _edje_color_class_recursive_find(const Edje *ed, const char *color_class)
5924 cc = _edje_color_class_recursive_find_helper(ed, ed->file->color_hash, color_class); 5966 cc = _edje_color_class_recursive_find_helper(ed, ed->file->color_hash, color_class);
5925 if (cc) return cc; 5967 if (cc) return cc;
5926 5968
5969 // fall back to parent class. expecting classes like:
5970 // /bg <- fallback for /bg/*
5971 // /bg/normal <- fallback for /bg/normal/*
5972 // /bg/normal/button <- mid grey
5973 // etc.
5974 if (color_class[0] == '/')
5975 {
5976 size_t len = strlen(color_class);
5977 char *color_class_parent = alloca(len + 1);
5978 const char *src = color_class;
5979 char *last_slash = NULL, *dst = color_class_parent;
5980
5981 for (;; src++, dst++)
5982 {
5983 *dst = *src;
5984 if (*dst == '/') last_slash = dst;
5985 if (*dst == 0) break;
5986 }
5987 if (last_slash)
5988 {
5989 if (last_slash == color_class_parent)
5990 return NULL;
5991 *last_slash = 0;
5992 }
5993 return _edje_color_class_recursive_find(ed, color_class_parent);
5994 }
5927 return NULL; 5995 return NULL;
5928} 5996}
5929 5997
diff --git a/src/lib/eet/eet_lib.c b/src/lib/eet/eet_lib.c
index e1216e6108..1aa2a1c9bb 100644
--- a/src/lib/eet/eet_lib.c
+++ b/src/lib/eet/eet_lib.c
@@ -9,7 +9,6 @@
9#include <time.h> 9#include <time.h>
10#include <string.h> 10#include <string.h>
11#include <unistd.h> 11#include <unistd.h>
12#include <fnmatch.h>
13#include <fcntl.h> 12#include <fcntl.h>
14 13
15#include <Eina.h> 14#include <Eina.h>
@@ -2607,7 +2606,7 @@ eet_list(Eet_File *ef,
2607 * check for * explicitly, because on some systems, * isn't well 2606 * check for * explicitly, because on some systems, * isn't well
2608 * supported 2607 * supported
2609 */ 2608 */
2610 if ((!glob) || !fnmatch(glob, efn->name, 0)) 2609 if ((!glob) || eina_fnmatch(glob, efn->name, 0))
2611 { 2610 {
2612 /* add it to our list */ 2611 /* add it to our list */
2613 list_count++; 2612 list_count++;
diff --git a/src/lib/eeze/eeze_disk.c b/src/lib/eeze/eeze_disk.c
index ea413976fc..9747b9801a 100644
--- a/src/lib/eeze/eeze_disk.c
+++ b/src/lib/eeze/eeze_disk.c
@@ -175,7 +175,11 @@ eeze_disk_new(const char *path)
175 return NULL; 175 return NULL;
176 176
177 if (!(disk = calloc(1, sizeof(Eeze_Disk)))) 177 if (!(disk = calloc(1, sizeof(Eeze_Disk))))
178 return NULL; 178 {
179 eina_stringshare_del(syspath);
180 udev_device_unref(dev);
181 return NULL;
182 }
179 183
180 if (is_dev) 184 if (is_dev)
181 { 185 {
@@ -185,7 +189,6 @@ eeze_disk_new(const char *path)
185 else 189 else
186 disk->syspath = eina_stringshare_add(udev_device_get_syspath(dev)); 190 disk->syspath = eina_stringshare_add(udev_device_get_syspath(dev));
187 191
188
189 disk->device = dev; 192 disk->device = dev;
190 disk->mount_opts = EEZE_DISK_MOUNTOPT_DEFAULTS; 193 disk->mount_opts = EEZE_DISK_MOUNTOPT_DEFAULTS;
191 disk->mount_cmd_changed = EINA_TRUE; 194 disk->mount_cmd_changed = EINA_TRUE;
diff --git a/src/lib/eeze/eeze_net.c b/src/lib/eeze/eeze_net.c
index bdd7181993..11fcc26d46 100644
--- a/src/lib/eeze/eeze_net.c
+++ b/src/lib/eeze/eeze_net.c
@@ -5,6 +5,7 @@
5#include <arpa/inet.h> 5#include <arpa/inet.h>
6#include <sys/ioctl.h> 6#include <sys/ioctl.h>
7#include <net/if.h> 7#include <net/if.h>
8#include <netinet/in.h>
8#include <unistd.h> 9#include <unistd.h>
9#include <Eeze_Net.h> 10#include <Eeze_Net.h>
10 11
@@ -203,7 +204,7 @@ eeze_net_scan(Eeze_Net *net)
203 eina_stringshare_replace_length(&net->broadip, ip, INET_ADDRSTRLEN); 204 eina_stringshare_replace_length(&net->broadip, ip, INET_ADDRSTRLEN);
204 205
205 if (ioctl(sock, *i++, &ifr) < 0) goto error; 206 if (ioctl(sock, *i++, &ifr) < 0) goto error;
206 sa = (struct sockaddr_in*) & (ifr.ifr_netmask); 207 sa = (struct sockaddr_in*) & (ifr.ifr_addr);
207 inet_ntop(AF_INET, (struct in_addr*)&sa->sin_addr, ip, INET_ADDRSTRLEN); 208 inet_ntop(AF_INET, (struct in_addr*)&sa->sin_addr, ip, INET_ADDRSTRLEN);
208 eina_stringshare_replace_length(&net->netmask, ip, INET_ADDRSTRLEN); 209 eina_stringshare_replace_length(&net->netmask, ip, INET_ADDRSTRLEN);
209 210
@@ -225,7 +226,7 @@ eeze_net_scan(Eeze_Net *net)
225 eina_stringshare_replace_length(&net->broadip6, ip6, INET6_ADDRSTRLEN); 226 eina_stringshare_replace_length(&net->broadip6, ip6, INET6_ADDRSTRLEN);
226 227
227 if (ioctl(sock, *i++, &ifr) < 0) goto error; 228 if (ioctl(sock, *i++, &ifr) < 0) goto error;
228 sa6 = (struct sockaddr_in6*) & (ifr.ifr_netmask); 229 sa6 = (struct sockaddr_in6*) & (ifr.ifr_addr);
229 inet_ntop(AF_INET6, (struct in6_addr*)&sa6->sin6_addr, ip6, INET6_ADDRSTRLEN); 230 inet_ntop(AF_INET6, (struct in6_addr*)&sa6->sin6_addr, ip6, INET6_ADDRSTRLEN);
230 eina_stringshare_replace_length(&net->netmask6, ip6, INET6_ADDRSTRLEN); 231 eina_stringshare_replace_length(&net->netmask6, ip6, INET6_ADDRSTRLEN);
231 232
diff --git a/src/lib/eeze/eeze_udev_walk.c b/src/lib/eeze/eeze_udev_walk.c
index 4cd661b184..5df34178a8 100644
--- a/src/lib/eeze/eeze_udev_walk.c
+++ b/src/lib/eeze/eeze_udev_walk.c
@@ -40,7 +40,7 @@ EAPI const char *
40eeze_udev_walk_get_sysattr(const char *syspath, 40eeze_udev_walk_get_sysattr(const char *syspath,
41 const char *sysattr) 41 const char *sysattr)
42{ 42{
43 _udev_device *device, *child, *parent; 43 _udev_device *device, *parent;
44 const char *test = NULL; 44 const char *test = NULL;
45 45
46 if (!syspath) 46 if (!syspath)
@@ -49,18 +49,12 @@ eeze_udev_walk_get_sysattr(const char *syspath,
49 if (!(device = _new_device(syspath))) 49 if (!(device = _new_device(syspath)))
50 return NULL; 50 return NULL;
51 51
52 for (parent = device; parent;) 52 for (parent = device; parent && !test;)
53 { 53 {
54 if ((test = udev_device_get_sysattr_value(parent, sysattr))) 54 test = udev_device_get_sysattr_value(parent, sysattr);
55 { 55 parent = udev_device_get_parent(parent);
56 test = eina_stringshare_add(test);
57 udev_device_unref(parent);
58 return test;
59 }
60 child = parent;
61 parent = udev_device_get_parent(child);
62 udev_device_unref(child);
63 } 56 }
64 57
65 return NULL; 58 udev_device_unref(device);
59 return eina_stringshare_add(test);
66} 60}
diff --git a/src/lib/efreet/efreet_mime.c b/src/lib/efreet/efreet_mime.c
index d94894ff71..9e3e7cb404 100644
--- a/src/lib/efreet/efreet_mime.c
+++ b/src/lib/efreet/efreet_mime.c
@@ -6,7 +6,6 @@
6#include <sys/stat.h> 6#include <sys/stat.h>
7#include <fcntl.h> 7#include <fcntl.h>
8#include <unistd.h> 8#include <unistd.h>
9#include <fnmatch.h>
10 9
11#include <Ecore.h> 10#include <Ecore.h>
12#include <Ecore_File.h> 11#include <Ecore_File.h>
@@ -1237,7 +1236,7 @@ efreet_mime_glob_match(const char *str, const char *glob)
1237 if (str[0] == 0) return 1; 1236 if (str[0] == 0) return 1;
1238 return 0; 1237 return 0;
1239 } 1238 }
1240 if (!fnmatch(glob, str, 0)) return 1; 1239 if (eina_fnmatch(glob, str, 0)) return 1;
1241 return 0; 1240 return 0;
1242} 1241}
1243 1242
@@ -1263,7 +1262,7 @@ efreet_mime_glob_case_match(char *str, const char *glob)
1263 tglob = alloca(strlen(glob) + 1); 1262 tglob = alloca(strlen(glob) + 1);
1264 for (tp = tglob, p = glob; *p; p++, tp++) *tp = tolower(*p); 1263 for (tp = tglob, p = glob; *p; p++, tp++) *tp = tolower(*p);
1265 *tp = 0; 1264 *tp = 0;
1266 if (!fnmatch(str, tglob, 0)) return 1; 1265 if (eina_fnmatch(str, tglob, 0)) return 1;
1267 return 0; 1266 return 0;
1268} 1267}
1269 1268
diff --git a/src/lib/efreet/efreet_utils.c b/src/lib/efreet/efreet_utils.c
index e1cafaaf89..14fc011cd6 100644
--- a/src/lib/efreet/efreet_utils.c
+++ b/src/lib/efreet/efreet_utils.c
@@ -4,7 +4,6 @@
4 4
5/* TODO: add no_display check, as we might want only displayable items */ 5/* TODO: add no_display check, as we might want only displayable items */
6 6
7#include <fnmatch.h>
8#include <ctype.h> 7#include <ctype.h>
9 8
10#include <Ecore_File.h> 9#include <Ecore_File.h>
@@ -450,7 +449,7 @@ efreet_util_glob_match(const char *str, const char *glob)
450 return 0; 449 return 0;
451 } 450 }
452 if (!strcmp(glob, "*")) return 1; 451 if (!strcmp(glob, "*")) return 1;
453 if (!fnmatch(glob, str, 0)) return 1; 452 if (eina_fnmatch(glob, str, 0)) return 1;
454 return 0; 453 return 0;
455} 454}
456 455
diff --git a/src/lib/eina/Eina.h b/src/lib/eina/Eina.h
index 383696d7d8..da73953362 100644
--- a/src/lib/eina/Eina.h
+++ b/src/lib/eina/Eina.h
@@ -214,6 +214,7 @@ extern "C" {
214#include <eina_types.h> 214#include <eina_types.h>
215#include <eina_alloca.h> 215#include <eina_alloca.h>
216#include <eina_main.h> 216#include <eina_main.h>
217#include <eina_fnmatch.h>
217#include <eina_fp.h> 218#include <eina_fp.h>
218#include <eina_rectangle.h> 219#include <eina_rectangle.h>
219#include <eina_range.h> 220#include <eina_range.h>
@@ -241,7 +242,6 @@ extern "C" {
241#include <eina_benchmark.h> 242#include <eina_benchmark.h>
242#include <eina_convert.h> 243#include <eina_convert.h>
243#include <eina_cpu.h> 244#include <eina_cpu.h>
244#include <eina_sched.h>
245#include <eina_tiler.h> 245#include <eina_tiler.h>
246#include <eina_hamster.h> 246#include <eina_hamster.h>
247#include <eina_matrixsparse.h> 247#include <eina_matrixsparse.h>
diff --git a/src/lib/eina/eina_fnmatch.c b/src/lib/eina/eina_fnmatch.c
new file mode 100644
index 0000000000..697a06edb0
--- /dev/null
+++ b/src/lib/eina/eina_fnmatch.c
@@ -0,0 +1,47 @@
1/* EINA - EFL data type library
2 * Copyright (C) 2012 Rich Felker
3 * Copyright (C) 2021 Vincent Torri
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library;
17 * if not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include <string.h>
21#include <stdlib.h>
22#include <wchar.h>
23#include <wctype.h>
24
25#include "eina_config.h"
26#include "eina_private.h"
27#include "eina_fnmatch.h"
28#include "../../static_libs/fnmatch/fnmatch.h"
29#include "../../static_libs/fnmatch/fnmatch.c"
30
31/*============================================================================*
32 * Local *
33 *============================================================================*/
34
35/*============================================================================*
36 * Global *
37 *============================================================================*/
38
39/*============================================================================*
40 * API *
41 *============================================================================*/
42
43EINA_API Eina_Bool
44eina_fnmatch(const char *glob, const char *string, Eina_Fnmatch_Flags flags)
45{
46 return (__fnmatch(glob, string, flags) == 0);
47}
diff --git a/src/lib/eina/eina_fnmatch.h b/src/lib/eina/eina_fnmatch.h
new file mode 100644
index 0000000000..2cb16ff7f1
--- /dev/null
+++ b/src/lib/eina/eina_fnmatch.h
@@ -0,0 +1,34 @@
1/* EINA - EFL data type library
2 * Copyright (C) 2021 Vincent Torri
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library;
16 * if not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef EINA_FNMATCH_H
20#define EINA_FNMATCH_H
21
22typedef enum
23{
24 EINA_FNMATCH_PATHNAME = (1 << 0),
25 EINA_FNMATCH_NOESCAPE = (1 << 1),
26 EINA_FNMATCH_PERIOD = (1 << 2),
27 EINA_FNMATCH_LEADING_DIR = (1 << 3),
28 EINA_FNMATCH_CASEFOLD = (1 << 4),
29 EINA_FNMATCH_FILE_NAME = EINA_FNMATCH_PATHNAME,
30} Eina_Fnmatch_Flags;
31
32EINA_API Eina_Bool eina_fnmatch(const char *glob, const char *string, Eina_Fnmatch_Flags flags);
33
34#endif
diff --git a/src/lib/eina/eina_log.c b/src/lib/eina/eina_log.c
index bd362fd9a2..4a841a746e 100644
--- a/src/lib/eina/eina_log.c
+++ b/src/lib/eina/eina_log.c
@@ -25,7 +25,6 @@
25#include <string.h> 25#include <string.h>
26#include <stdlib.h> 26#include <stdlib.h>
27#include <unistd.h> 27#include <unistd.h>
28#include <fnmatch.h>
29#include <assert.h> 28#include <assert.h>
30#include <errno.h> 29#include <errno.h>
31 30
@@ -45,6 +44,7 @@
45 44
46#include "eina_config.h" 45#include "eina_config.h"
47#include "eina_private.h" 46#include "eina_private.h"
47#include "eina_fnmatch.h"
48#include "eina_inlist.h" 48#include "eina_inlist.h"
49#include "eina_lock.h" 49#include "eina_lock.h"
50#include "eina_thread.h" 50#include "eina_thread.h"
@@ -1280,7 +1280,7 @@ finish_register:
1280 { 1280 {
1281 EINA_INLIST_FOREACH(_glob_list, pending) 1281 EINA_INLIST_FOREACH(_glob_list, pending)
1282 { 1282 {
1283 if (!fnmatch(pending->name, name, 0)) 1283 if (eina_fnmatch(pending->name, name, 0))
1284 { 1284 {
1285 _log_domains[i].level = pending->level; 1285 _log_domains[i].level = pending->level;
1286 break; 1286 break;
@@ -1996,7 +1996,7 @@ eina_log_domain_level_get(const char *domain_name)
1996 1996
1997 EINA_INLIST_FOREACH(_glob_list, pending) 1997 EINA_INLIST_FOREACH(_glob_list, pending)
1998 { 1998 {
1999 if (!fnmatch(pending->name, domain_name, 0)) 1999 if (eina_fnmatch(pending->name, domain_name, 0))
2000 return pending->level; 2000 return pending->level;
2001 } 2001 }
2002 2002
diff --git a/src/lib/eina/eina_promise.c b/src/lib/eina/eina_promise.c
index 4fe51206e4..873d3cb13d 100644
--- a/src/lib/eina/eina_promise.c
+++ b/src/lib/eina/eina_promise.c
@@ -1148,6 +1148,7 @@ typedef struct _Base_Ctx {
1148 Eina_Promise *promise; 1148 Eina_Promise *promise;
1149 Eina_Future **futures; 1149 Eina_Future **futures;
1150 unsigned int futures_len; 1150 unsigned int futures_len;
1151 Eina_Bool cancelled : 1;
1151} Base_Ctx; 1152} Base_Ctx;
1152 1153
1153typedef struct _All_Promise_Ctx { 1154typedef struct _All_Promise_Ctx {
@@ -1173,6 +1174,7 @@ _base_ctx_clean(Base_Ctx *ctx)
1173static void 1174static void
1174_all_promise_ctx_free(All_Promise_Ctx *ctx) 1175_all_promise_ctx_free(All_Promise_Ctx *ctx)
1175{ 1176{
1177 DBG("Cleaning base_ctx for %p", ctx);
1176 _base_ctx_clean(&ctx->base); 1178 _base_ctx_clean(&ctx->base);
1177 eina_value_flush(&ctx->values); 1179 eina_value_flush(&ctx->values);
1178 free(ctx); 1180 free(ctx);
@@ -1181,12 +1183,16 @@ _all_promise_ctx_free(All_Promise_Ctx *ctx)
1181static void 1183static void
1182_all_promise_cancel(void *data, const Eina_Promise *dead EINA_UNUSED) 1184_all_promise_cancel(void *data, const Eina_Promise *dead EINA_UNUSED)
1183{ 1185{
1184 _all_promise_ctx_free(data); 1186 All_Promise_Ctx *ctx = data;
1187
1188 ctx->base.cancelled = 1;
1189 _all_promise_ctx_free(ctx);
1185} 1190}
1186 1191
1187static void 1192static void
1188_race_promise_ctx_free(Race_Promise_Ctx *ctx) 1193_race_promise_ctx_free(Race_Promise_Ctx *ctx)
1189{ 1194{
1195 DBG("Cleaning base_ctx for %p", ctx);
1190 _base_ctx_clean(&ctx->base); 1196 _base_ctx_clean(&ctx->base);
1191 free(ctx); 1197 free(ctx);
1192} 1198}
@@ -1194,6 +1200,9 @@ _race_promise_ctx_free(Race_Promise_Ctx *ctx)
1194static void 1200static void
1195_race_promise_cancel(void *data, const Eina_Promise *dead EINA_UNUSED) 1201_race_promise_cancel(void *data, const Eina_Promise *dead EINA_UNUSED)
1196{ 1202{
1203 Race_Promise_Ctx *ctx = data;
1204
1205 ctx->base.cancelled = 1;
1197 _race_promise_ctx_free(data); 1206 _race_promise_ctx_free(data);
1198} 1207}
1199 1208
@@ -1233,7 +1242,8 @@ _race_then_cb(void *data, const Eina_Value v,
1233 ctx->dispatching = EINA_TRUE; 1242 ctx->dispatching = EINA_TRUE;
1234 1243
1235 //By freeing the race_ctx all the other futures will be cancelled. 1244 //By freeing the race_ctx all the other futures will be cancelled.
1236 _race_promise_ctx_free(ctx); 1245 if (!ctx->base.cancelled)
1246 _race_promise_ctx_free(ctx);
1237 1247
1238 r = eina_value_struct_setup(&result, &RACE_STRUCT_DESC); 1248 r = eina_value_struct_setup(&result, &RACE_STRUCT_DESC);
1239 EINA_SAFETY_ON_FALSE_GOTO(r, err_setup); 1249 EINA_SAFETY_ON_FALSE_GOTO(r, err_setup);
@@ -1275,7 +1285,8 @@ _all_then_cb(void *data, const Eina_Value v,
1275 //We're in a safe context (from mainloop), so we can avoid scheduling a new dispatch 1285 //We're in a safe context (from mainloop), so we can avoid scheduling a new dispatch
1276 _eina_promise_clean_dispatch(ctx->base.promise, ctx->values); 1286 _eina_promise_clean_dispatch(ctx->base.promise, ctx->values);
1277 ctx->values = EINA_VALUE_EMPTY; /* flushed in _eina_promise_clean_dispatch() */ 1287 ctx->values = EINA_VALUE_EMPTY; /* flushed in _eina_promise_clean_dispatch() */
1278 _all_promise_ctx_free(ctx); 1288 if (!ctx->base.cancelled)
1289 _all_promise_ctx_free(ctx);
1279 } 1290 }
1280 return v; 1291 return v;
1281} 1292}
diff --git a/src/lib/eina/eina_sched.c b/src/lib/eina/eina_sched.c
deleted file mode 100644
index 3864054712..0000000000
--- a/src/lib/eina/eina_sched.c
+++ /dev/null
@@ -1,84 +0,0 @@
1/* EINA - EFL data type library
2 * Copyright (C) 2010 ProFUSION embedded systems
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library;
16 * if not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifdef HAVE_CONFIG_H
20# include "config.h"
21#endif
22
23#include <pthread.h>
24#ifdef __linux__
25# include <sched.h>
26# include <sys/time.h>
27# include <sys/resource.h>
28# include <errno.h>
29#endif
30
31#include "eina_sched.h"
32#include "eina_log.h"
33
34#define RTNICENESS 1
35#define NICENESS 5
36
37EINA_API void
38eina_sched_prio_drop(void)
39{
40 struct sched_param param;
41 int pol, ret;
42 pthread_t pthread_id;
43
44 pthread_id = pthread_self();
45 ret = pthread_getschedparam(pthread_id, &pol, &param);
46 if (ret)
47 {
48 EINA_LOG_ERR("Unable to query sched parameters");
49 return;
50 }
51
52 if (EINA_UNLIKELY(pol == SCHED_RR || pol == SCHED_FIFO))
53 {
54 param.sched_priority -= RTNICENESS;
55
56 /* We don't change the policy */
57 if (param.sched_priority < 1)
58 {
59 EINA_LOG_INFO("RT prio < 1, setting to 1 instead");
60 param.sched_priority = 1;
61 }
62
63 pthread_setschedparam(pthread_id, pol, &param);
64 }
65# ifdef __linux__
66 else
67 {
68 int prio;
69 errno = 0;
70 prio = getpriority(PRIO_PROCESS, 0);
71 if (errno == 0)
72 {
73 prio += NICENESS;
74 if (prio > 19)
75 {
76 EINA_LOG_INFO("Max niceness reached; keeping max (19)");
77 prio = 19;
78 }
79
80 setpriority(PRIO_PROCESS, 0, prio);
81 }
82 }
83# endif
84}
diff --git a/src/lib/eina/eina_sched.h b/src/lib/eina/eina_sched.h
deleted file mode 100644
index 77d90a31e4..0000000000
--- a/src/lib/eina/eina_sched.h
+++ /dev/null
@@ -1,53 +0,0 @@
1/* EINA - EFL data type library
2 * Copyright (C) 2010 ProFUSION embedded systems
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library;
16 * if not, see <http://www.gnu.org/licenses/>.
17 */
18
19/**
20 * @defgroup Schedule Schedule
21 * @ingroup Eina_Tools_Group
22 *
23 * @{
24 *
25 * TODO: description
26 *
27 */
28
29#ifndef EINA_SCHED_H_
30#define EINA_SCHED_H_
31
32#include "eina_types.h"
33
34
35/**
36 * @brief Lowers the priority of the current thread.
37 *
38 * @details It's used by worker threads so that they use up the background CPU and do not stall
39 * the main thread. If the current thread is running with real-time priority, we
40 * decrease our priority by @c RTNICENESS. This is done in a portable way.
41 *
42 * Otherwise, (we are running with the SCHED_OTHER policy) there's no portable way to
43 * set the nice level on the current thread. In Linux, it does work and it's the
44 * only one that is implemented as of now. In this case, the nice level is
45 * incremented on this thread by @c NICENESS.
46 */
47EINA_API void eina_sched_prio_drop(void);
48
49/**
50 * @}
51 */
52
53#endif /* EINA_SCHED_H_ */
diff --git a/src/lib/eina/eina_thread.c b/src/lib/eina/eina_thread.c
index 75623edb0a..abb04a1bf5 100644
--- a/src/lib/eina/eina_thread.c
+++ b/src/lib/eina/eina_thread.c
@@ -20,284 +20,15 @@
20# include "config.h" 20# include "config.h"
21#endif 21#endif
22 22
23#include <stdlib.h> 23#include <stddef.h>
24 24
25#include "eina_config.h" 25#ifdef HAVE_PTHREAD_H
26#include "eina_lock.h" /* it will include pthread.h with proper flags */ 26# include <pthread.h>
27#include "eina_thread.h"
28#include "eina_sched.h"
29#include "eina_cpu.h"
30
31/* undefs EINA_ARG_NONULL() so NULL checks are not compiled out! */
32#include "eina_safety_checks.h"
33
34#include "eina_debug_private.h"
35
36#include <pthread.h>
37#include <errno.h>
38#ifndef _WIN32
39# include <signal.h>
40#endif
41# include <string.h>
42
43#if defined(EINA_HAVE_PTHREAD_AFFINITY) || defined(EINA_HAVE_PTHREAD_SETNAME)
44#ifndef __linux__
45#include <pthread_np.h>
46#define cpu_set_t cpuset_t
47#endif
48#endif
49
50static inline void *
51_eina_thread_join(Eina_Thread t)
52{
53 void *ret = NULL;
54 int err = pthread_join((pthread_t)t, &ret);
55
56 if (err == 0) return ret;
57 return NULL;
58}
59
60static inline Eina_Bool
61_eina_thread_create(Eina_Thread *t, int affinity, void *(*func)(void *data), void *data)
62{
63 int err;
64 pthread_attr_t attr;
65#ifndef _WIN32
66 sigset_t oldset, newset;
67#endif
68
69 if (pthread_attr_init(&attr) != 0)
70 {
71 return EINA_FALSE;
72 }
73 if (affinity >= 0)
74 {
75#ifdef EINA_HAVE_PTHREAD_AFFINITY
76 cpu_set_t cpu;
77
78 CPU_ZERO(&cpu);
79 CPU_SET(affinity, &cpu);
80 pthread_attr_setaffinity_np(&attr, sizeof(cpu), &cpu);
81#endif
82 }
83
84 /* setup initial locks */
85#ifndef _WIN32
86 sigemptyset(&newset);
87 sigaddset(&newset, SIGPIPE);
88 sigaddset(&newset, SIGALRM);
89 sigaddset(&newset, SIGCHLD);
90 sigaddset(&newset, SIGUSR1);
91 sigaddset(&newset, SIGUSR2);
92 sigaddset(&newset, SIGHUP);
93 sigaddset(&newset, SIGQUIT);
94 sigaddset(&newset, SIGINT);
95 sigaddset(&newset, SIGTERM);
96# ifdef SIGPWR
97 sigaddset(&newset, SIGPWR);
98# endif
99 pthread_sigmask(SIG_BLOCK, &newset, &oldset);
100#endif
101 err = pthread_create((pthread_t *)t, &attr, func, data);
102#ifndef _WIN32
103 pthread_sigmask(SIG_SETMASK, &oldset, NULL);
104#endif
105 pthread_attr_destroy(&attr);
106
107 if (err == 0) return EINA_TRUE;
108
109 return EINA_FALSE;
110}
111
112static inline Eina_Bool
113_eina_thread_equal(Eina_Thread t1, Eina_Thread t2)
114{
115 return pthread_equal((pthread_t)t1, (pthread_t)t2);
116}
117
118static inline Eina_Thread
119_eina_thread_self(void)
120{
121 return (Eina_Thread)pthread_self();
122}
123
124
125typedef struct _Eina_Thread_Call Eina_Thread_Call;
126struct _Eina_Thread_Call
127{
128 Eina_Thread_Cb func;
129 const void *data;
130
131 Eina_Thread_Priority prio;
132 int affinity;
133};
134
135static void *
136_eina_internal_call(void *context)
137{
138 Eina_Thread_Call *c = context;
139 void *r;
140 pthread_t self;
141
142 // Default this thread to not cancellable as per Eina documentation
143 eina_thread_cancellable_set(EINA_FALSE, NULL);
144
145 EINA_THREAD_CLEANUP_PUSH(free, c);
146
147 self = pthread_self();
148
149 if (c->prio == EINA_THREAD_IDLE)
150 {
151 struct sched_param params;
152 int min;
153#ifdef SCHED_IDLE
154 int pol = SCHED_IDLE;
155#else
156 int pol;
157 pthread_getschedparam(self, &pol, &params);
158#endif 27#endif
159 min = sched_get_priority_min(pol);
160 params.sched_priority = min;
161 pthread_setschedparam(self, pol, &params);
162 }
163 else if (c->prio == EINA_THREAD_BACKGROUND)
164 {
165 struct sched_param params;
166 int min, max;
167#ifdef SCHED_BATCH
168 int pol = SCHED_BATCH;
169#else
170 int pol;
171 pthread_getschedparam(self, &pol, &params);
172#endif
173 min = sched_get_priority_min(pol);
174 max = sched_get_priority_max(pol);
175 params.sched_priority = (max - min) / 2;
176 pthread_setschedparam(self, pol, &params);
177 }
178// do nothing for normal
179// else if (c->prio == EINA_THREAD_NORMAL)
180// {
181// }
182 else if (c->prio == EINA_THREAD_URGENT)
183 {
184 struct sched_param params;
185 int max, pol;
186
187 pthread_getschedparam(self, &pol, &params);
188 max = sched_get_priority_max(pol);
189 params.sched_priority += 5;
190 if (params.sched_priority > max) params.sched_priority = max;
191 pthread_setschedparam(self, pol, &params);
192 }
193
194 _eina_debug_thread_add(&self);
195 EINA_THREAD_CLEANUP_PUSH(_eina_debug_thread_del, &self);
196 r = c->func((void*) c->data, eina_thread_self());
197 EINA_THREAD_CLEANUP_POP(EINA_TRUE);
198 EINA_THREAD_CLEANUP_POP(EINA_TRUE);
199 28
200 return r; 29#include "eina_types.h"
201} 30#include "eina_config.h"
202 31#include "eina_thread.h"
203EINA_API Eina_Thread
204eina_thread_self(void)
205{
206 return _eina_thread_self();
207}
208
209EINA_API Eina_Bool
210eina_thread_equal(Eina_Thread t1, Eina_Thread t2)
211{
212 return !!_eina_thread_equal(t1, t2);
213}
214
215EINA_API Eina_Bool
216eina_thread_create(Eina_Thread *t,
217 Eina_Thread_Priority prio, int affinity,
218 Eina_Thread_Cb func, const void *data)
219{
220 Eina_Thread_Call *c;
221
222 EINA_SAFETY_ON_NULL_RETURN_VAL(t, EINA_FALSE);
223 EINA_SAFETY_ON_NULL_RETURN_VAL(func, EINA_FALSE);
224
225 c = malloc(sizeof (Eina_Thread_Call));
226 if (!c) return EINA_FALSE;
227
228 c->func = func;
229 c->data = data;
230 c->prio = prio;
231 c->affinity = affinity;
232
233 // valgrind complains c is lost - but it's not - it is handed to the
234 // child thread to be freed when c->func returns in _eina_internal_call().
235 if (_eina_thread_create(t, affinity, _eina_internal_call, c))
236 return EINA_TRUE;
237
238 free(c);
239 return EINA_FALSE;
240}
241
242EINA_API void *
243eina_thread_join(Eina_Thread t)
244{
245 return _eina_thread_join(t);
246}
247
248EINA_API Eina_Bool
249eina_thread_name_set(Eina_Thread t, const char *name)
250{
251#ifdef EINA_HAVE_PTHREAD_SETNAME
252 char buf[16];
253 if (name)
254 {
255 strncpy(buf, name, 15);
256 buf[15] = 0;
257 }
258 else buf[0] = 0;
259#ifndef __linux__
260 pthread_set_name_np((pthread_t)t, buf);
261 return EINA_TRUE;
262#else
263 if (pthread_setname_np((pthread_t)t, buf) == 0) return EINA_TRUE;
264#endif
265#else
266 (void)t;
267 (void)name;
268#endif
269 return EINA_FALSE;
270}
271
272EINA_API Eina_Bool
273eina_thread_cancel(Eina_Thread t)
274{
275 if (!t) return EINA_FALSE;
276 return pthread_cancel((pthread_t)t) == 0;
277}
278
279EINA_API Eina_Bool
280eina_thread_cancellable_set(Eina_Bool cancellable, Eina_Bool *was_cancellable)
281{
282 int state = cancellable ? PTHREAD_CANCEL_ENABLE : PTHREAD_CANCEL_DISABLE;
283 int old = 0;
284 int r;
285
286 /* enforce deferred in case users changed to asynchronous themselves */
287 pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &old);
288
289 r = pthread_setcancelstate(state, &old);
290 if (was_cancellable && r == 0)
291 *was_cancellable = (old == PTHREAD_CANCEL_ENABLE);
292
293 return r == 0;
294}
295
296EINA_API void
297eina_thread_cancel_checkpoint(void)
298{
299 pthread_testcancel();
300}
301 32
302EINA_API void * 33EINA_API void *
303eina_thread_cancellable_run(Eina_Thread_Cancellable_Run_Cb cb, Eina_Free_Cb cleanup_cb, void *data) 34eina_thread_cancellable_run(Eina_Thread_Cancellable_Run_Cb cb, Eina_Free_Cb cleanup_cb, void *data)
@@ -312,17 +43,3 @@ eina_thread_cancellable_run(Eina_Thread_Cancellable_Run_Cb cb, Eina_Free_Cb clea
312 eina_thread_cancellable_set(old, NULL); 43 eina_thread_cancellable_set(old, NULL);
313 return ret; 44 return ret;
314} 45}
315
316EINA_API const void *EINA_THREAD_JOIN_CANCELED = PTHREAD_CANCELED;
317
318Eina_Bool
319eina_thread_init(void)
320{
321 return EINA_TRUE;
322}
323
324Eina_Bool
325eina_thread_shutdown(void)
326{
327 return EINA_TRUE;
328}
diff --git a/src/lib/eina/eina_thread.h b/src/lib/eina/eina_thread.h
index d0ca8138c2..9c0b93bf1f 100644
--- a/src/lib/eina/eina_thread.h
+++ b/src/lib/eina/eina_thread.h
@@ -52,6 +52,12 @@ typedef uintptr_t Eina_Thread;
52typedef void *(*Eina_Thread_Cb)(void *data, Eina_Thread t); 52typedef void *(*Eina_Thread_Cb)(void *data, Eina_Thread t);
53 53
54/** 54/**
55 * @typedef Eina_Thread_Cleanup_Cb
56 * Type for the definition of a thread cleanup function
57 */
58typedef void (*Eina_Thread_Cleanup_Cb) (void *data);
59
60/**
55 * @typedef Eina_Thread_Priority 61 * @typedef Eina_Thread_Priority
56 * Type to enumerate different thread priorities 62 * Type to enumerate different thread priorities
57 */ 63 */
@@ -248,8 +254,16 @@ EINA_API void eina_thread_cancel_checkpoint(void);
248 * 254 *
249 * @since 1.19 255 * @since 1.19
250 */ 256 */
257#ifdef _WIN32
258EINA_API Eina_Bool
259eina_thread_cleanup_push(Eina_Thread_Cleanup_Cb fn, void *data);
260
261#define EINA_THREAD_CLEANUP_PUSH(cleanup, data) \
262 eina_thread_cleanup_push(cleanup, data)
263#else
251#define EINA_THREAD_CLEANUP_PUSH(cleanup, data) \ 264#define EINA_THREAD_CLEANUP_PUSH(cleanup, data) \
252 pthread_cleanup_push(cleanup, data) 265 pthread_cleanup_push(cleanup, data)
266#endif
253 267
254/** 268/**
255 * @def EINA_THREAD_CLEANUP_POP(exec_cleanup) 269 * @def EINA_THREAD_CLEANUP_POP(exec_cleanup)
@@ -278,8 +292,16 @@ EINA_API void eina_thread_cancel_checkpoint(void);
278 * 292 *
279 * @since 1.19 293 * @since 1.19
280 */ 294 */
295#ifdef _WIN32
296EINA_API void
297eina_thread_cleanup_pop(int execute);
298
299#define EINA_THREAD_CLEANUP_POP(exec_cleanup) \
300 eina_thread_cleanup_pop(exec_cleanup)
301#else
281#define EINA_THREAD_CLEANUP_POP(exec_cleanup) \ 302#define EINA_THREAD_CLEANUP_POP(exec_cleanup) \
282 pthread_cleanup_pop(exec_cleanup) 303 pthread_cleanup_pop(exec_cleanup)
304#endif
283 305
284/** 306/**
285 * @typedef Eina_Thread_Cancellable_Run_Cb 307 * @typedef Eina_Thread_Cancellable_Run_Cb
@@ -334,6 +356,20 @@ typedef void *(*Eina_Thread_Cancellable_Run_Cb)(void *data);
334EINA_API void *eina_thread_cancellable_run(Eina_Thread_Cancellable_Run_Cb cb, Eina_Free_Cb cleanup_cb, void *data); 356EINA_API void *eina_thread_cancellable_run(Eina_Thread_Cancellable_Run_Cb cb, Eina_Free_Cb cleanup_cb, void *data);
335 357
336/** 358/**
359 * @brief Lowers the priority of the current thread.
360 *
361 * @details It's used by worker threads so that they use up the background CPU and do not stall
362 * the main thread. If the current thread is running with real-time priority, we
363 * decrease our priority by @c RTNICENESS. This is done in a portable way.
364 *
365 * Otherwise, (we are running with the SCHED_OTHER policy) there's no portable way to
366 * set the nice level on the current thread. In Linux, it does work and it's the
367 * only one that is implemented as of now. In this case, the nice level is
368 * incremented on this thread by @c NICENESS.
369 */
370EINA_API void eina_sched_prio_drop(void);
371
372/**
337 * @} 373 * @}
338 */ 374 */
339 375
diff --git a/src/lib/eina/eina_thread_posix.c b/src/lib/eina/eina_thread_posix.c
new file mode 100644
index 0000000000..da793bd48d
--- /dev/null
+++ b/src/lib/eina/eina_thread_posix.c
@@ -0,0 +1,368 @@
1/* EINA - EFL data type library
2 * Copyright (C) 2012 Cedric Bail
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library;
16 * if not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifdef HAVE_CONFIG_H
20# include "config.h"
21#endif
22
23#include <stdlib.h>
24
25#include "eina_config.h"
26#include "eina_lock.h" /* it will include pthread.h with proper flags */
27#include "eina_thread.h"
28#include "eina_cpu.h"
29
30/* undefs EINA_ARG_NONULL() so NULL checks are not compiled out! */
31#include "eina_safety_checks.h"
32
33#include "eina_debug_private.h"
34
35#include <pthread.h>
36#include <errno.h>
37#ifndef _WIN32
38# include <signal.h>
39#endif
40# include <string.h>
41
42#if defined(EINA_HAVE_PTHREAD_AFFINITY) || defined(EINA_HAVE_PTHREAD_SETNAME)
43#ifndef __linux__
44#include <pthread_np.h>
45#define cpu_set_t cpuset_t
46#endif
47#endif
48
49#ifdef __linux__
50# include <sched.h>
51# include <sys/time.h>
52# include <sys/resource.h>
53#endif
54
55#include "eina_log.h"
56
57#define RTNICENESS 1
58#define NICENESS 5
59
60
61static inline void *
62_eina_thread_join(Eina_Thread t)
63{
64 void *ret = NULL;
65 int err = pthread_join((pthread_t)t, &ret);
66
67 if (err == 0) return ret;
68 return NULL;
69}
70
71static inline Eina_Bool
72_eina_thread_create(Eina_Thread *t, int affinity, void *(*func)(void *data), void *data)
73{
74 int err;
75 pthread_attr_t attr;
76 sigset_t oldset, newset;
77
78 if (pthread_attr_init(&attr) != 0)
79 {
80 return EINA_FALSE;
81 }
82 if (affinity >= 0)
83 {
84#ifdef EINA_HAVE_PTHREAD_AFFINITY
85 cpu_set_t cpu;
86
87 CPU_ZERO(&cpu);
88 CPU_SET(affinity, &cpu);
89 pthread_attr_setaffinity_np(&attr, sizeof(cpu), &cpu);
90#endif
91 }
92
93 /* setup initial locks */
94 sigemptyset(&newset);
95 sigaddset(&newset, SIGPIPE);
96 sigaddset(&newset, SIGALRM);
97 sigaddset(&newset, SIGCHLD);
98 sigaddset(&newset, SIGUSR1);
99 sigaddset(&newset, SIGUSR2);
100 sigaddset(&newset, SIGHUP);
101 sigaddset(&newset, SIGQUIT);
102 sigaddset(&newset, SIGINT);
103 sigaddset(&newset, SIGTERM);
104# ifdef SIGPWR
105 sigaddset(&newset, SIGPWR);
106# endif
107 pthread_sigmask(SIG_BLOCK, &newset, &oldset);
108 err = pthread_create((pthread_t *)t, &attr, func, data);
109 pthread_sigmask(SIG_SETMASK, &oldset, NULL);
110 pthread_attr_destroy(&attr);
111
112 if (err == 0) return EINA_TRUE;
113
114 return EINA_FALSE;
115}
116
117static inline Eina_Bool
118_eina_thread_equal(Eina_Thread t1, Eina_Thread t2)
119{
120 return pthread_equal((pthread_t)t1, (pthread_t)t2);
121}
122
123static inline Eina_Thread
124_eina_thread_self(void)
125{
126 return (Eina_Thread)pthread_self();
127}
128
129
130typedef struct _Eina_Thread_Call Eina_Thread_Call;
131struct _Eina_Thread_Call
132{
133 Eina_Thread_Cb func;
134 const void *data;
135
136 Eina_Thread_Priority prio;
137 int affinity;
138};
139
140static void *
141_eina_internal_call(void *context)
142{
143 Eina_Thread_Call *c = context;
144 void *r;
145 pthread_t self;
146
147 // Default this thread to not cancellable as per Eina documentation
148 eina_thread_cancellable_set(EINA_FALSE, NULL);
149
150 EINA_THREAD_CLEANUP_PUSH(free, c);
151
152 self = pthread_self();
153
154 if (c->prio == EINA_THREAD_IDLE)
155 {
156 struct sched_param params;
157 int min;
158#ifdef SCHED_IDLE
159 int pol = SCHED_IDLE;
160#else
161 int pol;
162 pthread_getschedparam(self, &pol, &params);
163#endif
164 min = sched_get_priority_min(pol);
165 params.sched_priority = min;
166 pthread_setschedparam(self, pol, &params);
167 }
168 else if (c->prio == EINA_THREAD_BACKGROUND)
169 {
170 struct sched_param params;
171 int min, max;
172#ifdef SCHED_BATCH
173 int pol = SCHED_BATCH;
174#else
175 int pol;
176 pthread_getschedparam(self, &pol, &params);