From 1919c8e07168859cc6362c5283d47d0ced3a9bc2 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 16 Aug 2012 20:20:49 +0100 Subject: Add message for content wanting wanting drag save to start. --- render/html.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'render/html.c') diff --git a/render/html.c b/render/html.c index 22fa80fbd..62b3d1d4e 100644 --- a/render/html.c +++ b/render/html.c @@ -1242,6 +1242,11 @@ html_object_callback(hlcache_handle *object, false); break; + case CONTENT_MSG_DRAGSAVE: + /* Pass it on */ + content_broadcast(&c->base, CONTENT_MSG_DRAGSAVE, event->data); + break; + default: assert(0); } -- cgit v1.2.3 From 402de7572d76686dd65a5ee71274a690a421cc8f Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 16 Aug 2012 23:26:05 +0100 Subject: Use new content message for saving of hyperlink target URL. --- content/content.h | 8 +++++++- desktop/browser.c | 10 ++++++++++ render/html.c | 5 +++++ render/html_interaction.c | 11 +++++++---- 4 files changed, 29 insertions(+), 5 deletions(-) (limited to 'render/html.c') 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; -- cgit v1.2.3 From 142a0bf859b70a2b278b007aac99a5ab0811a956 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 17 Aug 2012 10:01:15 +0100 Subject: Add content message for setting mouse pointer. --- content/content.h | 5 ++++- desktop/browser.c | 5 +++++ render/html.c | 5 +++++ 3 files changed, 14 insertions(+), 1 deletion(-) (limited to 'render/html.c') diff --git a/content/content.h b/content/content.h index f3a443868..d0b525c85 100644 --- a/content/content.h +++ b/content/content.h @@ -76,7 +76,8 @@ typedef enum { CONTENT_MSG_GETCTX, /**< Javascript context */ CONTENT_MSG_SCROLL, /**< Request to scroll content */ CONTENT_MSG_DRAGSAVE, /**< Allow drag saving of content */ - CONTENT_MSG_SAVELINK /**< Allow URL to be saved */ + CONTENT_MSG_SAVELINK, /**< Allow URL to be saved */ + CONTENT_MSG_POINTER /**< Wants a specific mouse pointer set */ } content_msg; /** RFC5988 metadata link */ @@ -145,6 +146,8 @@ union content_msg_data { const char *url; const char *title; } savelink; + /** CONTENT_MSG_POINTER - Mouse pointer to set */ + browser_pointer_shape pointer; }; /** parameters to content redraw */ diff --git a/desktop/browser.c b/desktop/browser.c index 3c99c5fb4..f9519b011 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -1483,6 +1483,11 @@ nserror browser_window_callback(hlcache_handle *c, } break; + case CONTENT_MSG_POINTER: + /* Content wants to have specific mouse pointer */ + browser_window_set_pointer(bw, event->data.pointer); + break; + default: assert(0); } diff --git a/render/html.c b/render/html.c index 7c7b797ba..ed7e7ebaa 100644 --- a/render/html.c +++ b/render/html.c @@ -1252,6 +1252,11 @@ html_object_callback(hlcache_handle *object, content_broadcast(&c->base, CONTENT_MSG_SAVELINK, event->data); break; + case CONTENT_MSG_POINTER: + /* Pass it on */ + content_broadcast(&c->base, CONTENT_MSG_POINTER, event->data); + break; + default: assert(0); } -- cgit v1.2.3