diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2013-02-08 16:05:44 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2013-02-08 16:05:44 +0000 |
commit | 59d24187f757463b1fef6c8c9ba4ebbc1952f74d (patch) | |
tree | 71f402267ac7a4e4a148a7008956a26ee95db91d /render | |
parent | 0a4e1a05e3a916fb13948e3801571131ffd10766 (diff) | |
download | netsurf-59d24187f757463b1fef6c8c9ba4ebbc1952f74d.tar.gz netsurf-59d24187f757463b1fef6c8c9ba4ebbc1952f74d.tar.bz2 |
Support dropping text file on textarea widget.
Diffstat (limited to 'render')
-rw-r--r-- | render/html.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/render/html.c b/render/html.c index 1eb0f91f1..4fc152a84 100644 --- a/render/html.c +++ b/render/html.c @@ -2796,7 +2796,7 @@ static bool html_drop_file_at_point(struct content *c, int x, int y, char *file) /* Redraw box. */ html__redraw_a_box(html, file_box); - } else if (html->bw != NULL) { + } else { /* File dropped on text input */ size_t file_len; @@ -2805,7 +2805,7 @@ static bool html_drop_file_at_point(struct content *c, int x, int y, char *file) char *utf8_buff; utf8_convert_ret ret; unsigned int size; - struct browser_window *bw; + int bx, by; /* Open file */ fp = fopen(file, "rb"); @@ -2861,13 +2861,13 @@ static bool html_drop_file_at_point(struct content *c, int x, int y, char *file) size = strlen(utf8_buff); /* Simulate a click over the input box, to place caret */ - browser_window_mouse_click(html->bw, - BROWSER_MOUSE_PRESS_1, x, y); - - bw = browser_window_get_root(html->bw); + box_coords(text_box, &bx, &by); + textarea_mouse_action(text_box->gadget->data.text.ta, + BROWSER_MOUSE_PRESS_1, x - bx, y - by); /* Paste the file as text */ - browser_window_paste_text(bw, utf8_buff, size, true); + textarea_drop_text(text_box->gadget->data.text.ta, + utf8_buff, size); free(utf8_buff); } |