Ecore_X: Fix CnP when using xcb backend.
SVN revision: 61662
This commit is contained in:
parent
f28ad30b8d
commit
35fbbc9aab
|
@ -532,11 +532,12 @@ _ecore_xcb_selection_set(Ecore_X_Window win, const void *data, int size, Ecore_X
|
||||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||||
|
|
||||||
xcb_set_selection_owner(_ecore_xcb_conn, win,
|
xcb_set_selection_owner(_ecore_xcb_conn, win,
|
||||||
selection, ecore_x_current_time_get());
|
selection, _ecore_xcb_events_last_time_get());
|
||||||
|
|
||||||
cookie = xcb_get_selection_owner(_ecore_xcb_conn, selection);
|
cookie = xcb_get_selection_owner(_ecore_xcb_conn, selection);
|
||||||
reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL);
|
reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL);
|
||||||
if (!reply) return EINA_FALSE;
|
if (!reply) return EINA_FALSE;
|
||||||
|
|
||||||
if (reply->owner != win)
|
if (reply->owner != win)
|
||||||
{
|
{
|
||||||
free(reply);
|
free(reply);
|
||||||
|
@ -552,7 +553,7 @@ _ecore_xcb_selection_set(Ecore_X_Window win, const void *data, int size, Ecore_X
|
||||||
in = 2;
|
in = 2;
|
||||||
else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
|
else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
|
||||||
in = 3;
|
in = 3;
|
||||||
else
|
else
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
|
@ -562,7 +563,7 @@ _ecore_xcb_selection_set(Ecore_X_Window win, const void *data, int size, Ecore_X
|
||||||
_selections[in].win = win;
|
_selections[in].win = win;
|
||||||
_selections[in].selection = selection;
|
_selections[in].selection = selection;
|
||||||
_selections[in].length = size;
|
_selections[in].length = size;
|
||||||
_selections[in].time = ecore_x_current_time_get();
|
_selections[in].time = _ecore_xcb_events_last_time_get();
|
||||||
|
|
||||||
buff = malloc(size);
|
buff = malloc(size);
|
||||||
if (!buff) return EINA_FALSE;
|
if (!buff) return EINA_FALSE;
|
||||||
|
@ -597,7 +598,7 @@ _ecore_xcb_selection_request(Ecore_X_Window win, Ecore_X_Atom selection, const c
|
||||||
atarget = _ecore_xcb_selection_target_atom_get(target);
|
atarget = _ecore_xcb_selection_target_atom_get(target);
|
||||||
|
|
||||||
xcb_convert_selection(_ecore_xcb_conn, win, selection, atarget, prop,
|
xcb_convert_selection(_ecore_xcb_conn, win, selection, atarget, prop,
|
||||||
ecore_x_current_time_get());
|
XCB_CURRENT_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
|
@ -622,7 +623,9 @@ _ecore_xcb_selection_converter_text(char *target, void *data, int size, void **d
|
||||||
else
|
else
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
if (!(str = strdup(data))) return EINA_FALSE;
|
str = alloca(size + 1);
|
||||||
|
memcpy(str, data, size);
|
||||||
|
str[size] = '\0';
|
||||||
|
|
||||||
#ifdef HAVE_ICONV
|
#ifdef HAVE_ICONV
|
||||||
if (_ecore_xcb_utf8_textlist_to_textproperty(&str, 1, style, &ret))
|
if (_ecore_xcb_utf8_textlist_to_textproperty(&str, 1, style, &ret))
|
||||||
|
@ -631,15 +634,10 @@ _ecore_xcb_selection_converter_text(char *target, void *data, int size, void **d
|
||||||
|
|
||||||
size = (strlen((char *)ret.value) + 1);
|
size = (strlen((char *)ret.value) + 1);
|
||||||
*data_ret = malloc(size);
|
*data_ret = malloc(size);
|
||||||
if (!*data_ret)
|
if (!*data_ret) return EINA_FALSE;
|
||||||
{
|
|
||||||
free(str);
|
|
||||||
return EINA_FALSE;
|
|
||||||
}
|
|
||||||
memcpy(*data_ret, ret.value, size);
|
memcpy(*data_ret, ret.value, size);
|
||||||
*size_ret = size;
|
*size_ret = size;
|
||||||
if (ret.value) free(ret.value);
|
if (ret.value) free(ret.value);
|
||||||
if (str) free(str);
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -649,23 +647,16 @@ _ecore_xcb_selection_converter_text(char *target, void *data, int size, void **d
|
||||||
|
|
||||||
size = (strlen((char *)ret.value) + 1);
|
size = (strlen((char *)ret.value) + 1);
|
||||||
*data_ret = malloc(size);
|
*data_ret = malloc(size);
|
||||||
if (!*data_ret)
|
if (!*data_ret) return EINA_FALSE;
|
||||||
{
|
|
||||||
free(str);
|
|
||||||
return EINA_FALSE;
|
|
||||||
}
|
|
||||||
memcpy(*data_ret, ret.value, size);
|
memcpy(*data_ret, ret.value, size);
|
||||||
*size_ret = size;
|
*size_ret = size;
|
||||||
if (ret.value) free(ret.value);
|
if (ret.value) free(ret.value);
|
||||||
if (str) free(str);
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
{
|
return EINA_TRUE;
|
||||||
if (str) free(str);
|
|
||||||
return EINA_TRUE;
|
|
||||||
}
|
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue