From 9c918930289b18dbfd4bb44081891d5780105bfd Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 13 Jul 2011 13:20:26 +0000 Subject: Fix selection for non-gui browser windows (iframes). Selection no longer uses current_redraw_browser. Fix long-standing selection bugs on platforms that use action on release behaviour. svn path=/trunk/netsurf/; revision=12598 --- desktop/textinput.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'desktop/textinput.c') diff --git a/desktop/textinput.c b/desktop/textinput.c index 32d8f5167..1879f414c 100644 --- a/desktop/textinput.c +++ b/desktop/textinput.c @@ -100,11 +100,7 @@ void browser_window_remove_caret(struct browser_window *bw) { struct browser_window *root_bw; - /* Find top level browser window */ - root_bw = bw; - while (root_bw && !root_bw->window && root_bw->parent) { - root_bw = root_bw->parent; - } + root_bw = browser_window_get_root(bw); gui_window_remove_caret(root_bw->window); @@ -113,8 +109,6 @@ void browser_window_remove_caret(struct browser_window *bw) bw->move_callback = NULL; bw->caret_p1 = NULL; bw->caret_p2 = NULL; - - selection_clear(bw->sel, true); } @@ -129,23 +123,25 @@ bool browser_window_key_press(struct browser_window *bw, uint32_t key) { struct browser_window *focus = bw->focus; + assert(bw->window != NULL); + /* keys that take effect wherever the caret is positioned */ switch (key) { case KEY_SELECT_ALL: - selection_select_all(focus->sel); + selection_select_all(bw->cur_sel); return true; case KEY_COPY_SELECTION: - gui_copy_to_clipboard(focus->sel); + gui_copy_to_clipboard(bw->cur_sel); return true; case KEY_CLEAR_SELECTION: - selection_clear(focus->sel, true); + selection_clear(bw->cur_sel, true); return true; case KEY_ESCAPE: - if (selection_defined(focus->sel)) { - selection_clear(focus->sel, true); + if (selection_defined(bw->cur_sel)) { + selection_clear(bw->cur_sel, true); return true; } /* if there's no selection, -- cgit v1.2.3