summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2013-02-12 12:09:49 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2013-02-12 12:09:49 +0000
commit97f0a22a8bb77718b6c8e1f304122d493cdce2ca (patch)
treee6dacf2f0f51d13312c93e162f6f6f9591956695
parent19f09dcc61293ebafa82585c3972ccb6a387887b (diff)
downloadnetsurf-97f0a22a8bb77718b6c8e1f304122d493cdce2ca.tar.gz
netsurf-97f0a22a8bb77718b6c8e1f304122d493cdce2ca.tar.bz2
Tidy textarea-handled mouse action.
-rw-r--r--desktop/textarea.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/desktop/textarea.c b/desktop/textarea.c
index bb0ed310c..a1c422202 100644
--- a/desktop/textarea.c
+++ b/desktop/textarea.c
@@ -2190,16 +2190,22 @@ bool textarea_mouse_action(struct textarea *ta, browser_mouse_state mouse,
}
}
- /* mouse button pressed above the text area, move caret */
- if (mouse & BROWSER_MOUSE_PRESS_1) {
+ /* Mouse action is textarea's responsibility */
+ if (mouse & BROWSER_MOUSE_DOUBLE_CLICK) {
+ /* Select word */
+ textarea_set_caret_xy(ta, x, y);
+ return textarea_select_fragment(ta);
+
+ } else if (mouse & BROWSER_MOUSE_PRESS_1) {
if (!(ta->flags & TEXTAREA_READONLY)) {
+ /* Place caret */
textarea_get_xy_offset(ta, x, y, &c_off);
ta->drag_start_char = c_off;
textarea_set_caret(ta, c_off);
}
if (ta->sel_start != -1) {
- /* remove selection */
+ /* Clear selection */
ta->sel_start = ta->sel_end = -1;
msg.ta = ta;
@@ -2212,12 +2218,6 @@ bool textarea_mouse_action(struct textarea *ta, browser_mouse_state mouse,
ta->callback(ta->data, &msg);
}
- } else if (mouse & BROWSER_MOUSE_DOUBLE_CLICK) {
- if (!(ta->flags & TEXTAREA_READONLY)) {
- textarea_set_caret_xy(ta, x, y);
- return textarea_select_fragment(ta);
- }
-
} else if (mouse & BROWSER_MOUSE_DRAG_1) {
/* Selection start */
textarea_get_xy_offset(ta, x, y, &c_off);
@@ -2232,6 +2232,7 @@ bool textarea_mouse_action(struct textarea *ta, browser_mouse_state mouse,
ta->callback(ta->data, &msg);
return textarea_select(ta, c_start, c_end, false);
+
} else if (mouse & BROWSER_MOUSE_HOLDING_1 &&
ta->drag_info.type == TEXTAREA_DRAG_SELECTION) {
/* Selection track */