struct ami_text_selection *ami_selection_to_text(struct gui_window_2 *gwin) { struct ami_text_selection *sel; sel = AllocVec(sizeof(struct ami_text_selection), MEMF_PRIVATE | MEMF_CLEAR); if(sel) selection_traverse(browser_window_get_selection(gwin->bw), ami_copy_selection, sel); return sel; }
bool gui_copy_to_clipboard(struct selection *s) { bool success; if(s->defined == false) return false; if(!gui_empty_clipboard()) return false; success = selection_traverse(s, ami_clipboard_copy, NULL); /* commit regardless, otherwise we leave the clipboard in an unusable state */ gui_commit_clipboard(); return success; }
bool gui_copy_to_clipboard(struct selection *s) { if (s->defined && selection_traverse(s, copy_handler, NULL)) gui_commit_clipboard(); return true; }