Commit Graph

66179 Commits

Author SHA1 Message Date
Marcel Hollerbach 9852b2b714 Revert "eo: make callback_add faster"
This reverts commit d34a0321cb.
2020-08-05 11:53:19 +02:00
Marcel Hollerbach 5dbc62a98b eo: event callback call optimization
a little overfiew to how eos event emission is working:
- In eo there are 2 types of events restart events and normal events.
  Normals are *always* emitted from callback_max to 0
  Restarts are emitted from the previous emissions current idx to 0. The
  previous emission will stop then
- To keep track of the previous event emissions for restarts there was
  an eina inlist.
- To keep track of other things in eo, there was an additional eo event
  stack frame (newly inserted events etc. etc.)

This commit now uses this event stack frame for implementing the details
about the restart events. This has the advatage that every
efl_object_data contains one byte less, and the up to date keeping of
the id's in the restart infrastructure is not needed anymore, making the
whole event emission code less instructions and faster.

How this now works:
- Every emission has a event emission frame, when the emission starts,
  the frame is added, next points to the next older event emission. In
  this event stack frame we are storing the current idx, the description
  and a few other things that are not really relevant at this point.
- when a restart event is started, this event stack is searched from the
  current frame up to the next one featuring the same event description.
  The event frame stack is then remembered, if the event emission is
  done, the current idx (normally 0 or something higher when callback
  was stopped) is then copyied back to the earlier frame.
- Based on the nature of the event frame stacks, the idx is updated
  every iteration. And for the restart events, we only need to know the
  next, which removes the need of permanently updating the idx in the
  current stack.
- The event frame stack is not allocated on the heap, hence more things
  in there does not matter at all.

Differential Revision: https://phab.enlightenment.org/D12097
2020-08-05 11:05:17 +02:00
Marcel Hollerbach 0cb7708c68 eo: evalulate special counts earlier
we have these special counts which are > 0 when there is a callback
subscribed. THey are currently evalulated in _callback_call. However,
we can also skip the entire call from inside eo_base_class as we are
having the fields there as well.

This way we are skipping the obj pointer lookup and vtable lookup.

Differential Revision: https://phab.enlightenment.org/D12079
2020-08-05 11:05:05 +02:00
Marcel Hollerbach d34a0321cb eo: make callback_add faster
I was researching for quite some time how eo events could be made
faster, while doing that i recognized that we are not utilizing the full
size of Efl_Object_Data, so we can do a little bit more hinting for how
our events are currently working.

In this commit a flag called single priority is inserted. This flag
ensures that the object only has one callback priority registered, which
gives us the possibility of skipping the binary search, the search
itself is not that bad, however, alone the loading of the instructions
takes time, so this way we can skip the search, *and* the instructions
for moving the array elements to later.

Differential Revision: https://phab.enlightenment.org/D12078
2020-08-05 11:04:51 +02:00
Wonki Kim e4651d8fe5 efl_canvas: fix a potentional error of null deref
this is a patch to fix a potentional error by null dereferencing.

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D12093
2020-08-05 10:47:15 +02:00
Wonki Kim efdd1b166e elm_access: fix a potentional error of null deref
Summary: this is a patch to fix a potentional error by null dereferencing.

Reviewers: jsuya, kimcinoo, bu5hm4n

Reviewed By: jsuya

Subscribers: kimcinoo, bu5hm4n, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12092
2020-08-05 17:03:02 +09:00
Wonki Kim 8265c6a98f evas/engine: fix a potentional error of null deref
Summary: this is a patch to fix a potentional error by null dereferencing.

Reviewers: jsuya, bu5hm4n, Hermet

Reviewed By: jsuya, bu5hm4n

Subscribers: bu5hm4n, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12091
2020-08-05 17:02:13 +09:00
Wonki Kim 19b603166a edje: fix a potentional error of null deref
Summary: this is a patch to fix a potentional error by null dereferencing.

Reviewers: jsuya, bu5hm4n, Hermet

Reviewed By: jsuya

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12086
2020-08-05 15:18:34 +09:00
Wonki Kim 7dcd14347d edje_edit: fix a potentional error of null deref
Summary: this is a patch to fix a potentional error by null dereferencing.

Reviewers: jsuya, bu5hm4n, cedric, Hermet

Reviewed By: jsuya

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12090
2020-08-05 15:14:25 +09:00
Bowon Ryu 39e9740fca edje_edit: add null check for return of eina_hash_find
Summary: to prevent null pointer dereference

