Improve click handling in text inputs.

svn path=/trunk/netsurf/; revision=4087
This commit is contained in:
Michael Drake 2008-04-08 12:40:05 +00:00
parent 90e061c6a9
commit 84cd9a655f
2 changed files with 7 additions and 5 deletions

View File

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

View File

@ -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) {