summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuilherme Iscaro <iscaro@profusion.mobi>2016-10-14 17:36:30 -0300
committerGuilherme Iscaro <iscaro@profusion.mobi>2016-10-14 18:06:29 -0300
commit659731fe3639f3c56159c5f38245ace4a6c99947 (patch)
tree564590f9d6b6e4c0b44af68f467b782fa596ecbc
parent354acfd7e60bd6b2e39577cfc06cb80ddbb83e8f (diff)
downloadefl-devs/iscaro/vnc_deadlock_fix.tar.gz
Ecore_Evas VNC: Initialize the data from the newly created frame buffer.devs/iscaro/vnc_deadlock_fix
In some cases we may not receive the whole buffer during a screen resize, therefore, the data that have not been painted must be initialized.
-rw-r--r--src/modules/ecore_evas/engines/x/ecore_evas_x.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/src/modules/ecore_evas/engines/x/ecore_evas_x.c b/src/modules/ecore_evas/engines/x/ecore_evas_x.c
index f0c53e77fe..48abefede7 100644
--- a/src/modules/ecore_evas/engines/x/ecore_evas_x.c
+++ b/src/modules/ecore_evas/engines/x/ecore_evas_x.c
@@ -236,9 +236,9 @@ _ecore_evas_x11_region_push_hook(Evas *e, int x, int y, int w, int h,
{
Ecore_Evas *ee;
Ecore_Evas_Engine_Data_X11 *edata;
- size_t size;
+ size_t size, src_stride;
int dy;
- int src_stride;
+ Eina_Bool new_buf = EINA_FALSE;
ee = evas_data_attach_get(e);
edata = ee->engine.data;
@@ -254,6 +254,7 @@ _ecore_evas_x11_region_push_hook(Evas *e, int x, int y, int w, int h,
edata->frame_buffer = new_fb;
edata->last_w = ee->w;
edata->last_h = ee->h;
+ new_buf = EINA_TRUE;
if (edata->vnc_screen)
{
@@ -284,6 +285,40 @@ _ecore_evas_x11_region_push_hook(Evas *e, int x, int y, int w, int h,
(char *)pixels + (dy * src_stride), src_stride);
}
+ //We did not receive the whole buffer yet, zero the missing bytes for now.
+ if (new_buf)
+ {
+ //Missing width
+ if (edata->last_w != w || x != 0)
+ {
+ for (dy = 0; dy < h; dy++)
+ {
+ if (x)
+ {
+ memset(edata->frame_buffer
+ + ((dy + y) * (edata->last_w * VNC_BYTES_PER_PIXEL)),
+ 0, x * VNC_BYTES_PER_PIXEL);
+ }
+
+ memset(edata->frame_buffer +
+ ((dy + y) * (edata->last_w * VNC_BYTES_PER_PIXEL))
+ + ((x + w) * VNC_BYTES_PER_PIXEL),
+ 0, (edata->last_w - (w + x)) * VNC_BYTES_PER_PIXEL);
+ }
+ }
+
+ //Missing height
+ if (edata->last_h != h || y != 0)
+ {
+ src_stride = edata->last_w * VNC_BYTES_PER_PIXEL;
+ for (dy = 0; dy < y; dy++)
+ memset(edata->frame_buffer + (dy * src_stride), 0, src_stride);
+
+ for (dy = y + h; dy < edata->last_h; dy++)
+ memset(edata->frame_buffer + (dy * src_stride), 0, src_stride);
+ }
+ }
+
if (edata->vnc_screen)
{
rfbMarkRectAsModified(edata->vnc_screen, x, y, x+w, y+h);