diff options
author | Adrian Lees <adrian@aemulor.com> | 2005-04-20 12:24:41 +0000 |
---|---|---|
committer | Adrian Lees <adrian@aemulor.com> | 2005-04-20 12:24:41 +0000 |
commit | 31c659a2ea8bf239569c8436e3b718786879df47 (patch) | |
tree | 4f934f55f0ba0151372135156e4bdb3ff461c6b4 /riscos/textselection.c | |
parent | a01210941b7717317cd4bd3c451596a845093d9c (diff) | |
download | netsurf-31c659a2ea8bf239569c8436e3b718786879df47.tar.gz netsurf-31c659a2ea8bf239569c8436e3b718786879df47.tar.bz2 |
[project @ 2005-04-20 12:24:41 by adrianl]
text import from global clipboard, other apps & files and additional keys for editing text in textareas
svn path=/import/netsurf/; revision=1673
Diffstat (limited to 'riscos/textselection.c')
-rw-r--r-- | riscos/textselection.c | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/riscos/textselection.c b/riscos/textselection.c index 67779bf6e..c6e4be57f 100644 --- a/riscos/textselection.c +++ b/riscos/textselection.c @@ -259,6 +259,53 @@ bool gui_copy_to_clipboard(struct selection *s) /** + * Request to paste the clipboard contents into a textarea/input field + * at a given position. Note that the actual operation may take place + * straight away (local clipboard) or in a number of chunks at some + * later time (clipboard owned by another app). + * + * \param g gui window + * \param x x ordinate at which to paste text + * \param y y ordinate at which to paste text + */ + +void gui_paste_from_clipboard(struct gui_window *g, int x, int y) +{ + if (owns_clipboard) { + if (clip_length > 0) + browser_window_paste_text(g->bw, clipboard, clip_length, true); + } + else { + wimp_full_message_data_request msg; + os_error *error; + os_coord pos; + + if (!window_screen_pos(g, x, y, &pos)) + return; + + msg.size = sizeof(msg); + msg.your_ref = 0; + msg.action = message_DATA_REQUEST; + msg.w = g->window; + msg.i = -1; + msg.pos.x = pos.x; + msg.pos.y = pos.y; + msg.flags = wimp_DATA_REQUEST_CLIPBOARD; + msg.file_types[0] = osfile_TYPE_TEXT; + msg.file_types[1] = ~0; + + error = xwimp_send_message(wimp_USER_MESSAGE, (wimp_message*)&msg, + wimp_BROADCAST); + if (error) { + LOG(("xwimp_send_message: 0x%x : %s", + error->errnum, error->errmess)); + warn_user("WimpError", error->errmess); + } + } +} + + +/** * Discard the current contents of the clipboard, if any, releasing the * memory it uses. */ @@ -306,8 +353,6 @@ void ro_gui_selection_claim_entity(wimp_full_message_claim_entity *claim) void ro_gui_selection_data_request(wimp_full_message_data_request *req) { - LOG(("%x owns %d size %d", req->flags, owns_clipboard, req->size)); - if (owns_clipboard && clip_length > 0 && (req->flags & wimp_DATA_REQUEST_CLIPBOARD)) { wimp_full_message_data_xfer message; |