summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-06-25 11:17:03 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-06-25 11:17:03 +0000
commit87f8a0e624e5aef18c1cf31fcf5e1fc9836ae40f (patch)
tree9164175c945ad588cbdbf6a3cb8447327d66ea38
parentbb11d9e336a91992d43a0f3bd61ad8adde8122f6 (diff)
handle selection loss cb's from elm now
SVN revision: 72799
-rw-r--r--TODO3
-rw-r--r--src/bin/termio.c24
2 files changed, 22 insertions, 5 deletions
diff --git a/TODO b/TODO
index a1df07b..acca708 100644
--- a/TODO
+++ b/TODO
@@ -5,9 +5,6 @@ make it a first-class terminal:
5[ ] blink and blink2 attributes need to be supported 5[ ] blink and blink2 attributes need to be supported
6[ ] improve terminal emulation handling. known apps with problems: 6[ ] improve terminal emulation handling. known apps with problems:
7 mc 7 mc
8[ ] elm_cnp has no way to call an event/cb to let you know your
9 selection has gone (selection_clear() doesnt do anything). also
10 elm_cnp doesn't track target object delections.
11[ ] dnd text (to/from terminal) 8[ ] dnd text (to/from terminal)
12[ ] handle multibyte displays better (does handle utf8 only atm and 9[ ] handle multibyte displays better (does handle utf8 only atm and
13 then maybe not according to convention like double cell spacing 10 then maybe not according to convention like double cell spacing
diff --git a/src/bin/termio.c b/src/bin/termio.c
index 5120387..8779236 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -49,6 +49,7 @@ struct _Termio
49 Config *config; 49 Config *config;
50 Ecore_IMF_Context *imf; 50 Ecore_IMF_Context *imf;
51 Eina_Bool jump_on_change : 1; 51 Eina_Bool jump_on_change : 1;
52 Eina_Bool have_sel : 1;
52}; 53};
53 54
54static Evas_Smart *_smart = NULL; 55static Evas_Smart *_smart = NULL;
@@ -340,6 +341,20 @@ _smart_update_queue(Evas_Object *obj, Termio *sd)
340} 341}
341 342
342static void 343static void
344_lost_selection(void *data, Elm_Sel_Type selection)
345{
346 Termio *sd = evas_object_smart_data_get(data);
347 if (!sd) return;
348 if (sd->have_sel)
349 {
350 sd->cur.sel = 0;
351 elm_object_cnp_selection_clear(sd->win, selection);
352 _smart_update_queue(data, sd);
353 sd->have_sel = EINA_FALSE;
354 }
355}
356
357static void
343_take_selection(Evas_Object *obj, Elm_Sel_Type type) 358_take_selection(Evas_Object *obj, Elm_Sel_Type type)
344{ 359{
345 Termio *sd = evas_object_smart_data_get(obj); 360 Termio *sd = evas_object_smart_data_get(obj);
@@ -362,8 +377,13 @@ _take_selection(Evas_Object *obj, Elm_Sel_Type type)
362 if (s) 377 if (s)
363 { 378 {
364 if (sd->win) 379 if (sd->win)
365 elm_cnp_selection_set(sd->win, type, 380 {
366 ELM_SEL_FORMAT_TEXT, s, strlen(s)); 381 sd->have_sel = EINA_FALSE;
382 elm_cnp_selection_set(sd->win, type,
383 ELM_SEL_FORMAT_TEXT, s, strlen(s));
384 elm_cnp_selection_loss_callback_set(type, _lost_selection, obj);
385 sd->have_sel = EINA_TRUE;
386 }
367 free(s); 387 free(s);
368 } 388 }
369} 389}