summaryrefslogtreecommitdiff
path: root/amiga/context_menu.c
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2011-04-29 18:15:20 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2011-04-29 18:15:20 +0000
commit1518543c227c61250da14a864ad88c10fc6cd4c4 (patch)
treebbeba98b5faea95ce61ac7676bc7ce1ea8a31430 /amiga/context_menu.c
parent1304964f92249a1f8e685db89aa694f77307d6ae (diff)
downloadnetsurf-1518543c227c61250da14a864ad88c10fc6cd4c4.tar.gz
netsurf-1518543c227c61250da14a864ad88c10fc6cd4c4.tar.bz2
Fix DSI when drag saving
Allow selection drags to URL and search gadgets svn path=/trunk/netsurf/; revision=12259
Diffstat (limited to 'amiga/context_menu.c')
-rwxr-xr-xamiga/context_menu.c38
1 files changed, 2 insertions, 36 deletions
diff --git a/amiga/context_menu.c b/amiga/context_menu.c
index cdd3df584..81f81361e 100755
--- a/amiga/context_menu.c
+++ b/amiga/context_menu.c
@@ -48,9 +48,6 @@
#include <string.h>
static uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved);
-static bool ami_context_menu_copy_selection(const char *text, size_t length,
- struct box *box, void *handle, const char *whitespace_text,
- size_t whitespace_length);
static bool ami_context_menu_history(const struct history *history, int x0, int y0,
int x1, int y1, const struct history_entry *entry, void *user_data);
@@ -84,12 +81,6 @@ struct Library *PopupMenuBase = NULL;
struct PopupMenuIFace *IPopupMenu = NULL;
char *ctxmenulab[CMID_LAST];
-struct ami_context_menu_selection
-{
- char text[1024];
- int length;
-};
-
void ami_context_menu_init(void)
{
if(PopupMenuBase = OpenLibrary("popupmenu.class",0))
@@ -584,16 +575,11 @@ static uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved
case CMID_SELSEARCH:
{
- struct ami_context_menu_selection *sel;
+ struct ami_text_selection *sel;
char *url;
- sel = AllocVec(sizeof(struct ami_context_menu_selection),
- MEMF_PRIVATE | MEMF_CLEAR);
-
- if(sel)
+ if(sel = ami_selection_to_text(gwin))
{
- selection_traverse(gwin->bw->sel, ami_context_menu_copy_selection,
- sel);
url = search_web_from_term(sel->text);
browser_window_go(gwin->bw, url, NULL, true);
@@ -607,26 +593,6 @@ static uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved
return itemid;
}
-static bool ami_context_menu_copy_selection(const char *text, size_t length,
- struct box *box, void *handle, const char *whitespace_text,
- size_t whitespace_length)
-{
- struct ami_context_menu_selection *sel = handle;
- int len = length;
-
- if((length + (sel->length)) > (sizeof(sel->text)))
- len = sizeof(sel->text) - (sel->length);
-
- if(len <= 0) return false;
-
- memcpy((sel->text) + (sel->length), text, len);
- sel->length += len;
-
- sel->text[sel->length] = '\0';
-
- return true;
-}
-
static bool ami_context_menu_history(const struct history *history, int x0, int y0,
int x1, int y1, const struct history_entry *entry, void *user_data)
{