[PATCH 3/3] wayland: Add cnp functionality for elementary entry widget.
zhiwen.wu at linux.intel.com
zhiwen.wu at linux.intel.com
Fri Aug 3 01:02:24 PDT 2012
From: Alex Wu <zhiwen.wu at linux.intel.com>
---
trunk/ecore/src/lib/ecore_wayland/Ecore_Wayland.h | 1 +
trunk/ecore/src/lib/ecore_wayland/ecore_wl_dnd.c | 9 +++++++++
trunk/elementary/src/lib/elm_cnp.c | 5 +++--
trunk/elementary/src/lib/elm_entry.c | 12 ++++++++++++
4 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/trunk/ecore/src/lib/ecore_wayland/Ecore_Wayland.h b/trunk/ecore/src/lib/ecore_wayland/Ecore_Wayland.h
index e380d46..05f320e 100644
--- a/trunk/ecore/src/lib/ecore_wayland/Ecore_Wayland.h
+++ b/trunk/ecore/src/lib/ecore_wayland/Ecore_Wayland.h
@@ -368,5 +368,6 @@ EAPI Eina_Bool ecore_wl_dnd_set_selection(Ecore_Wl_Dnd *dnd, const char **types_
EAPI Eina_Bool ecore_wl_dnd_get_selection(Ecore_Wl_Dnd *dnd, const char *type);
EAPI Ecore_Wl_Dnd *ecore_wl_dnd_get();
EAPI Eina_Bool ecore_wl_dnd_start_drag();
+EAPI Eina_Bool ecore_wl_dnd_selection_has_owner(Ecore_Wl_Dnd *dnd);
#endif
diff --git a/trunk/ecore/src/lib/ecore_wayland/ecore_wl_dnd.c b/trunk/ecore/src/lib/ecore_wayland/ecore_wl_dnd.c
index ac6f2a3..3f9af94 100644
--- a/trunk/ecore/src/lib/ecore_wayland/ecore_wl_dnd.c
+++ b/trunk/ecore/src/lib/ecore_wayland/ecore_wl_dnd.c
@@ -279,6 +279,15 @@ ecore_wl_dnd_get_selection(Ecore_Wl_Dnd *dnd, const char *type)
return EINA_TRUE;
}
+EAPI Eina_Bool
+ecore_wl_dnd_selection_has_owner(Ecore_Wl_Dnd *dnd)
+{
+ Ecore_Wl_Input *input;
+
+ input = dnd->input;
+ return (input->selection_source != NULL);
+}
+
static void
_ecore_wl_dnd_data_source_cancelled(void *data __UNUSED__, struct wl_data_source *source)
{
diff --git a/trunk/elementary/src/lib/elm_cnp.c b/trunk/elementary/src/lib/elm_cnp.c
index e28a861..1475a63 100644
--- a/trunk/elementary/src/lib/elm_cnp.c
+++ b/trunk/elementary/src/lib/elm_cnp.c
@@ -442,9 +442,10 @@ elm_selection_selection_has_owner(void)
{
#ifdef HAVE_ELEMENTARY_X
return !!ecore_x_selection_owner_get(ECORE_X_ATOM_SELECTION_CLIPBOARD);
-#else
- return EINA_FALSE;
+#elif defined HAVE_ELEMENTARY_WAYLAND
+ return ecore_wl_dnd_selection_has_owner(ecore_wl_dnd_get());
#endif
+ return EINA_FALSE;
}
#ifdef HAVE_ELEMENTARY_X
diff --git a/trunk/elementary/src/lib/elm_entry.c b/trunk/elementary/src/lib/elm_entry.c
index 1760603..71a7eb5 100644
--- a/trunk/elementary/src/lib/elm_entry.c
+++ b/trunk/elementary/src/lib/elm_entry.c
@@ -1257,6 +1257,18 @@ _paste(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
elm_cnp_selection_get(data, ELM_SEL_TYPE_CLIPBOARD, formats, NULL, NULL);
#endif
}
+ else
+ {
+#ifdef HAVE_ELEMENTARY_WAYLAND
+ Elm_Sel_Format formats = ELM_SEL_FORMAT_MARKUP;
+ wd->selection_asked = EINA_TRUE;
+ if (wd->cnp_mode == ELM_CNP_MODE_PLAINTEXT)
+ formats = ELM_SEL_FORMAT_TEXT;
+ else if (wd->cnp_mode != ELM_CNP_MODE_NO_IMAGE)
+ formats |= ELM_SEL_FORMAT_IMAGE;
+ elm_cnp_selection_get(data, ELM_SEL_TYPE_CLIPBOARD, formats, NULL, NULL);
+#endif
+ }
}
static void
--
1.7.9.5
More information about the wayland-devel
mailing list