From 84cd9a655f42642b3e6084e0844e6ca0d1da1a2e Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Tue, 8 Apr 2008 12:40:05 +0000 Subject: Improve click handling in text inputs. svn path=/trunk/netsurf/; revision=4087 --- desktop/browser.c | 6 +++++- desktop/selection.c | 6 ++---- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'desktop') diff --git a/desktop/browser.c b/desktop/browser.c index ccc68a92f..3d8119262 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -1446,6 +1446,8 @@ void browser_window_mouse_action_html(struct browser_window *bw, } else status = c->status_message; } + else if (mouse & BROWSER_MOUSE_CLICK_1) + selection_clear(bw->sel, true); break; case GADGET_TEXTBOX: case GADGET_PASSWORD: @@ -1461,7 +1463,7 @@ void browser_window_mouse_action_html(struct browser_window *bw, x - gadget_box_x, y - gadget_box_y); } - else if (text_box) { + if (text_box) { int pixel_offset; size_t idx; @@ -1482,6 +1484,8 @@ void browser_window_mouse_action_html(struct browser_window *bw, if (selection_dragging(bw->sel)) bw->drag_type = DRAGGING_SELECTION; } + else if (mouse & BROWSER_MOUSE_CLICK_1) + selection_clear(bw->sel, true); break; case GADGET_HIDDEN: /* not possible: no box generated */ diff --git a/desktop/selection.c b/desktop/selection.c index 168d28673..9dd58ce4f 100644 --- a/desktop/selection.c +++ b/desktop/selection.c @@ -49,8 +49,6 @@ * or wholly without the textarea/input box. */ -#define IS_TEXT(box) ((box)->text && !(box)->object) - #define IS_INPUT(box) ((box) && (box)->gadget && \ ((box)->gadget->type == GADGET_TEXTAREA || (box)->gadget->type == GADGET_TEXTBOX)) @@ -223,7 +221,7 @@ unsigned selection_label_subtree(struct box *box, unsigned idx) box->byte_offset = idx; - if (box->text && !box->object) + if (box->text) idx += box->length + box->space; while (child) { @@ -847,7 +845,7 @@ struct box *get_box(struct box *b, unsigned offset, int *pidx) { struct box *child = b->children; - if (b->text && !b->object) { + if (b->text) { if (offset >= b->byte_offset && offset < b->byte_offset + b->length + b->space) { -- cgit v1.2.3