summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--amiga/clipboard.c29
-rwxr-xr-xamiga/clipboard.h7
-rw-r--r--amiga/context_menu.c9
3 files changed, 4 insertions, 41 deletions
diff --git a/amiga/clipboard.c b/amiga/clipboard.c
index 2fe016b10..7be73bb56 100644
--- a/amiga/clipboard.c
+++ b/amiga/clipboard.c
@@ -286,35 +286,6 @@ void gui_set_clipboard(const char *buffer, size_t length,
}
}
-struct ami_text_selection *ami_selection_to_text(struct gui_window_2 *gwin)
-{
- struct ami_text_selection *sel;
- int len;
- char *ss;
-
- sel = AllocVec(sizeof(struct ami_text_selection),
- MEMF_PRIVATE | MEMF_CLEAR);
-
- if (sel) {
- /* Get selection string */
- ss = browser_window_get_selection(gwin->bw);
- if (ss == NULL)
- return sel;
-
- len = strlen(ss);
-
- if (len > sizeof(sel->text))
- len = sizeof(sel->text) - 1;
-
- memcpy(sel->text, ss, len);
- sel->length = len;
- sel->text[sel->length] = '\0';
-
- free(ss);
- }
- return sel;
-}
-
void ami_drag_selection(struct gui_window *g)
{
int x;
diff --git a/amiga/clipboard.h b/amiga/clipboard.h
index 6cae3e3b8..cf3f74087 100755
--- a/amiga/clipboard.h
+++ b/amiga/clipboard.h
@@ -26,18 +26,11 @@ struct selection;
struct gui_window;
struct gui_window_2;
-struct ami_text_selection
-{
- char text[1024];
- int length;
-};
-
void ami_clipboard_init(void);
void ami_clipboard_free(void);
void ami_drag_selection(struct gui_window *g);
bool ami_easy_clipboard(char *text);
bool ami_easy_clipboard_bitmap(struct bitmap *bitmap);
-struct ami_text_selection *ami_selection_to_text(struct gui_window_2 *gwin);
#ifdef WITH_NS_SVG
bool ami_easy_clipboard_svg(struct hlcache_handle *c);
#endif
diff --git a/amiga/context_menu.c b/amiga/context_menu.c
index c5b292927..ae08fbcc6 100644
--- a/amiga/context_menu.c
+++ b/amiga/context_menu.c
@@ -989,13 +989,13 @@ static uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved
case CMID_SELSEARCH:
{
- struct ami_text_selection *sel;
+ char *sel;
char *urltxt;
nsurl *url;
- if(sel = ami_selection_to_text(gwin))
+ if(sel = browser_window_get_selection(gwin->bw))
{
- urltxt = search_web_from_term(sel->text);
+ urltxt = search_web_from_term(sel);
if (nsurl_create(urltxt, &url) != NSERROR_OK) {
warn_user("NoMemory", 0);
@@ -1010,8 +1010,7 @@ static uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved
NULL);
nsurl_unref(url);
}
-
- FreeVec(sel);
+ free(sel);
}
}
break;