summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2015-10-01 10:25:38 -0400
committerChris Michael <cp.michael@samsung.com>2015-12-03 10:22:37 -0500
commit82a8d008fa8d55e451ec13063cc1b0f46c0cb85c (patch)
tree134870a1e2d035c84f3a565f3a21d993cd6c315c
parent533997adba50247ea2279c31badc63f079247ae9 (diff)
elementary: Port elementary copy/paste code to use Ecore_Wl2 library
Signed-off-by: Chris Michael <cp.michael@samsung.com>
-rw-r--r--src/lib/elm_cnp.c180
1 files changed, 105 insertions, 75 deletions
diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c
index 070105746..55cf376c6 100644
--- a/src/lib/elm_cnp.c
+++ b/src/lib/elm_cnp.c
@@ -2309,7 +2309,7 @@ _x11_elm_selection_selection_has_owner(Evas_Object *obj EINA_UNUSED)
2309 2309
2310#endif 2310#endif
2311 2311
2312#ifdef HAVE_ELEMENTARY_WAYLAND 2312#ifdef HAVE_ELEMENTARY_WL2
2313typedef struct _Wl_Cnp_Selection Wl_Cnp_Selection; 2313typedef struct _Wl_Cnp_Selection Wl_Cnp_Selection;
2314 2314
2315struct _Wl_Cnp_Selection 2315struct _Wl_Cnp_Selection
@@ -2329,7 +2329,7 @@ struct _Wl_Cnp_Selection
2329 void *loss_data; 2329 void *loss_data;
2330 2330
2331 Elm_Sel_Format format; 2331 Elm_Sel_Format format;
2332 Ecore_Wl_Window *win; 2332 Ecore_Wl2_Window *win;
2333 Elm_Xdnd_Action action; 2333 Elm_Xdnd_Action action;
2334 2334
2335 Eina_Bool active : 1; 2335 Eina_Bool active : 1;
@@ -2376,7 +2376,7 @@ static Dropable *_wl_dropable_find(unsigned int win);
2376static void _wl_dropable_handle(Dropable *drop, Evas_Coord x, Evas_Coord y); 2376static void _wl_dropable_handle(Dropable *drop, Evas_Coord x, Evas_Coord y);
2377static void _wl_dropable_all_clean(unsigned int win); 2377static void _wl_dropable_all_clean(unsigned int win);
2378static Eina_Bool _wl_drops_accept(const char *type); 2378static Eina_Bool _wl_drops_accept(const char *type);
2379static unsigned int _wl_elm_widget_window_get(const Evas_Object *obj); 2379static Ecore_Wl2_Window *_wl_elm_widget_window_get(const Evas_Object *obj);
2380static Evas * _wl_evas_get_from_win(unsigned int win); 2380static Evas * _wl_evas_get_from_win(unsigned int win);
2381 2381
2382static void 2382static void
@@ -2397,7 +2397,7 @@ _wl_sel_obj_del2(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_
2397static Eina_Bool 2397static Eina_Bool
2398_wl_elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection, Elm_Sel_Format format, const void *selbuf, size_t buflen) 2398_wl_elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection, Elm_Sel_Format format, const void *selbuf, size_t buflen)
2399{ 2399{
2400 Ecore_Wl_Window *win; 2400 Ecore_Wl2_Window *win;
2401 Wl_Cnp_Selection *sel = &wl_cnp_selection; 2401 Wl_Cnp_Selection *sel = &wl_cnp_selection;
2402 2402
2403 if ((!selbuf) && (format != ELM_SEL_FORMAT_IMAGE)) 2403 if ((!selbuf) && (format != ELM_SEL_FORMAT_IMAGE))
@@ -2408,7 +2408,7 @@ _wl_elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection, Elm_Sel_Form
2408 2408
2409 _wl_elm_cnp_init(); 2409 _wl_elm_cnp_init();
2410 2410
2411 win = elm_win_wl_window_get(obj); 2411 win = _wl_elm_widget_window_get(obj);
2412 2412
2413 if (sel->loss_cb) sel->loss_cb(sel->loss_data, selection); 2413 if (sel->loss_cb) sel->loss_cb(sel->loss_data, selection);
2414 2414
@@ -2465,7 +2465,7 @@ _wl_elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection, Elm_Sel_Form
2465 2465
2466 if (i < 0) return EINA_FALSE; 2466 if (i < 0) return EINA_FALSE;
2467 2467
2468 ecore_wl_dnd_selection_set(ecore_wl_input_get(), types); 2468 ecore_wl2_dnd_selection_set(ecore_wl2_window_input_get(win), types);
2469 2469
2470 free(sel->selbuf); 2470 free(sel->selbuf);
2471 sel->buflen = buflen; 2471 sel->buflen = buflen;
@@ -2483,12 +2483,12 @@ _wl_elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection, Elm_Sel_Form
2483static Eina_Bool 2483static Eina_Bool
2484_wl_elm_cnp_selection_get(const Evas_Object *obj, Elm_Sel_Type selection, Elm_Sel_Format format, Elm_Drop_Cb datacb, void *udata) 2484_wl_elm_cnp_selection_get(const Evas_Object *obj, Elm_Sel_Type selection, Elm_Sel_Format format, Elm_Drop_Cb datacb, void *udata)
2485{ 2485{
2486 Ecore_Wl_Window *win; 2486 Ecore_Wl2_Window *win;
2487 Wl_Cnp_Selection *sel = &wl_cnp_selection; 2487 Wl_Cnp_Selection *sel = &wl_cnp_selection;
2488 2488
2489 _wl_elm_cnp_init(); 2489 _wl_elm_cnp_init();
2490 2490
2491 win = elm_win_wl_window_get(obj); 2491 win = _wl_elm_widget_window_get(obj);
2492 2492
2493 if (sel->requestwidget) 2493 if (sel->requestwidget)
2494 evas_object_event_callback_del_full(sel->requestwidget, 2494 evas_object_event_callback_del_full(sel->requestwidget,
@@ -2528,7 +2528,7 @@ _wl_elm_cnp_selection_get(const Evas_Object *obj, Elm_Sel_Type selection, Elm_Se
2528 2528
2529 if (i < 0) return EINA_FALSE; 2529 if (i < 0) return EINA_FALSE;
2530 2530
2531 ecore_wl_dnd_selection_get(ecore_wl_input_get(), *types); 2531 ecore_wl2_dnd_selection_get(ecore_wl2_window_input_get(win), *types);
2532 } 2532 }
2533 2533
2534 return EINA_TRUE; 2534 return EINA_TRUE;
@@ -2573,7 +2573,7 @@ _wl_elm_cnp_selection_clear(Evas_Object *obj, Elm_Sel_Type selection EINA_UNUSED
2573 ELM_SAFE_FREE(sel->selbuf, free); 2573 ELM_SAFE_FREE(sel->selbuf, free);
2574 sel->buflen = 0; 2574 sel->buflen = 0;
2575 /* sel->clear(); */ 2575 /* sel->clear(); */
2576 ecore_wl_dnd_selection_clear(ecore_wl_input_get()); 2576 ecore_wl2_dnd_selection_clear(ecore_wl2_window_input_get(_wl_elm_widget_window_get(obj)));
2577 2577
2578 return EINA_TRUE; 2578 return EINA_TRUE;
2579} 2579}
@@ -2585,7 +2585,7 @@ _wl_selection_send(void *udata, int type EINA_UNUSED, void *event)
2585 int ret, len_remained; 2585 int ret, len_remained;
2586 int len_written = 0; 2586 int len_written = 0;
2587 Wl_Cnp_Selection *sel = udata; 2587 Wl_Cnp_Selection *sel = udata;
2588 Ecore_Wl_Event_Data_Source_Send *ev = event; 2588 Ecore_Wl2_Event_Data_Source_Send *ev = event;
2589 2589
2590 _wl_elm_cnp_init(); 2590 _wl_elm_cnp_init();
2591 2591
@@ -2609,7 +2609,7 @@ static Eina_Bool
2609_wl_selection_receive(void *udata, int type EINA_UNUSED, void *event) 2609_wl_selection_receive(void *udata, int type EINA_UNUSED, void *event)
2610{ 2610{
2611 Wl_Cnp_Selection *sel = udata; 2611 Wl_Cnp_Selection *sel = udata;
2612 Ecore_Wl_Event_Selection_Data_Ready *ev = event; 2612 Ecore_Wl2_Event_Selection_Data_Ready *ev = event;
2613 2613
2614 _wl_elm_cnp_init(); 2614 _wl_elm_cnp_init();
2615 2615
@@ -2700,9 +2700,9 @@ _wl_elm_cnp_init(void)
2700 if (_init_count > 0) return EINA_TRUE; 2700 if (_init_count > 0) return EINA_TRUE;
2701 _init_count++; 2701 _init_count++;
2702 2702
2703 ecore_event_handler_add(ECORE_WL_EVENT_DATA_SOURCE_SEND, 2703 ecore_event_handler_add(ECORE_WL2_EVENT_DATA_SOURCE_SEND,
2704 _wl_selection_send, &wl_cnp_selection); 2704 _wl_selection_send, &wl_cnp_selection);
2705 ecore_event_handler_add(ECORE_WL_EVENT_SELECTION_DATA_READY, 2705 ecore_event_handler_add(ECORE_WL2_EVENT_SELECTION_DATA_READY,
2706 _wl_selection_receive, &wl_cnp_selection); 2706 _wl_selection_receive, &wl_cnp_selection);
2707 2707
2708 return EINA_TRUE; 2708 return EINA_TRUE;
@@ -2718,12 +2718,12 @@ _wl_elm_dnd_init(void)
2718 2718
2719 text_uri = eina_stringshare_add("text/uri-list"); 2719 text_uri = eina_stringshare_add("text/uri-list");
2720 2720
2721 ecore_event_handler_add(ECORE_WL_EVENT_DATA_SOURCE_SEND, 2721 ecore_event_handler_add(ECORE_WL2_EVENT_DATA_SOURCE_SEND,
2722 _wl_dnd_send, &wl_cnp_selection); 2722 _wl_dnd_send, &wl_cnp_selection);
2723 ecore_event_handler_add(ECORE_WL_EVENT_SELECTION_DATA_READY, 2723 ecore_event_handler_add(ECORE_WL2_EVENT_SELECTION_DATA_READY,
2724 _wl_dnd_receive, &wl_cnp_selection); 2724 _wl_dnd_receive, &wl_cnp_selection);
2725 2725
2726 ecore_event_handler_add(ECORE_WL_EVENT_DND_END, 2726 ecore_event_handler_add(ECORE_WL2_EVENT_DND_END,
2727 _wl_dnd_end, &wl_cnp_selection); 2727 _wl_dnd_end, &wl_cnp_selection);
2728 2728
2729 return EINA_TRUE; 2729 return EINA_TRUE;
@@ -2769,16 +2769,16 @@ _wl_elm_drop_target_add(Evas_Object *obj, Elm_Sel_Format format, Elm_Drag_State
2769 if (first) 2769 if (first)
2770 { 2770 {
2771 handler_enter = 2771 handler_enter =
2772 ecore_event_handler_add(ECORE_WL_EVENT_DND_ENTER, 2772 ecore_event_handler_add(ECORE_WL2_EVENT_DND_ENTER,
2773 _wl_dnd_enter, NULL); 2773 _wl_dnd_enter, NULL);
2774 handler_leave = 2774 handler_leave =
2775 ecore_event_handler_add(ECORE_WL_EVENT_DND_LEAVE, 2775 ecore_event_handler_add(ECORE_WL2_EVENT_DND_LEAVE,
2776 _wl_dnd_leave, NULL); 2776 _wl_dnd_leave, NULL);
2777 handler_pos = 2777 handler_pos =
2778 ecore_event_handler_add(ECORE_WL_EVENT_DND_POSITION, 2778 ecore_event_handler_add(ECORE_WL2_EVENT_DND_MOTION,
2779 _wl_dnd_position, NULL); 2779 _wl_dnd_position, NULL);
2780 handler_drop = 2780 handler_drop =
2781 ecore_event_handler_add(ECORE_WL_EVENT_DND_DROP, 2781 ecore_event_handler_add(ECORE_WL2_EVENT_DND_DROP,
2782 _wl_dnd_drop, NULL); 2782 _wl_dnd_drop, NULL);
2783 _wl_elm_dnd_init(); 2783 _wl_elm_dnd_init();
2784 } 2784 }
@@ -2838,7 +2838,7 @@ _wl_elm_drag_start(Evas_Object *obj, Elm_Sel_Format format, const char *data,
2838 int x, y, x2 = 0, y2 = 0, x3, y3, w = 0, h = 0; 2838 int x, y, x2 = 0, y2 = 0, x3, y3, w = 0, h = 0;
2839 const char *types[CNP_N_ATOMS + 1]; 2839 const char *types[CNP_N_ATOMS + 1];
2840 int i, nb_types = 0; 2840 int i, nb_types = 0;
2841 Ecore_Wl_Window *parent = NULL; 2841 Ecore_Wl2_Window *parent = NULL, *win;
2842 2842
2843 _wl_elm_dnd_init(); 2843 _wl_elm_dnd_init();
2844 2844
@@ -2854,7 +2854,9 @@ _wl_elm_drag_start(Evas_Object *obj, Elm_Sel_Format format, const char *data,
2854 } 2854 }
2855 } 2855 }
2856 types[nb_types] = NULL; 2856 types[nb_types] = NULL;
2857 ecore_wl_dnd_drag_types_set(ecore_wl_input_get(), types); 2857
2858 win = _wl_elm_widget_window_get(obj);
2859 ecore_wl2_dnd_drag_types_set(ecore_wl2_window_input_get(win), types);
2858 2860
2859 /* set the drag data used when a drop occurs */ 2861 /* set the drag data used when a drop occurs */
2860 free(wl_cnp_selection.selbuf); 2862 free(wl_cnp_selection.selbuf);
@@ -2879,8 +2881,9 @@ _wl_elm_drag_start(Evas_Object *obj, Elm_Sel_Format format, const char *data,
2879 elm_win_borderless_set(dragwin, EINA_TRUE); 2881 elm_win_borderless_set(dragwin, EINA_TRUE);
2880 elm_win_override_set(dragwin, EINA_TRUE); 2882 elm_win_override_set(dragwin, EINA_TRUE);
2881 2883
2882 ecore_wl_window_type_set(elm_win_wl_window_get(dragwin), 2884 win = elm_win_wl_window_get(dragwin);
2883 ECORE_WL_WINDOW_TYPE_DND); 2885
2886 ecore_wl2_window_type_set(win, ECORE_WL2_WINDOW_TYPE_DND);
2884 2887
2885 if (createicon) 2888 if (createicon)
2886 { 2889 {
@@ -2938,12 +2941,10 @@ _wl_elm_drag_start(Evas_Object *obj, Elm_Sel_Format format, const char *data,
2938 if (!(ee = ecore_evas_ecore_evas_get(evas))) 2941 if (!(ee = ecore_evas_ecore_evas_get(evas)))
2939 return EINA_FALSE; 2942 return EINA_FALSE;
2940 2943
2941 parent = ecore_evas_wayland_window_get(ee); 2944 parent = ecore_evas_wayland_window_get2(ee);
2942 } 2945 }
2943 2946
2944 ecore_wl_dnd_drag_start(ecore_wl_input_get(), parent, 2947 ecore_wl2_dnd_drag_start(ecore_wl2_window_input_get(win), parent, win);
2945 elm_win_wl_window_get(dragwin),
2946 x3, y3, w, h);
2947 2948
2948 return EINA_TRUE; 2949 return EINA_TRUE;
2949} 2950}
@@ -2958,7 +2959,7 @@ _wl_drag_source_del(void *data EINA_UNUSED, Evas *evas EINA_UNUSED, Evas_Object
2958static Eina_Bool 2959static Eina_Bool
2959_wl_dnd_enter(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) 2960_wl_dnd_enter(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
2960{ 2961{
2961 Ecore_Wl_Event_Dnd_Enter *ev; 2962 Ecore_Wl2_Event_Dnd_Enter *ev;
2962 int i = 0; 2963 int i = 0;
2963 2964
2964 ev = event; 2965 ev = event;
@@ -2996,7 +2997,7 @@ _wl_dnd_enter(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
2996static Eina_Bool 2997static Eina_Bool
2997_wl_dnd_leave(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) 2998_wl_dnd_leave(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
2998{ 2999{
2999 Ecore_Wl_Event_Dnd_Leave *ev; 3000 Ecore_Wl2_Event_Dnd_Leave *ev;
3000 Dropable *drop; 3001 Dropable *drop;
3001 cnp_debug("In\n"); 3002 cnp_debug("In\n");
3002 3003
@@ -3013,16 +3014,16 @@ _wl_dnd_leave(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
3013static Eina_Bool 3014static Eina_Bool
3014_wl_dnd_position(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) 3015_wl_dnd_position(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
3015{ 3016{
3016 Ecore_Wl_Event_Dnd_Position *ev; 3017 Ecore_Wl2_Event_Dnd_Motion *ev;
3017 Dropable *drop; 3018 Dropable *drop;
3018 Eina_Bool will_accept = EINA_FALSE; 3019 Eina_Bool will_accept = EINA_FALSE;
3019 3020
3020 ev = event; 3021 ev = event;
3021 3022
3022 cnp_debug("mouse pos %i %i\n", ev->position.x, ev->position.y); 3023 cnp_debug("mouse pos %i %i\n", ev->x, ev->y);
3023 3024
3024 dragwin_x_end = ev->position.x - _dragx; 3025 dragwin_x_end = ev->x - _dragx;
3025 dragwin_y_end = ev->position.y - _dragy; 3026 dragwin_y_end = ev->y - _dragy;
3026 3027
3027 drop = _wl_dropable_find(ev->win); 3028 drop = _wl_dropable_find(ev->win);
3028 3029
@@ -3030,8 +3031,8 @@ _wl_dnd_position(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
3030 { 3031 {
3031 Evas_Coord x = 0, y = 0; 3032 Evas_Coord x = 0, y = 0;
3032 3033
3033 x = ev->position.x; 3034 x = ev->x;
3034 y = ev->position.y; 3035 y = ev->y;
3035 _dropable_coords_adjust(drop, &x, &y); 3036 _dropable_coords_adjust(drop, &x, &y);
3036 Evas *evas = _wl_evas_get_from_win(ev->win); 3037 Evas *evas = _wl_evas_get_from_win(ev->win);
3037 3038
@@ -3113,14 +3114,15 @@ _wl_dnd_position(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
3113static Eina_Bool 3114static Eina_Bool
3114_wl_dnd_drop(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) 3115_wl_dnd_drop(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
3115{ 3116{
3116 Ecore_Wl_Event_Dnd_Drop *ev; 3117 Ecore_Wl2_Event_Dnd_Drop *ev;
3118 Ecore_Wl2_Window *win;
3117 Dropable *drop; 3119 Dropable *drop;
3118 Eina_List *l; 3120 Eina_List *l;
3119 3121
3120 cnp_debug("In\n"); 3122 cnp_debug("In\n");
3121 ev = event; 3123 ev = event;
3122 savedtypes.x = ev->position.x; 3124 savedtypes.x = ev->x;
3123 savedtypes.y = ev->position.y; 3125 savedtypes.y = ev->y;
3124 3126
3125 EINA_LIST_FOREACH(drops, l, drop) 3127 EINA_LIST_FOREACH(drops, l, drop)
3126 { 3128 {
@@ -3132,12 +3134,16 @@ _wl_dnd_drop(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
3132 EVAS_CALLBACK_DEL, 3134 EVAS_CALLBACK_DEL,
3133 _wl_sel_obj_del2, 3135 _wl_sel_obj_del2,
3134 &wl_cnp_selection); 3136 &wl_cnp_selection);
3135 ecore_wl_dnd_drag_get(ecore_wl_input_get(), drop->last.type); 3137
3138 win = _wl_elm_widget_window_get(drop->obj);
3139 ecore_wl2_dnd_drag_get(ecore_wl2_window_input_get(win),
3140 drop->last.type);
3136 return ECORE_CALLBACK_PASS_ON; 3141 return ECORE_CALLBACK_PASS_ON;
3137 } 3142 }
3138 } 3143 }
3139 3144
3140 ecore_wl_dnd_drag_end(ecore_wl_input_get()); 3145 win = ecore_wl2_display_window_find(_elm_wl_display, ev->win);
3146 ecore_wl2_dnd_drag_end(ecore_wl2_window_input_get(win));
3141 return ECORE_CALLBACK_PASS_ON; 3147 return ECORE_CALLBACK_PASS_ON;
3142} 3148}
3143 3149
@@ -3148,7 +3154,7 @@ _wl_dnd_send(void *data, int type EINA_UNUSED, void *event)
3148 int ret, len_remained; 3154 int ret, len_remained;
3149 int len_written = 0; 3155 int len_written = 0;
3150 Wl_Cnp_Selection *sel; 3156 Wl_Cnp_Selection *sel;
3151 Ecore_Wl_Event_Data_Source_Send *ev; 3157 Ecore_Wl2_Event_Data_Source_Send *ev;
3152 3158
3153 cnp_debug("In\n"); 3159 cnp_debug("In\n");
3154 ev = event; 3160 ev = event;
@@ -3174,7 +3180,7 @@ static Eina_Bool
3174_wl_dnd_receive(void *data, int type EINA_UNUSED, void *event) 3180_wl_dnd_receive(void *data, int type EINA_UNUSED, void *event)
3175{ 3181{
3176 Wl_Cnp_Selection *sel; 3182 Wl_Cnp_Selection *sel;
3177 Ecore_Wl_Event_Selection_Data_Ready *ev; 3183 Ecore_Wl2_Event_Selection_Data_Ready *ev;
3178 cnp_debug("In\n"); 3184 cnp_debug("In\n");
3179 3185
3180 ev = event; 3186 ev = event;
@@ -3199,10 +3205,12 @@ _wl_dnd_receive(void *data, int type EINA_UNUSED, void *event)
3199static Eina_Bool 3205static Eina_Bool
3200_wl_dnd_end(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED) 3206_wl_dnd_end(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
3201{ 3207{
3208 Ecore_Wl2_Event_Dnd_End *ev;
3209 Ecore_Wl2_Window *win;
3210
3202 cnp_debug("In\n"); 3211 cnp_debug("In\n");
3203 /* Ecore_Wl_Event_Dnd_End *ev; */
3204 3212
3205 /* ev = event; */ 3213 ev = event;
3206 3214
3207 if (dragdonecb) dragdonecb(dragdonedata, dragwidget); 3215 if (dragdonecb) dragdonecb(dragdonedata, dragwidget);
3208 3216
@@ -3229,7 +3237,8 @@ _wl_dnd_end(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSE
3229 dragwidget = NULL; 3237 dragwidget = NULL;
3230 doaccept = EINA_FALSE; 3238 doaccept = EINA_FALSE;
3231 3239
3232 ecore_wl_input_ungrab(ecore_wl_input_get()); 3240 win = ecore_wl2_display_window_find(_elm_wl_display, ev->win);
3241 ecore_wl2_input_ungrab(ecore_wl2_window_input_get(win));
3233 3242
3234 return ECORE_CALLBACK_PASS_ON; 3243 return ECORE_CALLBACK_PASS_ON;
3235} 3244}
@@ -3243,17 +3252,21 @@ _wl_dropable_match(Dropable_Cbs *cbs, Dropable *drop, Elm_Sel_Format fmt)
3243static void 3252static void
3244_wl_dropable_data_handle(Wl_Cnp_Selection *sel, char *data, size_t size) 3253_wl_dropable_data_handle(Wl_Cnp_Selection *sel, char *data, size_t size)
3245{ 3254{
3246 cnp_debug("In\n");
3247 Dropable *drop; 3255 Dropable *drop;
3248 Elm_Selection_Data sdata; 3256 Elm_Selection_Data sdata;
3257 Ecore_Wl2_Window *win;
3249 char *s; 3258 char *s;
3250 3259
3260 cnp_debug("In\n");
3261
3251 sdata.action = ELM_XDND_ACTION_COPY; 3262 sdata.action = ELM_XDND_ACTION_COPY;
3252 3263
3253 sdata.len = size; 3264 sdata.len = size;
3254 sdata.x = savedtypes.x; 3265 sdata.x = savedtypes.x;
3255 sdata.y = savedtypes.y; 3266 sdata.y = savedtypes.y;
3256 3267
3268 win = _wl_elm_widget_window_get(sel->requestwidget);
3269
3257 eo_do(sel->requestwidget, drop = eo_key_data_get("__elm_dropable")); 3270 eo_do(sel->requestwidget, drop = eo_key_data_get("__elm_dropable"));
3258 if (drop) 3271 if (drop)
3259 { 3272 {
@@ -3267,7 +3280,7 @@ _wl_dropable_data_handle(Wl_Cnp_Selection *sel, char *data, size_t size)
3267 savedtypes.textreq || _wl_dropable_match(cbs, drop, ELM_SEL_FORMAT_TEXT)); 3280 savedtypes.textreq || _wl_dropable_match(cbs, drop, ELM_SEL_FORMAT_TEXT));
3268 if (!s) 3281 if (!s)
3269 { 3282 {
3270 ecore_wl_dnd_drag_end(ecore_wl_input_get()); 3283 ecore_wl2_dnd_drag_end(ecore_wl2_window_input_get(win));
3271 return; 3284 return;
3272 } 3285 }
3273 3286
@@ -3287,7 +3300,8 @@ _wl_dropable_data_handle(Wl_Cnp_Selection *sel, char *data, size_t size)
3287 } 3300 }
3288 } 3301 }
3289 } 3302 }
3290 ecore_wl_dnd_drag_end(ecore_wl_input_get()); 3303
3304 ecore_wl2_dnd_drag_end(ecore_wl2_window_input_get(win));
3291 savedtypes.textreq = 0; 3305 savedtypes.textreq = 0;
3292} 3306}
3293 3307
@@ -3296,11 +3310,17 @@ _wl_dropable_find(unsigned int win)
3296{ 3310{
3297 Eina_List *l; 3311 Eina_List *l;
3298 Dropable *dropable; 3312 Dropable *dropable;
3313 Ecore_Wl2_Window *window;
3299 3314
3300 if (!drops) return NULL; 3315 if (!drops) return NULL;
3316
3317 window = ecore_wl2_display_window_find(_elm_wl_display, win);
3318 if (!window) return NULL;
3319
3301 EINA_LIST_FOREACH(drops, l, dropable) 3320 EINA_LIST_FOREACH(drops, l, dropable)
3302 if (_wl_elm_widget_window_get(dropable->obj) == win) 3321 if (_wl_elm_widget_window_get(dropable->obj) == window)
3303 return dropable; 3322 return dropable;
3323
3304 return NULL; 3324 return NULL;
3305} 3325}
3306 3326
@@ -3362,10 +3382,14 @@ _wl_dropable_all_clean(unsigned int win)
3362{ 3382{
3363 Eina_List *l; 3383 Eina_List *l;
3364 Dropable *dropable; 3384 Dropable *dropable;
3385 Ecore_Wl2_Window *window;
3386
3387 window = ecore_wl2_display_window_find(_elm_wl_display, win);
3388 if (!window) return;
3365 3389
3366 EINA_LIST_FOREACH(drops, l, dropable) 3390 EINA_LIST_FOREACH(drops, l, dropable)
3367 { 3391 {
3368 if (_wl_elm_widget_window_get(dropable->obj) == win) 3392 if (_wl_elm_widget_window_get(dropable->obj) == window)
3369 { 3393 {
3370 dropable->last.x = 0; 3394 dropable->last.x = 0;
3371 dropable->last.y = 0; 3395 dropable->last.y = 0;
@@ -3413,11 +3437,11 @@ _wl_drops_accept(const char *type)
3413 return will_accept; 3437 return will_accept;
3414} 3438}
3415 3439
3416static unsigned int 3440static Ecore_Wl2_Window *
3417_wl_elm_widget_window_get(const Evas_Object *obj) 3441_wl_elm_widget_window_get(const Evas_Object *obj)
3418{ 3442{
3419 Evas_Object *top; 3443 Evas_Object *top;
3420 Ecore_Wl_Window *win = NULL; 3444 Ecore_Wl2_Window *win = NULL;
3421 3445
3422 if (elm_widget_is(obj)) 3446 if (elm_widget_is(obj))
3423 { 3447 {
@@ -3433,26 +3457,26 @@ _wl_elm_widget_window_get(const Evas_Object *obj)
3433 const char *engine_name; 3457 const char *engine_name;
3434 3458
3435 if (!(evas = evas_object_evas_get(obj))) 3459 if (!(evas = evas_object_evas_get(obj)))
3436 return 0; 3460 return NULL;
3437 if (!(ee = ecore_evas_ecore_evas_get(evas))) 3461 if (!(ee = ecore_evas_ecore_evas_get(evas)))
3438 return 0; 3462 return NULL;
3439 3463
3440 engine_name = ecore_evas_engine_name_get(ee); 3464 engine_name = ecore_evas_engine_name_get(ee);
3441 if (!strcmp(engine_name, ELM_BUFFER)) 3465 if (!strcmp(engine_name, ELM_BUFFER))
3442 { 3466 {
3443 ee = ecore_evas_buffer_ecore_evas_parent_get(ee); 3467 ee = ecore_evas_buffer_ecore_evas_parent_get(ee);
3444 if (!ee) return 0; 3468 if (!ee) return NULL;
3445 win = ecore_evas_wayland_window_get(ee); 3469 win = ecore_evas_wayland_window_get2(ee);
3446 } 3470 }
3447 else if (!strncmp(engine_name, "wayland", sizeof("wayland") - 1)) 3471 else if (!strncmp(engine_name, "wayland", sizeof("wayland") - 1))
3448 { 3472 {
3449 /* In case the engine is not a buffer, we want to check once. */ 3473 /* In case the engine is not a buffer, we want to check once. */
3450 win = ecore_evas_wayland_window_get(ee); 3474 win = ecore_evas_wayland_window_get2(ee);
3451 if (!win) return 0; 3475 if (!win) return NULL;
3452 } 3476 }
3453 } 3477 }
3454 3478
3455 return ecore_wl_window_id_get(win); 3479 return win;
3456} 3480}
3457 3481
3458#endif 3482#endif
@@ -3832,7 +3856,7 @@ elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection,
3832 if (xwin) 3856 if (xwin)
3833 return _x11_elm_cnp_selection_set(xwin, obj, selection, format, selbuf, buflen); 3857 return _x11_elm_cnp_selection_set(xwin, obj, selection, format, selbuf, buflen);
3834#endif 3858#endif
3835#ifdef HAVE_ELEMENTARY_WAYLAND 3859#ifdef HAVE_ELEMENTARY_WL2
3836 if (_wl_elm_widget_window_get(obj)) 3860 if (_wl_elm_widget_window_get(obj))
3837 return _wl_elm_cnp_selection_set(obj, selection, format, selbuf, buflen); 3861 return _wl_elm_cnp_selection_set(obj, selection, format, selbuf, buflen);
3838#endif 3862#endif
@@ -3850,7 +3874,7 @@ elm_cnp_selection_loss_callback_set(Evas_Object *obj, Elm_Sel_Type selection,
3850 if (_x11_elm_widget_xwin_get(obj)) 3874 if (_x11_elm_widget_xwin_get(obj))
3851 _x11_elm_cnp_selection_loss_callback_set(obj, selection, func, data); 3875 _x11_elm_cnp_selection_loss_callback_set(obj, selection, func, data);
3852#endif 3876#endif
3853#ifdef HAVE_ELEMENTARY_WAYLAND 3877#ifdef HAVE_ELEMENTARY_WL2
3854 if (_wl_elm_widget_window_get(obj)) 3878 if (_wl_elm_widget_window_get(obj))
3855 _wl_elm_cnp_selection_loss_callback_set(obj, selection, func, data); 3879 _wl_elm_cnp_selection_loss_callback_set(obj, selection, func, data);
3856#endif 3880#endif
@@ -3866,7 +3890,7 @@ elm_object_cnp_selection_clear(Evas_Object *obj, Elm_Sel_Type selection)
3866 if (_x11_elm_widget_xwin_get(obj)) 3890 if (_x11_elm_widget_xwin_get(obj))
3867 return _x11_elm_object_cnp_selection_clear(obj, selection); 3891 return _x11_elm_object_cnp_selection_clear(obj, selection);
3868#endif 3892#endif
3869#ifdef HAVE_ELEMENTARY_WAYLAND 3893#ifdef HAVE_ELEMENTARY_WL2
3870 if (_wl_elm_widget_window_get(obj)) 3894 if (_wl_elm_widget_window_get(obj))
3871 return _wl_elm_cnp_selection_clear(obj, selection); 3895 return _wl_elm_cnp_selection_clear(obj, selection);
3872#endif 3896#endif
@@ -3884,7 +3908,7 @@ elm_cnp_selection_get(const Evas_Object *obj, Elm_Sel_Type selection,
3884 if (xwin) 3908 if (xwin)
3885 return _x11_elm_cnp_selection_get(xwin, obj, selection, format, datacb, udata); 3909 return _x11_elm_cnp_selection_get(xwin, obj, selection, format, datacb, udata);
3886#endif 3910#endif
3887#ifdef HAVE_ELEMENTARY_WAYLAND 3911#ifdef HAVE_ELEMENTARY_WL2
3888 if (_wl_elm_widget_window_get(obj)) 3912 if (_wl_elm_widget_window_get(obj))
3889 return _wl_elm_cnp_selection_get(obj, selection, format, datacb, udata); 3913 return _wl_elm_cnp_selection_get(obj, selection, format, datacb, udata);
3890#endif 3914#endif
@@ -3910,7 +3934,7 @@ elm_drop_target_add(Evas_Object *obj, Elm_Sel_Format format,
3910 leavecb, leavedata, poscb, posdata, 3934 leavecb, leavedata, poscb, posdata,
3911 dropcb, dropdata); 3935 dropcb, dropdata);
3912#endif 3936#endif
3913#ifdef HAVE_ELEMENTARY_WAYLAND 3937#ifdef HAVE_ELEMENTARY_WL2
3914 if (_wl_elm_widget_window_get(obj)) 3938 if (_wl_elm_widget_window_get(obj))
3915 return _wl_elm_drop_target_add(obj, format, entercb, enterdata, 3939 return _wl_elm_drop_target_add(obj, format, entercb, enterdata,
3916 leavecb, leavedata, poscb, posdata, 3940 leavecb, leavedata, poscb, posdata,
@@ -3934,7 +3958,7 @@ elm_drop_target_del(Evas_Object *obj, Elm_Sel_Format format,
3934 return _x11_elm_drop_target_del(obj, format, entercb, enterdata, 3958 return _x11_elm_drop_target_del(obj, format, entercb, enterdata,
3935 leavecb, leavedata, poscb, posdata, dropcb, dropdata); 3959 leavecb, leavedata, poscb, posdata, dropcb, dropdata);
3936#endif 3960#endif
3937#ifdef HAVE_ELEMENTARY_WAYLAND 3961#ifdef HAVE_ELEMENTARY_WL2
3938 if (_wl_elm_widget_window_get(obj)) 3962 if (_wl_elm_widget_window_get(obj))
3939 return _wl_elm_drop_target_del(obj, format, entercb, enterdata, 3963 return _wl_elm_drop_target_del(obj, format, entercb, enterdata,
3940 leavecb, leavedata, poscb, posdata, dropcb, dropdata); 3964 leavecb, leavedata, poscb, posdata, dropcb, dropdata);
@@ -3967,7 +3991,7 @@ elm_drag_start(Evas_Object *obj, Elm_Sel_Format format, const char *data,
3967 acceptcb, acceptdata, 3991 acceptcb, acceptdata,
3968 dragdone, donecbdata); 3992 dragdone, donecbdata);
3969#endif 3993#endif
3970#ifdef HAVE_ELEMENTARY_WAYLAND 3994#ifdef HAVE_ELEMENTARY_WL2
3971 if (_wl_elm_widget_window_get(obj)) 3995 if (_wl_elm_widget_window_get(obj))
3972 return _wl_elm_drag_start(obj, format, data, action, 3996 return _wl_elm_drag_start(obj, format, data, action,
3973 createicon, createdata, 3997 createicon, createdata,
@@ -3990,7 +4014,7 @@ elm_drag_action_set(Evas_Object *obj, Elm_Xdnd_Action action)
3990 if (_x11_elm_widget_xwin_get(obj)) 4014 if (_x11_elm_widget_xwin_get(obj))
3991 return _x11_elm_drag_action_set(obj, action); 4015 return _x11_elm_drag_action_set(obj, action);
3992#endif 4016#endif
3993#ifdef HAVE_ELEMENTARY_WAYLAND 4017#ifdef HAVE_ELEMENTARY_WL2
3994 if (_wl_elm_widget_window_get(obj)) 4018 if (_wl_elm_widget_window_get(obj))
3995 return _wl_elm_drag_action_set(obj, action); 4019 return _wl_elm_drag_action_set(obj, action);
3996#endif 4020#endif
@@ -4005,9 +4029,12 @@ elm_selection_selection_has_owner(Evas_Object *obj)
4005 if (_x11_elm_widget_xwin_get(obj)) 4029 if (_x11_elm_widget_xwin_get(obj))
4006 return _x11_elm_selection_selection_has_owner(obj); 4030 return _x11_elm_selection_selection_has_owner(obj);
4007#endif 4031#endif
4008#ifdef HAVE_ELEMENTARY_WAYLAND 4032#ifdef HAVE_ELEMENTARY_WL2
4009 if (_wl_elm_widget_window_get(obj)) 4033 Ecore_Wl2_Window *win;
4010 return ecore_wl_dnd_selection_owner_has(ecore_wl_input_get()); 4034
4035 win = _wl_elm_widget_window_get(obj);
4036 if (win)
4037 return ecore_wl2_dnd_selection_owner_has(ecore_wl2_window_input_get(win));
4011#endif 4038#endif
4012 return _local_elm_selection_selection_has_owner(obj); 4039 return _local_elm_selection_selection_has_owner(obj);
4013} 4040}
@@ -4491,9 +4518,12 @@ elm_drag_cancel(Evas_Object *obj)
4491 goto end; 4518 goto end;
4492 } 4519 }
4493#endif 4520#endif
4494#ifdef HAVE_ELEMENTARY_WAYLAND 4521#ifdef HAVE_ELEMENTARY_WL2
4495 if (_wl_elm_widget_window_get(obj)) 4522 Ecore_Wl2_Window *win;
4496 ecore_wl_dnd_drag_end(ecore_wl_input_get()); 4523
4524 win = _wl_elm_widget_window_get(obj);
4525 if (win)
4526 ecore_wl2_dnd_drag_end(ecore_wl2_window_input_get(win));
4497#endif 4527#endif
4498 4528
4499end: 4529end: