summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiep Ha <thiepha@gmail.com>2015-06-02 10:15:02 +0900
committerThiep Ha <thiepha@gmail.com>2015-06-02 21:50:25 +0900
commit6261b683566dd22f323905d019ae8b815cd7d7f8 (patch)
tree3498868b61c4b292d1ba8f67708650829fce74fb
parenta3a225186191591e99c6c6d186c1a1de26b65546 (diff)
Revert "First review"
Get back to working code but keep the review log This reverts commit ae12f0c835c7d2a9c4d7b292620842029669e9fe.
-rw-r--r--src/lib/elm_cnp.c23
1 files changed, 1 insertions, 22 deletions
diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c
index afc2c9328..7be51dab0 100644
--- a/src/lib/elm_cnp.c
+++ b/src/lib/elm_cnp.c
@@ -2562,7 +2562,7 @@ _wl_targets_converter(char *target, Wl_Cnp_Selection *sel EINA_UNUSED, void *dat
2562 if (sel->format) 2562 if (sel->format)
2563 { 2563 {
2564 formats = sel->format; 2564 formats = sel->format;
2565 is_uri_data = _wl_is_uri_type_data(sel->selbuf, sel->buflen); /* why? */ 2565 is_uri_data = _wl_is_uri_type_data(sel->selbuf, sel->buflen);
2566 } 2566 }
2567 else 2567 else
2568 { 2568 {
@@ -2575,8 +2575,6 @@ _wl_targets_converter(char *target, Wl_Cnp_Selection *sel EINA_UNUSED, void *dat
2575 { 2575 {
2576 if (formats & _atoms[i].formats) 2576 if (formats & _atoms[i].formats)
2577 { 2577 {
2578 /* Why do we need only uri?
2579 * If really needed, instead of strcmp why not just compare atom ids? */
2580 if ((is_uri_data) || (!is_uri_data && 2578 if ((is_uri_data) || (!is_uri_data &&
2581 strcmp(_atoms[i].name, "text/uri") && 2579 strcmp(_atoms[i].name, "text/uri") &&
2582 strcmp(_atoms[i].name, "text/uri-list"))) 2580 strcmp(_atoms[i].name, "text/uri-list")))
@@ -2589,7 +2587,6 @@ _wl_targets_converter(char *target, Wl_Cnp_Selection *sel EINA_UNUSED, void *dat
2589 { 2587 {
2590 if (formats & _atoms[i].formats) 2588 if (formats & _atoms[i].formats)
2591 { 2589 {
2592 /* Same here */
2593 if ((is_uri_data) || (!is_uri_data && 2590 if ((is_uri_data) || (!is_uri_data &&
2594 strcmp(_atoms[i].name, "text/uri") && 2591 strcmp(_atoms[i].name, "text/uri") &&
2595 strcmp(_atoms[i].name, "text/uri-list"))) 2592 strcmp(_atoms[i].name, "text/uri-list")))
@@ -2819,10 +2816,6 @@ _wl_notify_handler_uri(Wl_Cnp_Selection *sel, Ecore_Wl_Event_Selection_Data_Read
2819 Eina_Inlist *itr; 2816 Eina_Inlist *itr;
2820 Elm_Selection_Data ddata; 2817 Elm_Selection_Data ddata;
2821 2818
2822 /* Is this function only needed for DnD?
2823 * Because it seems like, as __elm_dropable is set only when a drop target
2824 * is added! If this function is called during selection, it will sigsegv!
2825 */
2826 eo_do(sel->requestwidget, drop = eo_key_data_get("__elm_dropable")); 2819 eo_do(sel->requestwidget, drop = eo_key_data_get("__elm_dropable"));
2827 if (drop) 2820 if (drop)
2828 type = drop->last.type; 2821 type = drop->last.type;
@@ -2849,9 +2842,6 @@ _wl_notify_handler_uri(Wl_Cnp_Selection *sel, Ecore_Wl_Event_Selection_Data_Read
2849 uri = calloc(1, sizeof(*uri) * num_files); 2842 uri = calloc(1, sizeof(*uri) * num_files);
2850 if (!uri) return 0; 2843 if (!uri) return 0;
2851 2844
2852 /* Can't it be easier with Eina_Strbuf?
2853 * Seems complicated for nothing.
2854 */
2855 for (i = 0; i < num_files ; i++) 2845 for (i = 0; i < num_files ; i++)
2856 { 2846 {
2857 uri[i] = efreet_uri_decode(files[i]); 2847 uri[i] = efreet_uri_decode(files[i]);
@@ -2977,7 +2967,6 @@ _wl_notify_handler_uri(Wl_Cnp_Selection *sel, Ecore_Wl_Event_Selection_Data_Read
2977 2967
2978 mkupstr = _elm_util_text_to_mkup((const char *)stripstr); 2968 mkupstr = _elm_util_text_to_mkup((const char *)stripstr);
2979 /* TODO BUG: should never NEVER assume it's an elm_entry! */ 2969 /* TODO BUG: should never NEVER assume it's an elm_entry! */
2980 /* This should not be here! */
2981 _elm_entry_entry_paste(sel->requestwidget, mkupstr); 2970 _elm_entry_entry_paste(sel->requestwidget, mkupstr);
2982 free(mkupstr); 2971 free(mkupstr);
2983 } 2972 }
@@ -3208,10 +3197,6 @@ static Eina_Bool _wl_drops_accept(const char *type);
3208static unsigned int _wl_elm_widget_window_get(Evas_Object *obj); 3197static unsigned int _wl_elm_widget_window_get(Evas_Object *obj);
3209static Evas * _wl_evas_get_from_win(unsigned int win); 3198static Evas * _wl_evas_get_from_win(unsigned int win);
3210 3199
3211/* I think we can have only one function where data would be the widget itself.
3212 * Wl_Cnp_Selection is global anyway so no need to put it as parameter.
3213 * dragwidget can be NULLified everytime.
3214 */
3215static void 3200static void
3216_wl_sel_obj_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) 3201_wl_sel_obj_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
3217{ 3202{
@@ -3355,9 +3340,6 @@ _wl_elm_cnp_selection_get(Evas_Object *obj, Elm_Sel_Type selection, Elm_Sel_Form
3355 EVAS_CALLBACK_DEL, _wl_sel_obj_del2, 3340 EVAS_CALLBACK_DEL, _wl_sel_obj_del2,
3356 &wl_cnp_selection); 3341 &wl_cnp_selection);
3357 3342
3358 /* Why this check is not at the beginning?
3359 * More, I don't think you want to init stuff if the selection type is bad.
3360 */
3361 if ((selection == ELM_SEL_TYPE_CLIPBOARD) || 3343 if ((selection == ELM_SEL_TYPE_CLIPBOARD) ||
3362 (selection == ELM_SEL_TYPE_PRIMARY) || 3344 (selection == ELM_SEL_TYPE_PRIMARY) ||
3363 (selection == ELM_SEL_TYPE_SECONDARY)) 3345 (selection == ELM_SEL_TYPE_SECONDARY))
@@ -3410,7 +3392,6 @@ _wl_elm_cnp_selection_clear(Evas_Object *obj, Elm_Sel_Type selection EINA_UNUSED
3410 return EINA_TRUE; 3392 return EINA_TRUE;
3411} 3393}
3412 3394
3413/* If the function is common, it should be renamed. */
3414static Eina_Bool 3395static Eina_Bool
3415_wl_selection_send(void *data, int type EINA_UNUSED, void *event) 3396_wl_selection_send(void *data, int type EINA_UNUSED, void *event)
3416{ 3397{
@@ -3434,7 +3415,6 @@ _wl_selection_send(void *data, int type EINA_UNUSED, void *event)
3434 { 3415 {
3435 cnp_debug("Found a type: %s\n", atom->name); 3416 cnp_debug("Found a type: %s\n", atom->name);
3436 Dropable *drop; 3417 Dropable *drop;
3437 /* Why do we need it? Because it was in X11? */
3438 eo_do(sel->requestwidget, drop = eo_key_data_get("__elm_dropable")); 3418 eo_do(sel->requestwidget, drop = eo_key_data_get("__elm_dropable"));
3439 if (drop) 3419 if (drop)
3440 drop->last.type = atom->name; 3420 drop->last.type = atom->name;
@@ -3450,7 +3430,6 @@ _wl_selection_send(void *data, int type EINA_UNUSED, void *event)
3450 } 3430 }
3451 } 3431 }
3452 3432
3453 /* What if we don't find any atom? We don't send anything? */
3454 len_remained = len_ret; 3433 len_remained = len_ret;
3455 buf = data_ret; 3434 buf = data_ret;
3456 3435