Page MenuHomePhabricator

efl_ui_text: EFL_UI_EVENT_SELECTION_CLEARED not called
ClosedPublic

Authored by AbdullehGhujeh on Aug 28 2019, 8:04 AM.

Details

Summary

-Add a callback to ui_text for event EFL_UI_EVENT_SELECTION_CLEARED
-Select any text in the ui_text
-Clear selection by clicking any area by mouse or pressing arrows in keyboard
-The selection get cleared but the callback will never be called.

Test Plan
#define EFL_BETA_API_SUPPORT 1
 
#include <Elementary.h>

  static void
_efl_ui_text_cleared_cb(void *data, const Efl_Event *event)
{
  printf("%s\n", "_efl_ui_text_cleared_cb called");
}

EAPI_MAIN void
efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
     Eo *win, *box;
 
     win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
                efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
                efl_text_set(efl_added, "Hello World"),
                efl_ui_win_autodel_set(efl_added, EINA_TRUE));
 
     box = efl_add(EFL_UI_BOX_CLASS, win,
                efl_content_set(win, efl_added),
                efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(360, 240)));
 
     Eo *ui_text = efl_add(EFL_UI_TEXT_CLASS, box,
     efl_text_markup_set(efl_added, "Hello World"),
     efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, EFL_GFX_HINT_EXPAND),
     efl_gfx_hint_align_set(efl_added, 0.5, 0.5),
     efl_pack(box, efl_added));
   
     efl_event_callback_add(ui_text, EFL_UI_EVENT_SELECTION_CLEARED, _efl_ui_text_cleared_cb, NULL);
}
EFL_MAIN()

Diff Detail

Repository
rEFL core/efl
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
AbdullehGhujeh created this revision.Aug 28 2019, 8:04 AM

It seems that this patch has no reviewers specified. If you are unsure who can review your patch, please check this wiki page and see if anyone can be added: https://phab.enlightenment.org/w/maintainers_reviewers/

AbdullehGhujeh requested review of this revision.Aug 28 2019, 8:04 AM
AbdullehGhujeh edited the summary of this revision. (Show Details)Aug 28 2019, 8:09 AM
AbdullehGhujeh edited the test plan for this revision. (Show Details)
AbdullehGhujeh edited the summary of this revision. (Show Details)
AbdullehGhujeh added a reviewer: ali.alzyod.

_selection_clear check for value of (sd->have_selection).

This change is right

AbdullehGhujeh edited reviewers, added: tasn; removed: segfaultxavi.Aug 31 2019, 11:30 PM
tasn accepted this revision.Sep 2 2019, 8:57 AM

I haven't looked deeply into it, but this looks right to me too.

I added a note about something that's unrelated to the change, just a mistake I noticed in the surrounding code if anyone wants to fix that. :)

src/lib/elementary/efl_ui_text.c
3984

Unrelated to this patch, but I just noticed this. This is probably not the right way of doing it. All that needs to be done is to compare the cursors and see if they are different (or potentially if end > start).

This revision is now accepted and ready to land.Sep 2 2019, 8:57 AM
Closed by commit rEFLdd440c9f68b5: efl_ui_text: EFL_UI_EVENT_SELECTION_CLEARED not called (authored by abdulleh Ghujeh <a.ghujeh@samsung.com>, committed by Marcel Hollerbach <mail@marcel-hollerbach.de>). · Explain WhySep 5 2019, 2:17 AM
This revision was automatically updated to reflect the committed changes.