summaryrefslogtreecommitdiff
path: root/desktop/tree.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2010-12-15 23:55:39 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2010-12-15 23:55:39 +0000
commit064c8e50d29a982eb6a076148e1b409e10a36694 (patch)
tree6991520054cfc4e033d56d0adf1c13281e2863e4 /desktop/tree.c
parentc675c3552d5ddb436034dd6400bccfd40efb816c (diff)
downloadnetsurf-064c8e50d29a982eb6a076148e1b409e10a36694.tar.gz
netsurf-064c8e50d29a982eb6a076148e1b409e10a36694.tar.bz2
Improve double click handling.
svn path=/trunk/netsurf/; revision=11068
Diffstat (limited to 'desktop/tree.c')
-rw-r--r--desktop/tree.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/desktop/tree.c b/desktop/tree.c
index 46db6018d..cb3c915ff 100644
--- a/desktop/tree.c
+++ b/desktop/tree.c
@@ -2086,6 +2086,11 @@ bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse, int x,
struct node_element *element;
struct node_msg_data msg_data;
+ bool double_click_1 = mouse & BROWSER_MOUSE_DOUBLE_CLICK &&
+ mouse & BROWSER_MOUSE_CLICK_1;
+ bool double_click_2 = mouse & BROWSER_MOUSE_DOUBLE_CLICK &&
+ mouse & BROWSER_MOUSE_CLICK_2;
+
assert(tree != NULL);
assert(tree->root != NULL);
@@ -2170,9 +2175,9 @@ bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse, int x,
/* A click on expansion toggle or double click on folder toggles node
* expansion */
if (((expansion_toggle) && (mouse & (BROWSER_MOUSE_CLICK_1 |
- BROWSER_MOUSE_CLICK_2))) ||
- ((!expansion_toggle) && (node->child != NULL) &&
- (mouse & BROWSER_MOUSE_DOUBLE_CLICK))) {
+ BROWSER_MOUSE_CLICK_2))) ||
+ (((!expansion_toggle) && (node->child != NULL)) &&
+ (double_click_1 || double_click_2))) {
/* clear any selection */
tree_set_node_selected(tree, tree->root->child, true, false);
@@ -2215,8 +2220,7 @@ bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse, int x,
if ((element->editable) && (!tree->editing) &&
((element->type == NODE_ELEMENT_TEXT) ||
(element->type == NODE_ELEMENT_TEXT_PLUS_ICON)) &&
- (mouse & (BROWSER_MOUSE_CLICK_1 |
- BROWSER_MOUSE_DOUBLE_CLICK)) &&
+ (mouse & BROWSER_MOUSE_CLICK_1 || double_click_1) &&
(mouse & BROWSER_MOUSE_MOD_2 ||
mouse & BROWSER_MOUSE_MOD_3)) {
tree_set_node_selected(tree, tree->root->child, true, false);
@@ -2225,7 +2229,7 @@ bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse, int x,
}
/* double click launches the leaf */
- if (mouse & BROWSER_MOUSE_DOUBLE_CLICK) {
+ if (double_click_1 || double_click_2) {
if (node->user_callback == NULL)
return false;
msg_data.msg = NODE_LAUNCH;