Evas Software X11: Add a callback that informs the current screen content pixels.

This is necessary in order to implement a VNC server. Using this
callback the VNC server will be able to draw the current screen to the
VNC clients.
This commit is contained in:
Guilherme Iscaro 2016-09-21 13:46:17 -03:00 committed by Bruno Dilly
parent e99900bcd7
commit 7e2d700d06
5 changed files with 84 additions and 20 deletions

View File

@ -41,6 +41,7 @@ struct _Evas_Engine_Info_Software_X11
void *(*best_visual_get) (int backend, void *connection, int screen);
unsigned int (*best_colormap_get) (int backend, void *connection, int screen);
int (*best_depth_get) (int backend, void *connection, int screen);
void (*region_push_hook)(Evas *e, int x, int y, int w, int h, const void *pixels);
} func;
unsigned char mask_changed : 1;

View File

@ -32,6 +32,8 @@
# include <dlfcn.h>
#endif
#include <Ecore.h>
Evas_Native_Tbm_Surface_Image_Set_Call glsym__evas_native_tbm_surface_image_set = NULL;
Evas_Native_Tbm_Surface_Stride_Get_Call glsym__evas_native_tbm_surface_stride_get = NULL;
int _evas_engine_soft_x11_log_dom = -1;
@ -133,6 +135,22 @@ _output_egl_setup(int w, int h, int rot, Display *disp, Drawable draw,
}
*/
void
evas_software_x11_region_push_hook_call(Outbuf *buf, int x, int y, int w, int h,
const void *pixels)
{
int err;
if (!buf->region_push_hook.cb)
return;
err = ecore_thread_main_loop_begin();
EINA_SAFETY_ON_TRUE_RETURN(err == -1);
buf->region_push_hook.cb(buf->region_push_hook.evas, x, y, w, h, pixels);
ecore_thread_main_loop_end();
}
static void
_output_egl_shutdown(Render_Engine *re)
{
@ -526,6 +544,8 @@ eng_setup(Evas *eo_e, void *in)
info->info.destination_alpha);
re->outbuf_alpha_get = evas_software_xlib_outbuf_alpha_get;
}
re->generic.ob->region_push_hook.cb = info->func.region_push_hook;
re->generic.ob->region_push_hook.evas = eo_e;
}
#endif
@ -621,6 +641,8 @@ eng_setup(Evas *eo_e, void *in)
if (ob)
{
evas_render_engine_software_generic_update(&re->generic, ob, e->output.w, e->output.h);
ob->region_push_hook.cb = info->func.region_push_hook;
ob->region_push_hook.evas = eo_e;
}
/* if ((re) && (re->ob)) re->ob->onebuf = ponebuf; */

View File

@ -113,9 +113,16 @@ struct _Outbuf
unsigned char debug : 1;
unsigned char synced : 1;
} priv;
struct
{
void (*cb)(Evas *e, int x, int y, int w, int h, const void *pixels);
Evas *evas;
} region_push_hook;
};
void evas_software_xlib_x_init(void);
void evas_software_xcb_init(void);
void evas_software_x11_region_push_hook_call(Outbuf *buf, int x, int y, int w, int h, const void *pixels);
#endif

View File