Test Plan: N/A

Reviewers: cedric, jsuya

Reviewed By: jsuya

Subscribers: #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12094
2020-08-05 15:09:05 +09:00
Shinwoo Kim bab3f870b8 embryo_cc: ++safty code
Summary:
This patch is increasing safty code by handling following case.

sc_compile > OH!! there is uninitialized loacal variable "outfname"!! >
setopt > about > longjmp > setjmp returns 3 > goto cleanup >

then uninitialized data is read from local variable "outfname".

Reviewers: raster, Hermet, jsuya, herb

Reviewed By: jsuya

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12074
2020-08-05 14:53:35 +09:00
junsu choi 26b50c91f8 evas_filter: Add null check for instruction
Summary:
Add a null check for cases where the param passed
from the filter instruction can be a null pointer.

Test Plan: N/A

Reviewers: kimcinoo, Hermet

Subscribers: #reviewers, #committers, cedric

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12084
2020-08-05 14:45:22 +09:00
Ali Alzyod f126c7f06c efl_ui_textbox: preserve changing user color set
Summary:
setting color inside the constructor call will be override in theme apply because it happen later.
txt = efl_add(EFL_UI_TEXTBOX_CLASS, win,
               efl_text_color_set(efl_added, 0, 255, 0, 255));

Now we will preserve user choice, to not change it during theme apply.

Test Plan: ninja test

Reviewers: woohyun, bu5hm4n, zmike, segfaultxavi

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11942
2020-08-05 13:33:03 +09:00
Ali Alzyod ed18471ba9 evas_textblock: enhance cursor event submitting during markup_set/text_set
Summary:
Enhance text cursor events submitting:
1- Submit events only for changed cursors.
2- Reduce code complexity for cursor change.
3- Add test case for cursor event change

Reviewers: woohyun, zmike, bu5hm4n

Reviewed By: woohyun

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11775
2020-08-05 13:09:00 +09:00
Ali Alzyod 45c6212d20 elm_entry/efl.ui.textbox: use common key shortcuts
Summary:
**key** value comes from keyboard down callbacks are common, regardless of language/layout but **keyname** is dependent on layout(in X11, in Wayland Can not be produced).
This common fix for both.

For example if keyboard layout in arabic then:
Ctrl+A  will not work (in X11)

This one enhances D11606

Reviewers: woohyun, bu5hm4n, zmike

Reviewed By: woohyun

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11695
2020-08-05 11:32:11 +09:00
Ali Alzyod 86c274ea33 evas_textblock: enhance escape character handling
Summary:
-Lazy initialization for html escapes lists
-Lower memory consumtion for escapes lists
-Simplify code maintenance by sorting lists on runtime, new items donot need to respect sort order(run time will handle it)

Reviewers: woohyun, bowonryu, cedric, tasn

Reviewed By: woohyun

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9370
2020-08-05 11:27:04 +09:00
Ali Alzyod 5d3497e506 efl.ui.textbox: Keyboard Enter will add paragraph separator
Summary:
efl.ui.textbox: Keyboard Enter will add paragraph separator and \n

because of D9064 Textbox multiline can work with paragraph separator

Reviewers: woohyun, segfaultxavi, bu5hm4n, zmike

Reviewed By: woohyun

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11201
2020-08-05 11:22:14 +09:00
junsu choi 2d7667aa44 efl_ui_timepicker: Add null check for efl_text_get
Prevent null access of the string passed from efl_text_get.

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D12085
2020-08-04 14:52:35 +02:00
Wonki Kim f953909f59 evas: fix a potentional error of null deref
this is a patch to fix a potentional error by null dereferencing.

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D12089
2020-08-04 14:52:28 +02:00
Carsten Haitzler ee9836c5e7 elput - support libelogind.so.0 as well as libelogind-shared.so.0
for gentoo...
@fix
2020-08-04 09:41:39 +01:00
Jaehyun Cho cc0328d9e5 edje_embryo: fix memory leak in ALLOC_COPY_DESC
Summary:
If memory allocation fails in ALLOC_COPY_DESC, then the allocated memory
is not free.
To fix this memory leak, memory allocation of Edje_Real_Part_State is
done prior to ALLOC_COPY_DESC.

Reviewers: Hermet

