diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2017-09-09 18:45:22 +0100 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2017-09-10 15:53:15 +0100 |
commit | adbcb7f1b904c1a725fab4be7323a350f9ce02a8 (patch) | |
tree | d932d179cc8c368c2c05e13422ce280112c7e545 /desktop | |
parent | f877069399608c8805d871b0ff08852186467490 (diff) | |
download | netsurf-adbcb7f1b904c1a725fab4be7323a350f9ce02a8.tar.gz netsurf-adbcb7f1b904c1a725fab4be7323a350f9ce02a8.tar.bz2 |
Treeview: Update treeview mouse handling to offset for search bar presence.
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/treeview.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/desktop/treeview.c b/desktop/treeview.c index acf49ce15..5c0d05c1f 100644 --- a/desktop/treeview.c +++ b/desktop/treeview.c @@ -2695,7 +2695,8 @@ static bool treeview_clear_selection(treeview *tree, struct rect *rect) sw.purpose = TREEVIEW_WALK_CLEAR_SELECTION; sw.data.redraw.required = false; sw.data.redraw.rect = rect; - sw.current_y = 0; + sw.current_y = (tree->flags & TREEVIEW_SEARCHABLE) ? + tree_g.line_height : 0; treeview_walk_internal(tree->root, false, NULL, treeview_node_selection_walk_cb, &sw); @@ -2723,7 +2724,8 @@ static bool treeview_select_all(treeview *tree, struct rect *rect) sw.purpose = TREEVIEW_WALK_SELECT_ALL; sw.data.redraw.required = false; sw.data.redraw.rect = rect; - sw.current_y = 0; + sw.current_y = (tree->flags & TREEVIEW_SEARCHABLE) ? + tree_g.line_height : 0; treeview_walk_internal(tree->root, false, NULL, treeview_node_selection_walk_cb, &sw); @@ -2742,7 +2744,8 @@ static void treeview_commit_selection_drag(treeview *tree) struct treeview_selection_walk_data sw; sw.purpose = TREEVIEW_WALK_COMMIT_SELECT_DRAG; - sw.current_y = 0; + sw.current_y = (tree->flags & TREEVIEW_SEARCHABLE) ? + tree_g.line_height : 0; if (tree->drag.start.y > tree->drag.prev.y) { sw.data.drag.sel_min = tree->drag.prev.y; @@ -3967,6 +3970,8 @@ treeview_mouse_action(treeview *tree, browser_mouse_state mouse, int x, int y) { struct rect r; bool redraw = false; + int search_height = (tree->flags & TREEVIEW_SEARCHABLE) ? + tree_g.line_height : 0; assert(tree != NULL); assert(tree->root != NULL); @@ -4023,7 +4028,7 @@ treeview_mouse_action(treeview *tree, browser_mouse_state mouse, int x, int y) } } - if (y > tree->root->height) { + if (y > tree->root->height + search_height) { /* Below tree */ r.x0 = 0; @@ -4101,7 +4106,7 @@ treeview_mouse_action(treeview *tree, browser_mouse_state mouse, int x, int y) ma.mouse = mouse; ma.x = x; ma.y = y; - ma.current_y = 0; + ma.current_y = search_height; treeview_walk_internal(tree->root, false, NULL, treeview_node_mouse_action_cb, &ma); |