diff --git a/legacy/ecore/src/lib/ecore_x/Ecore_X.h b/legacy/ecore/src/lib/ecore_x/Ecore_X.h
index 94e1cf81f4..ae89fa1974 100644
--- a/legacy/ecore/src/lib/ecore_x/Ecore_X.h
+++ b/legacy/ecore/src/lib/ecore_x/Ecore_X.h
@@ -592,11 +592,11 @@ void ecore_x_io_error_handler_set(void (*func) (void *data), const v
int ecore_x_error_request_get(void);
int ecore_x_error_code_get(void);
-int ecore_x_selection_primary_set(Ecore_X_Window w, char *data, int len);
+int ecore_x_selection_primary_set(Ecore_X_Window w, char *data, int size);
int ecore_x_selection_primary_clear(void);
-int ecore_x_selection_secondary_set(Ecore_X_Window w, char *data, int len);
+int ecore_x_selection_secondary_set(Ecore_X_Window w, char *data, int size);
int ecore_x_selection_secondary_clear(void);
-int ecore_x_selection_clipboard_set(Ecore_X_Window w, char *data, int len);
+int ecore_x_selection_clipboard_set(Ecore_X_Window w, char *data, int size);
int ecore_x_selection_clipboard_clear(void);
void ecore_x_selection_primary_request(Ecore_X_Window w, char *target);
void ecore_x_selection_secondary_request(Ecore_X_Window w, char *target);
diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x_selection.c b/legacy/ecore/src/lib/ecore_x/ecore_x_selection.c
index dd869a0f71..d3151a3f12 100644
--- a/legacy/ecore/src/lib/ecore_x/ecore_x_selection.c
+++ b/legacy/ecore/src/lib/ecore_x/ecore_x_selection.c
@@ -55,6 +55,15 @@ _ecore_x_selection_request_data_get(Ecore_X_Atom selection, void **buf, int *len
return;
}
+/**
+ * Fetch the data returned by a PRIMARY selection request.
+ * @param buf A pointer to hold the selection data
+ * @param len The size of the data
+ *
+ * Get the converted data from a previous PRIMARY selection
+ * request. The buffer must be freed when done with.
+ *
+ */
void
ecore_x_selection_primary_request_data_get(void **buf, int *len)
{
@@ -62,6 +71,15 @@ ecore_x_selection_primary_request_data_get(void **buf, int *len)
buf, len);
}
+/**
+ * Fetch the data returned by a SECONDARY selection request.
+ * @param buf A pointer to hold the selection data
+ * @param len The size of the data
+ *
+ * Get the converted data from a previous SECONDARY selection
+ * request. The buffer must be freed when done with.
+ *
+ */
void
ecore_x_selection_secondary_request_data_get(void **buf, int *len)
{
@@ -69,6 +87,15 @@ ecore_x_selection_secondary_request_data_get(void **buf, int *len)
buf, len);
}
+/**
+ * Fetch the data returned by a CLIPBOARD selection request.
+ * @param buf A pointer to hold the selection data
+ * @param len The size of the data
+ *
+ * Get the converted data from a previous CLIPBOARD selection
+ * request. The buffer must be freed when done with.
+ *
+ */
void
ecore_x_selection_clipboard_request_data_get(void **buf, int *len)
{
@@ -106,7 +133,7 @@ _ecore_x_selection_get(Atom selection)
}
int
-_ecore_x_selection_set(Window w, char *data, int len, Atom selection)
+_ecore_x_selection_set(Window w, char *data, int size, Atom selection)
{
int in;
char *buf = NULL;
@@ -126,11 +153,11 @@ _ecore_x_selection_set(Window w, char *data, int len, Atom selection)
{
selections[in].win = w;
selections[in].selection = selection;
- selections[in].length = len;
+ selections[in].length = size;
selections[in].time = _ecore_x_event_last_time;
- buf = malloc(sizeof(char) * len);
- memcpy(buf, data, sizeof(char) * len);
+ buf = malloc(size);
+ memcpy(buf, data, size);
selections[in].data = buf;
}
else
@@ -142,41 +169,96 @@ _ecore_x_selection_set(Window w, char *data, int len, Atom selection)
}
}
- /* ecore_x_window_prop_property_set(_ecore_x_disp, w, selection,
- XA_STRING, 8, data, len); */
return 1;
}
+/**
+ * Claim ownership of the PRIMARY selection and set its data.
+ * @param w The window to which this selection belongs
+ * @param data The data associated with the selection
+ * @param size The size of the data buffer in bytes
+ * @return Returns 1 if the ownership of the selection was successfully
+ * claimed, or 0 if unsuccessful.
+ *
+ * Get the converted data from a previous PRIMARY selection
+ * request. The buffer must be freed when done with.
+ *
+ */
int
-ecore_x_selection_primary_set(Ecore_X_Window w, char *data, int len)
+ecore_x_selection_primary_set(Ecore_X_Window w, char *data, int size)
{
- return _ecore_x_selection_set(w, data, len, _ecore_x_atom_selection_primary);
+ return _ecore_x_selection_set(w, data, size, _ecore_x_atom_selection_primary);
}
+/**
+ * Release ownership of the primary selection
+ * @return Returns 1 if the selection was successfully cleared,
+ * or 0 if unsuccessful.
+ *
+ *
+ */
int
ecore_x_selection_primary_clear(void)
{
return _ecore_x_selection_set(None, NULL, 0, _ecore_x_atom_selection_primary);
}
+/**
+ * Claim ownership of the SECONDARY selection and set its data.
+ * @param w The window to which this selection belongs
+ * @param data The data associated with the selection
+ * @param size The size of the data buffer in bytes
+ * @return Returns 1 if the ownership of the selection was successfully
+ * claimed, or 0 if unsuccessful.
+ *
+ * Get the converted data from a previous SECONDARY selection
+ * request. The buffer must be freed when done with.
+ *
+ */
int
-ecore_x_selection_secondary_set(Ecore_X_Window w, char *data, int len)
+ecore_x_selection_secondary_set(Ecore_X_Window w, char *data, int size)
{
- return _ecore_x_selection_set(w, data, len, _ecore_x_atom_selection_secondary);
+ return _ecore_x_selection_set(w, data, size, _ecore_x_atom_selection_secondary);
}
+/**
+ * Release ownership of the secondary selection
+ * @return Returns 1 if the selection was successfully cleared,
+ * or 0 if unsuccessful.
+ *
+ *
+ */
int
ecore_x_selection_secondary_clear(void)
{
return _ecore_x_selection_set(None, NULL, 0, _ecore_x_atom_selection_secondary);
}
+/**
+ * Claim ownership of the CLIPBOARD selection and set its data.
+ * @param w The window to which this selection belongs
+ * @param data The data associated with the selection
+ * @param size The size of the data buffer in bytes
+ * @return Returns 1 if the ownership of the selection was successfully
+ * claimed, or 0 if unsuccessful.
+ *
+ * Get the converted data from a previous CLIPBOARD selection
+ * request. The buffer must be freed when done with.
+ *
+ */
int
-ecore_x_selection_clipboard_set(Ecore_X_Window w, char *data, int len)
+ecore_x_selection_clipboard_set(Ecore_X_Window w, char *data, int size)
{
- return _ecore_x_selection_set(w, data, len, _ecore_x_atom_selection_clipboard);
+ return _ecore_x_selection_set(w, data, size, _ecore_x_atom_selection_clipboard);
}
+/**
+ * Release ownership of the clipboard selection
+ * @return Returns 1 if the selection was successfully cleared,
+ * or 0 if unsuccessful.
+ *
+ *
+ */
int
ecore_x_selection_clipboard_clear(void)
{