Reviewed By: Hermet

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12082
2020-08-04 15:11:36 +09:00
Youngbok Shin 5af8301bad embryo: fix a integer(cell) overflow problem
Summary:
The most of functions for embryo based on cell(int) types.
addvariable(), defsymbol(), modstk() and etc.
Because of this, if embryo script has a really big(INT_MAX / 4) stack variable,
integer overflow problem has been happened.
@fix

Test Plan:
Put a script in your EDC like the following code.
Build it and try to access the variable.
Or check the writen HEX value by embryo_cc.

script {
   // It's size is 1,000,000,000.
   // Remember, INT_MAX is 2,147,483,647.
   new my_big_variable[1000000000];
   ...
}

Reviewers: cedric, woohyun, raster, eunue, SanghyeonLee

Reviewed By: eunue, SanghyeonLee

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12081
2020-08-04 14:48:02 +09:00
SangHyeon Jade Lee 279cc45132 elm : fix return of gengrid item swap anim to prevent animation memory leak.
Summary:
this is memory leak fix on gengrid item move.
when animation reached 1.0, it finish all animation and returns EINA_FALSE to delete current animation.

Test Plan: N/A

Reviewers: eagleeye

Reviewed By: eagleeye

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12083
2020-08-04 14:30:18 +09:00
Jaehyun Cho 9dde786ffe edje_embryo: fix null pointer dereference in ALLOC_COPY_DESC
To fix null pointer dereference in ALLOC_COPY_DESC, allocated variable
"new" is checked.
2020-08-03 20:32:33 +09:00
Jaehyun Cho 6f981794ad edje_embryo: fix to use parameter of macro ALLOC_COPY_DESC
The parameter "To" of macro ALLOC_COPY_DESC is not used.
To use the parameter "To", "d" is replaced to "To".
2020-08-03 19:43:02 +09:00
Jaehyun Cho 52df41b217 evas_gl_core: fix memory leak of EVGL_Resource
If eng_data is NULL and rsc is not NULL in _internal_resources_destroy,
then the allocated EVGL_Resource rsc is not free.

To resolve this memory leak, eng_data and rsc are checked separately.
2020-08-03 18:43:36 +09:00
Carsten Haitzler 87bcc82976 efl ui image - fix scal to fill - broken with non-rect src images
@fix
2020-08-02 16:26:09 +01:00
Daniel Kolesa 5ed0161564 elua: add searchpath impl for 5.1 compat 2020-07-31 19:01:59 +02:00
Daniel Kolesa 794ca20078 elua: fix elua_register with 5.1 2020-07-31 19:01:59 +02:00
Daniel Kolesa 86ee71ce4d elua: do not link to cffi, load the module instead 2020-07-31 19:01:53 +02:00
Boris Faure db14b82549 elm_config: add slider to configure tooltip_delay
reviewers_: #reviewers, raster, cedric, netstar, bu5hm4n

Reviewed By: bu5hm4n

Subscribers: bu5hm4n, cedric, #reviewers, #committers

Tags: #efl

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D12060
2020-07-31 13:24:43 +02:00
Yeongjong Lee 42d525e15b evas_textblock: remove logically dead code
Since `c->fmt` is allocated and dereferenced in `_layoutformat_push`, if
`c->fmt` is NULL, this causes a crash before checking for NULL.

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D12076
2020-07-31 10:17:47 +02:00
Marcel Hollerbach 8d034f08e8 efl_ui_focus_manager: reduce the amount of relying on events
with this commit we are not replying on event invocations anymore, but
rather on direct flag observation in the focus manager itself.

This reduces the amount of events that are emitted as a consequence to
elements beeing marked dirty segnificantly.

startup time of elementary_test goes from 0.50 to 0.46s.

Differential Revision: https://phab.enlightenment.org/D12072
2020-07-31 10:17:42 +02:00
Yeongjong Lee 4e24854f46 ecore_ipc: remove duplicated condition
The same condition is used above.

Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org>
Differential Revision: https://phab.enlightenment.org/D12077
2020-07-31 10:14:00 +02:00
Carsten Haitzler ebdbbb593a eina vpath - fix windows ~username handling to only error when used
we would always rrturn 0 on windows ... missing  {} in block. fix that.

@fix
2020-07-30 11:13:37 +01:00
AbdullehGhujeh ea6a6afef5 evas_textblock : return correct value for gfx_filter_get
return the same variable set with gfx_filter_set.
added test for it.

