summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2012-08-16 23:26:05 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2012-08-16 23:26:05 +0100
commit402de7572d76686dd65a5ee71274a690a421cc8f (patch)
tree31344508aed1e1caa650be5496a6df40e1eb8ea2
parenta548275fa238870075fc3c9a5076a731d3d11a9e (diff)
downloadnetsurf-402de7572d76686dd65a5ee71274a690a421cc8f.tar.gz
netsurf-402de7572d76686dd65a5ee71274a690a421cc8f.tar.bz2
Use new content message for saving of hyperlink target URL.
-rw-r--r--content/content.h8
-rw-r--r--desktop/browser.c10
-rw-r--r--render/html.c5
-rw-r--r--render/html_interaction.c11
4 files changed, 29 insertions, 5 deletions
diff --git a/content/content.h b/content/content.h
index 5ff40d00c..f3a443868 100644
--- a/content/content.h
+++ b/content/content.h
@@ -75,7 +75,8 @@ typedef enum {
CONTENT_MSG_LINK, /**< RFC5988 link */
CONTENT_MSG_GETCTX, /**< Javascript context */
CONTENT_MSG_SCROLL, /**< Request to scroll content */
- CONTENT_MSG_DRAGSAVE /**< Allow drag saving of content */
+ CONTENT_MSG_DRAGSAVE, /**< Allow drag saving of content */
+ CONTENT_MSG_SAVELINK /**< Allow URL to be saved */
} content_msg;
/** RFC5988 metadata link */
@@ -139,6 +140,11 @@ union content_msg_data {
} type;
struct hlcache_handle *content;
} dragsave;
+ /** CONTENT_MSG_SAVELINK - Save a URL */
+ struct {
+ const char *url;
+ const char *title;
+ } savelink;
};
/** parameters to content redraw */
diff --git a/desktop/browser.c b/desktop/browser.c
index 17e35619d..3c99c5fb4 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -1473,6 +1473,16 @@ nserror browser_window_callback(hlcache_handle *c,
}
break;
+ case CONTENT_MSG_SAVELINK:
+ {
+ /* Content wants a link to be saved */
+ struct browser_window *root = browser_window_get_root(bw);
+ gui_window_save_link(root->window,
+ event->data.savelink.url,
+ event->data.savelink.title);
+ }
+ break;
+
default:
assert(0);
}
diff --git a/render/html.c b/render/html.c
index 62b3d1d4e..7c7b797ba 100644
--- a/render/html.c
+++ b/render/html.c
@@ -1247,6 +1247,11 @@ html_object_callback(hlcache_handle *object,
content_broadcast(&c->base, CONTENT_MSG_DRAGSAVE, event->data);
break;
+ case CONTENT_MSG_SAVELINK:
+ /* Pass it on */
+ content_broadcast(&c->base, CONTENT_MSG_SAVELINK, event->data);
+ break;
+
default:
assert(0);
}
diff --git a/render/html_interaction.c b/render/html_interaction.c
index a74e99d9a..a3cfaa95f 100644
--- a/render/html_interaction.c
+++ b/render/html_interaction.c
@@ -696,16 +696,19 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
mouse & BROWSER_MOUSE_MOD_1) {
/* force download of link */
browser_window_go_post(bw, nsurl_access(url), 0, 0,
- false, nsurl_access(hlcache_handle_get_url(h)),
+ false,
+ nsurl_access(hlcache_handle_get_url(h)),
true, true, 0);
+
} else if (mouse & BROWSER_MOUSE_CLICK_2 &&
mouse & BROWSER_MOUSE_MOD_1) {
- gui_window_save_link(bw->window,
- nsurl_access(url), title);
+ msg_data.savelink.url = nsurl_access(url);
+ msg_data.savelink.title = title;
+ content_broadcast(c, CONTENT_MSG_SAVELINK, msg_data);
+
} else if (mouse & (BROWSER_MOUSE_CLICK_1 |
BROWSER_MOUSE_CLICK_2))
action = ACTION_GO;
-
} else {
bool done = false;