Use selection_copy_to_clipboard instead of peering into core.

This commit is contained in:
Michael Drake 2012-08-02 15:20:59 +01:00
parent 42e176097c
commit de8af23956
1 changed files with 1 additions and 24 deletions

View File

@ -714,35 +714,12 @@ bool gui_commit_clipboard(void)
return( (r>0)?true:false );
}
static bool
gui_selection_traverse_handler(const char *text,
size_t length,
struct box *box,
void *handle,
const char *space_text,
size_t space_length)
{
bool add_space = box != NULL ? box->space != 0 : false;
if (space_text != NULL && space_length > 0) {
if (!gui_add_to_clipboard(space_text, space_length, false)) {
return false;
}
}
if (!gui_add_to_clipboard(text, length, add_space))
return false;
return true;
}
bool gui_copy_to_clipboard(struct selection *s)
{
bool ret = false;
if( s->defined ) {
gui_empty_clipboard();
if(selection_traverse(s, gui_selection_traverse_handler, NULL)){
if(selection_copy_to_clipboard(s)){
ret = gui_commit_clipboard();
}
}