Reviewed-by: Ali Alzyod <ali198724@gmail.com>
Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org>
Differential Revision: https://phab.enlightenment.org/D12071
2020-07-29 09:50:59 +02:00
AbdullehGhujeh a1826580dc evas_textblock : Remove unneeded code
Duplicated code removed

Reviewed-by: Ali Alzyod <ali198724@gmail.com>
Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org>
Differential Revision: https://phab.enlightenment.org/D12070
2020-07-29 09:50:55 +02:00
Lucas f09080fad5 evil: Remove unnecessary delay for evil startup
Apparently there were two loops intended for an older (and dropped
off) implementation of `gettimeofday`. This patch simplifies the code removing
these loops and significantly lowering evil startup.

Without this patch `ecore-suite`, `efl-app` and `evas-suite` gets timeout in
Windows:
```
25/29 ecore-suite               TIMEOUT        30.12s
26/29 efl-app                   TIMEOUT        30.14s
...
29/29 evas-suite                TIMEOUT        60.07s
```

Reviewed-by: Vincent Torri <vincent.torri@gmail.com>
Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org>
Differential Revision: https://phab.enlightenment.org/D12064
2020-07-29 09:50:52 +02:00
Marcel Hollerbach a25bc7e769 tests: fix eio tests
there are tests that init & shutdown efl_object in the same test, which
is since to switch to const _CLASS_GET dangerously wrong.

I checked for more cases but only found cases where no _CLASS_GET
macros where used.

Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org>
Differential Revision: https://phab.enlightenment.org/D12069
2020-07-28 10:05:54 +02:00
Carsten Haitzler 6e4a3ba9f9 evas - render - dont crash is private data is null
@fix
2020-07-27 22:46:05 +01:00
Ali Alzyod 239cc32dbf evas: remove unused define
Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org>
Differential Revision: https://phab.enlightenment.org/D12066
2020-07-27 16:30:02 +02:00
Ali Alzyod 7a1d6375ea elementry_test: fix allocation size
This fix Coverty Issue CID: 1430579

Reviewed-by: Vincent Torri <vincent.torri@gmail.com>
Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org>
Differential Revision: https://phab.enlightenment.org/D12065
2020-07-27 14:37:31 +02:00
Marcel Hollerbach f9653f015b ci: do not build tests on ci
we need to do the same on any platform that upgrades check from 0.15.0 to
0.15.1. For now this is only with macos

Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org>
Differential Revision: https://phab.enlightenment.org/D12068
2020-07-27 14:24:54 +02:00
Marcel Hollerbach b7a61632d0 build: warn of faulty check version
Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org>
Differential Revision: https://phab.enlightenment.org/D12067
2020-07-27 14:24:51 +02:00
Hermet Park fb33fcb370 canvas engine: ++safety code
added null checking, no logical changes.
2020-07-27 14:29:03 +09:00
Carsten Haitzler 29a72e9c6c efreetd - add more logging for what efreetd says to clients 2020-07-24 23:22:47 +01:00
Carsten Haitzler b01b219017 efreetd - log the cache runs and when they launch, show data, exit 2020-07-24 23:02:16 +01:00
Carsten Haitzler 52ec7be013 efreetd - dont confuse log file file handle and log math func
better not to use the same symbol...
2020-07-24 21:22:33 +01:00
Ali Alzyod 54850ccd2f evas: font glyphs texture garbage collector
Summary:
Introduce two public APIS
```
#define EVAS_FONT_DATA_CACHE_TEXTURE 0x01

/**
 * Set the limit in bytes for memory allocated by font glyphs in evas.
 * @param[in] bytes cache size in bytes, pass negative value to ignore the limit.
 * @param[in] options for caching, pass 0x1 to set the texture cache (in case of accelerated rendering).
 *
 * @since 1.24
 */
EAPI void                    evas_font_data_cache_set(signed long long int byte, int options);

/**
 * @}
 */

/**
 * Get the limit in bytes for memory allocated by font glyphs in evas.
 * @param[in] options for caching, pass 0x1 to get the texture cache (in case of accelerated rendering).
 * @return Returns font allocated memory cache limit, if value is negative this means no limit.
 * @since 1.24
 */
EAPI signed long long int    evas_font_data_cache_get(int options);
```

Test Plan:
elementary_test => Text Memory
You need a tool to observe Video memory allocation.
1- If you have detected Graphics card then use **radiontop** or  **nvidia-smi** ).
2- If you have Integrated Graphics card, then you can detect memory allocation on RAM use.

----------------------------------------------

this example allows only 50 MByte Video memory texture allocated by font glyphs
```
#include <Elementary.h>

typedef struct _APP
{
  Evas_Object *tb1;
  Evas_Object *btnLoad;
} APP;

char *text = "<align=center><color=#4DE0FFFF underline=on underline_color=#4DE0FFFF><a href='tel:1234567890'>1234567890</a></color>😀😁😂🤣😃😄😅😆😉😊😋😎😍😘😗😙😚🙂🤗🤔😐😑😶🙄😏😣😥😮🤐😯😪😫😴😌🤓😛😜😝🤤😒😓😔😕🙃🤑😲🙁😖😞😟😤😢😭😦😧😨😩😬😰😱😳😵😡😠😇🤠🤡🤥😷🤒🤕🤢🤧😈👿👹👺💀👻👽👾🤖💩😺😸😹😻😼😽🙀😿😾🙈🙉🙊👦👧👨👩👵👶👼👨‍⚕️👩‍⚕️👨‍🎓👩‍🎓👨‍🏫👩‍🏫👨‍⚖👩‍⚖👨‍🌾👩‍🌾👨‍🍳👩‍🍳👨‍🔧👩‍🔧👨‍🏭👩‍🏭👨‍💼👩‍💼👨‍🔬👩‍🔬👨‍💻👩‍💻👨‍🎤👩‍🎤👨‍🎨👩‍🎨👨‍✈️👩‍✈️👨‍🚀👩‍🚀👨‍🚒👩‍🚒👮‍♂️👮‍♀️🕵️‍♂️🕵️‍♀️💂‍♂️💂‍♀️👷‍♂️👷‍♀️👳‍♂️👳‍♀️👱‍♂️👱‍♀️🎅🤶👸🤴👰🤵🤰👲🙍‍♂️🙍‍♀️🙎‍♂️🙎‍♀️🙅‍♂️🙅‍♀️🙆‍♂️🙆‍♀️💁‍♂️💁‍♀️🙋‍♂️🙋‍♀️🙇‍♂️🙇‍♀️🤦‍♂️🤦‍♀️🤷‍♂️🤷‍♀️💆‍♂️💆‍♀️💇‍♂️💇‍♀️🚶‍♂️🚶‍♀️🏃‍♂️🏃‍♀️💃🕺👯‍♂️👯‍♀️🕴🗣👤👥👫👬👭💏💑👪👨‍👩‍👧👨‍👩‍👧‍👦👨‍👩‍👦‍👦👨‍👩‍👧‍👧👨‍👦👨‍👦‍👦👨‍👧👨‍👧‍👦👨‍👧‍👧👩‍👦👩‍👦‍👦👩‍👧👩‍👧‍👦👩‍👧‍👧💪🤳👈👉☝️👆🖕👇🤞🖖🤘👊🖐👌👍👎👊🤛🤜🤚👋👏👐🙌🙏🤝💅👂👃👣👀👁👅👄💋💘💓💔💕💖💗💙💚💛💜🖤💝💞💟💌💤💢💣💥💦💨💫💬🗨🗯💭🕳👓🕶👔👕👖👗👘👙👚👛👜👝🛍🎒👞👟👠👡👢👑👒🎩🎓📿💄💍💎🐵🐒🦍🐶🐕🐩🐺🦊🐱🐈🦁🐯🐅🐆🐴🐎🦌🦄🐮🐂🐃🐄🐷🐖🐗🐽🐏🐑🐐🐪🐫🐘🦏🐭🐁🐀🐹🐰🐇🐿🦇🐻🐨🐼🐾🦃🐔🐓🐣🐤🐥🐦🐧🕊🦅🦆🦉🐸🐊🐢🦎🐍🐲🐉🐳🐋🐬🐟🐠🐡🦈🐙🐚🦀🦐🦑🦋🐌🐛🐜🐝🐞🕷🕸🦂💐🌸💮🏵🌹🥀🌺🌻🌼🌷🌱🌲🌳🌴🌵🌾🌿🍀🍁🍂🍃🍇🍈🍉🍊🍋🍌🍍🍎🍏🍐🍑🍒🍓🍅🥝🥑🍆🥔🥕🌽🌶🥒🍄🥜🌰🍞🥐🥖🥞🧀🍖🍗🥓🍔🍟🍕🌭🌮🌯🥙🥚🍳🥘🍲🥗🍿🍱🍘🍙🍚🍛🍜🍝🍠🍢🍣🍤🍥🍡🍦🍧🍨🍩🍪🎂🍰🍫🍬🍭🍮🍯🍼🥛🍵🍶🍾🍷🍸🍹🍺🍻🥂🍽🍴🥄🔪🏺🎃🎄🎆🎇🎈🎉🎊🎋🎍🎎🎏🎐🎑🎀🎁🎗🎟🎫🎖🏆🏅🥇🥈🥉🏀🏐🏈🏉🎾🎱🎳🏏🏑🏒🏓🏸🥊🥋🥅🎯🏌️‍♂️🏌️‍♀️🎣🎽🎿🏂🏄‍♂️🏄‍♀️🏇🏊‍♂️🏊‍♀️⛹️‍♂️⛹️‍♀️🏋️‍♂️🏋️‍♀️🚴‍♂️🚴‍♀️🚵‍♂️🚵‍♀️🏎🏍🤸‍♂️🤸‍♀️🤼‍♂️🤼‍♀️🤽‍♂️🤽‍♀️🤾‍♂️🤾‍♀️🤺🤹‍♂️🤹‍♀️🎮🕹🎲♠️♥️♦️♣️🃏🀄🎴🌍🌎🌏🌐🗺🏔⛰🌋🗻🏕🏖🏜🏝🏞🏟🏛🏗🏘🏙🏚🏠🏡🏢🏣🏤🏥🏦🏨🏩🏪🏫🏬🏭🏯🏰💒🗼🗽🕌🕍🕋🌁🌃🌄🌅🌆🌇🌉♨️🌌🎠🎡🎢💈🎪🎭🖼🎨🎰🚂🚃🚄🚅🚆🚇🚈🚉🚊🚝🚞🚋🚌🚍🚎🚐🚑🚒🚓🚔🚕🚖🚗🚘🚙🚚🚛🚜🚲🛴🛵🚏🛣🛤🚨🚥🚦🚧🛑🚣‍♂️🚣‍♀️🛶🚤🛳⛴🛥🚢✈🛩🛫🛬💺🚁🚟🚠🚡🚀🛰🛎🚪🛌🛏🛋🚽🚿🛀🛁⏱⏲🕰🕛🕧🕐🕜🕑🕝🕒🕞🕓🕟🕔🕠🕕🕡🕖🕢🕗🕣🕘🕤🕙🕥🕚🕦🌑🌒🌓🌔🌕🌖🌗🌘🌙🌚🌛🌜🌡☀️🌝🌞🌟🌠☁️⛈🌤🌥🌦🌧🌨🌩🌪🌫🌬🌀🌈🌂☂️☃️🔥💧🌊🔇🔈🔉🔊📢📣📯🔔🔕🎼🎵🎶🎙🎚🎛🎤🎧📻🎷🎸🎹🎺🎻🥁📱📲☎️📞📟📠🔋🔌💻🖥🖨⌨🖱🖲💽💾💿📀🎥🎞📽🎬📺📷📸📹📼🔍🔎🔬🔭📡🕯💡🔦🏮📔📕📖📗📘📙📚📓📒📃📜📄📰🗞📑🔖🏷💰💴💵💶💷💸💳💱💲📧📨📩📤📥📦📫📪📬📭📮🗳✏✒🖋🖊🖌🖍📝💼📁📂🗂📅📆🗒🗓📇📈📉📊📋📌📍📎🖇📏📐✂️🗃🗄🗑🔒🔓🔏🔐🔑🗝🔨⛏⚒🛠🗡⚔🔫🏹🛡🔧🔩⚙🗜⚗⚖🔗💉💊🚬⚰⚱🗿🛢🔮🔮🏧🚮🚰🚹🚺🚻🚼🚾🛂🛃🛄🛅⚠️🚸🚫🚳🚭🚯🚱🚷📵🔞☢☣⬆️↗️➡️↘️⬇️↙️⬅️↖️↕️↔️↩↪⤴️⤵️🔃🔄🔙🔚🔛🔜🔝🛐⚛🕉✡☸☯️☦☮🕎🔯🔀🔁🔂▶️⏭⏯◀️🔼🔽⏸⏹⏺⏏🎦🔅🔆📶📳📴♻️📛🔰🔱☑✔✖♀️♂️〽✳✴❇⁉️🔟💯🔠🔡🔢🔣🔤🅰️🆎🅱️🆑🆒🆓️ℹ🆔Ⓜ️🆕🆖🅾️🆗🅿️🆘🆙🆚🈁🈂🈷🈶🈯🉐🈹🈚🈲🉑🈸🈴🈳㊗㊙🈺🈵▫️◻◼🔶🔷🔸🔹🔺🔻💠🔘🔲🔳🔴🔵🏁🚩🏴🏳🏳️‍🌈⚀⚁⚂⚃⚄⚅⛾♾🇦🇨🇦🇩🇦🇪🇦🇫🇦🇬🇦🇮🇦🇱🇦🇲🇦🇴🇦🇶🇦🇷🇦🇸🇦🇹🇦🇺🇦🇼🇦🇽🇦🇿🇧🇦🇧🇧🇧🇩🇧🇪🇧🇫🇧🇬🇧🇭🇧🇮🇧🇯🇧🇱🇧🇲🇧🇳🇧🇴🇧🇶🇧🇷🇧🇸🇧🇹🇧🇼🇧🇾🇧🇿🇨🇦🇨🇨🇨🇩🇨🇫🇨🇬🇨🇭🇨🇮🇨🇰🇨🇱🇨🇲🇨🇳🇨🇴🇨🇷🇨🇺🇨🇻🇨🇼🇨🇽🇨🇾🇨🇿🇩🇪🇩🇯🇩🇰🇩🇲🇩🇴🇩🇿🇪🇨🇪🇪🇪🇬🇪🇭🇪🇷🇪🇸🇪🇹🇪🇺🇫🇮🇫🇯🇫🇰🇫🇲🇫🇴🇫🇷🇬🇦🇬🇧🇬🇩🇬🇪🇬🇫🇬🇬🇬🇭🇬🇮🇬🇱🇬🇲🇬🇳🇬🇵🇬🇶🇬🇷🇬🇸🇬🇹🇬🇺🇬🇼🇬🇾🇭🇰🇭🇲🇭🇳🇭🇷🇭🇹🇭🇺🇮🇨🇮🇩🇮🇪🇮🇱🇮🇲🇮🇳🇮🇴🇮🇶🇮🇷🇮🇸🇮🇹🇯🇪🇯🇲🇯🇴🇯🇵🇰🇪🇰🇬🇰🇭🇰🇮🇰🇲🇰🇳🇰🇵🇰🇷🇰🇼🇰🇾🇰🇿🇱🇦🇱🇧🇱🇨🇱🇮🇱🇰🇱🇷🇱🇸🇱🇹🇱🇺🇱🇻🇱🇾🇲🇦🇲🇨🇲🇩🇲🇪🇲🇬🇲🇭🇲🇰🇲🇱🇲🇲🇲🇳🇲🇴🇲🇵🇲🇶🇲🇷🇲🇸🇲🇹🇲🇺🇲🇻🇲🇼🇲🇽🇲🇾🇲🇿🇳🇦🇳🇨🇳🇪🇳🇫🇳🇬🇳🇮🇳🇱🇳🇴🇳🇵🇳🇷🇳🇺🇳🇿🇴🇲🇵🇦🇵🇪🇵🇫🇵🇬🇵🇭🇵🇰🇵🇱🇵🇲🇵🇳🇵🇷🇵🇸🇵🇹🇵🇼🇵🇾🇶🇦🇷🇪🇷🇴🇷🇸🇷🇺🇷🇼🇸🇦🇸🇧🇸🇨🇸🇩🇸🇪🇸🇬🇸🇭🇸🇮🇸🇰🇸🇱🇸🇲🇸🇳🇸🇴🇸🇷🇸🇸🇸🇹🇸🇻🇸🇽🇸🇾🇸🇿🇹🇦🇹🇨🇹🇩🇹🇫🇹🇬🇹🇭🇹🇯🇹🇰🇹🇱🇹🇲🇹🇳🇹🇴🇹🇷🇹🇹🇹🇻🇹🇼🇹🇿🇺🇦🇺🇬🇺🇳🇺🇸🇺🇾🇺🇿🇻🇦🇻🇨🇻🇪🇻🇬🇻🇮🇻🇳🇻🇺🇼🇫🇼🇸🇽🇰🇾🇪🇾🇹🇿🇦🇿🇲🇿🇼8<br/><br/><br/><br/>Sent from my Samsung Galaxy smartphone.</align>";
int font_size = 200;

int counter = 0;
void _button_clicked(void *data, Evas_Object *obj, void *event_info)
{
   APP *app = data;

  font_size -= 5;
  Evas_Textblock_Style *style = evas_textblock_style_new();
  char buffer[100] = {0};
  sprintf(buffer, "DEFAULT='font=NotoColorEmoji font_size=%i color=red ellipsis=-1.0 wrap=mixed'", font_size);
  evas_textblock_style_set(style, buffer);
  evas_object_textblock_style_set(app->tb1, style);
  evas_textblock_style_free(style);
  style = NULL;
}

EAPI_MAIN int
elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
{
  APP *app = calloc(1, sizeof(APP));
  Evas_Object *win, *scroller1, *scroller2, *box;

  elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

  win = elm_win_util_standard_add("", "");
  elm_win_autodel_set(win, EINA_TRUE);

  box = elm_box_add(win);
  evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL);
  scroller1 = elm_scroller_add(win);
  evas_object_size_hint_weight_set(scroller1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
  evas_object_size_hint_align_set(scroller1, EVAS_HINT_FILL, EVAS_HINT_FILL);

  evas_font_data_cache_set(50 * 1024* 1024, EVAS_FONT_DATA_CACHE_TEXTURE );

  app->tb1 = evas_object_textblock_add(win);
  Evas_Textblock_Style *style = evas_textblock_style_new();
  char buffer[100] = {0};
  sprintf(buffer, "DEFAULT='font=NotoColorEmoji font_size=%i color=red ellipsis=-1.0 wrap=mixed'", font_size);
  evas_textblock_style_set(style, buffer);
  evas_object_textblock_style_set(app->tb1, style);
  evas_textblock_style_free(style);
  style = NULL;

  evas_font_cache_set(evas_object_evas_get(app->tb1), 0);

  int w,h;
  evas_object_textblock_text_markup_set(app->tb1, "");
  evas_object_size_hint_min_set(app->tb1, 400, 400);
  elm_object_content_set(scroller1, app->tb1);
  elm_box_pack_end(box, scroller1);
  elm_object_content_set(win, box);

  app->btnLoad = elm_button_add(win);
  elm_object_text_set(app->btnLoad, "Scale Font");
  evas_object_smart_callback_add(app->btnLoad, "clicked", _button_clicked, app);
  evas_object_show(app->btnLoad);
  evas_object_move(app->btnLoad, 0, 20);
  evas_object_resize(app->btnLoad, 150, 20);

  evas_object_textblock_text_markup_set(app->tb1, text);
  evas_object_textblock_size_formatted_get(app->tb1, &w, &h);
  evas_object_size_hint_min_set(app->tb1, 400, w/400 + h + 150);

  evas_object_resize(win, 400, 400);
  evas_object_show(box);
  evas_object_show(scroller1);
  evas_object_show(scroller2);
  evas_object_show(win);
  elm_run();

  return 0;
}
ELM_MAIN()

```