@ -680,9 +680,14 @@ evas_software_xcb_outbuf_flush(Outbuf *buf, Tilebuf_Rect *rects EINA_UNUSED, Eva
pixman_region_n_rects(&tmpr),
(const xcb_rectangle_t *)pixman_region_rectangles(&tmpr, NULL));
if (obr->xcbob)
evas_software_xcb_output_buffer_paste(obr->xcbob,
buf->priv.x11.xcb.win,
buf->priv.x11.xcb.gc, 0, 0, 0);
{
evas_software_x11_region_push_hook_call(buf, 0, 0, obr->xcbob->xim->width,
obr->xcbob->xim->height,
evas_software_xcb_output_buffer_data(obr->xcbob, NULL));
evas_software_xcb_output_buffer_paste(obr->xcbob,
buf->priv.x11.xcb.win,
buf->priv.x11.xcb.gc, 0, 0, 0);
}
if (obr->mask)
{
xcb_set_clip_rectangles(buf->priv.x11.xcb.conn,
@ -709,10 +714,16 @@ evas_software_xcb_outbuf_flush(Outbuf *buf, Tilebuf_Rect *rects EINA_UNUSED, Eva
evas_software_xcb_outbuf_debug_show(buf, buf->priv.x11.xcb.win,
obr->x, obr->y, obr->w, obr->h);
if (obr->xcbob)
evas_software_xcb_output_buffer_paste(obr->xcbob,
buf->priv.x11.xcb.win,
buf->priv.x11.xcb.gc,
obr->x, obr->y, 0);
{
evas_software_x11_region_push_hook_call(buf, obr->x, obr->y,
obr->xcbob->xim->width,
obr->xcbob->xim->height,
evas_software_xcb_output_buffer_data(obr->xcbob, NULL));
evas_software_xcb_output_buffer_paste(obr->xcbob,
buf->priv.x11.xcb.win,
buf->priv.x11.xcb.gc,
obr->x, obr->y, 0);
}
if (obr->mask)
evas_software_xcb_output_buffer_paste(obr->mask,
buf->priv.x11.xcb.mask,
@ -959,10 +970,16 @@ evas_software_xcb_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, in
evas_software_xcb_outbuf_debug_show(buf, buf->priv.x11.xcb.win,
obr->x, obr->y, obr->w, obr->h);
if (obr->xcbob)
evas_software_xcb_output_buffer_paste(obr->xcbob,
buf->priv.x11.xcb.win,
buf->priv.x11.xcb.gc,
obr->x, obr->y, 0);
{
evas_software_x11_region_push_hook_call(buf, obr->x, obr->y,
obr->xcbob->xim->width,
obr->xcbob->xim->height,
evas_software_xcb_output_buffer_data(obr->xcbob, NULL));
evas_software_xcb_output_buffer_paste(obr->xcbob,
buf->priv.x11.xcb.win,
buf->priv.x11.xcb.gc,
obr->x, obr->y, 0);
}
}
#endif
if (obr->mask)

View File

@ -818,9 +818,14 @@ evas_software_xlib_outbuf_flush(Outbuf *buf, Tilebuf_Rect *rects EINA_UNUSED, Ev
eina_array_clean(&buf->priv.onebuf_regions);
XSetRegion(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gc, tmpr);
if (obr->xob)
evas_software_xlib_x_output_buffer_paste(obr->xob, buf->priv.x11.xlib.win,
buf->priv.x11.xlib.gc,
0, 0, 0);
{
evas_software_x11_region_push_hook_call(buf, 0, 0, obr->xob->xim->width,
obr->xob->xim->height,
evas_software_xlib_x_output_buffer_data(obr->xob, NULL));
evas_software_xlib_x_output_buffer_paste(obr->xob, buf->priv.x11.xlib.win,
buf->priv.x11.xlib.gc,
0, 0, 0);
}
if (obr->mxob)
{
XSetRegion(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gcm, tmpr);
@ -843,9 +848,15 @@ evas_software_xlib_outbuf_flush(Outbuf *buf, Tilebuf_Rect *rects EINA_UNUSED, Ev
evas_software_xlib_outbuf_debug_show(buf, buf->priv.x11.xlib.win,
obr->x, obr->y, obr->w, obr->h);
if (obr->xob)
evas_software_xlib_x_output_buffer_paste(obr->xob, buf->priv.x11.xlib.win,
buf->priv.x11.xlib.gc,
obr->x, obr->y, 0);
{
evas_software_x11_region_push_hook_call(buf, obr->x, obr->y,
obr->xob->xim->width,
obr->xob->xim->height,
evas_software_xlib_x_output_buffer_data(obr->xob, NULL));
evas_software_xlib_x_output_buffer_paste(obr->xob, buf->priv.x11.xlib.win,
buf->priv.x11.xlib.gc,
obr->x, obr->y, 0);
}
if (obr->mxob)
evas_software_xlib_x_output_buffer_paste(obr->mxob,
buf->priv.x11.xlib.mask,
@ -1124,9 +1135,15 @@ evas_software_xlib_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, i
evas_software_xlib_outbuf_debug_show(buf, buf->priv.x11.xlib.win,
obr->x, obr->y, obr->w, obr->h);
if (obr->xob)
evas_software_xlib_x_output_buffer_paste(obr->xob, buf->priv.x11.xlib.win,
buf->priv.x11.xlib.gc,
obr->x, obr->y, 0);
{
evas_software_x11_region_push_hook_call(buf, obr->x, obr->y,
obr->xob->xim->width,
obr->xob->xim->height,
evas_software_xlib_x_output_buffer_data(obr->xob, NULL));
evas_software_xlib_x_output_buffer_paste(obr->xob, buf->priv.x11.xlib.win,
buf->priv.x11.xlib.gc,
obr->x, obr->y, 0);
}
}
#endif
if (obr->mxob)