diff options
author | Guilherme Iscaro <iscaro@profusion.mobi> | 2016-09-21 13:46:17 -0300 |
---|---|---|
committer | Bruno Dilly <bdilly@profusion.mobi> | 2016-09-26 22:06:59 -0300 |
commit | 7e2d700d06ff970d68ae208d59bca76f6ea07467 (patch) | |
tree | fcc15c6da849a285fe921f27b0881753557e7778 | |
parent | e99900bcd7a222a6e4b3c547c3b0f0f4d7c568fc (diff) | |
download | efl-7e2d700d06ff970d68ae208d59bca76f6ea07467.tar.gz |
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.
5 files changed, 84 insertions, 20 deletions
diff --git a/src/modules/evas/engines/software_x11/Evas_Engine_Software_X11.h b/src/modules/evas/engines/software_x11/Evas_Engine_Software_X11.h index e42c10a618..6600c5d5dd 100644 --- a/src/modules/evas/engines/software_x11/Evas_Engine_Software_X11.h +++ b/src/modules/evas/engines/software_x11/Evas_Engine_Software_X11.h @@ -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; diff --git a/src/modules/evas/engines/software_x11/evas_engine.c b/src/modules/evas/engines/software_x11/evas_engine.c index 6429a5a079..7042e12925 100644 --- a/src/modules/evas/engines/software_x11/evas_engine.c +++ b/src/modules/evas/engines/software_x11/evas_engine.c @@ -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; */ diff --git a/src/modules/evas/engines/software_x11/evas_engine.h b/src/modules/evas/engines/software_x11/evas_engine.h index 895e320621..5999e6823a 100644 --- a/src/modules/evas/engines/software_x11/evas_engine.h +++ b/src/modules/evas/engines/software_x11/evas_engine.h @@ -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 diff --git a/src/modules/evas/engines/software_x11/evas_xcb_outbuf.c b/src/modules/evas/engines/software_x11/evas_xcb_outbuf.c index b747f640a3..a65c9d88a6 100644 --- a/src/modules/evas/engines/software_x11/evas_xcb_outbuf.c +++ b/src/modules/evas/engines/software_x11/evas_xcb_outbuf.c @@ -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) diff --git a/src/modules/evas/engines/software_x11/evas_xlib_outbuf.c b/src/modules/evas/engines/software_x11/evas_xlib_outbuf.c index 382709152a..cfd260981a 100644 --- a/src/modules/evas/engines/software_x11/evas_xlib_outbuf.c +++ b/src/modules/evas/engines/software_x11/evas_xlib_outbuf.c @@ -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) |