From edded10c0fab01984b43de8d857cce7b6027b242 Mon Sep 17 00:00:00 2001 From: Adrian Lees Date: Sat, 11 Feb 2006 18:33:05 +0000 Subject: [project @ 2006-02-11 18:33:05 by adrianl] Textarea/selection improvements and fixes svn path=/import/netsurf/; revision=2072 --- desktop/browser.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'desktop/browser.c') diff --git a/desktop/browser.c b/desktop/browser.c index 506d0b449..d20153721 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -903,17 +903,12 @@ void browser_window_mouse_action_html(struct browser_window *bw, case GADGET_TEXTAREA: status = messages_get("FormTextarea"); pointer = GUI_POINTER_CARET; - if (mouse & (BROWSER_MOUSE_MOD_1 | - BROWSER_MOUSE_MOD_2)) { - if (text_box) { - selection_click(bw->sel, text_box, - mouse, x - box_x, - y - box_y); - if (selection_dragging(bw->sel)) - bw->drag_type = - DRAGGING_SELECTION; - } - } else if (mouse & BROWSER_MOUSE_CLICK_1) { + + if (mouse & (BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_CLICK_2)) { + + if (text_box && selection_root(bw->sel) != gadget_box) + selection_init(bw->sel, gadget_box); + browser_window_textarea_click(bw, mouse, gadget_box, @@ -921,15 +916,16 @@ void browser_window_mouse_action_html(struct browser_window *bw, gadget_box_y, x - gadget_box_x, y - gadget_box_y); - } else if (text_box) { - if (mouse & (BROWSER_MOUSE_DRAG_1 | - BROWSER_MOUSE_DRAG_2)) - selection_init(bw->sel, gadget_box); + } - selection_click(bw->sel, text_box, mouse, - x - box_x, y - box_y); - if (selection_dragging(bw->sel)) + if (text_box) { + selection_click(bw->sel, text_box, mouse, x - box_x, y - box_y); + + if (selection_dragging(bw->sel)) { bw->drag_type = DRAGGING_SELECTION; + status = messages_get("Selecting"); + } else + status = c->status_message; } break; case GADGET_TEXTBOX: @@ -1021,6 +1017,12 @@ void browser_window_mouse_action_html(struct browser_window *bw, } else { + /* if clicking in the main page, remove the selection from any text areas */ + if (text_box && + (mouse & (BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_CLICK_2)) && + selection_root(bw->sel) != c->data.html.layout) + selection_init(bw->sel, c->data.html.layout); + if (text_box && selection_click(bw->sel, text_box, mouse, x - box_x, y - box_y)) { -- cgit v1.2.3