From ceab19042fa4f17044bf77d79ed7f13afd188310 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Tue, 6 Mar 2001 15:40:27 +0000 Subject: [PATCH] and you go handle those pesky selection clear events.. and we're done a full-featured 1 line text entry box (minus text scrolling - i think i'll add that) SVN revision: 4327 --- src/entry.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/entry.c b/src/entry.c index 7034853..bd1ac6e 100644 --- a/src/entry.c +++ b/src/entry.c @@ -2,6 +2,9 @@ static Evas_List entries; +static void e_clear_selection(Eevent * ev); +static void e_paste_request(Eevent * ev); + static void e_entry_down_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y); static void e_entry_up_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y); static void e_entry_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y); @@ -10,6 +13,29 @@ static void e_entry_unrealize(E_Entry *entry); static void e_entry_configure(E_Entry *entry); static void +e_clear_selection(Eevent * ev) +{ + Ev_Clear_Selection *e; + Evas_List l; + + e = ev->event; + for (l = entries; l; l = l->next) + { + E_Entry *entry; + + entry = l->data; + if (entry->selection_win == e->win) + { + e_window_destroy(entry->selection_win); + entry->selection_win = 0; + entry->select.start = -1; + entry->select.length = 0; + e_entry_configure(entry); + } + } +} + +static void e_paste_request(Eevent * ev) { Ev_Paste_Request *e; @@ -174,7 +200,7 @@ e_entry_move_cb(void *_data, Evas _e, Evas_Object _o, int _b, int _x, int _y) str2[len] = 0; printf(">%s<\n", str2); if (entry->selection_win) e_window_destroy(entry->selection_win); - entry->paste_win = e_selection_set(str2); + entry->selection_win = e_selection_set(str2); } e_entry_configure(entry); } @@ -278,6 +304,7 @@ void e_entry_init(void) { e_event_filter_handler_add(EV_PASTE_REQUEST, e_paste_request); + e_event_filter_handler_add(EV_CLEAR_SELECTION, e_clear_selection); } void @@ -546,7 +573,6 @@ e_entry_set_text(E_Entry *entry, const char *text) IF_FREE(entry->buffer); entry->buffer = strdup(text); evas_set_text(entry->evas, entry->text, entry->buffer); - printf("%i %i (%s)\n", entry->cursor_pos, strlen(entry->buffer), entry->buffer); if (entry->cursor_pos > strlen(entry->buffer)) entry->cursor_pos = strlen(entry->buffer); e_entry_configure(entry); -- 2.7.4