summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2018-02-12 14:58:01 -0600
committerDerek Foreman <derekf@osg.samsung.com>2018-04-20 13:00:28 -0500
commitdbf65eb96a628f32facdfd5e97d154bf735447c7 (patch)
tree4e5f4a1afa4668bc7c9dd968a71b0bb6cf10e686 /src
parenta9fd904a6e29dcb3e185531842863b0ee93abafd (diff)
ecore_evas_wayland: Handle region updates and alpha setting in engine
Instead of having elm handle all this stuff, handle it in ee. This fixes a loooong standing bug where we would always use an alpha enabled surface because CSD needs shadows - even if we aren't drawing CSD.
Diffstat (limited to 'src')
-rw-r--r--src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c107
1 files changed, 86 insertions, 21 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 7dd5c54e64..84ac300005 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
@@ -218,6 +218,77 @@ _ecore_evas_wl_common_cb_disconnect(void *data EINA_UNUSED, int type EINA_UNUSED
218 return ECORE_CALLBACK_RENEW; 218 return ECORE_CALLBACK_RENEW;
219} 219}
220 220
221static Eina_Bool
222ee_needs_alpha(Ecore_Evas *ee)
223{
224 return ee->shadow.l || ee->shadow.r || ee->shadow.t || ee->shadow.b ||
225 ee->alpha;
226}
227
228static void
229_ecore_evas_wayland_window_update(Ecore_Evas *ee, Ecore_Evas_Engine_Wl_Data *wdata, Eina_Bool new_alpha)
230{
231 Evas_Engine_Info_Wayland *einfo;
232 Eina_Bool has_shadow, needs_alpha, change;
233 int w, h, fw, fh, shw = 0, shh = 0;
234 int fullw, fullh;
235
236 einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas);
237
238 change = ee->shadow.changed || (new_alpha != ee->alpha);
239 ee->alpha = new_alpha;
240 has_shadow = ee->shadow.l || ee->shadow.r || ee->shadow.t || ee->shadow.b;
241
242 needs_alpha = ee_needs_alpha(ee);
243
244 if (einfo->info.destination_alpha != needs_alpha)
245 {
246 ecore_wl2_window_alpha_set(wdata->win, needs_alpha);
247 einfo->info.destination_alpha = needs_alpha;
248 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
249 ERR("Failed to set Evas Engine Info for '%s'", ee->driver);
250
251 change |= EINA_TRUE;
252 }
253
254 ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
255 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
256
257 if (has_shadow)
258 {
259 shh = ee->shadow.r + ee->shadow.l;
260 shw = ee->shadow.t + ee->shadow.b;
261 }
262
263 fullw = w + fw - shw;
264 fullh = h + fh - shh;
265
266 if (has_shadow && !ee->alpha)
267 {
268 ecore_wl2_window_opaque_region_set(wdata->win,
269 ee->shadow.l, ee->shadow.t,
270 fullw, fullh);
271 }
272 else
273 {
274 ecore_wl2_window_opaque_region_set(wdata->win, 0, 0, 0, 0);
275 }
276 ecore_wl2_window_input_region_set(wdata->win,
277 ee->shadow.l, ee->shadow.t,
278 fullw, fullh);
279 ecore_wl2_window_geometry_set(wdata->win,
280 ee->shadow.l, ee->shadow.t,
281 fullw, fullh);
282 if (!change) return;
283
284 if (ECORE_EVAS_PORTRAIT(ee))
285 evas_damage_rectangle_add(ee->evas, 0, 0, fullw, fullh);
286 else
287 evas_damage_rectangle_add(ee->evas, 0, 0, fullh, fullw);
288
289 ee->shadow.changed = EINA_FALSE;
290}
291
221static void 292static void
222_ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h) 293_ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
223{ 294{
@@ -418,6 +489,7 @@ _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
418 489
419 if (ee->func.fn_resize) ee->func.fn_resize(ee); 490 if (ee->func.fn_resize) ee->func.fn_resize(ee);
420 } 491 }
492 _ecore_evas_wayland_window_update(ee, wdata, ee->alpha);
421} 493}
422 494
423static void 495static void
@@ -608,6 +680,8 @@ _ecore_evas_wl_common_cb_window_configure(void *data EINA_UNUSED, int type EINA_
608 } 680 }
609 } 681 }
610 682
683 _ecore_evas_wayland_window_update(ee, wdata, ee->alpha);
684
611 return ECORE_CALLBACK_PASS_ON; 685 return ECORE_CALLBACK_PASS_ON;
612} 686}
613 687
@@ -1821,31 +1895,22 @@ _ecore_evas_wl_common_render_flush_pre(void *data, Evas *evas, void *event EINA_
1821static void 1895static void
1822_ecore_evas_wayland_alpha_do(Ecore_Evas *ee, int alpha) 1896_ecore_evas_wayland_alpha_do(Ecore_Evas *ee, int alpha)
1823{ 1897{
1824 Evas_Engine_Info_Wayland *einfo;
1825 Ecore_Evas_Engine_Wl_Data *wdata; 1898 Ecore_Evas_Engine_Wl_Data *wdata;
1826 int fw, fh;
1827 1899
1828 LOGFN(__FILE__, __LINE__, __FUNCTION__); 1900 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1829 1901
1830 if (!ee) return; 1902 if (!ee) return;
1831 if (ee->alpha == alpha) return; 1903 if (ee->alpha == alpha) return;
1832 ee->alpha = alpha;
1833 wdata = ee->engine.data;
1834 if (!wdata->sync_done) return;
1835
1836 if (wdata->win) ecore_wl2_window_alpha_set(wdata->win, ee->alpha);
1837
1838 _ecore_evas_wl_common_wm_rotation_protocol_set(ee);
1839 1904
1840 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh); 1905 wdata = ee->engine.data;
1841 1906 if (!wdata->sync_done)
1842 if ((einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas)))
1843 { 1907 {
1844 einfo->info.destination_alpha = EINA_TRUE; 1908 ee->alpha = alpha;
1845 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) 1909 return;
1846 ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver);
1847 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w + fw, ee->h + fh);
1848 } 1910 }
1911 _ecore_evas_wayland_window_update(ee, wdata, alpha);
1912
1913 _ecore_evas_wl_common_wm_rotation_protocol_set(ee);
1849} 1914}
1850 1915
1851static void 1916static void
@@ -2094,15 +2159,15 @@ _ecore_evas_wl_common_show(Ecore_Evas *ee)
2094 wdata->win->pending.max = 0; 2159 wdata->win->pending.max = 0;
2095 } 2160 }
2096 2161
2162 _ecore_evas_wayland_window_update(ee, wdata, ee->alpha);
2163
2097 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh); 2164 evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
2098 2165
2099 ecore_wl2_window_geometry_set(wdata->win, 0, 0, ee->w, ee->h);
2100 ecore_wl2_window_show(wdata->win); 2166 ecore_wl2_window_show(wdata->win);
2101 ecore_wl2_window_alpha_set(wdata->win, ee->alpha);
2102
2103 einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas); 2167 einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas);
2104 if (einfo) 2168 if (einfo)
2105 { 2169 {
2170 einfo->info.destination_alpha = ee_needs_alpha(ee);
2106 einfo->info.wl2_win = wdata->win; 2171 einfo->info.wl2_win = wdata->win;
2107 einfo->info.hidden = wdata->win->pending.configure; //EINA_FALSE; 2172 einfo->info.hidden = wdata->win->pending.configure; //EINA_FALSE;
2108 einfo->www_avail = !!wdata->win->www_surface; 2173 einfo->www_avail = !!wdata->win->www_surface;
@@ -2206,7 +2271,7 @@ _ee_cb_sync_done(void *data, int type EINA_UNUSED, void *event EINA_UNUSED)
2206 2271
2207 if ((einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas))) 2272 if ((einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas)))
2208 { 2273 {
2209 einfo->info.destination_alpha = EINA_TRUE; 2274 einfo->info.destination_alpha = ee_needs_alpha(ee);
2210 einfo->info.rotation = ee->rotation; 2275 einfo->info.rotation = ee->rotation;
2211 einfo->info.wl2_win = wdata->win; 2276 einfo->info.wl2_win = wdata->win;
2212 2277
@@ -2508,7 +2573,7 @@ _ecore_evas_wl_common_new_internal(const char *disp_name, unsigned int parent, i
2508 wdata->sync_done = EINA_TRUE; 2573 wdata->sync_done = EINA_TRUE;
2509 if ((einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas))) 2574 if ((einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas)))
2510 { 2575 {
2511 einfo->info.destination_alpha = EINA_TRUE; 2576 einfo->info.destination_alpha = ee_needs_alpha(ee);
2512 einfo->info.rotation = ee->rotation; 2577 einfo->info.rotation = ee->rotation;
2513 einfo->info.depth = 32; 2578 einfo->info.depth = 32;
2514 einfo->info.wl2_win = wdata->win; 2579 einfo->info.wl2_win = wdata->win;