Add paste request content message.

This commit is contained in:
Michael Drake 2012-08-18 22:19:15 +01:00
parent 19d2a0c011
commit a2906b3994
3 changed files with 21 additions and 1 deletions

View File

@ -77,7 +77,8 @@ typedef enum {
CONTENT_MSG_SCROLL, /**< Request to scroll content */ 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_SAVELINK, /**< Allow URL to be saved */
CONTENT_MSG_POINTER /**< Wants a specific mouse pointer set */ CONTENT_MSG_POINTER, /**< Wants a specific mouse pointer set */
CONTENT_MSG_PASTE /**< Inform that content wants clipboard paste */
} content_msg; } content_msg;
/** RFC5988 metadata link */ /** RFC5988 metadata link */
@ -148,6 +149,14 @@ union content_msg_data {
} savelink; } savelink;
/** CONTENT_MSG_POINTER - Mouse pointer to set */ /** CONTENT_MSG_POINTER - Mouse pointer to set */
browser_pointer_shape pointer; browser_pointer_shape pointer;
/** CONTENT_MSG_PASTE - Content requests that clipboard is pasted */
struct {
/* TODO: Get rid of these coords.
* browser_window_paste_text doesn't take coords, but
* RISC OS front end is doing something different. */
int x;
int y;
} paste;
}; };
/** parameters to content redraw */ /** parameters to content redraw */

View File

@ -1488,6 +1488,12 @@ nserror browser_window_callback(hlcache_handle *c,
browser_window_set_pointer(bw, event->data.pointer); browser_window_set_pointer(bw, event->data.pointer);
break; break;
case CONTENT_MSG_PASTE:
/* Content wants a clipboard paste */
gui_paste_from_clipboard(bw->window,
event->data.paste.x, event->data.paste.y);
break;
default: default:
assert(0); assert(0);
} }

View File

@ -1257,6 +1257,11 @@ html_object_callback(hlcache_handle *object,
content_broadcast(&c->base, CONTENT_MSG_POINTER, event->data); content_broadcast(&c->base, CONTENT_MSG_POINTER, event->data);
break; break;
case CONTENT_MSG_PASTE:
/* Pass it on */
content_broadcast(&c->base, CONTENT_MSG_PASTE, event->data);
break;
default: default:
assert(0); assert(0);
} }