Page MenuHomePhabricator

Efl.Ui.Selection: efl_ui_selection_get allow one callback registration at time
Open, NormalPublic

Description

Because Efl.Ui.Selection: efl_ui_selection_get allow one callback registration at time, this make some development challanges.
For example there are no two (paste) could be registered.
Following error will be raised:

ERR<13903>:eina_safety ../src/modules/ecore_evas/engines/x/ecore_evas_x.c:3928 _ecore_evas_x_selection_notify() safety check failed: !edata->selection_data[selection].later_conversion is false

Testing code:

#define EFL_EO_API_SUPPORT 1
#define EFL_BETA_API_SUPPORT 1
#include <Efl_Ui.h>
#include <Elementary.h>

static void
_paste_one_click_callback(void *data, const Efl_Event *event EINA_UNUSED)
{
   Eo *tb = (Eo*) data;
   efl_text_interactive_all_select(tb);
   efl_ui_textbox_selection_copy(tb);
   efl_text_interactive_all_unselect(tb);

   efl_ui_textbox_selection_paste(tb);
   efl_ui_textbox_selection_paste(tb);
}

static void
_quit_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
{
   efl_exit(0);
}

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_text_set(efl_added, "Hello world"),
                  efl_ui_win_autodel_set(efl_added, EINA_TRUE));
   efl_event_callback_add(win, EFL_UI_WIN_EVENT_DELETE_REQUEST, _quit_cb, NULL);
   efl_gfx_entity_size_set(win, EINA_SIZE2D(400, 240));

   box = efl_add(EFL_UI_BOX_CLASS, win,
                 efl_content_set(win, efl_added),
                 efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_VERTICAL));

   Eo *tb = efl_add(EFL_UI_TEXTBOX_CLASS, box,
            efl_text_set(efl_added, "HELLO WORLD"),
            efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0.1),
            efl_pack(box, efl_added));

   Eo *btn = efl_add(EFL_UI_BUTTON_CLASS, box,
            efl_text_set(efl_added, "Paste clipboard twice"),
            efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0.1),
            efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED, _paste_one_click_callback, tb),
            efl_pack(box, efl_added));
}
EFL_MAIN()

this code paste twice, so expected output is "Hello World Hello World Hello World" but instead we get "Hello World Hello World" and error printed in the terminal

ali.alzyod triaged this task as Normal priority.
ali.alzyod updated the task description. (Show Details)Mar 30 2020, 8:14 AM
ali.alzyod updated the task description. (Show Details)