summaryrefslogtreecommitdiff
path: root/src/lib/ecore_evas
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2017-03-22 11:19:27 -0700
committerCedric BAIL <cedric@osg.samsung.com>2017-04-12 15:13:19 -0700
commite0bb9d61349b02e785d3ccc1d43958e0ac4e942b (patch)
tree3d40d930328a266f6d034aefd2a054672c501e1d /src/lib/ecore_evas
parent6ea18851ba9f345f3fc49a7c154048f2832cdfe9 (diff)
ecore_evas: change VNC API and use snapshot internally.
Diffstat (limited to 'src/lib/ecore_evas')
-rw-r--r--src/lib/ecore_evas/Ecore_Evas.h18
-rw-r--r--src/lib/ecore_evas/ecore_evas.c80
-rw-r--r--src/lib/ecore_evas/ecore_evas_private.h2
3 files changed, 41 insertions, 59 deletions
diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h
index df514abc02..2dd46878f8 100644
--- a/src/lib/ecore_evas/Ecore_Evas.h
+++ b/src/lib/ecore_evas/Ecore_Evas.h
@@ -2579,23 +2579,15 @@ typedef void (*Ecore_Evas_Vnc_Client_Disconnected_Cb)(void *data, Ecore_Evas *ee
2579 * @param accept_cb A callback used to accept a new client. If @c NULL all clients will be accepted. 2579 * @param accept_cb A callback used to accept a new client. If @c NULL all clients will be accepted.
2580 * @param disc_cb A callback used to inform that a client has disconnected. It may be @c NULL. 2580 * @param disc_cb A callback used to inform that a client has disconnected. It may be @c NULL.
2581 * @param data Data to @a cb 2581 * @param data Data to @a cb
2582 * @return @c EINA_TRUE on success, @c EINA_FALSE otherwise. 2582 * @return an Evas_Object that take everything under it to represent the view of the client.
2583 * @see ecore_evas_vnc_stop() 2583 * @see ecore_evas_vnc_stop()
2584 * @see Ecore_Evas_Vnc_Client_Accept_Cb() 2584 * @see Ecore_Evas_Vnc_Client_Accept_Cb()
2585 * @since 1.19 2585 * @since 1.19
2586 */ 2586 */
2587EAPI Eina_Bool ecore_evas_vnc_start(Ecore_Evas *ee, const char *addr, int port, Ecore_Evas_Vnc_Client_Accept_Cb accept_cb, 2587EAPI Evas_Object *ecore_evas_vnc_start(Ecore_Evas *ee, const char *addr, int port,
2588 Ecore_Evas_Vnc_Client_Disconnected_Cb disc_cb, void *data); 2588 Ecore_Evas_Vnc_Client_Accept_Cb accept_cb,
2589 2589 Ecore_Evas_Vnc_Client_Disconnected_Cb disc_cb,
2590/** 2590 void *data);
2591 * @brief Stops a running VNC server
2592 *
2593 * @param ee Ecore_Evas to stop the VNC server
2594 * @return @c EINA_TRUE if the VNC server was stopped, @c EINA_FALSE otherwise.
2595 * @see ecore_evas_vnc_start()
2596 * @since 1.19
2597 */
2598EAPI Eina_Bool ecore_evas_vnc_stop(Ecore_Evas *ee);
2599 2591
2600#endif 2592#endif
2601 2593
diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c
index 8f4fe40f43..bc847b03eb 100644
--- a/src/lib/ecore_evas/ecore_evas.c
+++ b/src/lib/ecore_evas/ecore_evas.c
@@ -2613,31 +2613,31 @@ ecore_evas_pointer_warp(const Ecore_Evas *ee, Evas_Coord x, Evas_Coord y)
2613 2613
2614EAPI void 2614EAPI void
2615ecore_evas_pointer_device_xy_get(const Ecore_Evas *ee, 2615ecore_evas_pointer_device_xy_get(const Ecore_Evas *ee,
2616 const Efl_Input_Device *pointer, Evas_Coord *x, 2616 const Efl_Input_Device *pointer,
2617 Evas_Coord *y) 2617 Evas_Coord *x, Evas_Coord *y)
2618{ 2618{
2619 ECORE_EVAS_CHECK(ee);
2620
2619 if ((!pointer) || 2621 if ((!pointer) ||
2620 (pointer == evas_default_device_get(ee->evas, EFL_INPUT_DEVICE_CLASS_MOUSE))) 2622 (pointer == evas_default_device_get(ee->evas, EFL_INPUT_DEVICE_CLASS_MOUSE)))
2621 ecore_evas_pointer_xy_get(ee, x, y); 2623 ecore_evas_pointer_xy_get(ee, x, y);
2622 else 2624 else
2623 { 2625 {
2624 if (x) *x = 0; 2626 static Eina_Bool (*pointer_xy_get)(const Evas_Object *, const Efl_Input_Device *, Evas_Coord *, Evas_Coord *y) = NULL;
2625 if (y) *y = 0; 2627 Eina_Module *mod;
2626 ECORE_EVAS_CHECK(ee);
2627 if (ee->vnc_server)
2628 {
2629 Eina_Module *mod;
2630 void (*pointer_xy_get)(const void *, const Efl_Input_Device *, Evas_Coord *, Evas_Coord *y);
2631 2628
2629 if (!pointer_xy_get && ee->vnc_server)
2630 {
2632 mod = _ecore_evas_vnc_server_module_load(); 2631 mod = _ecore_evas_vnc_server_module_load();
2633 EINA_SAFETY_ON_NULL_RETURN(mod); 2632 EINA_SAFETY_ON_NULL_RETURN(mod);
2634 2633
2635 pointer_xy_get = eina_module_symbol_get(mod, "ecore_evas_vnc_server_pointer_xy_get"); 2634 pointer_xy_get = eina_module_symbol_get(mod, "ecore_evas_vnc_server_pointer_xy_get");
2636 EINA_SAFETY_ON_NULL_RETURN(pointer_xy_get); 2635 EINA_SAFETY_ON_NULL_RETURN(pointer_xy_get);
2637 pointer_xy_get(ee->vnc_server, pointer, x, y);
2638 } 2636 }
2639 else if (ee->engine.func->fn_pointer_device_xy_get) 2637
2640 ee->engine.func->fn_pointer_device_xy_get(ee, pointer, x, y); 2638 // FIXME: Handle matching of the efl_input_device with proper evas_object
2639
2640 ecore_evas_pointer_xy_get(ee, x, y);
2641 } 2641 }
2642} 2642}
2643 2643
@@ -3050,17 +3050,12 @@ _ecore_evas_unref(Ecore_Evas *ee)
3050static Eina_Bool 3050static Eina_Bool
3051_ecore_evas_vnc_stop(Ecore_Evas *ee) 3051_ecore_evas_vnc_stop(Ecore_Evas *ee)
3052{ 3052{
3053 Eina_Module *mod; 3053 Evas_Object *obj;
3054 void (*vnc_del)(void *); 3054 Eina_List *l;
3055
3056 mod = _ecore_evas_vnc_server_module_load();
3057 EINA_SAFETY_ON_NULL_RETURN_VAL(mod, EINA_FALSE);
3058 3055
3059 vnc_del = eina_module_symbol_get(mod, "ecore_evas_vnc_server_del"); 3056 EINA_LIST_FOREACH(ee->vnc_server, l, obj)
3060 EINA_SAFETY_ON_NULL_RETURN_VAL(vnc_del, EINA_FALSE); 3057 evas_object_del(obj);
3061 3058
3062 vnc_del(ee->vnc_server);
3063 ee->vnc_server = NULL;
3064 return EINA_TRUE; 3059 return EINA_TRUE;
3065} 3060}
3066 3061
@@ -3849,41 +3844,36 @@ ecore_evas_x11_shape_input_apply(Ecore_Evas *ee)
3849 iface->shape_input_apply(ee); 3844 iface->shape_input_apply(ee);
3850} 3845}
3851 3846
3852EAPI Eina_Bool 3847EAPI Evas_Object *
3853ecore_evas_vnc_start(Ecore_Evas *ee, const char *addr, int port, 3848ecore_evas_vnc_start(Ecore_Evas *ee, const char *addr, int port,
3854 Ecore_Evas_Vnc_Client_Accept_Cb accept_cb, 3849 Ecore_Evas_Vnc_Client_Accept_Cb accept_cb,
3855 Ecore_Evas_Vnc_Client_Disconnected_Cb disc_cb, 3850 Ecore_Evas_Vnc_Client_Disconnected_Cb disc_cb,
3856 void *data) 3851 void *data)
3857{ 3852{
3858 Eina_Module *mod; 3853 static Evas_Object *(*vnc_new)(Ecore_Evas *, int, const char *,
3859 void *(*vnc_new)(Ecore_Evas *, int, const char *, 3854 Ecore_Evas_Vnc_Client_Accept_Cb,
3860 Ecore_Evas_Vnc_Client_Accept_Cb, 3855 Ecore_Evas_Vnc_Client_Disconnected_Cb,
3861 Ecore_Evas_Vnc_Client_Disconnected_Cb, 3856 void *) = NULL;
3862 void *); 3857 Evas_Object *r;
3863 3858
3864 EINA_SAFETY_ON_NULL_RETURN_VAL(ee, EINA_FALSE); 3859 EINA_SAFETY_ON_NULL_RETURN_VAL(ee, NULL);
3865
3866 if (ee->vnc_server)
3867 return EINA_FALSE;
3868 3860
3869 mod = _ecore_evas_vnc_server_module_load(); 3861 if (!vnc_new)
3870 EINA_SAFETY_ON_NULL_RETURN_VAL(mod, EINA_FALSE); 3862 {
3863 Eina_Module *mod;
3871 3864
3872 vnc_new = eina_module_symbol_get(mod, "ecore_evas_vnc_server_new"); 3865 mod = _ecore_evas_vnc_server_module_load();
3873 EINA_SAFETY_ON_NULL_RETURN_VAL(vnc_new, EINA_FALSE); 3866 EINA_SAFETY_ON_NULL_RETURN_VAL(mod, NULL);
3874 3867
3875 ee->vnc_server = vnc_new(ee, port, addr, accept_cb, disc_cb, data); 3868 vnc_new = eina_module_symbol_get(mod, "ecore_evas_vnc_server_new");
3876 EINA_SAFETY_ON_NULL_RETURN_VAL(ee->vnc_server, EINA_FALSE); 3869 EINA_SAFETY_ON_NULL_RETURN_VAL(vnc_new, NULL);
3877 return EINA_TRUE; 3870 }
3878}
3879 3871
3880EAPI Eina_Bool 3872 r = vnc_new(ee, port, addr, accept_cb, disc_cb, data);
3881ecore_evas_vnc_stop(Ecore_Evas *ee) 3873 if (!r) return NULL;
3882{
3883 EINA_SAFETY_ON_NULL_RETURN_VAL(ee, EINA_FALSE);
3884 EINA_SAFETY_ON_FALSE_RETURN_VAL(ee->vnc_server, EINA_FALSE);
3885 3874
3886 return _ecore_evas_vnc_stop(ee); 3875 ee->vnc_server = eina_list_append(ee->vnc_server, r);
3876 return r;
3887} 3877}
3888 3878
3889EAPI Ecore_Evas * 3879EAPI Ecore_Evas *
diff --git a/src/lib/ecore_evas/ecore_evas_private.h b/src/lib/ecore_evas/ecore_evas_private.h
index 74005035db..25fa6def0d 100644
--- a/src/lib/ecore_evas/ecore_evas_private.h
+++ b/src/lib/ecore_evas/ecore_evas_private.h
@@ -218,7 +218,7 @@ struct _Ecore_Evas
218 Eina_Hash *data; 218 Eina_Hash *data;
219 Eina_List *mice_in; 219 Eina_List *mice_in;
220 220
221 void *vnc_server; /* @since 1.19 */ 221 Eina_List *vnc_server; /* @since 1.19 */
222 222
223 struct { 223 struct {
224 int x, y, w, h; 224 int x, y, w, h;