}
static void
-_store_selection(Evas_Object *obj)
+_store_selection(enum _elm_sel_type seltype, Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
const char *sel;
+
if (!wd) return;
sel = edje_object_part_text_selection_get(wd->ent, "elm.text");
+ elm_selection_set(seltype, obj, ELM_SEL_MARKUP, sel);
eina_stringshare_replace(&wd->cut_sel, sel);
}
{
Widget_Data *wd = elm_widget_data_get(data);
+ /* Store it */
wd->selmode = EINA_FALSE;
edje_object_part_text_select_allow_set(wd->ent, "elm.text", 0);
edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
elm_widget_scroll_hold_pop(data);
- _store_selection(data);
+ _store_selection(ELM_SEL_CLIPBOARD, data);
edje_object_part_text_insert(wd->ent, "elm.text", "");
edje_object_part_text_select_none(wd->ent, "elm.text");
}
edje_object_part_text_select_allow_set(wd->ent, "elm.text", 0);
edje_object_signal_emit(wd->ent, "elm,state,select,off", "elm");
elm_widget_scroll_hold_pop(data);
- _store_selection(data);
- edje_object_part_text_select_none(wd->ent, "elm.text");
+ _store_selection(ELM_SEL_CLIPBOARD, data);
+// edje_object_part_text_select_none(wd->ent, "elm.text");
}
static void
return str;
}
+
static char *
_text_to_mkup(const char *text)
{
if (!wd) return;
wd->have_selection = EINA_TRUE;
evas_object_smart_callback_call(data, SIG_SELECTION_CHANGED, NULL);
- if (wd->sel_notify_handler)
- {
- char *txt = _mkup_to_text(elm_entry_selection_get(data));
-
- if (txt)
- {
-#ifdef HAVE_ELEMENTARY_X
- Evas_Object *top;
-
- top = elm_widget_top_get(data);
- if ((top) && (elm_win_xwindow_get(top)))
- ecore_x_selection_primary_set(elm_win_xwindow_get(top), txt,
- strlen(txt));
-#endif
- free(txt);
- }
- }
+ elm_selection_set(ELM_SEL_PRIMARY, obj, ELM_SEL_MARKUP,
+ elm_entry_selection_get(data));
}
static void
Widget_Data *wd = elm_widget_data_get(data);
if (!wd) return;
evas_object_smart_callback_call(data, SIG_SELECTION_COPY, NULL);
+ elm_selection_set(ELM_SEL_CLIPBOARD, obj, ELM_SEL_MARKUP,
+ elm_entry_selection_get(data));
}
static void
char *txt;
if (!wd) return;
evas_object_smart_callback_call(data, SIG_SELECTION_CUT, NULL);
- txt = _mkup_to_text(elm_entry_selection_get(data));
- eina_stringshare_replace(&wd->cut_sel, txt);
- if (txt) free(txt);
+ elm_selection_set(ELM_SEL_CLIPBOARD, obj, ELM_SEL_MARKUP,
+ elm_entry_selection_get(data));
edje_object_part_text_insert(wd->ent, "elm.text", "");
wd->changed = EINA_TRUE;
_sizing_eval(data);
Ecore_X_Event_Selection_Notify *ev = event;
if (!wd) return 1;
if (!wd->selection_asked) return 1;
+
if ((ev->selection == ECORE_X_SELECTION_CLIPBOARD) ||
(ev->selection == ECORE_X_SELECTION_PRIMARY))
{
{
Widget_Data *wd = elm_widget_data_get(data);
Ecore_X_Event_Selection_Clear *ev = event;
+/*
if (!wd) return 1;
if (!wd->have_selection) return 1;
if ((ev->selection == ECORE_X_SELECTION_CLIPBOARD) ||
{
elm_entry_select_none(data);
}
- return 1;
+ return 1;*/
}
#endif
int references;
};
+
+enum _elm_sel_type {
+ ELM_SEL_PRIMARY,
+ ELM_SEL_SECONDARY,
+ ELM_SEL_CLIPBOARD,
+
+ ELM_SEL_MAX,
+};
+
+enum _elm_sel_format {
+ ELM_SEL_MARKUP = 0x01,
+};
+
+
+
#define ELM_NEW(t) calloc(1, sizeof(t))
void _elm_win_shutdown(void);
void _elm_config_sub_init(void);
void _elm_config_shutdown(void);
+Eina_Bool elm_selection_set(enum _elm_sel_type selection, Evas_Object *widget, enum _elm_sel_format format, const char *buf);
+Eina_Bool elm_selection_clear(enum _elm_sel_type selection, Evas_Object *widget);
+
+
+
+
#define ELM_SET_WIDTYPE(widtype, type) if (!widtype) widtype = eina_stringshare_add(type)
//#define ELM_CHECK_WIDTYPE(obj, widtype) if (elm_widget_type_get(obj) != widtype) return
#define ELM_CHECK_WIDTYPE(obj, widtype) if (!_elm_widget_type_check((obj), (widtype))) return