diff options
-rw-r--r-- | content/content.h | 13 | ||||
-rw-r--r-- | desktop/browser.c | 30 | ||||
-rw-r--r-- | render/html.c | 5 |
3 files changed, 47 insertions, 1 deletions
diff --git a/content/content.h b/content/content.h index f1ff2a2c9..5ff40d00c 100644 --- a/content/content.h +++ b/content/content.h @@ -74,7 +74,8 @@ typedef enum { CONTENT_MSG_DOWNLOAD, /**< download, not for display */ CONTENT_MSG_LINK, /**< RFC5988 link */ CONTENT_MSG_GETCTX, /**< Javascript context */ - CONTENT_MSG_SCROLL /**< Request to scroll content */ + CONTENT_MSG_SCROLL, /**< Request to scroll content */ + CONTENT_MSG_DRAGSAVE /**< Allow drag saving of content */ } content_msg; /** RFC5988 metadata link */ @@ -128,6 +129,16 @@ union content_msg_data { int x0, y0; int x1, y1; } scroll; + /** CONTENT_MSG_DRAGSAVE - Drag save a content */ + struct { + enum { + CONTENT_SAVE_ORIG, + CONTENT_SAVE_NATIVE, + CONTENT_SAVE_COMPLETE, + CONTENT_SAVE_SOURCE + } type; + struct hlcache_handle *content; + } dragsave; }; /** parameters to content redraw */ diff --git a/desktop/browser.c b/desktop/browser.c index 136557a75..95edf1d63 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -1440,6 +1440,36 @@ nserror browser_window_callback(hlcache_handle *c, break; + case CONTENT_MSG_DRAGSAVE: + { + /* Content wants drag save of a content */ + struct browser_window *root = browser_window_get_root(bw); + + switch(event->data.dragsave.type) { + case CONTENT_SAVE_ORIG: + gui_drag_save_object(GUI_SAVE_OBJECT_ORIG, + event->data.dragsave.content, + root->window); + break; + case CONTENT_SAVE_NATIVE: + gui_drag_save_object(GUI_SAVE_OBJECT_NATIVE, + event->data.dragsave.content, + root->window); + break; + case CONTENT_SAVE_COMPLETE: + gui_drag_save_object(GUI_SAVE_COMPLETE, + event->data.dragsave.content, + root->window); + break; + case CONTENT_SAVE_SOURCE: + gui_drag_save_object(GUI_SAVE_SOURCE, + event->data.dragsave.content, + root->window); + break; + } + } + break; + default: assert(0); } 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); } |