diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2011-07-13 13:20:26 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2011-07-13 13:20:26 +0000 |
commit | 9c918930289b18dbfd4bb44081891d5780105bfd (patch) | |
tree | 372de7dbf3d8393550e46ab1f8de6e9a97cf2140 /desktop/textinput.c | |
parent | 1832155b7c64e0a977541930fc78f47bbd675ab2 (diff) | |
download | netsurf-9c918930289b18dbfd4bb44081891d5780105bfd.tar.gz netsurf-9c918930289b18dbfd4bb44081891d5780105bfd.tar.bz2 |
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
Diffstat (limited to 'desktop/textinput.c')
-rw-r--r-- | desktop/textinput.c | 20 |
1 files changed, 8 insertions, 12 deletions
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, |