Reviewers: raster, woohyun, zmike, cedric, bu5hm4n, Hermet

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T8737

Differential Revision: https://phab.enlightenment.org/D11943
2020-07-24 10:36:27 +01:00
Bowon Ryu 59b9bbc496 edje_textblock: remove duplicated textblock style properties
Summary:
When there is "font" and "font_size" in  textblock style (already defined),
If "font" and "font_size" are set using edje_text_class_set(),
then "font" and "font_size" are defined duplicated in texblock style through eina_strbuf_append.

Duplicate properties use memory unnecessarily,
and also it is possible to cause confusion at debbuging.

This patch replaces duplicate properties "font", "font_size" using eina_strbuf_replace.

Test Plan:
* textblock style in edc
"font=Sans font_size=20 wrap=mixed text_class=TEXT_CLASS";

* edje_text_class_set in c
edje_text_class_set("TEXT_CLASS", "font=DejavuSans", 40);

* textblock style at runtime (BEFORE)
DEFAULT='font=Sans font_size=20 wrap=mixed font_size=40.0 font=DejavuSans'

* textblock style at runtime (AFTER)
DEFAULT='font=DejavuSans font_size=40 wrap=mixed'

Reviewers: subodh6129, woohyun, ali.alzyod

Reviewed By: ali.alzyod

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D11962
2020-07-22 19:16:32 +09:00