From: Michal Pakula vel Rutka <m.pakula@samsung.com>

Subject: [E-devel] [patch] allow copy and paste operations for
non-widget evas objects

I am currently implementing a clipboard for WebKit-EFL. When using
elm_cnp_selection_get and set function an evas object passed has to be
a widget. Currently in WebKit-EFL we are using an view which is an
Evas_Object, but not a widget. Sample WebKit applications like
EWebLauncher and tests applications does not use elementary so I
cannot obtain parent widget for a view object and finally we cannot
perform copy and paste operations.
Widgets are used in elm_cnp_selection functions to obtain
Ecore_X_Window. My patch leaves current way of obtaining it and adds
an another in case when the standard one fails. When Evas_Object is
not a widget I am trying to get an Ecore_X_Window using ecore.



SVN revision: 71381
This commit is contained in:
Michal Pakula vel Rutka 2012-05-24 04:34:53 +00:00 committed by Carsten Haitzler
parent 59718a93c7
commit 39d0d27e53
2 changed files with 28 additions and 2 deletions

View File

@ -92,3 +92,8 @@
* Map: Add elm_map_overlays_get & elm_map_overlay_visible_get functions.
2012-05-24 Michal Pakula vel Rutka
* Add ability to use cnp helper code on non-elm widget objects by
falling back to ecore-evas to get the window id.

View File

@ -400,6 +400,16 @@ elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection,
if (top) xwin = elm_win_xwindow_get(top);
else xwin = elm_win_xwindow_get(obj);
if (!xwin)
{
Evas *evas = evas_object_evas_get(obj);
if (!evas) return EINA_FALSE;
Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas);
if (!ee) return EINA_FALSE;
xwin = (Ecore_X_Window) ecore_evas_window_get(ee);
}
if ((!xwin) || (selection > ELM_SEL_TYPE_CLIPBOARD))
return EINA_FALSE;
if (!_elm_cnp_init_count) _elm_cnp_init();
@ -474,6 +484,7 @@ elm_cnp_selection_get(Evas_Object *obj, Elm_Sel_Type selection,
{
#ifdef HAVE_ELEMENTARY_X
Evas_Object *top;
Ecore_X_Window xwin;
Cnp_Selection *sel;
if (selection > ELM_SEL_TYPE_CLIPBOARD)
@ -482,11 +493,21 @@ elm_cnp_selection_get(Evas_Object *obj, Elm_Sel_Type selection,
sel = selections + selection;
top = elm_widget_top_get(obj);
if (!top) return EINA_FALSE;
if (top) xwin = elm_win_xwindow_get(top);
else
{
Evas *evas = evas_object_evas_get(obj);
if (!evas) return EINA_FALSE;
Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas);
if (!ee) return EINA_FALSE;
xwin = (Ecore_X_Window) ecore_evas_window_get(ee);
}
if (!xwin) return EINA_FALSE;
sel->requestformat = format;
sel->requestwidget = obj;
sel->request(elm_win_xwindow_get(top), ECORE_X_SELECTION_TARGET_TARGETS);
sel->request(xwin, ECORE_X_SELECTION_TARGET_TARGETS);
sel->datacb = datacb;
sel->udata = udata;