summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHermet Park <chuneon.park@samsung.com>2020-08-03 12:57:27 +0900
committerHermet Park <chuneon.park@samsung.com>2020-08-03 12:57:27 +0900
commit185e44caf23b3f25a7490ac76d22720a950d46fd (patch)
treec701563bc4ed03810967bc40a208fc00cb7250c7
parent283a6021c9d62af51202760e638d995a9f233286 (diff)
parent87bcc82976be023027dea04d1761fad58819846e (diff)
Merge branch 'master' into devs/hermet/lottie
-rw-r--r--meson.build10
-rw-r--r--src/bin/elementary/config.c46
-rw-r--r--src/lib/ecore_ipc/ecore_ipc.c2
-rw-r--r--src/lib/elementary/efl_ui_focus_manager.eo9
-rw-r--r--src/lib/elementary/efl_ui_focus_manager_calc.c20
-rw-r--r--src/lib/elementary/efl_ui_focus_manager_calc.eo1
-rw-r--r--src/lib/elementary/efl_ui_focus_manager_sub.c15
-rw-r--r--src/lib/elementary/efl_ui_image.c9
-rw-r--r--src/lib/elua/elua.c109
-rw-r--r--src/lib/elua/elua_private.h2
-rw-r--r--src/lib/elua/meson.build4
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c4
12 files changed, 178 insertions, 53 deletions
diff --git a/meson.build b/meson.build
index 55c286b822..30214555af 100644
--- a/meson.build
+++ b/meson.build
@@ -285,15 +285,7 @@ if get_option('lua-interpreter') == 'lua'
285 error('Lua not found') 285 error('Lua not found')
286 endif 286 endif
287 if have_elua 287 if have_elua
288 luaver_min = cc.compute_int('LUA_VERSION_NUM - 500', 288 message('Using experimental Elua with interpreter support...')
289 prefix: '#include <lua.h>', dependencies: lua
290 )
291 lua_ffi = dependency('cffi-lua-5.@0@'.format(luaver_min), required: false)
292 if not lua_ffi.found()
293 error('Elua with interpreter is experimental, disable it or install cffi-lua...')
294 else
295 message('Using experimental Elua with interpreter support...')
296 endif
297 endif 289 endif
298else 290else
299 lua = dependency(get_option('lua-interpreter')) 291 lua = dependency(get_option('lua-interpreter'))
diff --git a/src/bin/elementary/config.c b/src/bin/elementary/config.c
index 17d1376f54..ff05307700 100644
--- a/src/bin/elementary/config.c
+++ b/src/bin/elementary/config.c
@@ -942,7 +942,7 @@ transition_duration_change(void *data EINA_UNUSED,
942 void *event_info EINA_UNUSED) 942 void *event_info EINA_UNUSED)
943{ 943{
944 double val = elm_slider_value_get(obj); 944 double val = elm_slider_value_get(obj);
945 Eina_Bool scale = elm_config_transition_duration_factor_get(); 945 double scale = elm_config_transition_duration_factor_get();
946 946
947 if (EINA_DBL_EQ(scale, val)) return; 947 if (EINA_DBL_EQ(scale, val)) return;
948 elm_config_transition_duration_factor_set(val); 948 elm_config_transition_duration_factor_set(val);
@@ -950,6 +950,20 @@ transition_duration_change(void *data EINA_UNUSED,
950} 950}
951 951
952static void 952static void
953tooltip_delay_change(void *data EINA_UNUSED,
954 Evas_Object *obj,
955 void *event_info EINA_UNUSED)
956{
957 double val = elm_slider_value_get(obj);
958 double delay = elm_config_tooltip_delay_get();
959
960 if (EINA_DBL_EQ(delay, val)) return;
961 elm_config_tooltip_delay_set(val);
962 elm_config_all_flush();
963}
964
965
966static void
953_status_basic(Evas_Object *win, 967_status_basic(Evas_Object *win,
954 Evas_Object *bx0) 968 Evas_Object *bx0)
955{ 969{
@@ -1307,7 +1321,7 @@ _config_display_update(Evas_Object *win)
1307 ts_sensitivity_friction, ts_acceleration_threshold, 1321 ts_sensitivity_friction, ts_acceleration_threshold,
1308 ts_acceleration_time_limit, ts_acceleration_weight, page_friction, 1322 ts_acceleration_time_limit, ts_acceleration_weight, page_friction,
1309 bring_in_friction, zoom_friction, transition_duration, 1323 bring_in_friction, zoom_friction, transition_duration,
1310 smooth_amount, smooth_time_window; 1324 smooth_amount, smooth_time_window, tooltip_delay;
1311 const char *curr_theme; 1325 const char *curr_theme;
1312 Eina_Bool s_bounce, ts, smooth_start; 1326 Eina_Bool s_bounce, ts, smooth_start;
1313 Elm_Theme *th; 1327 Elm_Theme *th;
@@ -1319,6 +1333,7 @@ _config_display_update(Evas_Object *win)
1319 font_c = elm_config_cache_font_cache_size_get(); 1333 font_c = elm_config_cache_font_cache_size_get();
1320 image_c = elm_config_cache_image_cache_size_get(); 1334 image_c = elm_config_cache_image_cache_size_get();
1321 transition_duration = elm_config_transition_duration_factor_get(); 1335 transition_duration = elm_config_transition_duration_factor_get();
1336 tooltip_delay = elm_config_tooltip_delay_get();
1322 edje_file_c = elm_config_cache_edje_file_cache_size_get(); 1337 edje_file_c = elm_config_cache_edje_file_cache_size_get();
1323 edje_col_c = elm_config_cache_edje_collection_cache_size_get(); 1338 edje_col_c = elm_config_cache_edje_collection_cache_size_get();
1324 1339
@@ -1423,6 +1438,7 @@ _config_display_update(Evas_Object *win)
1423 elm_object_theme_set(evas_object_data_get(win, "theme_preview"), th); 1438 elm_object_theme_set(evas_object_data_get(win, "theme_preview"), th);
1424 elm_theme_free(th); 1439 elm_theme_free(th);
1425 elm_config_transition_duration_factor_set(transition_duration); 1440 elm_config_transition_duration_factor_set(transition_duration);
1441 elm_config_tooltip_delay_set(tooltip_delay);
1426 eina_stringshare_del(curr_theme); 1442 eina_stringshare_del(curr_theme);
1427} 1443}
1428 1444
@@ -2023,6 +2039,32 @@ _status_config_etc(Evas_Object *win,
2023 CHECK_ADD("Enable ATSPI support", "Set atspi mode", atspi_change, NULL); 2039 CHECK_ADD("Enable ATSPI support", "Set atspi mode", atspi_change, NULL);
2024 elm_check_state_set(ck, elm_config_atspi_mode_get()); 2040 elm_check_state_set(ck, elm_config_atspi_mode_get());
2025 2041
2042 // tooltip delay
2043 fr = elm_frame_add(bx);
2044 elm_object_text_set(fr, "Tooltip delay");
2045 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, 0.0);
2046 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, 0.5);
2047 elm_box_pack_end(bx, fr);
2048 evas_object_show(fr);
2049
2050 bx2 = elm_box_add(fr);
2051 elm_object_content_set(fr, bx2);
2052 evas_object_show(bx2);
2053
2054 sl = elm_slider_add(bx2);
2055 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
2056 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
2057 elm_slider_span_size_set(sl, 120);
2058 elm_slider_unit_format_set(sl, "%1.1f");
2059 elm_slider_indicator_format_set(sl, "%1.1f");
2060 elm_slider_min_max_set(sl, 0, 20.0);
2061 elm_slider_value_set(sl, elm_config_tooltip_delay_get());
2062 elm_box_pack_end(bx2, sl);
2063 evas_object_show(sl);
2064 evas_object_smart_callback_add(sl, "changed", sc_round, NULL);
2065 evas_object_smart_callback_add(sl, "delay,changed", tooltip_delay_change, NULL);
2066
2067
2026 // transition duration in edje 2068 // transition duration in edje
2027 fr = elm_frame_add(bx); 2069 fr = elm_frame_add(bx);
2028 elm_object_text_set(fr, "Edje Transition Duration Factor"); 2070 elm_object_text_set(fr, "Edje Transition Duration Factor");
diff --git a/src/lib/ecore_ipc/ecore_ipc.c b/src/lib/ecore_ipc/ecore_ipc.c
index c21cbcc965..389d905d9e 100644
--- a/src/lib/ecore_ipc/ecore_ipc.c
+++ b/src/lib/ecore_ipc/ecore_ipc.c
@@ -1851,7 +1851,7 @@ ecore_ipc_server_data_process(Ecore_Ipc_Server *svr, void *data, int size, Eina_
1851 offset += (s + msg.size); 1851 offset += (s + msg.size);
1852 if ((svr->buf_size == offset) && (svr->buf)) 1852 if ((svr->buf_size == offset) && (svr->buf))
1853 { 1853 {
1854 if (svr->buf) free(svr->buf); 1854 free(svr->buf);
1855 svr->buf = NULL; 1855 svr->buf = NULL;
1856 svr->buf_size = 0; 1856 svr->buf_size = 0;
1857 return ECORE_CALLBACK_CANCEL; 1857 return ECORE_CALLBACK_CANCEL;
diff --git a/src/lib/elementary/efl_ui_focus_manager.eo b/src/lib/elementary/efl_ui_focus_manager.eo
index dd95256b6d..080edaaf7a 100644
--- a/src/lib/elementary/efl_ui_focus_manager.eo
+++ b/src/lib/elementary/efl_ui_focus_manager.eo
@@ -96,6 +96,15 @@ interface Efl.Ui.Focus.Manager {
96 over the border objects.]] 96 over the border objects.]]
97 } 97 }
98 } 98 }
99 @property border_elements_changed {
100 [[Return $true if the border elements have changed since the last invocation of @.border_elements.get]]
101 get {
102
103 }
104 values {
105 changed : bool; [[$true if there was a change, $false if not]]
106 }
107 }
99 @property viewport_elements { 108 @property viewport_elements {
100 [[Elements that are at the border of the viewport 109 [[Elements that are at the border of the viewport
101 110
diff --git a/src/lib/elementary/efl_ui_focus_manager_calc.c b/src/lib/elementary/efl_ui_focus_manager_calc.c
index 173a663d79..7fb80c38c2 100644
--- a/src/lib/elementary/efl_ui_focus_manager_calc.c
+++ b/src/lib/elementary/efl_ui_focus_manager_calc.c
@@ -85,6 +85,7 @@ typedef struct {
85 int freeze; 85 int freeze;
86 86
87 Node *root; 87 Node *root;
88 Eina_Bool border_elements_changed;
88} Efl_Ui_Focus_Manager_Calc_Data; 89} Efl_Ui_Focus_Manager_Calc_Data;
89 90
90static Eina_Mempool *_node_mempool; 91static Eina_Mempool *_node_mempool;
@@ -247,7 +248,6 @@ node_item_free(Node *item)
247 Eina_List *l; 248 Eina_List *l;
248 Eo *obj = item->manager; 249 Eo *obj = item->manager;
249 FOCUS_DATA(obj); 250 FOCUS_DATA(obj);
250 Eina_Bool dirty_added = EINA_FALSE;
251 251
252 /*cleanup graph parts*/ 252 /*cleanup graph parts*/
253 253
@@ -264,7 +264,7 @@ node_item_free(Node *item)
264 if (partner->type != NODE_TYPE_ONLY_LOGICAL) \ 264 if (partner->type != NODE_TYPE_ONLY_LOGICAL) \
265 { \ 265 { \
266 dirty_add(obj, pd, partner); \ 266 dirty_add(obj, pd, partner); \
267 dirty_added = EINA_TRUE; \ 267 pd->border_elements_changed = EINA_TRUE; \
268 } \ 268 } \
269 } 269 }
270 270
@@ -278,7 +278,7 @@ node_item_free(Node *item)
278 } 278 }
279 279
280 //the unregistering of a item should ever result in atleast a coords_dirty call 280 //the unregistering of a item should ever result in atleast a coords_dirty call
281 if (dirty_added) 281 if (pd->border_elements_changed)
282 efl_event_callback_call(obj, EFL_UI_FOCUS_MANAGER_EVENT_COORDS_DIRTY, NULL); 282 efl_event_callback_call(obj, EFL_UI_FOCUS_MANAGER_EVENT_COORDS_DIRTY, NULL);
283 283
284 /*cleanup manager householdings*/ 284 /*cleanup manager householdings*/
@@ -475,7 +475,9 @@ dirty_add(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd, Node *dirty)
475 pd->dirty = eina_list_append(pd->dirty, dirty); 475 pd->dirty = eina_list_append(pd->dirty, dirty);
476 dirty->on_list = EINA_TRUE; 476 dirty->on_list = EINA_TRUE;
477 477
478 efl_event_callback_call(obj, EFL_UI_FOCUS_MANAGER_EVENT_COORDS_DIRTY, NULL); 478 if (!pd->border_elements_changed)
479 efl_event_callback_call(obj, EFL_UI_FOCUS_MANAGER_EVENT_COORDS_DIRTY, NULL);
480 pd->border_elements_changed = EINA_TRUE;
479} 481}
480 482
481 483
@@ -924,6 +926,7 @@ _efl_ui_focus_manager_calc_efl_object_constructor(Eo *obj, Efl_Ui_Focus_Manager_
924 pd->node_hash = eina_hash_pointer_new(_free_node); 926 pd->node_hash = eina_hash_pointer_new(_free_node);
925 927
926 pd->graph_ctx.offset_focusable = offsetof(Node, focusable); 928 pd->graph_ctx.offset_focusable = offsetof(Node, focusable);
929 pd->border_elements_changed = EINA_TRUE;
927 930
928 return obj; 931 return obj;
929} 932}
@@ -1110,9 +1113,18 @@ _elements_iterator_new(const Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd)
1110EOLIAN static Eina_Iterator* 1113EOLIAN static Eina_Iterator*
1111_efl_ui_focus_manager_calc_efl_ui_focus_manager_border_elements_get(const Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd) 1114_efl_ui_focus_manager_calc_efl_ui_focus_manager_border_elements_get(const Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd)
1112{ 1115{
1116 pd->border_elements_changed = EINA_FALSE;
1113 return (Eina_Iterator*) _elements_iterator_new(obj, pd); 1117 return (Eina_Iterator*) _elements_iterator_new(obj, pd);
1114} 1118}
1115 1119
1120
1121EOLIAN static Eina_Bool
1122_efl_ui_focus_manager_calc_efl_ui_focus_manager_border_elements_changed_get(const Eo *obj EINA_UNUSED, Efl_Ui_Focus_Manager_Calc_Data *pd)
1123{
1124 return pd->border_elements_changed;
1125}
1126
1127
1116EOLIAN static Eina_Iterator* 1128EOLIAN static Eina_Iterator*
1117_efl_ui_focus_manager_calc_efl_ui_focus_manager_viewport_elements_get(const Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd, Eina_Rect viewport) 1129_efl_ui_focus_manager_calc_efl_ui_focus_manager_viewport_elements_get(const Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd, Eina_Rect viewport)
1118{ 1130{
diff --git a/src/lib/elementary/efl_ui_focus_manager_calc.eo b/src/lib/elementary/efl_ui_focus_manager_calc.eo
index ed86b7b05c..d7f9124fe8 100644
--- a/src/lib/elementary/efl_ui_focus_manager_calc.eo
+++ b/src/lib/elementary/efl_ui_focus_manager_calc.eo
@@ -70,6 +70,7 @@ class @beta Efl.Ui.Focus.Manager_Calc extends Efl.Object implements Efl.Ui.Focus
70 Efl.Ui.Focus.Manager.manager_focus {get; set;} 70 Efl.Ui.Focus.Manager.manager_focus {get; set;}
71 Efl.Ui.Focus.Manager.redirect {set; get;} 71 Efl.Ui.Focus.Manager.redirect {set; get;}
72 Efl.Ui.Focus.Manager.border_elements {get;} 72 Efl.Ui.Focus.Manager.border_elements {get;}
73 Efl.Ui.Focus.Manager.border_elements_changed {get;}
73 Efl.Ui.Focus.Manager.viewport_elements {get;} 74 Efl.Ui.Focus.Manager.viewport_elements {get;}
74 Efl.Ui.Focus.Manager.root {set; get;} 75 Efl.Ui.Focus.Manager.root {set; get;}
75 Efl.Ui.Focus.Manager.request_subchild; 76 Efl.Ui.Focus.Manager.request_subchild;
diff --git a/src/lib/elementary/efl_ui_focus_manager_sub.c b/src/lib/elementary/efl_ui_focus_manager_sub.c
index 7a2de74003..2d4a872d74 100644
--- a/src/lib/elementary/efl_ui_focus_manager_sub.c
+++ b/src/lib/elementary/efl_ui_focus_manager_sub.c
@@ -9,7 +9,6 @@
9#define MY_DATA(o, p) Efl_Ui_Focus_Manager_Sub_Data *p = efl_data_scope_get(o, MY_CLASS); 9#define MY_DATA(o, p) Efl_Ui_Focus_Manager_Sub_Data *p = efl_data_scope_get(o, MY_CLASS);
10typedef struct { 10typedef struct {
11 Efl_Ui_Focus_Manager *manager;//the manager where current_border is currently registered 11 Efl_Ui_Focus_Manager *manager;//the manager where current_border is currently registered
12 Eina_Bool self_dirty;
13 Eina_List *current_border; //the current set of widgets which is registered as borders 12 Eina_List *current_border; //the current set of widgets which is registered as borders
14} Efl_Ui_Focus_Manager_Sub_Data; 13} Efl_Ui_Focus_Manager_Sub_Data;
15 14
@@ -94,7 +93,6 @@ _border_flush(Eo *obj, Efl_Ui_Focus_Manager_Sub_Data *pd)
94 93
95 eina_list_free(pd->current_border); 94 eina_list_free(pd->current_border);
96 pd->current_border = selection; 95 pd->current_border = selection;
97 pd->self_dirty = EINA_FALSE;
98} 96}
99 97
100static void 98static void
@@ -116,7 +114,7 @@ _parent_manager_pre_flush(void *data, const Efl_Event *ev EINA_UNUSED)
116{ 114{
117 MY_DATA(data, pd); 115 MY_DATA(data, pd);
118 116
119 if (!pd->self_dirty) return; //we are not interested 117 if (!efl_ui_focus_manager_border_elements_changed_get(data)) return;
120 118
121 _border_flush(data, pd); 119 _border_flush(data, pd);
122} 120}
@@ -152,14 +150,6 @@ EFL_CALLBACKS_ARRAY_DEFINE(parent_manager,
152); 150);
153 151
154static void 152static void
155_self_manager_dirty(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
156{
157 MY_DATA(data, pd);
158
159 pd->self_dirty = EINA_TRUE;
160}
161
162static void
163_logical_manager_change(void *data EINA_UNUSED, const Efl_Event *ev) 153_logical_manager_change(void *data EINA_UNUSED, const Efl_Event *ev)
164{ 154{
165 MY_DATA(data, pd); 155 MY_DATA(data, pd);
@@ -217,7 +207,6 @@ _manager_change(void *data, const Efl_Event *ev EINA_UNUSED)
217} 207}
218 208
219EFL_CALLBACKS_ARRAY_DEFINE(self_manager, 209EFL_CALLBACKS_ARRAY_DEFINE(self_manager,
220 {EFL_UI_FOCUS_MANAGER_EVENT_COORDS_DIRTY, _self_manager_dirty},
221 {EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_PARENT_CHANGED, _logical_manager_change}, 210 {EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_PARENT_CHANGED, _logical_manager_change},
222 {EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_MANAGER_CHANGED, _manager_change} 211 {EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_MANAGER_CHANGED, _manager_change}
223); 212);
@@ -228,8 +217,6 @@ _efl_ui_focus_manager_sub_efl_object_constructor(Eo *obj, Efl_Ui_Focus_Manager_S
228 obj = efl_constructor(efl_super(obj, MY_CLASS)); 217 obj = efl_constructor(efl_super(obj, MY_CLASS));
229 efl_event_callback_array_add(obj, self_manager(), obj); 218 efl_event_callback_array_add(obj, self_manager(), obj);
230 219
231 pd->self_dirty = EINA_TRUE;
232
233 return obj; 220 return obj;
234} 221}
235 222
diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c
index 35c3ac8168..1cabdf32c3 100644
--- a/src/lib/elementary/efl_ui_image.c
+++ b/src/lib/elementary/efl_ui_image.c
@@ -242,12 +242,9 @@ _image_sizing_eval(Eo *obj, Efl_Ui_Image_Data *sd, Evas_Object *img)
242 w = ((double)iw * h) / (double)ih; 242 w = ((double)iw * h) / (double)ih;
243 break; 243 break;
244 case EFL_GFX_IMAGE_SCALE_METHOD_EXPAND: 244 case EFL_GFX_IMAGE_SCALE_METHOD_EXPAND:
245 if ((iw - ow) < (ih - oh)) 245 w = ow;
246 { 246 h = ((double)ih * w) / (double)iw;
247 w = ow; 247 if (h < oh)
248 h = ((double)ih * w) / (double)iw;
249 }
250 else
251 { 248 {
252 h = oh; 249 h = oh;
253 w = ((double)iw * h) / (double)ih; 250 w = ((double)iw * h) / (double)ih;
diff --git a/src/lib/elua/elua.c b/src/lib/elua/elua.c
index b691ff524d..6fa856372e 100644
--- a/src/lib/elua/elua.c
+++ b/src/lib/elua/elua.c
@@ -2,10 +2,6 @@
2#include <Ecore_File.h> 2#include <Ecore_File.h>
3#include "elua_private.h" 3#include "elua_private.h"
4 4
5#ifdef ENABLE_LUA_OLD
6# include <cffi-lua.h>
7#endif
8
9static Eina_Prefix *_elua_pfx = NULL; 5static Eina_Prefix *_elua_pfx = NULL;
10 6
11static int _elua_init_counter = 0; 7static int _elua_init_counter = 0;
@@ -70,6 +66,65 @@ elua_shutdown(void)
70 return _elua_init_counter; 66 return _elua_init_counter;
71} 67}
72 68
69#ifdef ENABLE_LUA_OLD
70static int
71_ffi_loader(lua_State *L)
72{
73 lua_pushvalue(L, lua_upvalueindex(1));
74 lua_pushliteral(L, "cffi");
75 lua_pushvalue(L, lua_upvalueindex(2));
76 lua_call(L, 2, 1);
77 return 1;
78}
79
80#if LUA_VERSION_NUM < 502
81/* adapted from lua 5.2 source */
82static const char *
83_push_next_template(lua_State *L, const char *path)
84{
85 while (*path == *LUA_PATHSEP) ++path;
86 if (!*path)
87 return NULL;
88 const char *l = strchr(path, *LUA_PATHSEP);
89 if (!l)
90 l = path + strlen(path);
91 lua_pushlstring(L, path, l - path);
92 return l;
93}
94
95static int
96_elua_searchpath(lua_State *L)
97{
98 const char *name = luaL_checkstring(L, 1);
99 const char *path = luaL_checkstring(L, 2);
100 const char *sep = luaL_optstring(L, 3, ".");
101 const char *dsep = luaL_optstring(L, 4, LUA_DIRSEP);
102 luaL_Buffer msg;
103 luaL_buffinit(L, &msg);
104 if (*sep)
105 name = luaL_gsub(L, name, sep, dsep);
106 while ((path = _push_next_template(L, path)))
107 {
108 const char *fname = luaL_gsub(L, lua_tostring(L, -1), LUA_PATH_MARK, name);
109 lua_remove(L, -2);
110 FILE *rf = fopen(fname, "r");
111 if (rf)
112 {
113 fclose(rf);
114 return 1; /* found */
115 }
116 lua_pushfstring(L, "\n\tno file " LUA_QS, fname);
117 lua_remove(L, -2);
118 luaL_addvalue(&msg);
119 }
120 luaL_pushresult(&msg);
121 lua_pushnil(L);
122 lua_insert(L, -2);
123 return 2; /* nil plus error message */
124}
125#endif
126#endif
127
73EAPI Elua_State * 128EAPI Elua_State *
74elua_state_new(const char *progname) 129elua_state_new(const char *progname)
75{ 130{
@@ -82,12 +137,45 @@ elua_state_new(const char *progname)
82 if (progname) ret->progname = eina_stringshare_add(progname); 137 if (progname) ret->progname = eina_stringshare_add(progname);
83 luaL_openlibs(L); 138 luaL_openlibs(L);
84#ifdef ENABLE_LUA_OLD 139#ifdef ENABLE_LUA_OLD
85 /* make sure to inject cffi-lua to preload so that the system gets it */ 140 /* search for cffi-lua early, and pass it through as ffi */
86 lua_getglobal(L, "package"); 141 lua_getglobal(L, "package");
142#if LUA_VERSION_NUM < 502
143 /* lua 5.1 does not have package.searchpath, we rely on having that */
144 lua_getfield(L, -1, "searchpath");
145 if (lua_isnil(L, -1))
146 {
147 lua_pushcfunction(L, _elua_searchpath);
148 lua_setfield(L, -3, "searchpath");
149 }
150 lua_pop(L, 1);
151#endif
87 lua_getfield(L, -1, "preload"); 152 lua_getfield(L, -1, "preload");
88 lua_pushcfunction(L, luaopen_cffi); 153 lua_getfield(L, -2, "searchers");
89 lua_setfield(L, -2, "ffi"); 154 if (lua_isnil(L, -1))
90 lua_pop(L, 2); 155 {
156 lua_pop(L, 1);
157 lua_getfield(L, -2, "loaders");
158 }
159 if (lua_isnil(L, -1))
160 {
161 ERR("could not find a module searcher");
162 goto err;
163 }
164 lua_rawgeti(L, -1, 3);
165 lua_pushliteral(L, "cffi");
166 if (lua_pcall(L, 1, 2, 0))
167 {
168 ERR("could not find the cffi module");
169 goto err;
170 }
171 if (!lua_isfunction(L, -2))
172 {
173 ERR("could not find the cffi module: %s", lua_tostring(L, -2));
174 goto err;
175 }
176 lua_pushcclosure(L, _ffi_loader, 2);
177 lua_setfield(L, -3, "ffi");
178 lua_pop(L, 3);
91#endif 179#endif
92 /* on 64-bit, split the state pointer into two and reconstruct later */ 180 /* on 64-bit, split the state pointer into two and reconstruct later */
93 size_t retn = (size_t)ret; 181 size_t retn = (size_t)ret;
@@ -105,6 +193,11 @@ elua_state_new(const char *progname)
105 lua_setfield(L, LUA_REGISTRYINDEX, "elua_ptr1"); 193 lua_setfield(L, LUA_REGISTRYINDEX, "elua_ptr1");
106 lua_setfield(L, LUA_REGISTRYINDEX, "elua_ptr2"); 194 lua_setfield(L, LUA_REGISTRYINDEX, "elua_ptr2");
107 return ret; 195 return ret;
196err:
197 lua_close(L);
198 eina_stringshare_del(ret->progname);
199 free(ret);
200 return NULL;
108} 201}
109 202
110EAPI void 203EAPI void
diff --git a/src/lib/elua/elua_private.h b/src/lib/elua/elua_private.h
index 445bacc93d..72d43c3b33 100644
--- a/src/lib/elua/elua_private.h
+++ b/src/lib/elua/elua_private.h
@@ -52,7 +52,7 @@ Eina_Bool _elua_state_io_setup(const Elua_State *es);
52 52
53#if LUA_VERSION_NUM < 502 53#if LUA_VERSION_NUM < 502
54 54
55#define elua_register(L, lib) luaL_register(L, NULL, 0) 55#define elua_register(L, lib) luaL_register(L, NULL, lib)
56#define elua_strlen(L, i) lua_strlen(L, i) 56#define elua_strlen(L, i) lua_strlen(L, i)
57 57
58#else 58#else
diff --git a/src/lib/elua/meson.build b/src/lib/elua/meson.build
index 66bd9454b9..227d211584 100644
--- a/src/lib/elua/meson.build
+++ b/src/lib/elua/meson.build
@@ -1,10 +1,6 @@
1elua_deps = [eina, eo, efl, ecore, ecore_file, intl] 1elua_deps = [eina, eo, efl, ecore, ecore_file, intl]
2elua_pub_deps = [lua] 2elua_pub_deps = [lua]
3 3
4if get_option('lua-interpreter') == 'lua'
5 elua_deps += lua_ffi
6endif
7
8elua_src = ['elua.c', 'io.c', 'cache.c'] 4elua_src = ['elua.c', 'io.c', 'cache.c']
9elua_header_src = ['Elua.h'] 5elua_header_src = ['Elua.h']
10 6
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index b8541b3949..4c6fc865d8 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -7668,10 +7668,6 @@ _layout_setup(Ctxt *c, const Eo *eo_obj, Evas_Coord w, Evas_Coord h)
7668 { 7668 {
7669 c->fmt = _layout_format_push(c, o->main_fmt, NULL); 7669 c->fmt = _layout_format_push(c, o->main_fmt, NULL);
7670 } 7670 }
7671 if (!c->fmt)
7672 {
7673 return EINA_FALSE;
7674 }
7675 7671
7676 c->paragraphs = o->paragraphs; 7672 c->paragraphs = o->paragraphs;
7677 7673