Ecore Evas VNC: Add support for ecore_evas_pointer_device_xy_get().

This commit adds the support to fetch the mouse position of a VNC
client.
This commit is contained in:
Guilherme Iscaro 2016-11-21 17:05:18 -02:00 committed by Bruno Dilly
parent 133b4fa65b
commit 2e527851cf
2 changed files with 46 additions and 1 deletions

View File

@ -2393,7 +2393,19 @@ ecore_evas_pointer_device_xy_get(const Ecore_Evas *ee,
if (x) *x = 0;
if (y) *y = 0;
ECORE_EVAS_CHECK(ee);
if (ee->engine.func->fn_pointer_device_xy_get)
if (ee->vnc_server)
{
Eina_Module *mod;
void (*pointer_xy_get)(const void *, const Efl_Input_Device *, Evas_Coord *, Evas_Coord *y);
mod = _ecore_evas_vnc_server_module_load();
EINA_SAFETY_ON_NULL_RETURN(mod);
pointer_xy_get = eina_module_symbol_get(mod, "ecore_evas_vnc_server_pointer_xy_get");
EINA_SAFETY_ON_NULL_RETURN(pointer_xy_get);
pointer_xy_get(ee->vnc_server, pointer, x, y);
}
else if (ee->engine.func->fn_pointer_device_xy_get)
ee->engine.func->fn_pointer_device_xy_get(ee, pointer, x, y);
}
}

View File

@ -893,5 +893,38 @@ ecore_evas_vnc_server_del(Ecore_Evas_Vnc_Server *server)
free(server);
}
EAPI void
ecore_evas_vnc_server_pointer_xy_get(const Ecore_Evas_Vnc_Server *server,
const Evas_Device *pointer,
Evas_Coord *x, Evas_Coord *y)
{
Evas_Coord sx, sy;
rfbClientIteratorPtr itr;
rfbClientRec *client;
Ecore_Evas_Vnc_Server_Client_Data *cdata;
EINA_SAFETY_ON_NULL_RETURN(server);
EINA_SAFETY_ON_NULL_RETURN(pointer);
sx = sy = 0;
itr = rfbGetClientIterator(server->vnc_screen);
while ((client = rfbClientIteratorNext(itr)))
{
cdata = client->clientData;
if (cdata->mouse == pointer)
{
sx = client->lastPtrX;
sy = client->lastPtrY;
break;
}
}
rfbReleaseClientIterator(itr);
if (x) *x = sx;
if (y) *y = sy;
}
EINA_MODULE_INIT(_ecore_evas_vnc_server_init);
EINA_MODULE_SHUTDOWN(_ecore_evas_vnc_server_shutdown);