From: Enlightenment S. <no-...@en...> - 2009-08-12 22:34:18
|
Log: 'everything' module: - added pasting from clipboard with ctrl+v - ctrl+u does not clear the trigger Author: jeffdameth Date: 2009-08-12 15:34:07 -0700 (Wed, 12 Aug 2009) New Revision: 41720 Modified: trunk/e/src/modules/everything/evry.c trunk/e/src/modules/everything/evry_plug_tracker.c Modified: trunk/e/src/modules/everything/evry.c =================================================================== --- trunk/e/src/modules/everything/evry.c 2009-08-12 20:26:27 UTC (rev 41719) +++ trunk/e/src/modules/everything/evry.c 2009-08-12 22:34:07 UTC (rev 41720) @@ -102,6 +102,8 @@ static int _evry_cb_key_down(void *data, int type, void *event); +static int _evry_cb_selection_notify(void *data, int type, void *event); + /* static int _evry_cb_mouse_down(void *data, int type, void *event); * static int _evry_cb_mouse_up(void *data, int type, void *event); * static int _evry_cb_mouse_move(void *data, int type, void *event); @@ -243,6 +245,11 @@ handlers = eina_list_append (handlers, ecore_event_handler_add (ECORE_EVENT_KEY_DOWN, _evry_cb_key_down, NULL)); + handlers = eina_list_append + (handlers, ecore_event_handler_add + (ECORE_X_EVENT_SELECTION_NOTIFY, + _evry_cb_selection_notify, win)); + /* handlers = eina_list_append * (handlers, ecore_event_handler_add * (ECORE_EVENT_MOUSE_BUTTON_DOWN, _evry_cb_mouse_down, NULL)); @@ -1039,16 +1046,22 @@ else if ((!strcmp(ev->key, "BackSpace")) || (!strcmp(ev->key, "Delete"))) _evry_backspace(s); + else if (!strcmp(ev->key, "v") && + (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)) + ecore_x_selection_clipboard_request(win->popup->evas_win, + ECORE_X_SELECTION_TARGET_UTF8_STRING); else if ((ev->key) && (ev->modifiers & ECORE_EVENT_MODIFIER_CTRL)) _evry_list_plugin_next_by_name(s, ev->key); else if ((ev->compose) && - (!(ev->modifiers & ECORE_EVENT_MODIFIER_ALT) || - (ev->modifiers & ECORE_EVENT_MODIFIER_WIN)) && - ((strlen(s->input) < (INPUTLEN - strlen(ev->compose))))) + (!(ev->modifiers & ECORE_EVENT_MODIFIER_ALT) || + (ev->modifiers & ECORE_EVENT_MODIFIER_WIN))) { - strcat(s->input, ev->compose); - _evry_update(s); + if (strlen(s->input) < (INPUTLEN - strlen(ev->compose))) + { + strcat(s->input, ev->compose); + _evry_update(s); + } } return 1; } @@ -1110,8 +1123,14 @@ static void _evry_clear(Evry_State *s) { - if (s->input[0] != 0) + if ((s->plugin->trigger && s->input) && + (!strncmp(s->plugin->trigger, s->input, strlen(s->plugin->trigger)))) { + s->input[strlen(s->plugin->trigger)] = 0; + _evry_update(s); + } + else if (s->input[0] != 0) + { s->input[0] = 0; _evry_update(s); edje_object_signal_emit(list->o_main, "e,state,entry_hide", "e"); @@ -1975,20 +1994,34 @@ Eina_List *l, *ll; Evry_Plugin *plugin; Evry_Item *it; - int cnt; + int cnt = 0; if (p->items) eina_list_free(p->items); p->items = NULL; EINA_LIST_FOREACH(s->cur_plugins, l, plugin) + cnt += eina_list_count(plugin->items); + + if (cnt <= 100) { - for (cnt = 0, ll = plugin->items; ll && cnt < 15; ll = ll->next, cnt++) + EINA_LIST_FOREACH(s->cur_plugins, l, plugin) { - it = ll->data; - p->items = eina_list_append(p->items, it); + EINA_LIST_FOREACH(plugin->items, ll, it) + p->items = eina_list_append(p->items, it); } } + else + { + EINA_LIST_FOREACH(s->cur_plugins, l, plugin) + { + for (cnt = 0, ll = plugin->items; ll && cnt < 15; ll = ll->next, cnt++) + { + it = ll->data; + p->items = eina_list_append(p->items, it); + } + } + } return 1; } @@ -2325,3 +2358,33 @@ return _evry_icon_fdo_set(obj, icon); } } + + +static int +_evry_cb_selection_notify(void *data, int type, void *event) +{ + Ecore_X_Event_Selection_Notify *ev; + Evry_State *s = selector->state; + + if (!s || (data != win)) return 1; + + ev = event; + if ((ev->selection == ECORE_X_SELECTION_CLIPBOARD) || + (ev->selection == ECORE_X_SELECTION_PRIMARY)) + { + if (strcmp(ev->target, ECORE_X_SELECTION_TARGET_UTF8_STRING) == 0) + { + Ecore_X_Selection_Data_Text *text_data; + + text_data = ev->data; + + if (strlen(s->input) < (INPUTLEN - strlen(text_data->text))) + { + strcat(s->input, text_data->text); + _evry_update(s); + } + } + } + + return 1; +} Modified: trunk/e/src/modules/everything/evry_plug_tracker.c =================================================================== --- trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-12 20:26:27 UTC (rev 41719) +++ trunk/e/src/modules/everything/evry_plug_tracker.c 2009-08-12 22:34:07 UTC (rev 41720) @@ -34,7 +34,7 @@ char rdf_query[32768]; int len = 0; - inst->service = "Files"; + /* inst->service = "Files"; */ if (inst->condition[0]) free (inst->condition); inst->condition = ""; @@ -281,6 +281,7 @@ inst->condition = ""; inst->service = service; inst->max_hits = max_hits; + inst->active = 0; p->private = inst; evry_plugin_register(p); plugins = eina_list_append(plugins, p); @@ -299,7 +300,7 @@ _plugin_new("Music", type_subject, "Music", 20, 0); _plugin_new("Videos", type_subject, "Videos", 20, 0); _plugin_new("Documents", type_subject, "Documents", 20, 0); - _plugin_new("Text", type_subject, "TextFiles", 20, 0); + /* _plugin_new("Text", type_subject, "TextFiles", 20, 0); */ _plugin_new("Find Files", type_object, "Files", 20, 1); _plugin_new("Folders", type_object, "Folders", 20, 0); |