diff options
-rw-r--r-- | content/content.h | 1 | ||||
-rw-r--r-- | desktop/browser.c | 17 | ||||
-rw-r--r-- | render/html.c | 12 | ||||
-rw-r--r-- | render/html_interaction.c | 4 |
4 files changed, 24 insertions, 10 deletions
diff --git a/content/content.h b/content/content.h index 19ec7919a..8987e2cdf 100644 --- a/content/content.h +++ b/content/content.h @@ -140,6 +140,7 @@ union content_msg_data { CONTENT_SAVE_COMPLETE, CONTENT_SAVE_SOURCE } type; + /** if NULL, save the content generating the message */ struct hlcache_handle *content; } dragsave; /** CONTENT_MSG_SAVELINK - Save a URL */ diff --git a/desktop/browser.c b/desktop/browser.c index e7d39fd8b..3fe16f54c 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -1456,26 +1456,27 @@ nserror browser_window_callback(hlcache_handle *c, { /* Content wants drag save of a content */ struct browser_window *root = browser_window_get_root(bw); + hlcache_handle *save = event->data.dragsave.content; + + if (save == NULL) { + save = c; + } switch(event->data.dragsave.type) { case CONTENT_SAVE_ORIG: - gui_drag_save_object(GUI_SAVE_OBJECT_ORIG, - event->data.dragsave.content, + gui_drag_save_object(GUI_SAVE_OBJECT_ORIG, save, root->window); break; case CONTENT_SAVE_NATIVE: - gui_drag_save_object(GUI_SAVE_OBJECT_NATIVE, - event->data.dragsave.content, + gui_drag_save_object(GUI_SAVE_OBJECT_NATIVE, save, root->window); break; case CONTENT_SAVE_COMPLETE: - gui_drag_save_object(GUI_SAVE_COMPLETE, - event->data.dragsave.content, + gui_drag_save_object(GUI_SAVE_COMPLETE, save, root->window); break; case CONTENT_SAVE_SOURCE: - gui_drag_save_object(GUI_SAVE_SOURCE, - event->data.dragsave.content, + gui_drag_save_object(GUI_SAVE_SOURCE, save, root->window); break; } diff --git a/render/html.c b/render/html.c index 134852fa2..db9e20810 100644 --- a/render/html.c +++ b/render/html.c @@ -1243,6 +1243,18 @@ html_object_callback(hlcache_handle *object, break; case CONTENT_MSG_DRAGSAVE: + { + union content_msg_data msg_data; + if (event->data.dragsave.content == NULL) + msg_data.dragsave.content = object; + else + msg_data.dragsave.content = + event->data.dragsave.content; + + content_broadcast(&c->base, CONTENT_MSG_DRAGSAVE, msg_data); + } + break; + case CONTENT_MSG_SAVELINK: case CONTENT_MSG_POINTER: case CONTENT_MSG_PASTE: diff --git a/render/html_interaction.c b/render/html_interaction.c index 05afeeb8d..08cab5d81 100644 --- a/render/html_interaction.c +++ b/render/html_interaction.c @@ -773,7 +773,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw, if (mouse & BROWSER_MOUSE_MOD_2) { msg_data.dragsave.type = CONTENT_SAVE_COMPLETE; - msg_data.dragsave.content = h; + msg_data.dragsave.content = NULL; content_broadcast(c, CONTENT_MSG_DRAGSAVE, msg_data); @@ -793,7 +793,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw, if (mouse & BROWSER_MOUSE_MOD_2) { msg_data.dragsave.type = CONTENT_SAVE_SOURCE; - msg_data.dragsave.content = h; + msg_data.dragsave.content = NULL; content_broadcast(c, CONTENT_MSG_DRAGSAVE, msg_data); |