From fc803eeb1e565e3df38049467bf4994e5b08f96c Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Tue, 6 Mar 2001 07:59:21 +0000 Subject: [PATCH] it does pastes out of entry boxes (code needs some smartening up - but it works!) SVN revision: 4323 --- src/e.h | 1 + src/entry.c | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/e.h b/src/e.h index 7709a4b..ddad8b6 100644 --- a/src/e.h +++ b/src/e.h @@ -558,6 +558,7 @@ struct _E_Entry Evas_Object selection; Evas_Object text; Window paste_win; + Window selection_win; }; void e_entry_init(void); diff --git a/src/entry.c b/src/entry.c index 21251a1..7034853 100644 --- a/src/entry.c +++ b/src/entry.c @@ -26,7 +26,6 @@ e_paste_request(Eevent * ev) char *str2; char *type; - printf("destined for this entry!\n"); type = e->string; if (entry->select.start >= 0) { @@ -163,7 +162,20 @@ e_entry_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y) entry->select.length = entry->cursor_pos - entry->select.down + 1; } } - printf("%i %i\n", entry->select.start, entry->select.length); + if (entry->select.start >= 0) + { + char *str2; + int len; + + len = entry->select.length; + if (entry->select.start + entry->select.length >= strlen(entry->buffer)) + len = strlen(entry->buffer) - entry->select.start; + str2 = e_memdup(&(entry->buffer[entry->select.start]), len + 1); + str2[len] = 0; + printf(">%s<\n", str2); + if (entry->selection_win) e_window_destroy(entry->selection_win); + entry->paste_win = e_selection_set(str2); + } e_entry_configure(entry); } } -- 2.7.4