summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Michael <devilhorns@comcast.net>2020-05-18 09:58:43 -0400
committerChristopher Michael <devilhorns@comcast.net>2020-05-18 09:58:43 -0400
commit783e99081999601b13a0bf90e496bfb95957a814 (patch)
tree7a68e07c1c72b0d3661e4712db45c457b8a11f28
parent63b5d81983374838194b6335cc1c7b5ab9db749a (diff)
ecore-evas-wayland: Fix formatting according to coding conventions
"80 column code whenever possible - Wrap longer lines where required." NB: No functional changes
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c237
1 files changed, 159 insertions, 78 deletions
diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
index bd1022e3e5..0331c2a56c 100644
--- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
+++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c
@@ -140,7 +140,8 @@ _ecore_evas_wl_common_cb_mouse_out(void *data EINA_UNUSED, int type EINA_UNUSED,
140 ev = event; 140 ev = event;
141 ee = ecore_event_window_match((Ecore_Window)ev->window); 141 ee = ecore_event_window_match((Ecore_Window)ev->window);
142 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; 142 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
143 if ((Ecore_Window)ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 143 if ((Ecore_Window)ev->window != ee->prop.window)
144 return ECORE_CALLBACK_PASS_ON;
144 if (!_ecore_evas_mouse_in_check(ee, ev->dev)) return ECORE_CALLBACK_PASS_ON; 145 if (!_ecore_evas_mouse_in_check(ee, ev->dev)) return ECORE_CALLBACK_PASS_ON;
145 146
146 ecore_event_evas_seat_modifier_lock_update(ee->evas, 147 ecore_event_evas_seat_modifier_lock_update(ee->evas,
@@ -162,7 +163,8 @@ _ecore_evas_wl_common_cb_focus_in(void *data EINA_UNUSED, int type EINA_UNUSED,
162 ev = event; 163 ev = event;
163 ee = ecore_event_window_match((Ecore_Window)ev->window); 164 ee = ecore_event_window_match((Ecore_Window)ev->window);
164 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; 165 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
165 if ((Ecore_Window)ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 166 if ((Ecore_Window)ev->window != ee->prop.window)
167 return ECORE_CALLBACK_PASS_ON;
166 _ecore_evas_focus_device_set(ee, ev->dev, EINA_TRUE); 168 _ecore_evas_focus_device_set(ee, ev->dev, EINA_TRUE);
167 return ECORE_CALLBACK_PASS_ON; 169 return ECORE_CALLBACK_PASS_ON;
168} 170}
@@ -178,7 +180,8 @@ _ecore_evas_wl_common_cb_focus_out(void *data EINA_UNUSED, int type EINA_UNUSED,
178 ev = event; 180 ev = event;
179 ee = ecore_event_window_match((Ecore_Window)ev->window); 181 ee = ecore_event_window_match((Ecore_Window)ev->window);
180 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; 182 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
181 if ((Ecore_Window)ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 183 if ((Ecore_Window)ev->window != ee->prop.window)
184 return ECORE_CALLBACK_PASS_ON;
182 _ecore_evas_focus_device_set(ee, ev->dev, EINA_FALSE); 185 _ecore_evas_focus_device_set(ee, ev->dev, EINA_FALSE);
183 return ECORE_CALLBACK_PASS_ON; 186 return ECORE_CALLBACK_PASS_ON;
184} 187}
@@ -284,9 +287,7 @@ _ecore_evas_wayland_window_update(Ecore_Evas *ee, Ecore_Evas_Engine_Wl_Data *wda
284 */ 287 */
285 else if (!ee->alpha) 288 else if (!ee->alpha)
286 { 289 {
287 ecore_wl2_window_opaque_region_set(wdata->win, 290 ecore_wl2_window_opaque_region_set(wdata->win, 0, 0, fullw, fullh);
288 0, 0,
289 fullw, fullh);
290 } 291 }
291 /* alpha is set and we might use it, so we'd better clear the 292 /* alpha is set and we might use it, so we'd better clear the
292 * opaque region, let the compositor blend it all. 293 * opaque region, let the compositor blend it all.
@@ -304,9 +305,9 @@ _ecore_evas_wayland_window_update(Ecore_Evas *ee, Ecore_Evas_Engine_Wl_Data *wda
304 if (!change) return; 305 if (!change) return;
305 306
306 if (ECORE_EVAS_PORTRAIT(ee)) 307 if (ECORE_EVAS_PORTRAIT(ee))
307 evas_damage_rectangle_add(ee->evas, 0, 0, fullw, fullh); 308 evas_damage_rectangle_add(ee->evas, 0, 0, fullw, fullh);
308 else 309 else
309 evas_damage_rectangle_add(ee->evas, 0, 0, fullh, fullw); 310 evas_damage_rectangle_add(ee->evas, 0, 0, fullh, fullw);
310 311
311 ee->shadow.changed = EINA_FALSE; 312 ee->shadow.changed = EINA_FALSE;
312} 313}
@@ -337,25 +338,33 @@ _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
337 ee->w = w; 338 ee->w = w;
338 ee->h = h; 339 ee->h = h;
339 340
340 if (wdata->win->xdg_set_min_size && wdata->win->xdg_toplevel && wdata->win->pending.min) 341 if (wdata->win->xdg_set_min_size && wdata->win->xdg_toplevel &&
342 wdata->win->pending.min)
341 { 343 {
342 wdata->win->xdg_set_min_size(wdata->win->xdg_toplevel, ee->prop.min.w + fw, ee->prop.min.h + fh); 344 wdata->win->xdg_set_min_size(wdata->win->xdg_toplevel,
345 ee->prop.min.w + fw, ee->prop.min.h + fh);
343 wdata->win->pending.min = 0; 346 wdata->win->pending.min = 0;
344 } 347 }
345 if (wdata->win->xdg_set_max_size && wdata->win->xdg_toplevel && wdata->win->pending.max) 348 if (wdata->win->xdg_set_max_size && wdata->win->xdg_toplevel &&
349 wdata->win->pending.max)
346 { 350 {
347 wdata->win->xdg_set_max_size(wdata->win->xdg_toplevel, ee->prop.max.w + fw, ee->prop.max.h + fh); 351 wdata->win->xdg_set_max_size(wdata->win->xdg_toplevel,
352 ee->prop.max.w + fw, ee->prop.max.h + fh);
348 wdata->win->pending.max = 0; 353 wdata->win->pending.max = 0;
349 } 354 }
350 355
351 if (wdata->win->zxdg_set_min_size && wdata->win->zxdg_toplevel && wdata->win->pending.min) 356 if (wdata->win->zxdg_set_min_size && wdata->win->zxdg_toplevel &&
357 wdata->win->pending.min)
352 { 358 {
353 wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel, ee->prop.min.w + fw, ee->prop.min.h + fh); 359 wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel,
360 ee->prop.min.w + fw, ee->prop.min.h + fh);
354 wdata->win->pending.min = 0; 361 wdata->win->pending.min = 0;
355 } 362 }
356 if (wdata->win->zxdg_set_max_size && wdata->win->zxdg_toplevel && wdata->win->pending.max) 363 if (wdata->win->zxdg_set_max_size && wdata->win->zxdg_toplevel &&
364 wdata->win->pending.max)
357 { 365 {
358 wdata->win->zxdg_set_max_size(wdata->win->zxdg_toplevel, ee->prop.max.w + fw, ee->prop.max.h + fh); 366 wdata->win->zxdg_set_max_size(wdata->win->zxdg_toplevel,
367 ee->prop.max.w + fw, ee->prop.max.h + fh);
359 wdata->win->pending.max = 0; 368 wdata->win->pending.max = 0;
360 } 369 }
361 370
@@ -390,7 +399,8 @@ _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
390 h = (bh + (((h - bh) / ee->prop.step.h) * ee->prop.step.h)); 399 h = (bh + (((h - bh) / ee->prop.step.h) * ee->prop.step.h));
391 } 400 }
392 401
393 if (!wdata->win->display->wl.efl_hints && EINA_DBL_NONZERO(ee->prop.aspect)) 402 if (!wdata->win->display->wl.efl_hints &&
403 EINA_DBL_NONZERO(ee->prop.aspect))
394 { 404 {
395 /* copied from e_client.c */ 405 /* copied from e_client.c */
396 Evas_Aspect_Control aspect; 406 Evas_Aspect_Control aspect;
@@ -458,9 +468,9 @@ _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
458 } 468 }
459 469
460 if (ECORE_EVAS_PORTRAIT(ee)) 470 if (ECORE_EVAS_PORTRAIT(ee))
461 evas_output_size_get(ee->evas, &ow, &oh); 471 evas_output_size_get(ee->evas, &ow, &oh);
462 else 472 else
463 evas_output_size_get(ee->evas, &oh, &ow); 473 evas_output_size_get(ee->evas, &oh, &ow);
464 474
465 if (ECORE_EVAS_PORTRAIT(ee) && ((ow != w) || (oh != h))) 475 if (ECORE_EVAS_PORTRAIT(ee) && ((ow != w) || (oh != h)))
466 diff = 1; 476 diff = 1;
@@ -584,9 +594,11 @@ _ecore_evas_wl_common_cb_window_configure(void *data EINA_UNUSED, int type EINA_
584 prev_max = ee->prop.maximized; 594 prev_max = ee->prop.maximized;
585 prev_full = ee->prop.fullscreen; 595 prev_full = ee->prop.fullscreen;
586 ee->prop.maximized = 596 ee->prop.maximized =
587 (ev->states & ECORE_WL2_WINDOW_STATE_MAXIMIZED) == ECORE_WL2_WINDOW_STATE_MAXIMIZED; 597 (ev->states & ECORE_WL2_WINDOW_STATE_MAXIMIZED) ==
598 ECORE_WL2_WINDOW_STATE_MAXIMIZED;
588 ee->prop.fullscreen = 599 ee->prop.fullscreen =
589 (ev->states & ECORE_WL2_WINDOW_STATE_FULLSCREEN) == ECORE_WL2_WINDOW_STATE_FULLSCREEN; 600 (ev->states & ECORE_WL2_WINDOW_STATE_FULLSCREEN) ==
601 ECORE_WL2_WINDOW_STATE_FULLSCREEN;
590 active = wdata->activated; 602 active = wdata->activated;
591 wdata->activated = ecore_wl2_window_activated_get(wdata->win); 603 wdata->activated = ecore_wl2_window_activated_get(wdata->win);
592 604
@@ -750,8 +762,10 @@ _ecore_evas_wl_common_cb_aux_hint_supported(void *data EINA_UNUSED, int type EI
750 if (!ee) return ECORE_CALLBACK_PASS_ON; 762 if (!ee) return ECORE_CALLBACK_PASS_ON;
751 if ((Ecore_Window)ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 763 if ((Ecore_Window)ev->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
752 wdata = ee->engine.data; 764 wdata = ee->engine.data;
753 EINA_LIST_FREE(ee->prop.aux_hint.supported_list, hint) eina_stringshare_del(hint); 765 EINA_LIST_FREE(ee->prop.aux_hint.supported_list, hint)
754 ee->prop.aux_hint.supported_list = ecore_wl2_window_aux_hints_supported_get(wdata->win); 766 eina_stringshare_del(hint);
767 ee->prop.aux_hint.supported_list =
768 ecore_wl2_window_aux_hints_supported_get(wdata->win);
755 return ECORE_CALLBACK_RENEW; 769 return ECORE_CALLBACK_RENEW;
756} 770}
757 771
@@ -963,7 +977,8 @@ _ecore_evas_wl_common_cb_www_drag(void *d EINA_UNUSED, int t EINA_UNUSED, void *
963 977
964 ee = ecore_event_window_match((Ecore_Window)ev->window); 978 ee = ecore_event_window_match((Ecore_Window)ev->window);
965 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; 979 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
966 if ((Ecore_Window)ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 980 if ((Ecore_Window)ev->window != ee->prop.window)
981 return ECORE_CALLBACK_PASS_ON;
967 982
968 wdata = ee->engine.data; 983 wdata = ee->engine.data;
969 wdata->dragging = !!ev->dragging; 984 wdata->dragging = !!ev->dragging;
@@ -981,7 +996,8 @@ _ecore_evas_wl_common_cb_www(void *d EINA_UNUSED, int t EINA_UNUSED, void *event
981 996
982 ee = ecore_event_window_match((Ecore_Window)ev->window); 997 ee = ecore_event_window_match((Ecore_Window)ev->window);
983 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; 998 if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON;
984 if ((Ecore_Window)ev->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; 999 if ((Ecore_Window)ev->window != ee->prop.window)
1000 return ECORE_CALLBACK_PASS_ON;
985 1001
986 wdata = ee->engine.data; 1002 wdata = ee->engine.data;
987 wdata->x_rel += ev->x_rel; 1003 wdata->x_rel += ev->x_rel;
@@ -1060,7 +1076,7 @@ _ecore_evas_wl_common_cb_global_added(void *d EINA_UNUSED, int t EINA_UNUSED, vo
1060 EE_Wl_Device *device; 1076 EE_Wl_Device *device;
1061 1077
1062 if ((!ev->interface) || (strcmp(ev->interface, "wl_seat"))) 1078 if ((!ev->interface) || (strcmp(ev->interface, "wl_seat")))
1063 return ECORE_CALLBACK_PASS_ON; 1079 return ECORE_CALLBACK_PASS_ON;
1064 1080
1065 EINA_LIST_FOREACH(ee_list, l, ee) 1081 EINA_LIST_FOREACH(ee_list, l, ee)
1066 { 1082 {
@@ -1109,7 +1125,7 @@ _ecore_evas_wl_common_cb_global_removed(void *d EINA_UNUSED, int t EINA_UNUSED,
1109 Eina_List *l, *ll; 1125 Eina_List *l, *ll;
1110 1126
1111 if ((!ev->interface) || (strcmp(ev->interface, "wl_seat"))) 1127 if ((!ev->interface) || (strcmp(ev->interface, "wl_seat")))
1112 return ECORE_CALLBACK_PASS_ON; 1128 return ECORE_CALLBACK_PASS_ON;
1113 1129
1114 EINA_LIST_FOREACH(ee_list, l, ee) 1130 EINA_LIST_FOREACH(ee_list, l, ee)
1115 { 1131 {
@@ -1438,7 +1454,7 @@ _ecore_evas_wl_common_free(Ecore_Evas *ee)
1438 ecore_wl2_display_disconnect(wdata->display); 1454 ecore_wl2_display_disconnect(wdata->display);
1439 1455
1440 EINA_LIST_FREE(wdata->devices_list, device) 1456 EINA_LIST_FREE(wdata->devices_list, device)
1441 free(device); 1457 free(device);
1442 1458
1443 free(wdata); 1459 free(wdata);
1444 1460
@@ -1517,7 +1533,9 @@ _ecore_evas_wl_common_pointer_xy_get(const Ecore_Evas *ee, Evas_Coord *x, Evas_C
1517 LOGFN; 1533 LOGFN;
1518 1534
1519 wdata = ee->engine.data; 1535 wdata = ee->engine.data;
1520 input = ecore_wl2_display_input_find_by_name(ecore_wl2_window_display_get(wdata->win), "default"); 1536 input =
1537 ecore_wl2_display_input_find_by_name
1538 (ecore_wl2_window_display_get(wdata->win), "default");
1521 if (input) ecore_wl2_input_pointer_xy_get(input, x, y); 1539 if (input) ecore_wl2_input_pointer_xy_get(input, x, y);
1522} 1540}
1523 1541
@@ -1594,7 +1612,9 @@ _ecore_evas_wl_common_pointer_device_xy_get(const Ecore_Evas *ee, const Efl_Inpu
1594 wdata = ee->engine.data; 1612 wdata = ee->engine.data;
1595 seat = evas_device_parent_get(pointer); 1613 seat = evas_device_parent_get(pointer);
1596 EINA_SAFETY_ON_NULL_RETURN(seat); 1614 EINA_SAFETY_ON_NULL_RETURN(seat);
1597 input = ecore_wl2_display_input_find(ecore_wl2_window_display_get(wdata->win), evas_device_seat_id_get(seat)); 1615 input =
1616 ecore_wl2_display_input_find
1617 (ecore_wl2_window_display_get(wdata->win), evas_device_seat_id_get(seat));
1598 EINA_SAFETY_ON_NULL_RETURN(input); 1618 EINA_SAFETY_ON_NULL_RETURN(input);
1599 ecore_wl2_input_pointer_xy_get(input, x, y); 1619 ecore_wl2_input_pointer_xy_get(input, x, y);
1600} 1620}
@@ -1608,7 +1628,8 @@ _ecore_evas_wl_common_aux_hints_supported_update(Ecore_Evas *ee)
1608 1628
1609 if (!ee) return; 1629 if (!ee) return;
1610 wdata = ee->engine.data; 1630 wdata = ee->engine.data;
1611 ee->prop.aux_hint.supported_list = ecore_wl2_window_aux_hints_supported_get(wdata->win); 1631 ee->prop.aux_hint.supported_list =
1632 ecore_wl2_window_aux_hints_supported_get(wdata->win);
1612} 1633}
1613 1634
1614static void 1635static void
@@ -1776,7 +1797,9 @@ _ecore_evas_wl_common_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int la
1776 1797
1777 wdata = ee->engine.data; 1798 wdata = ee->engine.data;
1778 if (obj == _ecore_evas_default_cursor_image_get(ee)) return; 1799 if (obj == _ecore_evas_default_cursor_image_get(ee)) return;
1779 input = ecore_wl2_display_input_find_by_name(ecore_wl2_window_display_get(wdata->win), "default"); 1800 input =
1801 ecore_wl2_display_input_find_by_name
1802 (ecore_wl2_window_display_get(wdata->win), "default");
1780 if (input) ecore_wl2_input_pointer_set(input, NULL, hot_x, hot_y); 1803 if (input) ecore_wl2_input_pointer_set(input, NULL, hot_x, hot_y);
1781} 1804}
1782 1805
@@ -2146,24 +2169,36 @@ _ecore_evas_wl_common_show(Ecore_Evas *ee)
2146 int fw, fh; 2169 int fw, fh;
2147 2170
2148 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh); 2171 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
2149 if (wdata->win->xdg_set_min_size && wdata->win->xdg_toplevel && wdata->win->pending.min) 2172 if (wdata->win->xdg_set_min_size && wdata->win->xdg_toplevel &&
2173 wdata->win->pending.min)
2150 { 2174 {
2151 wdata->win->xdg_set_min_size(wdata->win->xdg_toplevel, ee->prop.min.w + fw, ee->prop.min.h + fh); 2175 wdata->win->xdg_set_min_size(wdata->win->xdg_toplevel,
2176 ee->prop.min.w + fw,
2177 ee->prop.min.h + fh);
2152 wdata->win->pending.min = 0; 2178 wdata->win->pending.min = 0;
2153 } 2179 }
2154 if (wdata->win->xdg_set_max_size && wdata->win->xdg_toplevel && wdata->win->pending.max) 2180 if (wdata->win->xdg_set_max_size && wdata->win->xdg_toplevel &&
2181 wdata->win->pending.max)
2155 { 2182 {
2156 wdata->win->xdg_set_max_size(wdata->win->xdg_toplevel, ee->prop.max.w + fw, ee->prop.max.h + fh); 2183 wdata->win->xdg_set_max_size(wdata->win->xdg_toplevel,
2184 ee->prop.max.w + fw,
2185 ee->prop.max.h + fh);
2157 wdata->win->pending.max = 0; 2186 wdata->win->pending.max = 0;
2158 } 2187 }
2159 if (wdata->win->zxdg_set_min_size && wdata->win->zxdg_toplevel && wdata->win->pending.min) 2188 if (wdata->win->zxdg_set_min_size && wdata->win->zxdg_toplevel &&
2189 wdata->win->pending.min)
2160 { 2190 {
2161 wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel, ee->prop.min.w + fw, ee->prop.min.h + fh); 2191 wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel,
2192 ee->prop.min.w + fw,
2193 ee->prop.min.h + fh);
2162 wdata->win->pending.min = 0; 2194 wdata->win->pending.min = 0;
2163 } 2195 }
2164 if (wdata->win->zxdg_set_max_size && wdata->win->zxdg_toplevel && wdata->win->pending.max) 2196 if (wdata->win->zxdg_set_max_size && wdata->win->zxdg_toplevel &&
2197 wdata->win->pending.max)
2165 { 2198 {
2166 wdata->win->zxdg_set_max_size(wdata->win->zxdg_toplevel, ee->prop.max.w + fw, ee->prop.max.h + fh); 2199 wdata->win->zxdg_set_max_size(wdata->win->zxdg_toplevel,
2200 ee->prop.max.w + fw,
2201 ee->prop.max.h + fh);
2167 wdata->win->pending.max = 0; 2202 wdata->win->pending.max = 0;
2168 } 2203 }
2169 2204
@@ -2382,15 +2417,20 @@ static void
2382_reeval_seat(unsigned int *seat, Ecore_Evas *ee) 2417_reeval_seat(unsigned int *seat, Ecore_Evas *ee)
2383{ 2418{
2384 if (*seat == 0) 2419 if (*seat == 0)
2385 *seat = evas_device_seat_id_get(evas_default_device_get(ee->evas, EFL_INPUT_DEVICE_TYPE_SEAT)); 2420 {
2421 *seat =
2422 evas_device_seat_id_get(evas_default_device_get
2423 (ee->evas, EFL_INPUT_DEVICE_TYPE_SEAT));
2424 }
2386} 2425}
2387 2426
2388static inline void 2427static inline void
2389_clear_selection(Ecore_Evas *ee, unsigned int seat, Ecore_Evas_Selection_Buffer selection) 2428_clear_selection(Ecore_Evas *ee, unsigned int seat, Ecore_Evas_Selection_Buffer selection)
2390{ 2429{
2391 Ecore_Evas_Engine_Wl_Data *edata = ee->engine.data; 2430 Ecore_Evas_Engine_Wl_Data *edata = ee->engine.data;
2392 Ecore_Evas_Selection_Callbacks *cbs = &edata->selection_data[selection].callbacks; 2431 Ecore_Evas_Selection_Callbacks *cbs;
2393 2432
2433 cbs = &edata->selection_data[selection].callbacks;
2394 EINA_SAFETY_ON_FALSE_RETURN(cbs->cancel); 2434 EINA_SAFETY_ON_FALSE_RETURN(cbs->cancel);
2395 2435
2396 cbs->cancel(ee, seat, selection); 2436 cbs->cancel(ee, seat, selection);
@@ -2435,7 +2475,8 @@ _ecore_evas_wl_selection_claim(Ecore_Evas *ee, unsigned int seat, Ecore_Evas_Sel
2435 2475
2436 if (selection == ECORE_EVAS_SELECTION_BUFFER_SELECTION_BUFFER) 2476 if (selection == ECORE_EVAS_SELECTION_BUFFER_SELECTION_BUFFER)
2437 { 2477 {
2438 _store_selection_cbs(ee, seat, selection, available_types, delivery, cancel); 2478 _store_selection_cbs(ee, seat, selection, available_types,
2479 delivery, cancel);
2439 return EINA_TRUE; 2480 return EINA_TRUE;
2440 } 2481 }
2441 2482
@@ -2448,7 +2489,9 @@ _ecore_evas_wl_selection_claim(Ecore_Evas *ee, unsigned int seat, Ecore_Evas_Sel
2448 } 2489 }
2449 tmp_array[eina_array_count(available_types)] = NULL; 2490 tmp_array[eina_array_count(available_types)] = NULL;
2450 2491
2451 data->sent_serial = ecore_wl2_dnd_selection_set(_fetch_input(ee, seat), (const char**)tmp_array); 2492 data->sent_serial =
2493 ecore_wl2_dnd_selection_set(_fetch_input(ee, seat),
2494 (const char**)tmp_array);
2452 return EINA_TRUE; 2495 return EINA_TRUE;
2453} 2496}
2454 2497
@@ -2497,7 +2540,11 @@ _ecore_evas_wl_selection_request(Ecore_Evas *ee, unsigned int seat, Ecore_Evas_S
2497 char *available_type = eina_array_data_get(available_types, i); 2540 char *available_type = eina_array_data_get(available_types, i);
2498 for (unsigned int j = 0; j < eina_array_count(acceptable_types) && !selected_type; ++j) 2541 for (unsigned int j = 0; j < eina_array_count(acceptable_types) && !selected_type; ++j)
2499 { 2542 {
2500 char *acceptable_type = eina_array_data_get(acceptable_types, j); 2543 Eina_Iterator *convertions;
2544 const char *convert_available_type;
2545 char *acceptable_type;
2546
2547 acceptable_type = eina_array_data_get(acceptable_types, j);
2501 if (eina_streq(acceptable_type, available_type)) 2548 if (eina_streq(acceptable_type, available_type))
2502 { 2549 {
2503 selected_type = available_type; 2550 selected_type = available_type;
@@ -2505,8 +2552,9 @@ _ecore_evas_wl_selection_request(Ecore_Evas *ee, unsigned int seat, Ecore_Evas_S
2505 break; 2552 break;
2506 } 2553 }
2507 2554
2508 const char *convert_available_type; 2555 convertions =
2509 Eina_Iterator *convertions = eina_content_converter_possible_conversions(available_type); 2556 eina_content_converter_possible_conversions(available_type);
2557
2510 EINA_ITERATOR_FOREACH(convertions, convert_available_type) 2558 EINA_ITERATOR_FOREACH(convertions, convert_available_type)
2511 { 2559 {
2512 if (eina_streq(convert_available_type, acceptable_type)) 2560 if (eina_streq(convert_available_type, acceptable_type))
@@ -2568,12 +2616,16 @@ _wl_selection_changed(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
2568 return ECORE_CALLBACK_PASS_ON; 2616 return ECORE_CALLBACK_PASS_ON;
2569 2617
2570 if (ee->func.fn_selection_changed) 2618 if (ee->func.fn_selection_changed)
2571 ee->func.fn_selection_changed(ee, 0, ECORE_EVAS_SELECTION_BUFFER_COPY_AND_PASTE_BUFFER); 2619 {
2620 ee->func.fn_selection_changed
2621 (ee, 0, ECORE_EVAS_SELECTION_BUFFER_COPY_AND_PASTE_BUFFER);
2622 }
2572 2623
2573 return ECORE_CALLBACK_PASS_ON; 2624 return ECORE_CALLBACK_PASS_ON;
2574} 2625}
2575 2626
2576typedef struct { 2627typedef struct
2628{
2577 Eina_Rw_Slice slice; 2629 Eina_Rw_Slice slice;
2578 unsigned int written_bytes; 2630 unsigned int written_bytes;
2579} Delayed_Writing; 2631} Delayed_Writing;
@@ -2634,8 +2686,11 @@ _wl_interaction_send(void *data, int type EINA_UNUSED, void *event)
2634 selection = &wdata->selection_data[buffer]; 2686 selection = &wdata->selection_data[buffer];
2635 EINA_SAFETY_ON_NULL_GOTO(selection, end); 2687 EINA_SAFETY_ON_NULL_GOTO(selection, end);
2636 EINA_SAFETY_ON_NULL_GOTO(selection->callbacks.delivery, end); 2688 EINA_SAFETY_ON_NULL_GOTO(selection->callbacks.delivery, end);
2637 EINA_SAFETY_ON_FALSE_GOTO(selection->callbacks.delivery(ee, ev->seat, buffer, ev->type, &forign_slice->slice), end); 2689 EINA_SAFETY_ON_FALSE_GOTO(selection->callbacks.delivery
2638 ecore_main_fd_handler_add(ev->fd, ECORE_FD_WRITE, _write_to_fd, forign_slice, NULL, NULL); 2690 (ee, ev->seat, buffer, ev->type,
2691 &forign_slice->slice), end);
2692 ecore_main_fd_handler_add(ev->fd, ECORE_FD_WRITE, _write_to_fd,
2693 forign_slice, NULL, NULL);
2639 2694
2640 return ECORE_CALLBACK_PASS_ON; 2695 return ECORE_CALLBACK_PASS_ON;
2641 2696
@@ -2671,7 +2726,8 @@ _wl_selection_receive(void *data, int type EINA_UNUSED, void *event)
2671 { 2726 {
2672 //ensure that we always have a \0 at the end, there is no assertion that \0 is included here. 2727 //ensure that we always have a \0 at the end, there is no assertion that \0 is included here.
2673 slice.len = ready->len + 1; 2728 slice.len = ready->len + 1;
2674 slice.mem = eina_memdup((unsigned char*)ready->data, ready->len, EINA_TRUE); 2729 slice.mem =
2730 eina_memdup((unsigned char*)ready->data, ready->len, EINA_TRUE);
2675 } 2731 }
2676 else 2732 else
2677 { 2733 {
@@ -2683,13 +2739,16 @@ _wl_selection_receive(void *data, int type EINA_UNUSED, void *event)
2683 2739
2684 if (wdata->selection_data[selection].later_convert) 2740 if (wdata->selection_data[selection].later_convert)
2685 { 2741 {
2686 Eina_Content *tmp = eina_content_convert(content, wdata->selection_data[selection].later_convert); 2742 Eina_Content *tmp;
2743
2744 tmp = eina_content_convert(content, wdata->selection_data[selection].later_convert);
2687 wdata->selection_data[selection].later_convert = NULL; 2745 wdata->selection_data[selection].later_convert = NULL;
2688 eina_content_free(content); 2746 eina_content_free(content);
2689 content = tmp; 2747 content = tmp;
2690 } 2748 }
2691 2749
2692 eina_promise_resolve(wdata->selection_data[selection].delivery, eina_value_content_init(content)); 2750 eina_promise_resolve(wdata->selection_data[selection].delivery,
2751 eina_value_content_init(content));
2693 wdata->selection_data[selection].delivery = NULL; 2752 wdata->selection_data[selection].delivery = NULL;
2694 eina_content_free(content); 2753 eina_content_free(content);
2695 2754
@@ -2708,8 +2767,10 @@ _wl_selection_dnd_leave(void *data, int type EINA_UNUSED, void *event)
2708 if (ee->prop.window != (Ecore_Window)ev->win) return ECORE_CALLBACK_PASS_ON; 2767 if (ee->prop.window != (Ecore_Window)ev->win) return ECORE_CALLBACK_PASS_ON;
2709 2768
2710 //evas_output_framespace_get(ee->evas, &fpos.x, &fpos.y, NULL, NULL); 2769 //evas_output_framespace_get(ee->evas, &fpos.x, &fpos.y, NULL, NULL);
2711 ecore_wl2_input_pointer_xy_get(ecore_wl2_display_input_find(ev->display, ev->seat), &cpos.x, &cpos.y); 2770 ecore_wl2_input_pointer_xy_get(ecore_wl2_display_input_find
2712 ecore_evas_dnd_leave(data, ev->seat, EINA_POSITION2D(cpos.x - fpos.x, cpos.y - fpos.y)); 2771 (ev->display, ev->seat), &cpos.x, &cpos.y);
2772 ecore_evas_dnd_leave(data, ev->seat, EINA_POSITION2D(cpos.x - fpos.x,
2773 cpos.y - fpos.y));
2713 wdata->external_offer = NULL; 2774 wdata->external_offer = NULL;
2714 2775
2715 return ECORE_CALLBACK_PASS_ON; 2776 return ECORE_CALLBACK_PASS_ON;
@@ -2725,7 +2786,8 @@ _wl_selection_dnd_motion(void *data, int type EINA_UNUSED, void *event)
2725 if (ee->prop.window != (Ecore_Window)ev->win) return ECORE_CALLBACK_PASS_ON; 2786 if (ee->prop.window != (Ecore_Window)ev->win) return ECORE_CALLBACK_PASS_ON;
2726 2787
2727 evas_output_framespace_get(ee->evas, &fpos.x, &fpos.y, NULL, NULL); 2788 evas_output_framespace_get(ee->evas, &fpos.x, &fpos.y, NULL, NULL);
2728 ecore_evas_dnd_position_set(data, ev->seat, EINA_POSITION2D(ev->x - fpos.x, ev->y - fpos.y)); 2789 ecore_evas_dnd_position_set(data, ev->seat,
2790 EINA_POSITION2D(ev->x - fpos.x, ev->y - fpos.y));
2729 return ECORE_CALLBACK_PASS_ON; 2791 return ECORE_CALLBACK_PASS_ON;
2730} 2792}
2731static Eina_Bool 2793static Eina_Bool
@@ -2739,7 +2801,10 @@ _wl_selection_dnd_enter(void *data, int type EINA_UNUSED, void *event)
2739 if (ee->prop.window != (Ecore_Window)ev->win) return ECORE_CALLBACK_PASS_ON; 2801 if (ee->prop.window != (Ecore_Window)ev->win) return ECORE_CALLBACK_PASS_ON;
2740 2802
2741 evas_output_framespace_get(ee->evas, &fpos.x, &fpos.y, NULL, NULL); 2803 evas_output_framespace_get(ee->evas, &fpos.x, &fpos.y, NULL, NULL);
2742 ecore_evas_dnd_enter(data, ev->seat, eina_array_iterator_new(ecore_wl2_offer_mimes_get(ev->offer)), EINA_POSITION2D(ev->x - fpos.x, ev->y - fpos.y)); 2804 ecore_evas_dnd_enter(data, ev->seat,
2805 eina_array_iterator_new
2806 (ecore_wl2_offer_mimes_get(ev->offer)),
2807 EINA_POSITION2D(ev->x - fpos.x, ev->y - fpos.y));
2743 ecore_wl2_offer_mimes_set(ev->offer, ecore_wl2_offer_mimes_get(ev->offer)); 2808 ecore_wl2_offer_mimes_set(ev->offer, ecore_wl2_offer_mimes_get(ev->offer));
2744 wdata->external_offer = ev->offer; 2809 wdata->external_offer = ev->offer;
2745 return ECORE_CALLBACK_PASS_ON; 2810 return ECORE_CALLBACK_PASS_ON;
@@ -2755,7 +2820,10 @@ _wl_selection_dnd_drop(void *data, int type EINA_UNUSED, void *event)
2755 wdata = ee->engine.data; 2820 wdata = ee->engine.data;
2756 2821
2757 if (ee->func.fn_dnd_drop) 2822 if (ee->func.fn_dnd_drop)
2758 ee->func.fn_dnd_drop(ee, ev->seat, ecore_evas_dnd_pos_get(ee, ev->seat), "ask"); 2823 {
2824 ee->func.fn_dnd_drop(ee, ev->seat,
2825 ecore_evas_dnd_pos_get(ee, ev->seat), "ask");
2826 }
2759 2827
2760 ecore_wl2_dnd_drag_end(_fetch_input(ee, ev->seat)); 2828 ecore_wl2_dnd_drag_end(_fetch_input(ee, ev->seat));
2761 wdata->external_offer = NULL; 2829 wdata->external_offer = NULL;
@@ -2784,22 +2852,30 @@ _ecore_evas_wl_selection_init(Ecore_Evas *ee)
2784{ 2852{
2785 Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data; 2853 Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
2786 2854
2787 wdata->changed_handler = ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_SELECTION, 2855 wdata->changed_handler =
2788 _wl_selection_changed, ee); 2856 ecore_event_handler_add(ECORE_WL2_EVENT_SEAT_SELECTION,
2789 wdata->send_handler = ecore_event_handler_add(ECORE_WL2_EVENT_DATA_SOURCE_SEND, 2857 _wl_selection_changed, ee);
2790 _wl_interaction_send, ee); 2858 wdata->send_handler =
2791 wdata->offer_handler = ecore_event_handler_add(ECORE_WL2_EVENT_OFFER_DATA_READY, 2859 ecore_event_handler_add(ECORE_WL2_EVENT_DATA_SOURCE_SEND,
2792 _wl_selection_receive, ee); 2860 _wl_interaction_send, ee);
2793 wdata->dnd_leave_handler = ecore_event_handler_add(ECORE_WL2_EVENT_DND_LEAVE, 2861 wdata->offer_handler =
2794 _wl_selection_dnd_leave, ee); 2862 ecore_event_handler_add(ECORE_WL2_EVENT_OFFER_DATA_READY,
2795 wdata->dnd_motion_handler = ecore_event_handler_add(ECORE_WL2_EVENT_DND_MOTION, 2863 _wl_selection_receive, ee);
2796 _wl_selection_dnd_motion, ee); 2864 wdata->dnd_leave_handler =
2797 wdata->dnd_enter_handler = ecore_event_handler_add(ECORE_WL2_EVENT_DND_ENTER, 2865 ecore_event_handler_add(ECORE_WL2_EVENT_DND_LEAVE,
2798 _wl_selection_dnd_enter, ee); 2866 _wl_selection_dnd_leave, ee);
2799 wdata->dnd_drop_handler = ecore_event_handler_add(ECORE_WL2_EVENT_DND_DROP, 2867 wdata->dnd_motion_handler =
2800 _wl_selection_dnd_drop, ee); 2868 ecore_event_handler_add(ECORE_WL2_EVENT_DND_MOTION,
2801 wdata->dnd_end_handler = ecore_event_handler_add(ECORE_WL2_EVENT_DATA_SOURCE_DROP, 2869 _wl_selection_dnd_motion, ee);
2802 _wl_selection_dnd_end, ee); 2870 wdata->dnd_enter_handler =
2871 ecore_event_handler_add(ECORE_WL2_EVENT_DND_ENTER,
2872 _wl_selection_dnd_enter, ee);
2873 wdata->dnd_drop_handler =
2874 ecore_event_handler_add(ECORE_WL2_EVENT_DND_DROP,
2875 _wl_selection_dnd_drop, ee);
2876 wdata->dnd_end_handler =
2877 ecore_event_handler_add(ECORE_WL2_EVENT_DATA_SOURCE_DROP,
2878 _wl_selection_dnd_end, ee);
2803 for (int i = 0; i < ECORE_EVAS_SELECTION_BUFFER_LAST; ++i) 2879 for (int i = 0; i < ECORE_EVAS_SELECTION_BUFFER_LAST; ++i)
2804 { 2880 {
2805 wdata->selection_data[i].callbacks.available_types = NULL; 2881 wdata->selection_data[i].callbacks.available_types = NULL;
@@ -2815,7 +2891,8 @@ _ecore_evas_wl_dnd_start(Ecore_Evas *ee, unsigned int seat, Eina_Array *availabl
2815 const char *tmp_array[eina_array_count(available_types) + 1]; 2891 const char *tmp_array[eina_array_count(available_types) + 1];
2816 2892
2817 _reeval_seat(&seat, ee); 2893 _reeval_seat(&seat, ee);
2818 _store_selection_cbs(ee, seat, ECORE_EVAS_SELECTION_BUFFER_DRAG_AND_DROP_BUFFER, available_types, delivery, cancel); 2894 _store_selection_cbs(ee, seat, ECORE_EVAS_SELECTION_BUFFER_DRAG_AND_DROP_BUFFER,
2895 available_types, delivery, cancel);
2819 2896
2820 for (unsigned int i = 0; i < eina_array_count(available_types); ++i) 2897 for (unsigned int i = 0; i < eina_array_count(available_types); ++i)
2821 { 2898 {
@@ -2823,9 +2900,13 @@ _ecore_evas_wl_dnd_start(Ecore_Evas *ee, unsigned int seat, Eina_Array *availabl
2823 } 2900 }
2824 tmp_array[eina_array_count(available_types)] = NULL; 2901 tmp_array[eina_array_count(available_types)] = NULL;
2825 2902
2826 ecore_wl2_dnd_drag_types_set(_fetch_input(ee, seat), (const char**)tmp_array); 2903 ecore_wl2_dnd_drag_types_set(_fetch_input(ee, seat),
2904 (const char**)tmp_array);
2827 wdata->selection_data[ECORE_EVAS_SELECTION_BUFFER_DRAG_AND_DROP_BUFFER].sent_serial = 2905 wdata->selection_data[ECORE_EVAS_SELECTION_BUFFER_DRAG_AND_DROP_BUFFER].sent_serial =
2828 ecore_wl2_dnd_drag_start(_fetch_input(ee, seat), _ecore_evas_wayland_window_get(ee), _ecore_evas_wayland_window_get(drag_rep)); 2906 ecore_wl2_dnd_drag_start(_fetch_input(ee, seat),
2907 _ecore_evas_wayland_window_get(ee),
2908 _ecore_evas_wayland_window_get(drag_rep));
2909
2829 return EINA_TRUE; 2910 return EINA_TRUE;
2830} 2911}
2831 2912