Add message for content wanting wanting drag save to start.

This commit is contained in:
Michael Drake 2012-08-16 20:20:49 +01:00
parent 049d5097b8
commit 1919c8e071
3 changed files with 47 additions and 1 deletions

View File

@ -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 */

View File

@ -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);
}

View File

@ -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);
}