handle selection loss cb's from elm now

SVN revision: 72799
devs/lucas/wip
Carsten Haitzler 11 years ago
parent bb11d9e336
commit 87f8a0e624
  1. 3
      TODO
  2. 24
      src/bin/termio.c

@ -5,9 +5,6 @@ make it a first-class terminal:
[ ] blink and blink2 attributes need to be supported
[ ] improve terminal emulation handling. known apps with problems:
mc
[ ] elm_cnp has no way to call an event/cb to let you know your
selection has gone (selection_clear() doesnt do anything). also
elm_cnp doesn't track target object delections.
[ ] dnd text (to/from terminal)
[ ] handle multibyte displays better (does handle utf8 only atm and
then maybe not according to convention like double cell spacing

@ -49,6 +49,7 @@ struct _Termio
Config *config;
Ecore_IMF_Context *imf;
Eina_Bool jump_on_change : 1;
Eina_Bool have_sel : 1;
};
static Evas_Smart *_smart = NULL;
@ -339,6 +340,20 @@ _smart_update_queue(Evas_Object *obj, Termio *sd)
sd->anim = ecore_animator_add(_smart_cb_change, obj);
}
static void
_lost_selection(void *data, Elm_Sel_Type selection)
{
Termio *sd = evas_object_smart_data_get(data);
if (!sd) return;
if (sd->have_sel)
{
sd->cur.sel = 0;
elm_object_cnp_selection_clear(sd->win, selection);
_smart_update_queue(data, sd);
sd->have_sel = EINA_FALSE;
}
}
static void
_take_selection(Evas_Object *obj, Elm_Sel_Type type)
{
@ -362,8 +377,13 @@ _take_selection(Evas_Object *obj, Elm_Sel_Type type)
if (s)
{
if (sd->win)
elm_cnp_selection_set(sd->win, type,
ELM_SEL_FORMAT_TEXT, s, strlen(s));
{
sd->have_sel = EINA_FALSE;
elm_cnp_selection_set(sd->win, type,
ELM_SEL_FORMAT_TEXT, s, strlen(s));
elm_cnp_selection_loss_callback_set(type, _lost_selection, obj);
sd->have_sel = EINA_TRUE;
}
free(s);
}
}

Loading…
Cancel
Save