summaryrefslogtreecommitdiff
path: root/desktop/textinput.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2013-01-03 15:25:59 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2013-01-03 15:25:59 +0000
commit131b4cdda14632f6c1c59d896582d509d1e04b09 (patch)
treeec676d22cf1a36e438a5455443efe61d7845b88e /desktop/textinput.c
parent4aadb5237a27dee82c6660294d4e76aa0d17503e (diff)
downloadnetsurf-131b4cdda14632f6c1c59d896582d509d1e04b09.tar.gz
netsurf-131b4cdda14632f6c1c59d896582d509d1e04b09.tar.bz2
For now selection clear and selection copy are handled by the bw. Select all is only handled by the bw if nothing has claimed input. This stops the crash when select all is used in textarea.
TODO: The special keys should not be handled by the bw, they should be handled by the content with focus.
Diffstat (limited to 'desktop/textinput.c')
-rw-r--r--desktop/textinput.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/desktop/textinput.c b/desktop/textinput.c
index 36daa374d..4b3d0b6ac 100644
--- a/desktop/textinput.c
+++ b/desktop/textinput.c
@@ -127,18 +127,8 @@ bool browser_window_key_press(struct browser_window *bw, uint32_t key)
assert(bw->window != NULL);
- if (focus->caret_callback) {
- /* Pass keypress onto anything that has claimed input focus */
- return focus->caret_callback(focus, key,
- focus->caret_p1, focus->caret_p2);
- }
-
- /* keys that take effect wherever the caret is positioned */
+ /* safe keys that can be handled whether input claimed or not */
switch (key) {
- case KEY_SELECT_ALL:
- selection_select_all(bw->cur_sel);
- return true;
-
case KEY_COPY_SELECTION:
gui_copy_to_clipboard(bw->cur_sel);
return true;
@@ -157,6 +147,19 @@ bool browser_window_key_press(struct browser_window *bw, uint32_t key)
return false;
}
+ if (focus->caret_callback) {
+ /* Pass keypress onto anything that has claimed input focus */
+ return focus->caret_callback(focus, key,
+ focus->caret_p1, focus->caret_p2);
+ }
+
+ /* keys we can't handle here if cursor is in form */
+ switch (key) {
+ case KEY_SELECT_ALL:
+ selection_select_all(bw->cur_sel);
+ return true;
+ }
+
return false;
}